directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r377509 - in /directory/sandbox/akarasulu/rc1: apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/ shared/ldap/src/main/java/org/apache/directory/shared/...
Date Mon, 13 Feb 2006 22:13:52 GMT
Author: elecharny
Date: Mon Feb 13 14:13:51 2006
New Revision: 377509

URL: http://svn.apache.org/viewcvs?rev=377509&view=rev
Log:
Fix the Binary attributes problem

Modified:
    directory/sandbox/akarasulu/rc1/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
    directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
    directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java
    directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java

Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java?rev=377509&r1=377508&r2=377509&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
(original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolProvider.java
Mon Feb 13 14:13:51 2006
@@ -71,7 +71,6 @@
 import org.apache.directory.shared.ldap.message.UnbindRequest;
 import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
-import org.apache.directory.shared.ldap.message.spi.Provider;
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
@@ -357,27 +356,13 @@
 
         public ProtocolEncoder getEncoder()
         {
-            if ( env == null || env.get( Provider.BERLIB_PROVIDER ) == null )
-            {
-                return new Asn1CodecEncoder( new MessageEncoder() );
-            }
-            else
-            {
-                return new Asn1CodecEncoder( new MessageEncoder( env ) );
-            }
+            return new Asn1CodecEncoder( new MessageEncoder( env ) );
         }
 
 
         public ProtocolDecoder getDecoder()
         {
-            if ( env == null || env.get( Provider.BERLIB_PROVIDER ) == null )
-            {
-                return new Asn1CodecDecoder( new MessageDecoder() );
-            }
-            else
-            {
-                return new Asn1CodecDecoder( new MessageDecoder( env ) );
-            }
+            return new Asn1CodecDecoder( new MessageDecoder( env ) );
         }
     }
 

Modified: directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=377509&r1=377508&r2=377509&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
(original)
+++ directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
Mon Feb 13 14:13:51 2006
@@ -69,19 +69,6 @@
      * Creates a MessageDecoder using default properties for enabling a BER
      * library provider.
      * 
-     * @throws MessageException
-     *             if there is a problem creating this decoder.
-     */
-    public MessageDecoder() throws MessageException
-    {
-        this( Provider.getEnvironment() );
-    }
-
-
-    /**
-     * Creates a MessageDecoder using default properties for enabling a BER
-     * library provider.
-     * 
      * @param env
      *            The Map of environment parameters.
      * @throws MessageException
@@ -90,7 +77,13 @@
     public MessageDecoder(final Hashtable env) throws MessageException
     {
         this.env = ( Hashtable ) env.clone();
-        this.provider = Provider.getProvider( this.env );
+        
+        // We need to get the encoder class name
+        Hashtable providerEnv = Provider.getEnvironment();
+        
+        this.env.put( Provider.BERLIB_PROVIDER, providerEnv.get( Provider.BERLIB_PROVIDER
) );
+        this.provider = Provider.getProvider( providerEnv );
+
         Set binaries;
 
         if ( env.containsKey( BINARY_KEY ) )

Modified: directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java?rev=377509&r1=377508&r2=377509&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java
(original)
+++ directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageEncoder.java
Mon Feb 13 14:13:51 2006
@@ -53,19 +53,6 @@
      * Creates a MessageEncoder using default properties for enabling a BER
      * library provider.
      * 
-     * @throws MessageException
-     *             if the encoder cannot be created.
-     */
-    public MessageEncoder() throws MessageException
-    {
-        this( Provider.getEnvironment() );
-    }
-
-
-    /**
-     * Creates a MessageEncoder using default properties for enabling a BER
-     * library provider.
-     * 
      * @param env
      *            The Map of environment parameters.
      * @throws MessageException
@@ -73,7 +60,10 @@
      */
     public MessageEncoder(final Hashtable env) throws MessageException
     {
-        this.provider = Provider.getProvider( ( Hashtable ) env.clone() );
+        // We need to get the encoder class name
+        Hashtable providerEnv = Provider.getEnvironment();
+        
+        this.provider = Provider.getProvider( Provider.getEnvironment() );
         this.encoder = provider.getEncoder();
         this.transformer = provider.getTransformer();
     }

