You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/10/07 07:46:32 UTC

svn commit: rev 53937 - in incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve: config jndi schema/config

Author: akarasulu
Date: Wed Oct  6 22:46:31 2004
New Revision: 53937

Added:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/config/
      - copied from rev 53912, incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/config/
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/config/SyntaxCheckerConfig.java
      - copied unchanged from rev 53936, incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/config/SyntaxCheckerConfig.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/schema/config/SyntaxConfig.java
      - copied unchanged from rev 53936, incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/config/SyntaxConfig.java
Removed:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/config/
Modified:
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
   incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveJndiProvider.java
Log:
moving config section to under schema package

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java	(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContextFactory.java	Wed Oct  6 22:46:31 2004
@@ -8,6 +8,11 @@
 import javax.naming.spi.InitialContextFactory;
 
 import org.apache.ldap.common.NotImplementedException;
+import org.apache.ldap.common.schema.Syntax;
+import org.apache.eve.schema.DefaultSyntaxCheckerRegistry;
+import org.apache.eve.schema.DefaultSyntaxRegistry;
+import org.apache.eve.schema.DefaultOidRegistry;
+import org.apache.eve.config.SyntaxConfig;
 
 
 /**
@@ -25,8 +30,10 @@
 {
     /** The singleton EveJndiProvider instance */
     private EveJndiProvider provider = null;
+    /** the initial context environment that fired up the backend subsystem */
+    private Hashtable initialEnv;
+
 
-    
     /**
      * Default constructor that sets the provider of this EveContextFactory.
      */
@@ -52,15 +59,34 @@
      * @see javax.naming.spi.InitialContextFactory#getInitialContext(
      * java.util.Hashtable)
      */
-    public Context getInitialContext( Hashtable an_envoronment )
-        throws NamingException
+    public Context getInitialContext( Hashtable env ) throws NamingException
     {
         // fire up the backend subsystem if we need to
         if ( null == provider )
         {
+            this.initialEnv = env;
             throw new NotImplementedException();
         }
         
-        return provider.getLdapContext( an_envoronment );
+        return provider.getLdapContext( env );
+    }
+
+
+    private EveJndiProvider create( Hashtable env )
+    {
+        EveJndiProvider provider;
+        Syntax[] syntaxes;
+        DefaultOidRegistry oidRegistry;
+        SyntaxConfig syntaxConfig;
+        DefaultSyntaxRegistry syntaxRegistry;
+
+        syntaxConfig = new SyntaxConfig();
+        syntaxes = syntaxConfig.loadSyntaxes( null );
+        oidRegistry = new DefaultOidRegistry();
+        syntaxRegistry = new DefaultSyntaxRegistry( syntaxes, oidRegistry );
+
+        
+
+        return provider;
     }
 }

Modified: incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveJndiProvider.java
==============================================================================
--- incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveJndiProvider.java	(original)
+++ incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveJndiProvider.java	Wed Oct  6 22:46:31 2004
@@ -1,18 +1,18 @@
-package org.apache.eve.jndi ;
+package org.apache.eve.jndi;
 
 
 import org.apache.eve.RootNexus;
 import org.apache.eve.PartitionNexus;
 import org.apache.eve.EveBackendSubsystem;
 
-import java.util.Hashtable ;
+import java.util.Hashtable;
 
-import java.lang.reflect.Proxy ;
-import java.lang.reflect.Method ;
-import java.lang.reflect.InvocationHandler ;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationHandler;
 
-import javax.naming.NamingException ;
-import javax.naming.ldap.LdapContext ;
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
 
 
 /**
@@ -22,18 +22,18 @@
 public class EveJndiProvider implements EveBackendSubsystem, InvocationHandler
 {
     /** Singleton instance of this class */
-    private static EveJndiProvider s_singleton = null ;
+    private static EveJndiProvider s_singleton = null;
     
     /** Interceptor of interceptors in post-invocation pipeline */
-    private InterceptorPipeline m_after = new FailFastPipeline() ;
+    private InterceptorPipeline after = new FailFastPipeline();
     /** Interceptor of interceptors in pre-invocation pipeline */
