[lsc-changes] r503 - in lsc/trunk/src/main/java/org/lsc: . beans/syncoptions jndi

jclarke at lsc-project.org jclarke at lsc-project.org
Mon Nov 30 00:51:55 CET 2009


Author: jclarke
Date: 2009-11-30 00:51:55 +0100 (Mon, 30 Nov 2009)
New Revision: 503

Modified:
   lsc/trunk/src/main/java/org/lsc/Configuration.java
   lsc/trunk/src/main/java/org/lsc/beans/syncoptions/ForceSyncOptions.java
   lsc/trunk/src/main/java/org/lsc/beans/syncoptions/PropertiesBasedSyncOptions.java
   lsc/trunk/src/main/java/org/lsc/jndi/AbstractSimpleJndiService.java
Log:
Remove and replace pointless method in Configuration

Modified: lsc/trunk/src/main/java/org/lsc/Configuration.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/Configuration.java	2009-11-29 23:38:11 UTC (rev 502)
+++ lsc/trunk/src/main/java/org/lsc/Configuration.java	2009-11-29 23:51:55 UTC (rev 503)
@@ -56,12 +56,10 @@
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
-import java.util.StringTokenizer;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
@@ -182,17 +180,6 @@
 		return dst;
 	}
 
-	public static List<String> getListFromString(String propertyValue) {
-		List<String> result = new ArrayList<String>();
-		if (propertyValue != null) {
-			StringTokenizer st = new StringTokenizer(propertyValue, " ");
-			while (st.hasMoreTokens()) {
-				result.add(st.nextToken().toLowerCase());
-			}
-		}
-		return result;
-	}
-
 	/**
 	 * Create a Properties object that is a subset of this configuration.
 	 * If there are no properties matching the prefix, an empty Properties

Modified: lsc/trunk/src/main/java/org/lsc/beans/syncoptions/ForceSyncOptions.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/beans/syncoptions/ForceSyncOptions.java	2009-11-29 23:38:11 UTC (rev 502)
+++ lsc/trunk/src/main/java/org/lsc/beans/syncoptions/ForceSyncOptions.java	2009-11-29 23:51:55 UTC (rev 503)
@@ -45,6 +45,7 @@
  */
 package org.lsc.beans.syncoptions;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
 
@@ -101,10 +102,10 @@
 
     public List<String> getWriteAttributes() {
         String property = Configuration.getString("lsc.tasks." + taskname + ".dstService.attrs");
-        if(property == null) {
+        if (property == null) {
             return null;
         }
-        return Configuration.getListFromString(property);
+        return Arrays.asList(property.split(" "));
     }
 
 

Modified: lsc/trunk/src/main/java/org/lsc/beans/syncoptions/PropertiesBasedSyncOptions.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/beans/syncoptions/PropertiesBasedSyncOptions.java	2009-11-29 23:38:11 UTC (rev 502)
+++ lsc/trunk/src/main/java/org/lsc/beans/syncoptions/PropertiesBasedSyncOptions.java	2009-11-29 23:51:55 UTC (rev 503)
@@ -46,6 +46,7 @@
 package org.lsc.beans.syncoptions;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
@@ -277,7 +278,7 @@
             return null;
         }
         
-        List<String> writeAttributes = Configuration.getListFromString(property);
+        List<String> writeAttributes = Arrays.asList(property.split(" "));
         if (writeAttributes.size() == 0) {
         	LOGGER.warn("No attributes set to write in the destination. This means that LSC will not change anything! Update lsc.tasks.{}.dstService.attrs to change this.",
 									syncName);

Modified: lsc/trunk/src/main/java/org/lsc/jndi/AbstractSimpleJndiService.java
===================================================================
--- lsc/trunk/src/main/java/org/lsc/jndi/AbstractSimpleJndiService.java	2009-11-29 23:38:11 UTC (rev 502)
+++ lsc/trunk/src/main/java/org/lsc/jndi/AbstractSimpleJndiService.java	2009-11-29 23:51:55 UTC (rev 503)
@@ -48,6 +48,7 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -62,7 +63,6 @@
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
-import org.lsc.Configuration;
 import org.lsc.LscObject;
 import org.lsc.LscAttributes;
 import org.lsc.beans.IBean;
@@ -122,23 +122,20 @@
 		baseDn = serviceProps.getProperty("baseDn");
 		filterId = serviceProps.getProperty("filterId");
 		filterAll = serviceProps.getProperty("filterAll");
+		_filteredSc = new SearchControls();
 
 		String attrsValue = serviceProps.getProperty("attrs");
 		if (attrsValue != null) {
-			attrs = Configuration.getListFromString(attrsValue);
+			String[] attributes = attrsValue.split(" ");
+			attrs = Arrays.asList(attributes);
+			_filteredSc.setReturningAttributes(attributes);
 		}
 
 		String attrsIdValue = serviceProps.getProperty("pivotAttrs");
 		if (attrsIdValue != null) {
-			attrsId = Configuration.getListFromString(attrsIdValue);
+			attrsId = Arrays.asList(attrsIdValue.split(" "));
 		}
 
-		_filteredSc = new SearchControls();
-		if(attrs != null) {
-			String[] attributes = new String[attrs.size()];
-			attributes = attrs.toArray(attributes);
-			_filteredSc.setReturningAttributes(attributes);
-		}
 	}
 
 	/**



More information about the lsc-changes mailing list