summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2014-10-23 12:33:04 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2015-04-14 07:44:59 +0200
commit595f973cd7f996a616e1ef7279d01641d5e5606c (patch)
treeaa9c77730b47eaa9e841870d75b0bfd53b912db1
parentbe6a717ea73730d023e8bcb50d96f4c73abaafa0 (diff)
downloadsssync-595f973cd7f996a616e1ef7279d01641d5e5606c.tar.gz
sssync-595f973cd7f996a616e1ef7279d01641d5e5606c.tar.bz2
sssync-595f973cd7f996a616e1ef7279d01641d5e5606c.zip
Code review, changes in comments
-rw-r--r--src/connectors/src/data/io/csv/CSVDataReader.java1
-rw-r--r--src/connectors/src/data/io/ldap/LDAPConnectionWrapper.java3
-rw-r--r--src/connectors/src/data/io/ldap/LDAPFlatDataReader.java6
3 files changed, 7 insertions, 3 deletions
diff --git a/src/connectors/src/data/io/csv/CSVDataReader.java b/src/connectors/src/data/io/csv/CSVDataReader.java
index 6dbc8ff..1c09ca0 100644
--- a/src/connectors/src/data/io/csv/CSVDataReader.java
+++ b/src/connectors/src/data/io/csv/CSVDataReader.java
@@ -227,6 +227,7 @@ public class CSVDataReader extends AbstractMVDataReader {
CSVRecord res = null;
boolean abort = !csvIt.hasNext();
boolean done = false;
+ //TODO : re-think logic : csvIt will not return nulls but throws IOException wrapped in RuntimeException
while (!abort && !done) {
// Try to read a CSV line
res = (csvIt.hasNext())?csvIt.next():null;
diff --git a/src/connectors/src/data/io/ldap/LDAPConnectionWrapper.java b/src/connectors/src/data/io/ldap/LDAPConnectionWrapper.java
index 3f6497b..5c9d70b 100644
--- a/src/connectors/src/data/io/ldap/LDAPConnectionWrapper.java
+++ b/src/connectors/src/data/io/ldap/LDAPConnectionWrapper.java
@@ -29,6 +29,7 @@ import com.unboundid.ldap.sdk.LDAPConnectionOptions;
import com.unboundid.ldap.sdk.LDAPException;
import com.unboundid.ldap.sdk.ResultCode;
+
/**
* TODO javadoc
*
@@ -76,7 +77,7 @@ public class LDAPConnectionWrapper implements Closeable {
* @param dataSourceName Short name of this data source (for logging)
* @param baseDN Search base DN (will return childs of this DN)
* @param keyAttr Attribute name that is the primary key of the entry, identifying the entry in a unique manner
- * @param lookAheadAmount Grab this amount of entries at once (in memory-sorted, 128 could be great)
+ * @param lookAheadAmount Grab this amount of entries at once (in-memory sorted, 128 could be great)
* @return A new reader ready to iterate on search results
*/
public LDAPFlatDataReader newFlatReader(String dataSourceName, String baseDN, String keyAttr, int lookAheadAmount) {
diff --git a/src/connectors/src/data/io/ldap/LDAPFlatDataReader.java b/src/connectors/src/data/io/ldap/LDAPFlatDataReader.java
index 2cc79a8..dad75d1 100644
--- a/src/connectors/src/data/io/ldap/LDAPFlatDataReader.java
+++ b/src/connectors/src/data/io/ldap/LDAPFlatDataReader.java
@@ -54,11 +54,12 @@ public class LDAPFlatDataReader extends AbstractMVDataReader {
private final String baseDN;
private final String keyAttr;
private final int lookAheadAmount;
- private final SortedSet<String> keys;
+ private final SortedSet<String> keys; //FIXME : TreeSet is sexy but costly (memory). Use ArrayList<String> or String[] and Collections.sort()
private transient Iterator<String> keysItCached;
private transient Iterator<String> keysItConsumed;
- private transient SortedMap<String, MVDataEntry> entries;
+ private transient SortedMap<String, MVDataEntry> entries; //TODO : memory ineffcient
+ // Could help ? http://trove4j.sourceforge.net/javadocs/gnu/trove/map/package-summary.html
// Listener to feed LDAP search result in SortedMap without instantiating a big fat SearchResult
private final SearchResultListener keysReqListener = new SearchResultListener() {
@@ -95,6 +96,7 @@ public class LDAPFlatDataReader extends AbstractMVDataReader {
this.keys = new TreeSet<String>();
SearchRequest keysReq = new SearchRequest(keysReqListener, baseDN, SearchScope.ONE, Filter.create("(objectClass=*)"), keyAttr);
conn.search(keysReq);
+
}
/**