[Swift-commit] r3226 - trunk/src/org/globus/swift/data

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu Feb 4 17:31:53 CST 2010


Author: wozniak
Date: 2010-02-04 17:31:53 -0600 (Thu, 04 Feb 2010)
New Revision: 3226

Modified:
   trunk/src/org/globus/swift/data/Director.java
Log:
Provide a simple command-line interface for policy queries. 


Modified: trunk/src/org/globus/swift/data/Director.java
===================================================================
--- trunk/src/org/globus/swift/data/Director.java	2010-02-04 18:35:53 UTC (rev 3225)
+++ trunk/src/org/globus/swift/data/Director.java	2010-02-04 23:31:53 UTC (rev 3226)
@@ -64,4 +64,31 @@
     	}
     	return Policy.DEFAULT;
     }
+    
+    /** 
+     * Check the policy effect of name with respect to policy_file
+     * @param args {name, policy_file} 
+     */
+    public static void main(String[] args) {
+        if (args.length != 2) {
+            System.out.println("Incorrect args");
+            System.exit(1);
+        }
+            
+        try {
+       
+            String name = args[0]; 
+            File policyFile = new File(args[1]);
+            if (! policyFile.exists()) {
+                System.out.println("Policy file does not exist: " + 
+                    args[1]);
+            }
+            load(policyFile);
+            Policy policy = lookup(name);
+            System.out.println(name + ": " + policy);
+        } catch (Exception e) { 
+            e.printStackTrace();
+            System.exit(2);
+        }
+    }   
 }




More information about the Swift-commit mailing list