[lsc-changes] r283 - in lsc-sample/trunk: . sample/csvtosql src/main/java/org/lsc/service src/test/resources

sbahloul at lsc-project.org sbahloul at lsc-project.org
Tue Jul 7 12:46:38 CEST 2009


Author: sbahloul
Date: 2009-07-07 12:46:38 +0200 (Tue, 07 Jul 2009)
New Revision: 283

Modified:
   lsc-sample/trunk/
   lsc-sample/trunk/.classpath
   lsc-sample/trunk/pom.xml
   lsc-sample/trunk/sample/csvtosql/sample.csv
   lsc-sample/trunk/src/main/java/org/lsc/service/StructureJdbcService.java
   lsc-sample/trunk/src/test/resources/log4j.properties
   lsc-sample/trunk/src/test/resources/lsc.properties
Log:
First try without POJO generation


Property changes on: lsc-sample/trunk
___________________________________________________________________
Added: svn:ignore
   + target
build.properties
.settings
doc
ant.install.log


Modified: lsc-sample/trunk/.classpath
===================================================================
--- lsc-sample/trunk/.classpath	2009-07-07 10:45:22 UTC (rev 282)
+++ lsc-sample/trunk/.classpath	2009-07-07 10:46:38 UTC (rev 283)
@@ -3,7 +3,7 @@
 	<classpathentry excluding="**/.svn/*|.svn/*" kind="src" path="src/main/java"/>
 	<classpathentry kind="src" path="src/impl/java"/>
 	<classpathentry excluding="**/.svn/*|.svn/*" kind="src" path="src/test/java"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: lsc-sample/trunk/pom.xml
===================================================================
--- lsc-sample/trunk/pom.xml	2009-07-07 10:45:22 UTC (rev 282)
+++ lsc-sample/trunk/pom.xml	2009-07-07 10:46:38 UTC (rev 283)
@@ -111,21 +111,6 @@
     </repositories>
     <dependencies>
         <dependency>
-            <groupId>com.ibatis</groupId>
-            <artifactId>ibatis2-common</artifactId>
-            <version>2.1.7.597</version>
-        </dependency>
-        <dependency>
-            <groupId>com.ibatis</groupId>
-            <artifactId>ibatis2-dao</artifactId>
-            <version>2.1.7.597</version>
-        </dependency>
-        <dependency>
-            <groupId>com.ibatis</groupId>
-            <artifactId>ibatis2-sqlmap</artifactId>
-            <version>2.1.7.597</version>
-        </dependency>
-        <dependency>
             <groupId>commons-collections</groupId>
             <artifactId>commons-collections</artifactId>
             <version>3.2</version>

Modified: lsc-sample/trunk/sample/csvtosql/sample.csv
===================================================================
--- lsc-sample/trunk/sample/csvtosql/sample.csv	2009-07-07 10:45:22 UTC (rev 282)
+++ lsc-sample/trunk/sample/csvtosql/sample.csv	2009-07-07 10:46:38 UTC (rev 283)
@@ -1,12 +1,12 @@
 "id";"uid";"endOfValidity";"sn";"cn";"givenName";"mail";"address";"telephoneNumber"