-    private InterceptorPipeline m_before = new FailFastPipeline() ;
+    private InterceptorPipeline before = new FailFastPipeline();
     /** Interceptor of interceptors in post-invocation pipeline failure */
-    private InterceptorPipeline m_afterFailure  = new AfterFailurePipeline() ;
+    private InterceptorPipeline afterFailure  = new AfterFailurePipeline();
     /** RootNexus as it was given to us by the ServiceManager */
-    private RootNexus m_nexus = null ;
-    /** PartitionNexus proxy wrapping m_nexus to inject services */
-    private PartitionNexus m_proxy = null ;
+    private RootNexus nexus = null;
+    /** PartitionNexus proxy wrapping nexus to inject services */
+    private PartitionNexus proxy = null;
 
 
     // ------------------------------------------------------------------------
@@ -42,8 +42,8 @@
 
 
     /**
-     * Creates a singlton instance of the EveBackendSubsystem.  In the words of the
-     * Highlander, "there can only be one."
+     * Creates a singlton instance of the EveBackendSubsystem.  In the words of
+     * the Highlander, "there can only be one."
      *
      * @throws IllegalStateException if another EveJndiProvider has already
      * been instantiated.
@@ -53,14 +53,14 @@
         if ( s_singleton != null )
         {
             throw new IllegalStateException(
-                "Cannot instantiate more than one EveJndiProvider!" ) ;
+                "Cannot instantiate more than one EveJndiProvider!" );
         }
 
-        s_singleton = this ;
-        this.m_nexus = nexus;
-        this.m_proxy = ( PartitionNexus ) Proxy.newProxyInstance(
-            m_nexus.getClass().getClassLoader(),
-            m_nexus.getClass().getInterfaces(), this ) ;
+        s_singleton = this;
+        this.nexus = nexus;
+        this.proxy = ( PartitionNexus ) Proxy.newProxyInstance(
+            nexus.getClass().getClassLoader(),
+            nexus.getClass().getInterfaces(), this );
 
     }
 
@@ -78,7 +78,7 @@
      */
     static void setProviderOn( EveContextFactory a_factory )
     {
-        a_factory.setProvider( s_singleton ) ;
+        a_factory.setProvider( s_singleton );
     }
 
 
@@ -92,7 +92,7 @@
      */
     public LdapContext getLdapContext( Hashtable an_env ) throws NamingException
     {
-        return new EveLdapContext( m_proxy, an_env ) ;
+        return new EveLdapContext( proxy, an_env );
     }
 
 
@@ -108,14 +108,14 @@
         throws Throwable
     {
         // Setup the invocation and populate: remember aspect sets context stack
-        Invocation l_invocation = new Invocation() ;
-        l_invocation.setMethod( a_method ) ;
-        l_invocation.setProxy( a_proxy ) ;
-        l_invocation.setParameters( a_args ) ;
+        Invocation invocation = new Invocation();
+        invocation.setMethod( a_method );
+        invocation.setProxy( a_proxy );
+        invocation.setParameters( a_args );
         
         try
         {
-            m_before.invoke( l_invocation ) ;
+            before.invoke( invocation );
         }
         catch ( Throwable a_throwable )
         {
@@ -125,18 +125,18 @@
              */
             if ( a_throwable instanceof InterceptorException )
             {
-                l_invocation.setBeforeFailure( ( InterceptorException ) 
-                    a_throwable ) ;
+                invocation.setBeforeFailure( ( InterceptorException )
+                    a_throwable );
             }
             else 
             {
-                InterceptorException l_ie = 
-                    new InterceptorException( m_before, l_invocation ) ;
-                l_invocation.setBeforeFailure( l_ie ) ;
-                l_ie.setRootCause( a_throwable ) ;
+                InterceptorException ie =
+                    new InterceptorException( before, invocation );
+                invocation.setBeforeFailure( ie );
+                ie.setRootCause( a_throwable );
             }
             
-            l_invocation.setState( InvocationStateEnum.FAILUREHANDLING ) ;
+            invocation.setState( InvocationStateEnum.FAILUREHANDLING );
         }
 
         
@@ -148,27 +148,27 @@
          * If before pipeline failed then we invoke the after failure pipeline
          * and throw the before failure exception.
          */
-        if ( InvocationStateEnum.PREINVOCATION == l_invocation.getState() )
+        if ( InvocationStateEnum.PREINVOCATION == invocation.getState() )
         {
             try
             {
-                l_invocation.setReturnValue( a_method.invoke( m_nexus, 
-                    l_invocation.getParameters() ) ) ;
-                l_invocation.setState( InvocationStateEnum.POSTINVOCATION ) ;
+                invocation.setReturnValue( a_method.invoke( nexus,
+                    invocation.getParameters() ) );
+                invocation.setState( InvocationStateEnum.POSTINVOCATION );
             }
             catch ( Throwable a_throwable )
             {
-                l_invocation.setThrowable( a_throwable ) ;
-                l_invocation.setState( InvocationStateEnum.FAILUREHANDLING ) ;
+                invocation.setThrowable( a_throwable );
+                invocation.setState( InvocationStateEnum.FAILUREHANDLING );
             }
 
-            l_invocation.setComplete( true ) ;
+            invocation.setComplete( true );
         }
         else if ( 
-            InvocationStateEnum.FAILUREHANDLING == l_invocation.getState() )
+            InvocationStateEnum.FAILUREHANDLING == invocation.getState() )
         {
-            m_afterFailure.invoke( l_invocation ) ;
-            throw l_invocation.getBeforeFailure() ;
+            afterFailure.invoke( invocation );
+            throw invocation.getBeforeFailure();
         }
 
 
