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 2005/09/07 17:30:58 UTC

svn commit: r279346 - in /directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi: DeadContext.java ServerContext.java ServerDirContext.java

Author: akarasulu
Date: Wed Sep  7 08:30:55 2005
New Revision: 279346

URL: http://svn.apache.org/viewcvs?rev=279346&view=rev
Log:
Made contexts implement EventContext and EventDirContext using do nothing stubs
for implemenation methods.  This was done to fascilitate hot redeployment 
capabilities using the OSGi version of the container.

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java?rev=279346&r1=279345&r2=279346&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/DeadContext.java Wed Sep  7 08:30:55 2005
@@ -25,6 +25,8 @@
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.event.EventDirContext;
+import javax.naming.event.NamingListener;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
@@ -48,7 +50,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-class DeadContext implements LdapContext
+class DeadContext implements LdapContext, EventDirContext
 {
     private final String EXCEPTION_MSG = "Context operation unavailable when " +
             "invoked after Eve provider has been shutdown";
@@ -421,6 +423,55 @@
 
 
     public Name composeName( Name name, Name prefix ) throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public void addNamingListener( Name name, String s, SearchControls searchControls, NamingListener namingListener )
+            throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public void addNamingListener( String s, String s1, SearchControls searchControls, NamingListener namingListener ) throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public void addNamingListener( Name name, String s, Object[] objects, SearchControls searchControls, NamingListener namingListener ) throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public void addNamingListener( String s, String s1, Object[] objects, SearchControls searchControls, NamingListener namingListener ) throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public void addNamingListener( Name name, int i, NamingListener namingListener ) throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public void addNamingListener( String s, int i, NamingListener namingListener ) throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public void removeNamingListener( NamingListener namingListener ) throws NamingException
+    {
+        throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
+    }
+
+
+    public boolean targetMustExist() throws NamingException
     {
         throw new LdapServiceUnavailableException( EXCEPTION_MSG, ResultCodeEnum.UNAVAILABLE );
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java?rev=279346&r1=279345&r2=279346&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerContext.java Wed Sep  7 08:30:55 2005
@@ -30,6 +30,8 @@
 import javax.naming.NamingException;
 import javax.naming.Reference;
 import javax.naming.Referenceable;
+import javax.naming.event.EventContext;
+import javax.naming.event.NamingListener;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
@@ -54,7 +56,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class ServerContext implements Context
+public abstract class ServerContext implements EventContext
 {
     /** property key used for deleting the old RDN on a rename */
     public static final String DELETE_OLD_RDN_PROP = "java.naming.ldap.deleteRDN";
@@ -739,7 +741,7 @@
         while ( fqn.size() > 0 )
         {
             // match found end loop
-            if ( fqn.get( 0 ).equalsIgnoreCase( head ) )
+            if ( ( ( String ) fqn.get( 0 ) ).equalsIgnoreCase( head ) )
             {
                 return fqn;
             }
@@ -755,8 +757,37 @@
 
         throw new NamingException( msg );
     }
-    
-    
+
+
+    // ------------------------------------------------------------------------
+    // EventContext implementations
+    // ------------------------------------------------------------------------
+
+
+    public void addNamingListener( Name name, int i, NamingListener namingListener ) throws NamingException
+    {
+        // stub: does not do anything just yet
+    }
+
+
+    public void addNamingListener( String s, int i, NamingListener namingListener ) throws NamingException
+    {
+        // stub: does not do anything just yet
+    }
+
+
+    public void removeNamingListener( NamingListener namingListener ) throws NamingException
+    {
+        // stub: does not do anything just yet
+    }
+
+
+    public boolean targetMustExist() throws NamingException
+    {
+        return false;
+    }
+
+
     // ------------------------------------------------------------------------
     // Utility Methods to Reduce Code
     // ------------------------------------------------------------------------

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java?rev=279346&r1=279345&r2=279346&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/jndi/ServerDirContext.java Wed Sep  7 08:30:55 2005
@@ -27,6 +27,8 @@
 import javax.naming.NamingException;
 import javax.naming.Reference;
 import javax.naming.Referenceable;
+import javax.naming.event.EventDirContext;
+import javax.naming.event.NamingListener;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
@@ -55,7 +57,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class ServerDirContext extends ServerContext implements DirContext
+public abstract class ServerDirContext extends ServerContext implements EventDirContext
 {
     
     
@@ -658,5 +660,38 @@
         }
         
         return search( name, buf.toString(), cons );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // EventDirContext implementations
+    // ------------------------------------------------------------------------
+
+
+    public void addNamingListener( Name name, String s, SearchControls searchControls, NamingListener namingListener ) 
+            throws NamingException
+    {
+        // stub: does not do anything just yet
+    }
+
+
+    public void addNamingListener( String s, String s1, SearchControls searchControls, NamingListener namingListener )
+            throws NamingException
+    {
+        // stub: does not do anything just yet
+    }
+
+
+    public void addNamingListener( Name name, String s, Object[] objects, SearchControls searchControls,
+                                   NamingListener namingListener ) throws NamingException
+    {
+        // stub: does not do anything just yet
+    }
+
+
+    public void addNamingListener( String s, String s1, Object[] objects, SearchControls searchControls,
+                                   NamingListener namingListener ) throws NamingException
+    {
+        // stub: does not do anything just yet
     }
 }