You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2007/05/28 06:19:05 UTC
svn commit: r542104 - in
/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared:
AbstractBackingStoreTest.java MapAdapter.java catalog/Catalog.java
catalog/GetCatalog.java store/LdifFileLoader.java
Author: erodriguez
Date: Sun May 27 21:18:59 2007
New Revision: 542104
URL: http://svn.apache.org/viewvc?view=rev&rev=542104
Log:
Warnings clean-up in protocol-shared.
Modified:
directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java
directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/MapAdapter.java
directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/Catalog.java
directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java
directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java?view=diff&rev=542104&r1=542103&r2=542104
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java Sun May 27 21:18:59 2007
@@ -88,12 +88,12 @@
protected MutableStartupConfiguration config;
protected CoreContextFactory factory;
- protected Hashtable env;
+ protected Hashtable<String, Object> env;
protected void setUp() throws Exception
{
- env = new Hashtable( setUpPartition() );
+ env = new Hashtable<String, Object>( setUpPartition() );
env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
env.put( Context.SECURITY_AUTHENTICATION, "simple" );
@@ -145,7 +145,7 @@
}
- protected Hashtable setUpPartition() throws NamingException
+ protected Hashtable<String, Object> setUpPartition() throws NamingException
{
config = new MutableStartupConfiguration();
@@ -238,7 +238,7 @@
{
super.tearDown();
- Hashtable env = new Hashtable();
+ Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put( Context.PROVIDER_URL, "ou=system" );
env.put( Context.INITIAL_CONTEXT_FACTORY, CoreContextFactory.class.getName() );
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/MapAdapter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/MapAdapter.java?view=diff&rev=542104&r1=542103&r2=542104
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/MapAdapter.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/MapAdapter.java Sun May 27 21:18:59 2007
@@ -42,10 +42,15 @@
*/
public class MapAdapter implements Map
{
- private Dictionary dictionary;
+ private Dictionary<Object, Object> dictionary;
- public MapAdapter(Dictionary dictionary)
+ /**
+ * Creates a new instance of MapAdapter.
+ *
+ * @param dictionary
+ */
+ public MapAdapter( Dictionary<Object, Object> dictionary )
{
this.dictionary = dictionary;
}
@@ -56,7 +61,7 @@
*/
public void clear()
{
- dictionary = new Hashtable();
+ dictionary = new Hashtable<Object, Object>();
}
@@ -83,7 +88,7 @@
*/
public Set entrySet()
{
- Map map = new HashMap();
+ Map<Object, Object> map = new HashMap<Object, Object>();
Enumeration e = dictionary.keys();
@@ -121,7 +126,7 @@
*/
public Set keySet()
{
- return new HashSet( Collections.list( dictionary.keys() ) );
+ return new HashSet<Object>( Collections.list( dictionary.keys() ) );
}
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/Catalog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/Catalog.java?view=diff&rev=542104&r1=542103&r2=542104
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/Catalog.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/Catalog.java Sun May 27 21:18:59 2007
@@ -29,5 +29,11 @@
*/
public interface Catalog
{
+ /**
+ * Returns the base DN for searches, given a zone or realm name.
+ *
+ * @param name
+ * @return The base DN for searches.
+ */
public String getBaseDn( String name );
}
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java?view=diff&rev=542104&r1=542103&r2=542104
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java Sun May 27 21:18:59 2007
@@ -61,7 +61,7 @@
NamingEnumeration list = ctx.search( "", filter, controls );
- Map catalog = new HashMap();
+ Map<String, String> catalog = new HashMap<String, String>();
while ( list.hasMore() )
{
Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java?view=diff&rev=542104&r1=542103&r2=542104
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/LdifFileLoader.java Sun May 27 21:18:59 2007
@@ -38,7 +38,6 @@
import org.apache.directory.shared.ldap.ldif.Entry;
import org.apache.directory.shared.ldap.ldif.LdifReader;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +58,7 @@
/** the LDIF file or directory containing LDIFs to load */
protected File ldif;
/** the filters to use while loading entries into the server */
- protected final List filters;
+ protected final List<LdifLoadFilter> filters;
/** the class loader to use if we cannot file the file as a path */
protected final ClassLoader loader;
/** the total count of entries loaded */
@@ -67,24 +66,39 @@
/**
- * Creates the LDIF file loader command.
+ * Creates a new instance of LdifFileLoader.
*
* @param ctx the context to load the entries into.
* @param ldif the file of LDIF entries to load.
*/
- public LdifFileLoader(DirContext ctx, String ldif)
+ public LdifFileLoader( DirContext ctx, String ldif )
{
this( ctx, new File( ldif ), null );
}
- public LdifFileLoader(DirContext ctx, File ldif, List filters)
+ /**
+ * Creates a new instance of LdifFileLoader.
+ *
+ * @param ctx
+ * @param ldif
+ * @param filters
+ */
+ public LdifFileLoader( DirContext ctx, File ldif, List<LdifLoadFilter> filters )
{
this( ctx, ldif, filters, null );
}
- public LdifFileLoader(DirContext ctx, File ldif, List filters, ClassLoader loader)
+ /**
+ * Creates a new instance of LdifFileLoader.
+ *
+ * @param ctx
+ * @param ldif
+ * @param filters
+ * @param loader
+ */
+ public LdifFileLoader( DirContext ctx, File ldif, List<LdifLoadFilter> filters, ClassLoader loader )
{
this.ctx = ctx;
this.ldif = ldif;
@@ -92,7 +106,7 @@
if ( filters == null )
{
- this.filters = Collections.EMPTY_LIST;
+ this.filters = Collections.emptyList();
}
else
{
@@ -122,7 +136,7 @@
{
try
{
- accept &= ( ( LdifLoadFilter ) filters.get( ii ) ).filter( ldif, dn, entry, ctx );
+ accept &= ( filters.get( ii ) ).filter( ldif, dn, entry, ctx );
}
catch ( NamingException e )
{
@@ -141,6 +155,8 @@
/**
* Opens the LDIF file and loads the entries into the context.
+ *
+ * @return The count of entries created.
*/
public int execute()
{
@@ -155,13 +171,13 @@
while ( ldifIterator.hasNext() )
{
Entry entry = ( Entry ) ldifIterator.next();
-
+
String dn = entry.getDn();
-
- if ( entry.isEntry() == false)
+
+ if ( entry.isEntry() == false )
{
- // If the entry is a modification, just skip it
- continue;
+ // If the entry is a modification, just skip it
+ continue;
}
Attributes attributes = entry.getAttributes();