From 595f973cd7f996a616e1ef7279d01641d5e5606c Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Thu, 23 Oct 2014 12:33:04 +0200 Subject: Code review, changes in comments --- src/connectors/src/data/io/csv/CSVDataReader.java | 1 + src/connectors/src/data/io/ldap/LDAPConnectionWrapper.java | 3 ++- src/connectors/src/data/io/ldap/LDAPFlatDataReader.java | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') 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 keys; + private final SortedSet keys; //FIXME : TreeSet is sexy but costly (memory). Use ArrayList or String[] and Collections.sort() private transient Iterator keysItCached; private transient Iterator keysItConsumed; - private transient SortedMap entries; + private transient SortedMap 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(); SearchRequest keysReq = new SearchRequest(keysReqListener, baseDN, SearchScope.ONE, Filter.create("(objectClass=*)"), keyAttr); conn.search(keysReq); + } /** -- cgit v1.2.3