directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r193123 - in /directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server: authn/ authz/ interceptor/ invocation/ operational/
Date Thu, 23 Jun 2005 09:46:02 GMT
Author: trustin
Date: Thu Jun 23 02:45:59 2005
New Revision: 193123

URL: http://svn.apache.org/viewcvs?rev=193123&view=rev
Log:
* Renamed Invocation.target to 'caller'
* Revised JavaDoc for 'invocation' package

Modified:
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authz/AuthorizationService.java
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/Invocation.java
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
    directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java?rev=193123&r1=193122&r2=193123&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authn/AuthenticationService.java
Thu Jun 23 02:45:59 2005
@@ -295,7 +295,7 @@
         // check if we are already authenticated and if so we return making
         // sure first that the credentials are not exposed within context
         ServerContext ctx =
-            ( ServerContext ) InvocationStack.getInstance().peek().getTarget();
+            ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
 
         if ( ctx.getPrincipal() != null )
         {

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authz/AuthorizationService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authz/AuthorizationService.java?rev=193123&r1=193122&r2=193123&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authz/AuthorizationService.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/authz/AuthorizationService.java
Thu Jun 23 02:45:59 2005
@@ -320,7 +320,7 @@
     private void protectLookUp( Name dn ) throws NamingException
     {
         LdapContext ctx =
-            ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+            ( LdapContext ) InvocationStack.getInstance().peek().getCaller();
         Name principalDn = ( ( ServerContext ) ctx ).getPrincipal().getJndiName();
 
         if ( !principalDn.equals( ADMIN_DN ) )
@@ -381,7 +381,7 @@
         //}
         
         LdapContext ctx =
-            ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+            ( LdapContext ) InvocationStack.getInstance().peek().getCaller();
         return new SearchResultFilteringEnumeration( e, searchCtls, ctx,
                 new SearchResultFilter()
                 {
@@ -399,7 +399,7 @@
     {
         NamingEnumeration e = nextInterceptor.list( base );
         LdapContext ctx =
-            ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+            ( LdapContext ) InvocationStack.getInstance().peek().getCaller();
         
         return new SearchResultFilteringEnumeration( e, null, ctx,
             new SearchResultFilter()

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java?rev=193123&r1=193122&r2=193123&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/interceptor/BaseInterceptor.java
Thu Jun 23 02:45:59 2005
@@ -61,7 +61,7 @@
      */
     public static LdapContext getContext()
     {
-        return ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+        return ( LdapContext ) InvocationStack.getInstance().peek().getCaller();
     }
 
 

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/Invocation.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/Invocation.java?rev=193123&r1=193122&r2=193123&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/Invocation.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/Invocation.java
Thu Jun 23 02:45:59 2005
@@ -23,40 +23,44 @@
 
 import javax.naming.Context;
 
-import org.apache.ldap.server.partition.ContextPartition;
+import org.apache.ldap.server.partition.ContextPartitionNexus;
 
 
 /**
- * Represents a method invocation on {@link ContextPartition}s.
- * <p/>
- * This class is abstract, and developers should extend this class to
- * represent the actual method invocations.
+ * Represents a call from JNDI {@link Context} to {@link ContextPartitionNexus}.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
 public class Invocation
 {
-    private final Context target;
+    private final Context caller;
     private final String name;
     private final List parameters;
     
     /**
-     * Creates a new instance.
+     * Creates a new instance that represents an invocation without parameters.
+     * 
+     * @parem caller the JNDI {@link Context} that made this invocation
+     * @param name the name of the called method
      */
-    public Invocation( Context target, String name )
+    public Invocation( Context caller, String name )
     {
-        this( target, name, null );
+        this( caller, name, null );
     }
 
     /**
      * Creates a new instance.
+     * 
+     * @parem caller the JNDI {@link Context} that made this invocation
+     * @param name the name of the called method
+     * @param parameters the array of parameters passed to the called method
      */
-    public Invocation( Context target, String name, Object[] parameters )
+    public Invocation( Context caller, String name, Object[] parameters )
     {
-        if( target == null )
+        if( caller == null )
         {
-            throw new NullPointerException( "target" );
+            throw new NullPointerException( "caller" );
         }
         if( name == null )
         {
@@ -68,7 +72,7 @@
             parameters = new Object[ 0 ];
         }
         
-        this.target = target;
+        this.caller = caller;
         this.name = name;
         
         List paramList = new ArrayList();
@@ -81,15 +85,15 @@
     }
     
     /**
-     * Returns the target context of this invocation.
+     * Returns the JNDI {@link Context} which made this invocation.
      */
-    public Context getTarget()
+    public Context getCaller()
     {
-        return target;
+        return caller;
     }
     
     /**
-     * Returns the name of this invocation.
+     * Returns the name of the called method.
      */
     public String getName()
     {
@@ -97,7 +101,7 @@
     }
     
     /**
-     * Returns the list of parameters
+     * Returns the list of parameters parameters passed to the called method.
      */
     public List getParameters()
     {

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java?rev=193123&r1=193122&r2=193123&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/invocation/InvocationStack.java
Thu Jun 23 02:45:59 2005
@@ -1,3 +1,19 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
 package org.apache.ldap.server.invocation;
 
 
@@ -6,8 +22,18 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.naming.Context;
+
 
 /**
+ * Keeps track of recursive {@link Invocation}s.  This stack assumes an invocation
+ * occurs in the same thread since it is called first, so we manages stacks
+ * for each invocation in {@link ThreadLocal}-like manner.  You can just use
+ * {@link #getInstance()} to get current invocation stack.
+ * <p>
+ * Using {@link InvocationStack}, you can find out current effective JNDI
+ * {@link Context} or detect infinite recursions.
+ * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
@@ -18,6 +44,9 @@
     // <tt>ThreadLocal.remove()</tt>, but we're still targetting 1.4.
     private static final Map stacks = new IdentityHashMap();
     
+    /**
+     * Returns the invocation stack of current thread.
+     */
     public static InvocationStack getInstance()
     {
         Thread currentThread = Thread.currentThread();
@@ -44,6 +73,10 @@
         stacks.put( currentThread, this );
     }
     
+    /**
+     * Returns an array of {@link Invocation}s.  0th element is the
+     * latest invocation.
+     */
     public Invocation[] toArray()
     {
         Invocation[] result = new Invocation[ stack.size() ];
@@ -51,16 +84,26 @@
         return result;
     }
     
+    /**
+     * Returns the latest invocation.
+     */
     public Invocation peek()
     {
         return ( Invocation ) this.stack.get( 0 );
     }
     
+    /**
+     * Pushes the specified invocation to this stack.
+     */
     public void push( Invocation invocation )
     {
         this.stack.add( 0, invocation );
     }
     
+    /**
+     * Pops the latest invocation from this stack.  This stack is released
+     * automatically if you pop all items from this stack.
+     */
     public Invocation pop()
     {
         Invocation invocation = ( Invocation ) this.stack.remove( 0 );

Modified: directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java?rev=193123&r1=193122&r2=193123&view=diff
==============================================================================
--- directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
(original)
+++ directory/apacheds/branches/db_refactor/core/src/main/java/org/apache/ldap/server/operational/OperationalAttributeService.java
Thu Jun 23 02:45:59 2005
@@ -242,7 +242,7 @@
     {
         NamingEnumeration e = nextInterceptor.list( base );
         LdapContext ctx =
-            ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+            ( LdapContext ) InvocationStack.getInstance().peek().getCaller();
         return new SearchResultFilteringEnumeration( e, new SearchControls(), ctx, SEARCH_FILTER
);
     }
 
@@ -258,7 +258,7 @@
         }
 
         LdapContext ctx =
-            ( LdapContext ) InvocationStack.getInstance().peek().getTarget();
+            ( LdapContext ) InvocationStack.getInstance().peek().getCaller();
         return new SearchResultFilteringEnumeration( e, searchCtls, ctx, SEARCH_FILTER );
     }
 



Mime
View raw message