-;;"10/27/1999";"Kowalski";"Mike Kowalski";"Mike";"a0g03 at unb.ca";"2682 Route 690 Sunnyside Beach, New Brunswick";"(506) 385-2183"
-;;"10/28/1999";"Laporte";"Jean Laporte";"Jean";"jeanlaporte at videotron.ca";"1620 dfe la Seigneurie, Charlesbourg (Québec) G2L 2C1";
-;;"10/28/1999";"Murrant";"Catherine L. Murrant";"Catherine";"shearwater at seascape.ns.ca";"466 Sand Lake Rd. RR 1 Port Morien, Nova Scotia, B0A 1T0";"(902)737-2684"
-;;"10/28/1999";"Boschat";"Michael Boschat";"Michael";"mboschat at ns.sympatico.ca";"6306 Cork St., Apt.512, Halifax, Nova Scotia";"902-455-6831"
-;;"10/28/1999";"MacPhee-Davidson";"Tammie MacPhee-Davidson";"Tammie";"macphetd at gov.ns.ca";"103 Kearney Lake Road, Apt. 202";"(902)443-8761"
-;;"10/28/1999";"Wagar";"Brent Wagar";"Brent";"bwagar at trojanuv.com";"275 Berkshire Drive";"(519) 471-0927"
-;;"10/28/1999";"Weir";"Shawna Weir";"Shawna";"shawna at beaconsecurities.ns.ca";;
-;;"10/28/1999";"Kijek";"Gord Kijek";"Gord";"kijek at planet.eon.net";"13028 - 32 Street, Edmonton, AB T5A 3E3";"(780)475-4058"
-;;"10/29/1999";"Parker";"Janet Parker";"Janet";"grammy at nb.sympatico.ca";"24 Hazelton Rd. Doaktown, N B";"506-365-7817"
-;;"10/29/1999";"Tindall";"David Tindall";"David";"david.tindall at dal.ca";"3231 Glendale Road hailfax, NS B3L 3S4";"(902) 455-7456"
-;;"10/31/1999";"Boivin";"Claude Boivin";"Claude";"cboivin at destination.ca";"1265 des Cormiers St-Félicien";"418-679-8194"
+;"m.kowalski";"10/27/1999";"Kowalski";"Mike Kowalski";"Mike";"a0g03 at unb.ca";"2682 Route 690 Sunnyside Beach, New Brunswick";"(506) 385-2183"
+;"j.laporte";"10/28/1999";"Laporte";"Jean Laporte";"Jean";"jeanlaporte at videotron.ca";"1620 dfe la Seigneurie, Charlesbourg (Québec) G2L 2C1";
+;"c.murrant";"10/28/1999";"Murrant";"Catherine L. Murrant";"Catherine";"shearwater at seascape.ns.ca";"466 Sand Lake Rd. RR 1 Port Morien, Nova Scotia, B0A 1T0";"(902)737-2684"
+;"m.boschat";"10/28/1999";"Boschat";"Michael Boschat";"Michael";"mboschat at ns.sympatico.ca";"6306 Cork St., Apt.512, Halifax, Nova Scotia";"902-455-6831"
+;"t.macphee-davidson";"10/28/1999";"MacPhee-Davidson";"Tammie MacPhee-Davidson";"Tammie";"macphetd at gov.ns.ca";"103 Kearney Lake Road, Apt. 202";"(902)443-8761"
+;"b.wagar";"10/28/1999";"Wagar";"Brent Wagar";"Brent";"bwagar at trojanuv.com";"275 Berkshire Drive";"(519) 471-0927"
+;"s.weir";"10/28/1999";"Weir";"Shawna Weir";"Shawna";"shawna at beaconsecurities.ns.ca";;
+;"g.kijek";"10/28/1999";"Kijek";"Gord Kijek";"Gord";"kijek at planet.eon.net";"13028 - 32 Street, Edmonton, AB T5A 3E3";"(780)475-4058"
+;"j.parker";"10/29/1999";"Parker";"Janet Parker";"Janet";"grammy at nb.sympatico.ca";"24 Hazelton Rd. Doaktown, N B";"506-365-7817"
+;"d.tindall";"10/29/1999";"Tindall";"David Tindall";"David";"david.tindall at dal.ca";"3231 Glendale Road hailfax, NS B3L 3S4";"(902) 455-7456"
+;"c.boivin";"10/31/1999";"Boivin";"Claude Boivin";"Claude";"cboivin at destination.ca";"1265 des Cormiers St-Félicien";"418-679-8194"

Modified: lsc-sample/trunk/src/main/java/org/lsc/service/StructureJdbcService.java
===================================================================
--- lsc-sample/trunk/src/main/java/org/lsc/service/StructureJdbcService.java	2009-07-07 10:45:22 UTC (rev 282)
+++ lsc-sample/trunk/src/main/java/org/lsc/service/StructureJdbcService.java	2009-07-07 10:46:38 UTC (rev 283)
@@ -45,6 +45,7 @@
  */
 package org.lsc.service;
 
+import java.lang.reflect.InvocationTargetException;
 import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -60,6 +61,8 @@
 import org.lsc.Configuration;
 import org.lsc.LscAttributes;
 import org.lsc.LscObject;
+import org.lsc.beans.AbstractBean;
+import org.lsc.beans.inetOrgPersonBean;
 import org.lsc.objects.Structure;
 import org.lsc.objects.flat.fStructure;
 import org.lsc.persistence.DaoConfig;
@@ -288,7 +291,16 @@
         return ret;
 	}
 
-	public LscObject getObject(Entry<String, LscAttributes> ids) throws NamingException {
-        return structures.get(ids.getKey());
+	public AbstractBean getBean(AbstractBean bean, Entry<String, LscAttributes> ids) throws NamingException {
+        try {
+			AbstractBean.mapper(bean.getClass(), bean, structures.get(ids.getKey()));
+		} catch (IllegalAccessException e) {
+            LOGGER.warn("Unable to convert object to bean (" + e + ")", e);
+			return null;
+		} catch (InvocationTargetException e) {
+            LOGGER.warn("Unable to convert object to bean (" + e + ")", e);
+			return null;
+		}
+        return bean;
 	}
 }

