directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r575341 - in /directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server: configuration/MutableServerStartupConfiguration.java configuration/ServerStartupConfiguration.java jndi/ServerContextFactory.java
Date Thu, 13 Sep 2007 16:04:19 GMT
Author: elecharny
Date: Thu Sep 13 09:04:18 2007
New Revision: 575341

URL: http://svn.apache.org/viewvc?rev=575341&view=rev
Log:
Removed warnings by using generics, cleaning the antlr .g files from useless imports, removed
useless casts.

Modified:
    directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
    directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
    directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java

Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java?rev=575341&r1=575340&r2=575341&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
(original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/MutableServerStartupConfiguration.java
Thu Sep 13 09:04:18 2007
@@ -25,11 +25,15 @@
 import java.util.Set;
 
 import org.apache.directory.server.changepw.ChangePasswordConfiguration;
+import org.apache.directory.server.core.configuration.AuthenticatorConfiguration;
+import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.configuration.PartitionConfiguration;
 import org.apache.directory.server.dns.DnsConfiguration;
 import org.apache.directory.server.kerberos.kdc.KdcConfiguration;
 import org.apache.directory.server.ldap.LdapConfiguration;
 import org.apache.directory.server.ntp.NtpConfiguration;
+import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
+import org.apache.directory.shared.ldap.ldif.Entry;
 
 
 /**
@@ -112,7 +116,7 @@
     }
 
 
-    public void setAuthenticatorConfigurations( Set arg0 )
+    public void setAuthenticatorConfigurations( Set<AuthenticatorConfiguration> arg0
)
     {
         super.setAuthenticatorConfigurations( arg0 );
     }
@@ -124,13 +128,13 @@
     }
 
 
-    public void setInterceptorConfigurations( List arg0 )
+    public void setInterceptorConfigurations( List<InterceptorConfiguration> arg0 )
     {
         super.setInterceptorConfigurations( arg0 );
     }
 
 
-    public void setTestEntries( List arg0 )
+    public void setTestEntries( List<Entry> arg0 )
     {
         super.setTestEntries( arg0 );
     }
@@ -148,7 +152,7 @@
     }
 
 
-    public void setLdifFilters( List ldifFilters )
+    public void setLdifFilters( List<LdifLoadFilter> ldifFilters )
     {
         super.setLdifFilters( ldifFilters );
     }

Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java?rev=575341&r1=575340&r2=575341&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
(original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ServerStartupConfiguration.java
Thu Sep 13 09:04:18 2007
@@ -50,7 +50,7 @@
     private boolean enableNetworking = true;
 
     private File ldifDirectory = null;
-    private final List ldifFilters = new ArrayList();
+    private final List<LdifLoadFilter> ldifFilters = new ArrayList<LdifLoadFilter>();
 
     private KdcConfiguration kdcConfiguration = new KdcConfiguration();
     private LdapConfiguration ldapConfiguration = new LdapConfiguration();
@@ -112,23 +112,14 @@
     }
 
 
-    public List getLdifFilters()
+    public List<LdifLoadFilter> getLdifFilters()
     {
-        return new ArrayList( ldifFilters );
+        return new ArrayList<LdifLoadFilter>( ldifFilters );
     }
 
 
-    protected void setLdifFilters( List filters )
+    protected void setLdifFilters( List<LdifLoadFilter> filters )
     {
-        for ( int ii = 0; ii < filters.size(); ii++ )
-        {
-            if ( !( filters.get( ii ) instanceof LdifLoadFilter ) )
-            {
-                throw new IllegalArgumentException(
-                    "The specified filter collection contains an element which is not an
LdifLoadFilter." );
-            }
-        }
-
         this.ldifFilters.clear();
         this.ldifFilters.addAll( filters );
     }

Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java?rev=575341&r1=575340&r2=575341&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java
(original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/jndi/ServerContextFactory.java
Thu Sep 13 09:04:18 2007
@@ -82,7 +82,6 @@
 import org.apache.mina.transport.socket.nio.DatagramAcceptorConfig;
 import org.apache.mina.transport.socket.nio.SocketAcceptor;
 import org.apache.mina.transport.socket.nio.SocketAcceptorConfig;
-import org.apache.mina.transport.socket.nio.SocketSessionConfig;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -414,7 +413,8 @@
         }
 
         // get an initial context to the rootDSE for creating the LDIF entries
-        Hashtable env = ( Hashtable ) service.getConfiguration().getEnvironment().clone();
+        @SuppressWarnings(value={"unchecked"})
+        Hashtable<String, Object> env = ( Hashtable<String, Object> ) service.getConfiguration().getEnvironment().clone();
         env.put( Context.PROVIDER_URL, "" );
         DirContext root = ( DirContext ) this.getInitialContext( env );
 
@@ -474,6 +474,7 @@
         for ( int ii = 0; ii < ldifFiles.length; ii++ )
         {
             Attributes fileEntry = getLdifFileEntry( root, ldifFiles[ii] );
+            
             if ( fileEntry != null )
             {
                 String time = ( String ) fileEntry.get( SchemaConstants.CREATE_TIMESTAMP_AT
).get();
@@ -481,9 +482,11 @@
                     + "' skipped.  It has already been loaded on " + time + "." );
                 continue;
             }
+            
             LdifFileLoader loader = new LdifFileLoader( root, ldifFiles[ii], cfg.getLdifFilters()
);
             int count = loader.execute();
             log.info( "Loaded " + count + " entries from LDIF file '" + getCanonical( ldifFiles[ii]
) + "'" );
+            
             if ( fileEntry == null )
             {
                 addFileEntry( root, ldifFiles[ii] );
@@ -560,7 +563,7 @@
             acceptorCfg.setFilterChainBuilder( chainBuilder );
             acceptorCfg.setThreadModel( ThreadModel.MANUAL );
 
-            ( ( SocketSessionConfig ) ( acceptorCfg.getSessionConfig() ) ).setTcpNoDelay(
true );
+            acceptorCfg.getSessionConfig().setTcpNoDelay( true );
 
             dsc.tcpAcceptor.bind( new InetSocketAddress( port ), protocolProvider.getHandler(),
acceptorCfg );
             dsc.ldapStarted = true;
@@ -705,17 +708,17 @@
         {
             // we should unbind the service before we begin sending the notice 
             // of disconnect so new connections are not formed while we process
-            List writeFutures = new ArrayList();
+            List<WriteFuture> writeFutures = new ArrayList<WriteFuture>();
 
             // If the socket has already been unbound as with a successful 
             // GracefulShutdownRequest then this will complain that the service
             // is not bound - this is ok because the GracefulShutdown has already
             // sent notices to to the existing active sessions
-            List sessions = null;
+            List<IoSession> sessions = null;
         
             try
             {
-                sessions = new ArrayList( dsc.tcpAcceptor.getManagedSessions( new InetSocketAddress(
port ) ) );
+                sessions = new ArrayList<IoSession>( dsc.tcpAcceptor.getManagedSessions(
new InetSocketAddress( port ) ) );
             }
             catch ( IllegalArgumentException e )
             {
@@ -734,21 +737,19 @@
             // Send Notification of Disconnection messages to all connected clients.
             if ( sessions != null )
             {
-                for ( Iterator i = sessions.iterator(); i.hasNext(); )
+                for ( IoSession session:sessions )
                 {
-                    IoSession session = ( IoSession ) i.next();
                     writeFutures.add( session.write( NoticeOfDisconnect.UNAVAILABLE ) );
                 }
             }
 
             // And close the connections when the NoDs are sent.
-            Iterator sessionIt = sessions.iterator();
+            Iterator<IoSession> sessionIt = sessions.iterator();
             
-            for ( Iterator i = writeFutures.iterator(); i.hasNext(); )
+            for ( WriteFuture future:writeFutures )
             {
-                WriteFuture future = ( WriteFuture ) i.next();
                 future.join( 1000 );
-                ( ( IoSession ) sessionIt.next() ).close();
+                sessionIt.next().close();
             }
         }
         catch ( Exception e )



Mime
View raw message