Modified: directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java?rev=377509&r1=377508&r2=377509&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java
(original)
+++ directory/sandbox/akarasulu/rc1/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/spi/Provider.java
Mon Feb 13 14:13:51 2006
@@ -26,18 +26,9 @@
 package org.apache.directory.shared.ldap.message.spi;
 
 
-import org.apache.directory.shared.ldap.util.StringTools;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import java.util.List;
 import java.util.Properties;
 import java.util.Hashtable;
 import java.util.Set;
@@ -308,107 +299,10 @@
      */
     public static Properties getEnvironment()
     {
-        String cp = System.getProperty( "java.class.path" );
-        FileFilter filter = new FileFilter()
-        {
-            public boolean accept( File file )
-            {
-                return ( file.exists() && file.isDirectory() );
-            }
-        };
-
-        List paths = StringTools.getPaths( cp, filter );
-        Properties env = null;
-
-        // Loop through directories in classpath looking for berlib.properties
-        for ( int ii = 0; ii < paths.size(); ii++ )
-        {
-            File dir = new File( ( String ) paths.get( ii ) );
-            File propFile = new File( dir, BERLIB_PROPFILE );
-
-            if ( propFile.exists() )
-            {
-                env = new Properties();
-
-                try
-                {
-                    env.load( new FileInputStream( propFile ) );
-                }
-                catch ( FileNotFoundException fnfe )
-                {
-                    ProviderException pe = new ProviderException( null, "Failed to load "
+ propFile.getAbsolutePath() );
-                    pe.addThrowable( fnfe );
-                }
-                catch ( IOException ioe )
-                {
-                    ProviderException pe = new ProviderException( null, "Failed to load "
+ propFile.getAbsolutePath() );
-                    pe.addThrowable( ioe );
-                }
-
-                findMonitor( env );
-                monitor.propsFound( propFile.getAbsolutePath(), env );
-
-                break;
-            }
-        }
-
-        File javaHome = new File( System.getProperty( "java.home" ), "lib" );
-        File userHome = new File( System.getProperty( "user.home" ) );
-        File wkdirHome = new File( System.getProperty( "user.dir" ) );
-
-        // If prop file not on classpath so we try lookin for it other places
-        if ( env == null )
-        {
-            File propFile = new File( javaHome, BERLIB_PROPFILE );
-
-            if ( !propFile.exists() )
-            {
-                propFile = new File( userHome, BERLIB_PROPFILE );
-            }
-
-            if ( !propFile.exists() )
-            {
-                propFile = new File( wkdirHome, BERLIB_PROPFILE );
-            }
-
-            if ( propFile.exists() )
-            {
-                env = new Properties();
-
-                try
-                {
-                    env.load( new FileInputStream( propFile ) );
-                }
-                catch ( FileNotFoundException fnfe )
-                {
-                    ProviderException pe = new ProviderException( null, "Failed to load "
+ propFile.getAbsolutePath() );
-                    pe.addThrowable( fnfe );
-                }
-                catch ( IOException ioe )
-                {
-                    ProviderException pe = new ProviderException( null, "Failed to load "
+ propFile.getAbsolutePath() );
-                    pe.addThrowable( ioe );
-                }
-
-                findMonitor( env );
-                monitor.propsFound( propFile.getAbsolutePath(), env );
-            }
-        }
-
-        // Attempt to override or add values off of JVM command-line parameter.
-        if ( System.getProperties().containsKey( BERLIB_PROVIDER ) && ( System.getProperty(
BERLIB_PROVIDER ) != null ) )
-        {
-            env = new Properties();
-            env.setProperty( BERLIB_PROVIDER, System.getProperty( BERLIB_PROVIDER ) );
-        }
-
         // Prop file not on classpath so we complain and use the default!
-        if ( env == null )
-        {
-            env = new Properties();
-            env.setProperty( BERLIB_PROVIDER, DEFAULT_PROVIDER );
-            monitor.usingDefaults( USING_DEFAULTS_MSG, env );
-        }
+        Properties env = new Properties();
+        env.setProperty( BERLIB_PROVIDER, DEFAULT_PROVIDER );
+        monitor.usingDefaults( USING_DEFAULTS_MSG, env );
 
         return env;
     }



Mime
View raw message