[Swift-commit] r3667 - in trunk/src/org/globus/swift/data: . policy util
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Thu Oct 7 16:25:29 CDT 2010
Author: wozniak
Date: 2010-10-07 16:25:29 -0500 (Thu, 07 Oct 2010)
New Revision: 3667
Modified:
trunk/src/org/globus/swift/data/Director.java
trunk/src/org/globus/swift/data/Query.java
trunk/src/org/globus/swift/data/policy/Broadcast.java
trunk/src/org/globus/swift/data/util/LineReader.java
Log:
Minor refactoring
Modified: trunk/src/org/globus/swift/data/Director.java
===================================================================
--- trunk/src/org/globus/swift/data/Director.java 2010-10-07 20:40:01 UTC (rev 3666)
+++ trunk/src/org/globus/swift/data/Director.java 2010-10-07 21:25:29 UTC (rev 3667)
@@ -7,12 +7,10 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -21,7 +19,6 @@
import org.globus.swift.data.policy.Policy;
import org.globus.swift.data.policy.Broadcast;
import org.globus.swift.data.util.LineReader;
-import org.griphyn.vdl.karajan.Loader;
/**
* Manages CDM policies for files based on pattern matching.
@@ -29,7 +26,8 @@
* */
public class Director {
- private static final Logger logger = Logger.getLogger(Director.class);
+ private static final Logger logger =
+ Logger.getLogger(Director.class);
/**
Has a CDM policy file been provided?
@@ -44,12 +42,14 @@
/**
Maps from Patterns to Policies for fs.data rules
*/
- static Map<Pattern,Policy> map = new LinkedHashMap();
+ static Map<Pattern,Policy> map =
+ new LinkedHashMap<Pattern, Policy>();
/**
Maps from String names to String values for fs.data properties
*/
- static Map<String,String> properties = new HashMap();
+ static Map<String,String> properties =
+ new HashMap<String, String>();
/**
Remember the files we have broadcasted.
@@ -82,12 +82,9 @@
logger.info("CDM file: " + policyFile);
enabled = true;
Director.policyFile = policyFile;
- LineReader lines = new LineReader();
- List list = lines.read(policyFile);
- for (Iterator it = list.iterator(); it.hasNext(); ) {
- String s = (String) it.next();
+ List<String> list = LineReader.read(policyFile);
+ for (String s : list)
addLine(s);
- }
}
/**
@@ -168,7 +165,8 @@
/**
Add a file to the list of files to be broadcasted.
*/
- public static synchronized void addBroadcast(String srcdir, String srcfile) {
+ public static synchronized void addBroadcast(String srcdir,
+ String srcfile) {
logger.debug("addBroadcast(): " + srcdir + " " + srcfile);
String path = srcdir+"/"+srcfile;
broadcastWork.add(path);
@@ -266,7 +264,6 @@
}
try {
-
String name = args[0];
File policyFile = new File(args[1]);
if (! policyFile.exists()) {
Modified: trunk/src/org/globus/swift/data/Query.java
===================================================================
--- trunk/src/org/globus/swift/data/Query.java 2010-10-07 20:40:01 UTC (rev 3666)
+++ trunk/src/org/globus/swift/data/Query.java 2010-10-07 21:25:29 UTC (rev 3667)
@@ -1,14 +1,9 @@
package org.globus.swift.data;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
import org.apache.log4j.Logger;
import org.globus.cog.karajan.arguments.Arg;
import org.globus.cog.karajan.stack.VariableStack;
-import org.globus.cog.karajan.util.TypeUtil;
import org.globus.cog.karajan.workflow.ExecutionException;
import org.globus.cog.karajan.workflow.nodes.functions.FunctionsCollection;
Modified: trunk/src/org/globus/swift/data/policy/Broadcast.java
===================================================================
--- trunk/src/org/globus/swift/data/policy/Broadcast.java 2010-10-07 20:40:01 UTC (rev 3666)
+++ trunk/src/org/globus/swift/data/policy/Broadcast.java 2010-10-07 21:25:29 UTC (rev 3667)
@@ -4,9 +4,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
-import java.util.Map;
-import java.util.Map.Entry;
-
import org.globus.swift.data.Director;
public class Broadcast extends Policy {
Modified: trunk/src/org/globus/swift/data/util/LineReader.java
===================================================================
--- trunk/src/org/globus/swift/data/util/LineReader.java 2010-10-07 20:40:01 UTC (rev 3666)
+++ trunk/src/org/globus/swift/data/util/LineReader.java 2010-10-07 21:25:29 UTC (rev 3667)
@@ -10,27 +10,26 @@
import java.util.ArrayList;
import java.util.List;
-import org.globus.cog.karajan.arguments.Arg;
-
public class LineReader {
public LineReader()
{}
- public static List read(File file) throws FileNotFoundException {
+ public static List<String> read(File file)
+ throws FileNotFoundException {
BufferedReader reader =
new BufferedReader(new FileReader(file));
return read(reader);
}
- public static List read(String s) {
+ public static List<String> read(String s) {
BufferedReader reader =
new BufferedReader(new StringReader(s));
return read(reader);
}
- public static List read(BufferedReader reader) {
- List result = new ArrayList();
+ public static List<String> read(BufferedReader reader) {
+ List<String> result = new ArrayList<String>();
try
{
String prevline = "";
@@ -65,7 +64,7 @@
public static String[] tokenize(String line) {
if (line == null)
return null;
- List words = new ArrayList();
+ List<String> words = new ArrayList<String>();
String[] ws = line.split("\\s");
for (int i = 0; i < ws.length; i++)
if (ws[i].length() > 0)
More information about the Swift-commit
mailing list