Modified: lsc-sample/trunk/src/test/resources/log4j.properties
===================================================================
--- lsc-sample/trunk/src/test/resources/log4j.properties	2009-07-07 10:45:22 UTC (rev 282)
+++ lsc-sample/trunk/src/test/resources/log4j.properties	2009-07-07 10:46:38 UTC (rev 283)
@@ -1,4 +1,4 @@
-log4j.rootLogger = WARN, CONSOLE
+log4j.rootLogger = DEBUG, CONSOLE
 
 log4j.logger.communicationLogger = WARN, CONSOLE
 log4j.logger.org.apache = WARN, CONSOLE

Modified: lsc-sample/trunk/src/test/resources/lsc.properties
===================================================================
--- lsc-sample/trunk/src/test/resources/lsc.properties	2009-07-07 10:45:22 UTC (rev 282)
+++ lsc-sample/trunk/src/test/resources/lsc.properties	2009-07-07 10:46:38 UTC (rev 283)
@@ -1,19 +1,47 @@
-#Re/set the Source LDAP properties
-#Tue Jan 20 08:42:38 CET 2009
-dst.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
-dn.real_root=dc=lsc-project,dc=org
-src.java.naming.ldap.derefAliases=never
-src.java.naming.ldap.version=3
-src.java.naming.security.credentials=secret
-src.java.naming.security.authentication=simple
-src.java.naming.security.principal=cn=Directory Manager
-dst.java.naming.security.credentials=secret
-dst.java.naming.provider.url=ldap://localhost:33389/dc=lsc-project,dc=org
-dst.java.naming.ldap.derefAliases=never
-dst.java.naming.security.authentication=simple
-src.java.naming.provider.url=ldap://localhost:33389/dc=lsc-project,dc=org
-dst.java.naming.ldap.version=3
-dst.java.naming.referral=ignore
-dst.java.naming.security.principal=cn=Directory Manager
-src.java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
-src.java.naming.referral=ignore
+#Tue Jan 20 11:41:28 CET 2009
+
+src.java.naming.security.principal = cn=Directory Manager
+src.java.naming.security.credentials = secret
+src.java.naming.security.authentication = simple
+src.java.naming.referral = ignore
+src.java.naming.provider.url = ldap://localhost:33389/dc=lsc-project,dc=org
+src.java.naming.ldap.version = 3
+src.java.naming.ldap.derefAliases = never
+src.java.naming.factory.initial = com.sun.jndi.ldap.LdapCtxFactory
+
+dst.java.naming.security.principal = cn=Directory Manager
+dst.java.naming.security.credentials = secret
+dst.java.naming.security.authentication = simple
+dst.java.recursivedelete = true
+dst.java.naming.referral = ignore
+dst.java.naming.provider.url = ldap://localhost:33389/dc=lsc-project,dc=org
+dst.java.naming.ldap.version = 3
+dst.java.naming.ldap.derefAliases = never
+dst.java.naming.factory.initial = com.sun.jndi.ldap.LdapCtxFactory
+
+lsc.tasks = MySyncTask
+
+lsc.tasks.MySyncTask.type = db2ldap
+
+lsc.tasks.MySyncTask.dn = \"uid=\" + srcBean.getAttributeValueById(\"uid\") + \",ou=People\"
+lsc.tasks.MySyncTask.bean = org.lsc.beans.inetOrgPersonBean
+lsc.tasks.MySyncTask.object = org.lsc.objects.inetOrgPerson
+
+lsc.tasks.MySyncTask.srcService = org.lsc.service.InetOrgPersonJDBCService
+
+lsc.tasks.MySyncTask.dstService = org.lsc.jndi.SimpleJndiDstService
+lsc.tasks.MySyncTask.dstService.pivotAttrs = uid
+lsc.tasks.MySyncTask.dstService.filterId = (&(objectClass=inetOrgPerson)(uid={uid}))
+lsc.tasks.MySyncTask.dstService.filterAll = (objectClass=inetOrgPerson)
+lsc.tasks.MySyncTask.dstService.baseDn = ou=People
+lsc.tasks.MySyncTask.dstService.attrs = uid cn sn givenName mail objectClass employeeNumber
+
+lsc.syncoptions.MySyncTask = org.lsc.beans.syncoptions.PropertiesBasedSyncOptions
+
+lsc.syncoptions.MySyncTask.default.action = F
+
+lsc.syncoptions.MySyncTask.objectClass.action = K
+lsc.syncoptions.MySyncTask.objectClass.create_value = inetOrgPerson,organizationalPerson,person,top
+
+
+dn.real_root = dc=lsc-project,dc=org



More information about the lsc-changes mailing list