diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2014-10-23 13:17:16 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2015-04-14 07:44:59 +0200 |
commit | 267c7b1af11ec8f306b37c58c7190c57fd906dc5 (patch) | |
tree | 28d3702fd32993c926b1f2057a91419ff9845b2b /src/main | |
parent | 177a7ece545dd0de3dd6de2042ae2491a523193b (diff) | |
download | sssync-267c7b1af11ec8f306b37c58c7190c57fd906dc5.tar.gz sssync-267c7b1af11ec8f306b37c58c7190c57fd906dc5.tar.bz2 sssync-267c7b1af11ec8f306b37c58c7190c57fd906dc5.zip |
Config : all enum values in CAPS.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/JUTests/conf/testConn.yaml | 10 | ||||
-rw-r--r-- | src/main/JUTests/conf/testExpectedConn.yaml | 6 | ||||
-rw-r--r-- | src/main/JUTests/conf/testExpectedMain.yaml | 12 | ||||
-rw-r--r-- | src/main/JUTests/conf/testMain.yaml | 14 | ||||
-rw-r--r-- | src/main/conf/connections.yaml | 6 | ||||
-rw-r--r-- | src/main/conf/sssync.yaml | 14 | ||||
-rw-r--r-- | src/main/src/conf/ConfigConnectionBean.java | 2 | ||||
-rw-r--r-- | src/main/src/conf/ConfigDestBean.java | 8 | ||||
-rw-r--r-- | src/main/src/conf/ConfigRootBean.java | 2 | ||||
-rw-r--r-- | src/main/src/conf/ConfigSourceBean.java | 2 | ||||
-rw-r--r-- | src/main/src/data/io/SSSyncConnectionsFactory.java | 4 | ||||
-rw-r--r-- | src/main/src/sync/SSSyncTasksFactory.java | 14 |
12 files changed, 48 insertions, 46 deletions
diff --git a/src/main/JUTests/conf/testConn.yaml b/src/main/JUTests/conf/testConn.yaml index c41063c..78a4fa6 100644 --- a/src/main/JUTests/conf/testConn.yaml +++ b/src/main/JUTests/conf/testConn.yaml @@ -1,17 +1,17 @@ # This file contains credentials (should be readable only by SSSync) connections: - id : ora_1 - type: jdbc - dbms: oracle + type: JDBC + dbms: ORACLE ress: gest host: ora.univ-jfc.fr port: 1521 - user: GRHUM + user: grhum pass: secret - db : GHRUM + db : grhum - id : ldap_1 - type: ldap + type: LDAP host: localhost port: 389 bind: uid=ldapadmin,ou=specialUsers,dc=univ-jfc,dc=fr diff --git a/src/main/JUTests/conf/testExpectedConn.yaml b/src/main/JUTests/conf/testExpectedConn.yaml index 4cb3421..17d4f0b 100644 --- a/src/main/JUTests/conf/testExpectedConn.yaml +++ b/src/main/JUTests/conf/testExpectedConn.yaml @@ -2,13 +2,13 @@ connections: - bind: null db: GHRUM - dbms: oracle + dbms: ORACLE host: ora.univ-jfc.fr id: ora_1 pass: secret port: 1521 ress: gest - type: jdbc + type: JDBC user: GRHUM - bind: uid=ldapadmin,ou=specialUsers,dc=univ-jfc,dc=fr db: null @@ -18,5 +18,5 @@ connections: pass: secret port: 389 ress: null - type: ldap + type: LDAP user: null diff --git a/src/main/JUTests/conf/testExpectedMain.yaml b/src/main/JUTests/conf/testExpectedMain.yaml index dd00aef..88bcb32 100644 --- a/src/main/JUTests/conf/testExpectedMain.yaml +++ b/src/main/JUTests/conf/testExpectedMain.yaml @@ -6,7 +6,7 @@ tasks: attr: uid base: ou=people,dc=univ-jfc,dc=fr conn: ldap_1 - kind: ldap + kind: LDAP mode: null name: LDAP de test, ou=people path: null @@ -22,7 +22,7 @@ tasks: - attr: null base: null conn: ora_1 - kind: sql + kind: SQL mode: PRIMARY_SOURCE name: GHRUM, comptes et personnes path: null @@ -30,7 +30,7 @@ tasks: - attr: null base: null conn: null - kind: csv + kind: FIXED_CSV mode: MERGE_APPEND name: CSV personnes additionnelles path: people_append.csv @@ -38,7 +38,7 @@ tasks: - attr: null base: null conn: null - kind: sorted_csv + kind: FIXED_CSV_SORTED mode: MERGE_REPLACE name: CSV correctifs personnes path: people_replace.csv @@ -47,7 +47,7 @@ tasks: attr: supannEntiteAffectation base: ou=structures,dc=univ-jfc,dc=fr conn: ldap_1 - kind: ldap + kind: LDAP mode: null name: LDAP de test, ou=structures path: null @@ -63,7 +63,7 @@ tasks: - attr: null base: null conn: ora_1 - kind: sql + kind: SQL mode: PRIMARY_SOURCE name: GHRUM, structures path: null diff --git a/src/main/JUTests/conf/testMain.yaml b/src/main/JUTests/conf/testMain.yaml index 39350b2..123a8b1 100644 --- a/src/main/JUTests/conf/testMain.yaml +++ b/src/main/JUTests/conf/testMain.yaml @@ -11,24 +11,24 @@ tasks: delete: 10 sources: - name: GHRUM, comptes et personnes - kind: sql + kind: SQL conn: ora_1 mode: PRIMARY_SOURCE query: people.sql - name: CSV personnes additionnelles - kind: csv + kind: FIXED_CSV mode: MERGE_APPEND path: people_append.csv - name: CSV correctifs personnes - kind: sorted_csv + kind: FIXED_CSV_SORTED mode: MERGE_REPLACE path: people_replace.csv destination: name: LDAP de test, ou=people - kind: ldap + kind: LDAP conn: ldap_1 attr: uid base: ou=people,dc=univ-jfc,dc=fr @@ -36,13 +36,13 @@ tasks: - name: Structure sync sources: - name: GHRUM, structures - kind: sql + kind: SQL conn: ora_1 mode: PRIMARY_SOURCE query: structures.sql destination: name: LDAP de test, ou=structures - kind: ldap + kind: LDAP conn: ldap_1 attr: supannEntiteAffectation base: ou=structures,dc=univ-jfc,dc=fr @@ -51,4 +51,4 @@ tasks: opLimits: insert: 10 update: 10 - delete: 10
\ No newline at end of file + delete: 10 diff --git a/src/main/conf/connections.yaml b/src/main/conf/connections.yaml index 1918d02..097117e 100644 --- a/src/main/conf/connections.yaml +++ b/src/main/conf/connections.yaml @@ -1,8 +1,8 @@ # This file contains credentials (should be readable only by SSSync) connections: - id : mysql_1 - type: jdbc - dbms: mysql + type: JDBC + dbms: MYSQL host: localhost port: 3306 user: root @@ -10,7 +10,7 @@ connections: db : sssync - id : ldap_1 - type: ldap + type: LDAP host: localhost port: 389 bind: uid=ldapadmin,ou=specialUsers,dc=univ-jfc,dc=fr diff --git a/src/main/conf/sssync.yaml b/src/main/conf/sssync.yaml index b285a37..068a95b 100644 --- a/src/main/conf/sssync.yaml +++ b/src/main/conf/sssync.yaml @@ -11,24 +11,24 @@ tasks: delete: 300 sources: - name: GHRUM, comptes et personnes - kind: sql + kind: SQL conn: mysql_1 mode: PRIMARY_SOURCE query: conf/queries/people.sql - name: CSV personnes additionnelles - kind: csv + kind: FIXED_CSV mode: MERGE_APPEND path: data/people_append.csv - name: CSV correctifs personnes - kind: csv + kind: FIXED_CSV mode: MERGE_REPLACE path: data/people_replace.csv destination: name: LDAP de test, ou=people - kind: ldap + kind: LDAP conn: ldap_1 attr: uid base: ou=people,dc=univ-jfc,dc=fr @@ -40,17 +40,17 @@ tasks: delete: 10 sources: - name: GHRUM, structures - kind: sql + kind: SQL conn: mysql_1 mode: PRIMARY_SOURCE query: conf/queries/structures.sql destination: name: LDAP de test, ou=structures - kind: ldap + kind: LDAP conn: ldap_1 attr: supannCodeEntite base: ou=structures,dc=univ-jfc,dc=fr skipEntryDelete: true - skipReadErrors: true
\ No newline at end of file + skipReadErrors: true diff --git a/src/main/src/conf/ConfigConnectionBean.java b/src/main/src/conf/ConfigConnectionBean.java index b43b56f..0597480 100644 --- a/src/main/src/conf/ConfigConnectionBean.java +++ b/src/main/src/conf/ConfigConnectionBean.java @@ -27,7 +27,7 @@ import data.io.sql.SQLConnectionWrapper.DBMSType; */ public class ConfigConnectionBean { - public enum ConnectionType { jdbc, ldap } + public enum ConnectionType { JDBC, LDAP } private String id; private ConnectionType type; diff --git a/src/main/src/conf/ConfigDestBean.java b/src/main/src/conf/ConfigDestBean.java index 2d9b2f7..d3c12fb 100644 --- a/src/main/src/conf/ConfigDestBean.java +++ b/src/main/src/conf/ConfigDestBean.java @@ -24,10 +24,10 @@ package conf; * Generated Configuration Bean */ public class ConfigDestBean { - public enum DestinationKind { ldap }; + public enum DestKind { LDAP }; private String name; - private DestinationKind kind; + private DestKind kind; private String conn; private String attr; private String base; @@ -39,10 +39,10 @@ public class ConfigDestBean { public void setName(String name) { this.name = name; } - public DestinationKind getKind() { + public DestKind getKind() { return kind; } - public void setKind(DestinationKind kind) { + public void setKind(DestKind kind) { this.kind = kind; } public String getConn() { diff --git a/src/main/src/conf/ConfigRootBean.java b/src/main/src/conf/ConfigRootBean.java index acbbd49..eac7793 100644 --- a/src/main/src/conf/ConfigRootBean.java +++ b/src/main/src/conf/ConfigRootBean.java @@ -51,6 +51,8 @@ public class ConfigRootBean { public static <T> String listDump(List<T> list, int ident) { + if ( list == null ) return "{}"; + StringBuffer buf = new StringBuffer(); buf.append('{'); for (T item : list) { diff --git a/src/main/src/conf/ConfigSourceBean.java b/src/main/src/conf/ConfigSourceBean.java index cf01dce..893d41a 100644 --- a/src/main/src/conf/ConfigSourceBean.java +++ b/src/main/src/conf/ConfigSourceBean.java @@ -28,7 +28,7 @@ import data.filters.MVDataCombiner; public class ConfigSourceBean { //TODO : fixed_csv ? - public enum SourceKind { csv, ldap, sorted_csv, sql }; + public enum SourceKind { FIXED_CSV, FIXED_CSV_SORTED, LDAP, SQL }; private String name; private SourceKind kind; diff --git a/src/main/src/data/io/SSSyncConnectionsFactory.java b/src/main/src/data/io/SSSyncConnectionsFactory.java index 07f19e9..0eab7a2 100644 --- a/src/main/src/data/io/SSSyncConnectionsFactory.java +++ b/src/main/src/data/io/SSSyncConnectionsFactory.java @@ -42,11 +42,11 @@ public class SSSyncConnectionsFactory { for ( ConfigConnectionBean conn : confConn.getConnections() ) { switch (conn.getType()) { - case jdbc: + case JDBC: SQLConnectionWrapper connSQL = new SQLConnectionWrapper(conn.getDbms(), conn.getHost(), conn.getPort(), conn.getRess(), conn.getUser(), conn.getPass(), conn.getDb()); connections.putConnSQL(conn.getId(), connSQL); break; - case ldap: + case LDAP: LDAPConnectionWrapper connLDAP = new LDAPConnectionWrapper(conn.getHost(), conn.getPort(), conn.getBind(), conn.getPass()); connections.putConnLDAP(conn.getId(), connLDAP); break; diff --git a/src/main/src/sync/SSSyncTasksFactory.java b/src/main/src/sync/SSSyncTasksFactory.java index a91b3fa..4f7cfd6 100644 --- a/src/main/src/sync/SSSyncTasksFactory.java +++ b/src/main/src/sync/SSSyncTasksFactory.java @@ -118,18 +118,18 @@ public class SSSyncTasksFactory { private static MVDataReader _makeSrcReader(ConnectionsHolder connections, ConfigSourceBean confSource, String taskName) throws Exception { MVDataReader reader=null; switch (confSource.getKind()) { - case csv: + case FIXED_CSV: reader = new CSVDataReader(confSource.getName(), new FileReader(confSource.getPath()), false); break; - case ldap: + case FIXED_CSV_SORTED: + reader = new CSVDataReader(confSource.getName(), new FileReader(confSource.getPath()), true); + break; + case LDAP: LDAPConnectionWrapper ldapConnBuilder = connections.getLDAPConnectionBuilder(confSource.getConn()); //FIXME if conf error, getLDAPConnectionBuilder could return null reader = ldapConnBuilder.newFlatReader(confSource.getName(), confSource.getBase(), confSource.getAttr(), confSource.getLookahead()); break; - case sorted_csv: - reader = new CSVDataReader(confSource.getName(), new FileReader(confSource.getPath()), true); - break; - case sql: + case SQL: SQLConnectionWrapper sqlConnBuilder = connections.getSQLConnectionBuilder(confSource.getConn()); //FIXME if conf error, getSQLConnectionBuilder could return null //TODO We assume the query config item is a filepath. It isn't checked anywhere. @@ -156,7 +156,7 @@ public class SSSyncTasksFactory { MVDataWriter writer = null; switch ( confDest.getKind() ) { - case ldap: + case LDAP: LDAPConnectionWrapper builder = connections.getLDAPConnectionBuilder(confDest.getConn()); reader = builder.newFlatReader(confDest.getName()+"_reader", confDest.getBase(), confDest.getAttr(), confDest.getLookahead()); writer = builder.newFlatWriter(confDest.getBase(), confDest.getAttr()); |