@@ -181,55 +181,55 @@
          * pipeline since we will be in the FAILUREHANDLINE state and after 
          * doing so we throw the original throwable raised by the target.
          */
-        if ( InvocationStateEnum.POSTINVOCATION == l_invocation.getState() )
+        if ( InvocationStateEnum.POSTINVOCATION == invocation.getState() )
         {
             try
             {
-                m_after.invoke( l_invocation ) ;
-                return l_invocation.getReturnValue() ;
+                after.invoke( invocation );
+                return invocation.getReturnValue();
             }
             catch ( Throwable a_throwable )
             {
-                l_invocation.setState( InvocationStateEnum.FAILUREHANDLING ) ;
+                invocation.setState( InvocationStateEnum.FAILUREHANDLING );
                 
                 if ( a_throwable instanceof InterceptorException )
                 {
-                    l_invocation.setAfterFailure( ( InterceptorException ) 
-                        a_throwable ) ;
+                    invocation.setAfterFailure( ( InterceptorException )
+                        a_throwable );
                 }
                 else 
                 {
-                    InterceptorException l_ie = 
-                        new InterceptorException( m_after, l_invocation ) ;
-                    l_ie.setRootCause( a_throwable ) ;
-                    l_invocation.setAfterFailure( l_ie ) ;
+                    InterceptorException ie =
+                        new InterceptorException( after, invocation );
+                    ie.setRootCause( a_throwable );
+                    invocation.setAfterFailure( ie );
                 }
                 
-                m_afterFailure.invoke( l_invocation ) ;
-                throw l_invocation.getAfterFailure() ;
+                afterFailure.invoke( invocation );
+                throw invocation.getAfterFailure();
             }
         }
         else if ( 
-            InvocationStateEnum.FAILUREHANDLING == l_invocation.getState() 
+            InvocationStateEnum.FAILUREHANDLING == invocation.getState()
             )
         {
-            m_afterFailure.invoke( l_invocation ) ;
+            afterFailure.invoke( invocation );
             
-            if ( null != l_invocation.getThrowable() )
+            if ( null != invocation.getThrowable() )
             {
-                throw l_invocation.getThrowable() ;
+                throw invocation.getThrowable();
             }
-            else if ( null != l_invocation.getBeforeFailure() )
+            else if ( null != invocation.getBeforeFailure() )
             {
-                throw l_invocation.getBeforeFailure() ;
+                throw invocation.getBeforeFailure();
             }
-            else if ( null != l_invocation.getAfterFailure() )
+            else if ( null != invocation.getAfterFailure() )
             {
-                throw l_invocation.getAfterFailure() ;
+                throw invocation.getAfterFailure();
             }
         }
         
         throw new IllegalStateException( "The EveJndiProvider's invocation "
-            + "handler method invoke should never have reached this line" ) ;
+            + "handler method invoke should never have reached this line" );
     }
 }