Author: akarasulu
Date: Sun Oct 24 11:07:04 2004
New Revision: 55455
Added:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/JavaLdapSupport.java
- copied, changed from rev 55390,
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/JavaLdap.java
Removed:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/JavaLdap.java
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AfterFailurePipeline.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContext.java
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/EveDirContext.java
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/EveLdapContext.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/FailFastPipeline.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Interceptor.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorException.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorPipeline.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Invocation.java
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InvocationStateEnum.java
Log:
Changes ...
o added ASL 2.0 boilerplate
o removed @author tags replacing it with the default
o reformatted code to remove space in front of ;
o removed usage of m_, a_, an_, and l_
o added some more java docs
o renamed JavaLdap to be more descriptive as JavaLdapSupport
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AfterFailurePipeline.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AfterFailurePipeline.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/AfterFailurePipeline.java
Sun Oct 24 11:07:04 2004
@@ -1,4 +1,20 @@
-package org.apache.eve.jndi ;
+/*
+ * 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.eve.jndi;
/**
@@ -7,6 +23,8 @@
* exceptions are added to the afterFailure list of exceptions on the
* Invocation.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public class AfterFailurePipeline extends InterceptorPipeline
{
@@ -17,7 +35,7 @@
*/
public final boolean isFailFast()
{
- return false ;
+ return false;
}
@@ -31,19 +49,19 @@
*
* @see Interceptor#invoke(Invocation)
*/
- public void invoke( Invocation a_invocation ) throws InterceptorException
+ public void invoke( Invocation invocation ) throws InterceptorException
{
- InterceptorException l_last = null ;
+ InterceptorException last = null;
- for ( int ii = 0 ; ii < getList().size(); ii++ )
+ for ( int ii = 0; ii < getList().size(); ii++ )
{
- Interceptor l_service = ( Interceptor ) getList().get( ii ) ;
+ Interceptor service = ( Interceptor ) getList().get( ii );
try
{
- l_service.invoke( a_invocation ) ;
+ service.invoke( invocation );
}
- catch ( Throwable a_throwable )
+ catch ( Throwable throwable )
{
/*
* If exception is InterceptorException we add it to the list
@@ -53,25 +71,24 @@
* Invocation
*/
- if ( a_throwable instanceof InterceptorException )
+ if ( throwable instanceof InterceptorException )
{
- l_last = ( InterceptorException ) a_throwable ;
- a_invocation.addFailure( l_last ) ;
+ last = ( InterceptorException ) throwable;
+ invocation.addFailure( last );
}
else
{
- l_last =
- new InterceptorException( l_service, a_invocation ) ;
- l_last.setRootCause( a_throwable ) ;
- a_invocation.addFailure( l_last ) ;
+ last = new InterceptorException( service, invocation );
+ last.setRootCause( throwable );
+ invocation.addFailure( last );
}
}
}
// Throw the last excepts if any after all Interceptors are invoked
- if ( null != l_last )
+ if ( null != last )
{
- throw l_last ;
+ throw last;
}
}
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContext.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContext.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveContext.java
Sun Oct 24 11:07:04 2004
@@ -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.eve.jndi;
@@ -24,6 +40,8 @@
/**
* A non-federated abstract Context implementation.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public abstract class EveContext implements Context
{
@@ -211,10 +229,10 @@
* l_attributes.put( BootstrapSchema.DN_ATTR, l_target.toString() ) ;
*/
l_attributes.put( l_rdnAttribute, l_rdnValue ) ;
- l_attributes.put( JavaLdap.OBJECTCLASS_ATTR,
- JavaLdap.JCONTAINER_ATTR ) ;
- l_attributes.put( JavaLdap.OBJECTCLASS_ATTR,
- JavaLdap.TOP_ATTR ) ;
+ l_attributes.put( JavaLdapSupport.OBJECTCLASS_ATTR,
+ JavaLdapSupport.JCONTAINER_ATTR ) ;
+ l_attributes.put( JavaLdapSupport.OBJECTCLASS_ATTR,
+ JavaLdapSupport.TOP_ATTR ) ;
/*
* Add the new context to the server which as a side effect adds
@@ -287,7 +305,7 @@
Name l_target = buildTarget( a_name ) ;
// Serialize object into entry attributes and add it.
- JavaLdap.serialize( l_attributes, a_obj ) ;
+ JavaLdapSupport.serialize( l_attributes, a_obj ) ;
m_nexusProxy.add( l_target.toString(), l_target, l_attributes ) ;
}
@@ -420,10 +438,10 @@
Attributes l_attributes = m_nexusProxy.lookup( l_target ) ;
// First lets test and see if the entry is a serialized java object
- if ( l_attributes.get( JavaLdap.JCLASSNAME_ATTR ) != null )
+ if ( l_attributes.get( JavaLdapSupport.JCLASSNAME_ATTR ) != null )
{
// Give back serialized object and not a context
- return JavaLdap.deserialize( l_attributes ) ;
+ return JavaLdapSupport.deserialize( l_attributes ) ;
}
// Initialize and return a context since the entry is not a java object
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
Sun Oct 24 11:07:04 2004
@@ -32,6 +32,8 @@
* InitialContext initialContext = new InitialContext( env );
* </code>
* @see javax.naming.spi.InitialContextFactory
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public class EveContextFactory implements InitialContextFactory
{
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveDirContext.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveDirContext.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveDirContext.java
Sun Oct 24 11:07:04 2004
@@ -1,29 +1,45 @@
+/*
+ * 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.eve.jndi;
-import java.io.IOException ;
-import java.util.Hashtable ;
-import java.text.ParseException ;
-
-import javax.naming.Name ;
-import javax.naming.ldap.Control ;
-import javax.naming.NamingException ;
-import javax.naming.NamingEnumeration ;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.text.ParseException;
+
+import javax.naming.Name;
+import javax.naming.ldap.Control;
+import javax.naming.NamingException;
+import javax.naming.NamingEnumeration;
import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes ;
-import javax.naming.directory.DirContext ;
-import javax.naming.directory.SearchControls ;
-import javax.naming.directory.ModificationItem ;
-import javax.naming.directory.InvalidSearchFilterException ;
-
-import org.apache.ldap.common.name.LdapName ;
-import org.apache.ldap.common.filter.ExprNode ;
-import org.apache.ldap.common.filter.BranchNode ;
-import org.apache.ldap.common.filter.SimpleNode ;
-import org.apache.ldap.common.filter.PresenceNode ;
-import org.apache.ldap.common.filter.FilterParser ;
-import org.apache.ldap.common.util.NamespaceTools ;
-import org.apache.ldap.common.filter.FilterParserImpl ;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.InvalidSearchFilterException;
+
+import org.apache.ldap.common.name.LdapName;
+import org.apache.ldap.common.filter.ExprNode;
+import org.apache.ldap.common.filter.BranchNode;
+import org.apache.ldap.common.filter.SimpleNode;
+import org.apache.ldap.common.filter.PresenceNode;
+import org.apache.ldap.common.filter.FilterParser;
+import org.apache.ldap.common.util.NamespaceTools;
+import org.apache.ldap.common.filter.FilterParserImpl;
import org.apache.eve.PartitionNexus;
@@ -31,6 +47,8 @@
/**
* The DirContext implementation for the Server Side JNDI LDAP provider.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public abstract class EveDirContext extends EveContext implements DirContext
{
@@ -44,13 +62,13 @@
* Creates a new EveDirContext by reading the PROVIDER_URL to resolve the
* distinguished name for this context.
*
- * @param a_nexusProxy the proxy to the backend nexus
- * @param a_env the environment used for this context
+ * @param nexusProxy the proxy to the backend nexus
+ * @param env the environment used for this context
* @throws NamingException if something goes wrong
*/
- public EveDirContext( PartitionNexus a_nexusProxy, Hashtable a_env )
throws NamingException
+ public EveDirContext( PartitionNexus nexusProxy, Hashtable env ) throws
NamingException
{
- super( a_nexusProxy, a_env ) ;
+ super( nexusProxy, env );
}
@@ -58,13 +76,13 @@
* Creates a new EveDirContext with a distinguished name which is used to
* set the PROVIDER_URL to the distinguished name for this context.
*
- * @param a_nexusProxy the intercepting proxy to the nexus
- * @param a_env the environment properties used by this context
- * @param a_dn the distinguished name of this context
+ * @param nexusProxy the intercepting proxy to the nexus
+ * @param env the environment properties used by this context
+ * @param dn the distinguished name of this context
*/
- protected EveDirContext( PartitionNexus a_nexusProxy, Hashtable a_env,
LdapName a_dn )
+ protected EveDirContext( PartitionNexus nexusProxy, Hashtable env,
LdapName dn )
{
- super( a_nexusProxy, a_env, a_dn ) ;
+ super( nexusProxy, env, dn );
}
@@ -76,18 +94,18 @@
/**
* @see javax.naming.directory.DirContext#getAttributes(java.lang.String)
*/
- public Attributes getAttributes( String a_name ) throws NamingException
+ public Attributes getAttributes( String name ) throws NamingException
{
- return getAttributes( new LdapName( a_name ) ) ;
+ return getAttributes( new LdapName( name ) );
}
/**
* @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name)
*/
- public Attributes getAttributes( Name a_name ) throws NamingException
+ public Attributes getAttributes( Name name ) throws NamingException
{
- return getNexusProxy().lookup( buildTarget( a_name ) ) ;
+ return getNexusProxy().lookup( buildTarget( name ) );
}
@@ -95,10 +113,10 @@
* @see javax.naming.directory.DirContext#getAttributes(java.lang.String,
* java.lang.String[])
*/
- public Attributes getAttributes( String a_name, String[] a_attrIds )
+ public Attributes getAttributes( String name, String[] attrIds )
throws NamingException
{
- return getAttributes( new LdapName( a_name ), a_attrIds ) ;
+ return getAttributes( new LdapName( name ), attrIds );
}
@@ -106,10 +124,10 @@
* @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name,
* java.lang.String[])
*/
- public Attributes getAttributes( Name a_name, String[] a_attrIds )
+ public Attributes getAttributes( Name name, String[] attrIds )
throws NamingException
{
- return getNexusProxy().lookup( buildTarget( a_name ), a_attrIds ) ;
+ return getNexusProxy().lookup( buildTarget( name ), attrIds );
}
@@ -117,10 +135,10 @@
* @see
javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
* int, javax.naming.directory.Attributes)
*/
- public void modifyAttributes( String a_name, int a_modOp,
- Attributes a_attrs ) throws NamingException
+ public void modifyAttributes( String name, int modOp,
+ Attributes attrs ) throws NamingException
{
- modifyAttributes( new LdapName( a_name ), a_modOp, a_attrs ) ;
+ modifyAttributes( new LdapName( name ), modOp, attrs );
}
@@ -128,10 +146,10 @@
* @see javax.naming.directory.DirContext#modifyAttributes(
* javax.naming.Name,int, javax.naming.directory.Attributes)
*/
- public void modifyAttributes( Name a_name, int a_modOp, Attributes a_attrs
)
+ public void modifyAttributes( Name name, int modOp, Attributes attrs )
throws NamingException
{
- getNexusProxy().modify( buildTarget( a_name ), a_modOp, a_attrs ) ;
+ getNexusProxy().modify( buildTarget( name ), modOp, attrs );
}
@@ -139,10 +157,10 @@
* @see
javax.naming.directory.DirContext#modifyAttributes(java.lang.String,
* javax.naming.directory.ModificationItem[])
*/
- public void modifyAttributes( String a_name, ModificationItem[] a_mods )
+ public void modifyAttributes( String name, ModificationItem[] mods )
throws NamingException
{
- modifyAttributes( new LdapName( a_name ), a_mods ) ;
+ modifyAttributes( new LdapName( name ), mods );
}
@@ -150,10 +168,10 @@
* @see javax.naming.directory.DirContext#modifyAttributes(
* javax.naming.Name, javax.naming.directory.ModificationItem[])
*/
- public void modifyAttributes( Name a_name, ModificationItem[] a_mods )
+ public void modifyAttributes( Name name, ModificationItem[] mods )
throws NamingException
{
- getNexusProxy().modify( buildTarget( a_name ), a_mods ) ;
+ getNexusProxy().modify( buildTarget( name ), mods );
}
@@ -161,10 +179,10 @@
* @see javax.naming.directory.DirContext#bind(java.lang.String,
* java.lang.Object, javax.naming.directory.Attributes)
*/
- public void bind( String a_name, Object a_obj, Attributes a_attrs )
+ public void bind( String name, Object obj, Attributes attrs )
throws NamingException
{
- bind( new LdapName( a_name ), a_obj, a_attrs ) ;
+ bind( new LdapName( name ), obj, attrs );
}
@@ -172,40 +190,40 @@
* @see javax.naming.directory.DirContext#bind(javax.naming.Name,
* java.lang.Object, javax.naming.directory.Attributes)
*/
- public void bind( Name a_name, Object a_obj, Attributes a_attrs )
+ public void bind( Name name, Object obj, Attributes attrs )
throws NamingException
{
- if ( null == a_obj && null == a_attrs )
+ if ( null == obj && null == attrs )
{
- throw new NamingException( "Both a_obj and a_attrs args are null. "
- + "At least one of these parameters must not be null." ) ;
+ throw new NamingException( "Both obj and attrs args are null. "
+ + "At least one of these parameters must not be null." );
}
- // A null a_attrs defaults this to the Context.bind() operation
- if ( null == a_attrs )
+ // A null attrs defaults this to the Context.bind() operation
+ if ( null == attrs )
{
- super.bind( a_name, a_obj ) ;
+ super.bind( name, obj );
}
// No object binding so we just add the attributes
- else if ( null == a_obj )
+ else if ( null == obj )
{
- Attributes l_clone = ( Attributes ) a_attrs.clone() ;
- Name l_target = buildTarget( a_name ) ;
- getNexusProxy().add( l_target.toString(), l_target, l_clone ) ;
+ Attributes clone = ( Attributes ) attrs.clone();
+ Name target = buildTarget( name );
+ getNexusProxy().add( target.toString(), target, clone );
}
- // Need to perform serialization of object into a copy of a_attrs
+ // Need to perform serialization of object into a copy of attrs
else
{
- if ( a_obj instanceof EveLdapContext )
+ if ( obj instanceof EveLdapContext )
{
throw new IllegalArgumentException(
- "Cannot bind a directory context object!" ) ;
+ "Cannot bind a directory context object!" );
}
- Attributes l_clone = ( Attributes ) a_attrs.clone() ;
- JavaLdap.serialize( l_clone, a_obj ) ;
- Name l_target = buildTarget( a_name ) ;
- getNexusProxy().add( l_target.toString(), l_target, l_clone ) ;
+ Attributes clone = ( Attributes ) attrs.clone();
+ JavaLdapSupport.serialize( clone, obj );
+ Name target = buildTarget( name );
+ getNexusProxy().add( target.toString(), target, clone );
}
}
@@ -214,10 +232,10 @@
* @see javax.naming.directory.DirContext#rebind(java.lang.String,
* java.lang.Object, javax.naming.directory.Attributes)
*/
- public void rebind( String a_name, Object a_obj, Attributes a_attrs )
+ public void rebind( String name, Object obj, Attributes attrs )
throws NamingException
{
- rebind( new LdapName( a_name ), a_obj, a_attrs ) ;
+ rebind( new LdapName( name ), obj, attrs );
}
@@ -225,17 +243,17 @@
* @see javax.naming.directory.DirContext#rebind(javax.naming.Name,
* java.lang.Object, javax.naming.directory.Attributes)
*/
- public void rebind( Name a_name, Object a_obj, Attributes a_attrs )
+ public void rebind( Name name, Object obj, Attributes attrs )
throws NamingException
{
- Name l_target = buildTarget( a_name ) ;
+ Name target = buildTarget( name );
- if ( getNexusProxy().hasEntry( l_target ) )
+ if ( getNexusProxy().hasEntry( target ) )
{
- getNexusProxy().delete( l_target ) ;
+ getNexusProxy().delete( target );
}
- bind( a_name, a_obj, a_attrs ) ;
+ bind( name, obj, attrs );
}
@@ -243,10 +261,10 @@
* @see
javax.naming.directory.DirContext#createSubcontext(java.lang.String,
* javax.naming.directory.Attributes)
*/
- public DirContext createSubcontext( String a_name, Attributes a_attrs )
+ public DirContext createSubcontext( String name, Attributes attrs )
throws NamingException
{
- return createSubcontext( new LdapName( a_name ), a_attrs ) ;
+ return createSubcontext( new LdapName( name ), attrs );
}
@@ -254,30 +272,30 @@
* @see javax.naming.directory.DirContext#createSubcontext(
* javax.naming.Name, javax.naming.directory.Attributes)
*/
- public DirContext createSubcontext( Name a_name, Attributes a_attrs )
+ public DirContext createSubcontext( Name name, Attributes attrs )
throws NamingException
{
- if ( null == a_attrs )
+ if ( null == attrs )
{
- return ( DirContext ) super.createSubcontext( a_name ) ;
+ return ( DirContext ) super.createSubcontext( name );
}
// @todo again note that we presume single attribute name components
- LdapName l_target = buildTarget( a_name ) ;
- String l_rdn = a_name.get( a_name.size() - 1 ) ;
- String l_rdnAttribute = NamespaceTools.getRdnAttribute( l_rdn ) ;
- String l_rdnValue = NamespaceTools.getRdnValue( l_rdn ) ;
+ LdapName target = buildTarget( name );
+ String rdn = name.get( name.size() - 1 );
+ String rdnAttribute = NamespaceTools.getRdnAttribute( rdn );
+ String rdnValue = NamespaceTools.getRdnValue( rdn );
// Clone the attributes and add the Rdn attributes
- Attributes l_attributes = ( Attributes ) a_attrs.clone() ;
- l_attributes.put( l_rdnAttribute, l_rdnValue ) ;
+ Attributes attributes = ( Attributes ) attrs.clone();
+ attributes.put( rdnAttribute, rdnValue );
// Add the new context to the server which as a side effect adds
- getNexusProxy().add( l_target.toString(), l_target, l_attributes ) ;
+ getNexusProxy().add( target.toString(), target, attributes );
// Initialize the new context
- EveLdapContext l_ctx = new EveLdapContext( getNexusProxy(),
- getEnvironment(), l_target ) ;
+ EveLdapContext ctx = new EveLdapContext( getNexusProxy(),
+ getEnvironment(), target );
Control [] controls = ( ( EveLdapContext ) this ).getRequestControls();
if ( controls != null )
@@ -289,68 +307,68 @@
controls = new Control[0];
}
- l_ctx.setRequestControls( controls ) ;
- return l_ctx ;
+ ctx.setRequestControls( controls );
+ return ctx;
}
/**
* Presently unsupported operation!
*
- * @param a_name TODO
+ * @param name TODO
* @return TODO
* @throws NamingException all the time.
* @see javax.naming.directory.DirContext#getSchema(javax.naming.Name)
*/
- public DirContext getSchema( Name a_name ) throws NamingException
+ public DirContext getSchema( Name name ) throws NamingException
{
- throw new UnsupportedOperationException() ;
+ throw new UnsupportedOperationException();
}
/**
* Presently unsupported operation!
*
- * @param a_name TODO
+ * @param name TODO
* @return TODO
* @throws NamingException all the time.
* @see javax.naming.directory.DirContext#getSchema(java.lang.String)
*/
- public DirContext getSchema( String a_name ) throws NamingException
+ public DirContext getSchema( String name ) throws NamingException
{
- throw new UnsupportedOperationException() ;
+ throw new UnsupportedOperationException();
}
/**
* Presently unsupported operation!
*
- * @param a_name TODO
+ * @param name TODO
* @return TODO
* @throws NamingException all the time.
* @see javax.naming.directory.DirContext#getSchemaClassDefinition(
* javax.naming.Name)
*/
- public DirContext getSchemaClassDefinition( Name a_name )
+ public DirContext getSchemaClassDefinition( Name name )
throws NamingException
{
- throw new UnsupportedOperationException() ;
+ throw new UnsupportedOperationException();
}
/**
* Presently unsupported operation!
*
- * @param a_name TODO
+ * @param name TODO
* @return TODO
* @throws NamingException all the time.
* @see javax.naming.directory.DirContext#getSchemaClassDefinition(
* java.lang.String)
*/
- public DirContext getSchemaClassDefinition( String a_name )
+ public DirContext getSchemaClassDefinition( String name )
throws NamingException
{
- throw new UnsupportedOperationException() ;
+ throw new UnsupportedOperationException();
}
@@ -363,10 +381,10 @@
* @see javax.naming.directory.DirContext#search(java.lang.String,
* javax.naming.directory.Attributes)
*/
- public NamingEnumeration search( String a_name,
- Attributes a_matchingAttributes ) throws NamingException
+ public NamingEnumeration search( String name,
+ Attributes matchingAttributes ) throws NamingException
{
- return search( new LdapName( a_name ), a_matchingAttributes, null ) ;
+ return search( new LdapName( name ), matchingAttributes, null );
}
@@ -374,10 +392,10 @@
* @see javax.naming.directory.DirContext#search(javax.naming.Name,
* javax.naming.directory.Attributes)
*/
- public NamingEnumeration search( Name a_name,
- Attributes a_matchingAttributes ) throws NamingException
+ public NamingEnumeration search( Name name,
+ Attributes matchingAttributes ) throws NamingException
{
- return search( a_name, a_matchingAttributes, null ) ;
+ return search( name, matchingAttributes, null );
}
@@ -385,12 +403,12 @@
* @see javax.naming.directory.DirContext#search(java.lang.String,
* javax.naming.directory.Attributes, java.lang.String[])
*/
- public NamingEnumeration search( String a_name,
- Attributes a_matchingAttributes, String[] a_attributesToReturn )
+ public NamingEnumeration search( String name,
+ Attributes matchingAttributes, String[] attributesToReturn )
throws NamingException
{
- return search( new LdapName( a_name ), a_matchingAttributes,
- a_attributesToReturn ) ;
+ return search( new LdapName( name ), matchingAttributes,
+ attributesToReturn );
}
@@ -401,72 +419,72 @@
* @see javax.naming.directory.DirContext#search(javax.naming.Name,
* javax.naming.directory.Attributes, java.lang.String[])
*/
- public NamingEnumeration search( Name a_name,
- Attributes a_matchingAttributes, String[] a_attributesToReturn )
+ public NamingEnumeration search( Name name,
+ Attributes matchingAttributes, String[] attributesToReturn )
throws NamingException
{
- SearchControls l_ctls = new SearchControls() ;
- LdapName l_target = buildTarget( a_name ) ;
+ SearchControls ctls = new SearchControls();
+ LdapName target = buildTarget( name );
// If we need to return specific attributes add em to the
SearchControls
- if ( null != a_attributesToReturn )
+ if ( null != attributesToReturn )
{
- l_ctls.setReturningAttributes( a_attributesToReturn ) ;
+ ctls.setReturningAttributes( attributesToReturn );
}
// If matchingAttributes is null/empty use a match for everything
filter
- if ( null == a_matchingAttributes || a_matchingAttributes.size() <= 0 )
+ if ( null == matchingAttributes || matchingAttributes.size() <= 0 )
{
- PresenceNode l_filter = new PresenceNode( "objectClass" ) ;
- return getNexusProxy().search( l_target , getEnvironment(),
- l_filter, l_ctls ) ;
+ PresenceNode filter = new PresenceNode( "objectClass" );
+ return getNexusProxy().search( target , getEnvironment(),
+ filter, ctls );
}
/*
* Go through the set of attributes using each attribute value pair as
* an attribute value assertion within one big AND filter expression.
*/
- Attribute l_attr = null ;
- SimpleNode l_node = null ;
- BranchNode l_filter = new BranchNode( BranchNode.AND ) ;
- NamingEnumeration l_list = a_matchingAttributes.getAll() ;
+ Attribute attr = null;
+ SimpleNode node = null;
+ BranchNode filter = new BranchNode( BranchNode.AND );
+ NamingEnumeration list = matchingAttributes.getAll();
// Loop through each attribute value pair
- while ( l_list.hasMore() )
+ while ( list.hasMore() )
{
- l_attr = ( Attribute ) l_list.next() ;
+ attr = ( Attribute ) list.next();
/*
- * According to JNDI if an attribute in the a_matchingAttributes
+ * According to JNDI if an attribute in the matchingAttributes
* list does not have any values then we match for just the
presence
* of the attribute in the entry
*/
- if ( l_attr.size() == 0 )
+ if ( attr.size() == 0 )
{
- l_filter.addNode( new PresenceNode( l_attr.getID() ) ) ;
- continue ;
+ filter.addNode( new PresenceNode( attr.getID() ) );
+ continue;
}
/*
* With 1 or more value we build a set of simple nodes and add them
* to the AND node - each attribute value pair is a simple AVA
node.
*/
- for ( int ii = 0; ii < l_attr.size(); ii++ )
+ for ( int ii = 0; ii < attr.size(); ii++ )
{
- Object l_val = l_attr.get( ii ) ;
+ Object val = attr.get( ii );
// Add simpel AVA node if its value is a String
- if ( l_val instanceof String )
+ if ( val instanceof String )
{
- l_node = new SimpleNode( l_attr.getID(),
- ( String ) l_val, SimpleNode.EQUALITY ) ;
- l_filter.addNode( l_node ) ;
+ node = new SimpleNode( attr.getID(),
+ ( String ) val, SimpleNode.EQUALITY );
+ filter.addNode( node );
}
}
}
- return getNexusProxy().search( l_target , getEnvironment(),
- l_filter, l_ctls ) ;
+ return getNexusProxy().search( target , getEnvironment(),
+ filter, ctls );
}
@@ -474,10 +492,10 @@
* @see javax.naming.directory.DirContext#search(java.lang.String,
* java.lang.String, javax.naming.directory.SearchControls)
*/
- public NamingEnumeration search( String a_name, String a_filter,
- SearchControls a_cons ) throws NamingException
+ public NamingEnumeration search( String name, String filter,
+ SearchControls cons ) throws NamingException
{
- return search( new LdapName( a_name ), a_filter, a_cons ) ;
+ return search( new LdapName( name ), filter, cons );
}
@@ -485,11 +503,11 @@
* @see javax.naming.directory.DirContext#search(javax.naming.Name,
* java.lang.String, javax.naming.directory.SearchControls)
*/
- public NamingEnumeration search( Name a_name, String a_filter,
- SearchControls a_cons ) throws NamingException
+ public NamingEnumeration search( Name name, String filter,
+ SearchControls cons ) throws NamingException
{
- ExprNode l_filter = null ;
- LdapName l_target = buildTarget( a_name ) ;
+ ExprNode filterNode = null;
+ LdapName target = buildTarget( name );
try
{
@@ -497,29 +515,29 @@
* TODO Added this parser initialization code to the FilterImpl
* and have a static class parser that can be globally accessed.
*/
- FilterParser l_parser = new FilterParserImpl() ;
- l_filter = l_parser.parse( a_filter ) ;
+ FilterParser parser = new FilterParserImpl();
+ filterNode = parser.parse( filter );
}
catch ( ParseException pe )
{
- InvalidSearchFilterException l_isfe =
+ InvalidSearchFilterException isfe =
new InvalidSearchFilterException (
"Encountered parse exception while parsing the filter: '"
- + a_filter + "'" ) ;
- l_isfe.setRootCause( pe ) ;
- throw l_isfe ;
+ + filter + "'" );
+ isfe.setRootCause( pe );
+ throw isfe;
}
catch ( IOException ioe )
{
- NamingException l_ne = new NamingException(
+ NamingException ne = new NamingException(
"Parser failed with IO exception on filter: '"
- + a_filter + "'" ) ;
- l_ne.setRootCause( ioe ) ;
- throw l_ne ;
+ + filter + "'" );
+ ne.setRootCause( ioe );
+ throw ne;
}
- return getNexusProxy().search( l_target , getEnvironment(),
- l_filter, new SearchControls() ) ;
+ return getNexusProxy().search( target , getEnvironment(),
+ filterNode, new SearchControls() );
}
@@ -528,11 +546,11 @@
* java.lang.String, java.lang.Object[],
* javax.naming.directory.SearchControls)
*/
- public NamingEnumeration search( String a_name, String a_filterExpr,
- Object[] a_filterArgs, SearchControls a_cons ) throws NamingException
+ public NamingEnumeration search( String name, String filterExpr,
+ Object[] filterArgs, SearchControls cons ) throws NamingException
{
- return search( new LdapName( a_name ), a_filterExpr, a_filterArgs,
- a_cons ) ;
+ return search( new LdapName( name ), filterExpr, filterArgs,
+ cons );
}
@@ -544,37 +562,37 @@
* java.lang.String, java.lang.Object[],
* javax.naming.directory.SearchControls)
*/
- public NamingEnumeration search( Name a_name, String a_filterExpr,
- Object[] a_filterArgs, SearchControls a_cons ) throws NamingException
+ public NamingEnumeration search( Name name, String filterExpr,
+ Object[] filterArgs, SearchControls cons ) throws NamingException
{
- int l_start ;
- StringBuffer l_buf = new StringBuffer( a_filterExpr ) ;
+ int start;
+ StringBuffer buf = new StringBuffer( filterExpr );
// Scan until we hit the end of the string buffer
- for ( int ii = 0; ii < l_buf.length(); ii++ )
+ for ( int ii = 0; ii < buf.length(); ii++ )
{
// Advance until we hit the start of a variable
- while ( '{' != l_buf.charAt( ii ) )
+ while ( '{' != buf.charAt( ii ) )
{
- ii++ ;
+ ii++;
}
// Record start of variable at '{'
- l_start = ii ;
+ start = ii;
// Advance to the end of a variable at '}'
- while ( '}' != l_buf.charAt( ii ) )
+ while ( '}' != buf.charAt( ii ) )
{
- ii++ ;
+ ii++;
}
/*
* Replace the '{ i }' with the string representation of the value
- * held in the a_filterArgs array at index l_index.
+ * held in the filterArgs array at index index.
*/
- l_buf.replace( l_start, ii + 1, a_filterArgs[ii].toString() ) ;
+ buf.replace( start, ii + 1, filterArgs[ii].toString() );
}
- return search( a_name, l_buf.toString(), a_cons ) ;
+ return search( name, buf.toString(), cons );
}
}
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
Sun Oct 24 11:07:04 2004
@@ -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.eve.jndi;
@@ -18,6 +34,8 @@
/**
* EveBackendSubsystem service implementing block.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public class EveJndiProvider implements EveBackendSubsystem, InvocationHandler
{
@@ -74,11 +92,11 @@
* Enables a EveContextFactory with a handle to the system wide
* EveJndiProvider instance.
*
- * @param a_factory the EveContextFactory to enable
+ * @param factory the EveContextFactory to enable
*/
- static void setProviderOn( EveContextFactory a_factory )
+ static void setProviderOn( EveContextFactory factory )
{
- a_factory.setProvider( s_singleton );
+ factory.setProvider( s_singleton );
}
@@ -90,9 +108,9 @@
/**
* @see org.apache.eve.EveBackendSubsystem#getLdapContext(Hashtable)
*/
- public LdapContext getLdapContext( Hashtable an_env ) throws
NamingException
+ public LdapContext getLdapContext( Hashtable aenv ) throws NamingException
{
- return new EveLdapContext( proxy, an_env );
+ return new EveLdapContext( proxy, aenv );
}
@@ -104,36 +122,36 @@
/**
* @see java.lang.reflect.InvocationHandler#invoke(Object,Method,Object[])
*/
- public Object invoke( Object a_proxy, Method a_method, Object[] a_args )
+ public Object invoke( Object proxy, Method method, Object[] args )
throws Throwable
{
// Setup the invocation and populate: remember aspect sets context
stack
Invocation invocation = new Invocation();
- invocation.setMethod( a_method );
- invocation.setProxy( a_proxy );
- invocation.setParameters( a_args );
+ invocation.setMethod( method );
+ invocation.setProxy( proxy );
+ invocation.setParameters( args );
try
{
before.invoke( invocation );
}
- catch ( Throwable a_throwable )
+ catch ( Throwable throwable )
{
/*
* On errors we need to continue into the failure handling state
* of Invocation processing and not throw anything just record it.
*/
- if ( a_throwable instanceof InterceptorException )
+ if ( throwable instanceof InterceptorException )
{
invocation.setBeforeFailure( ( InterceptorException )
- a_throwable );
+ throwable );
}
else
{
InterceptorException ie =
new InterceptorException( before, invocation );
invocation.setBeforeFailure( ie );
- ie.setRootCause( a_throwable );
+ ie.setRootCause( throwable );
}
invocation.setState( InvocationStateEnum.FAILUREHANDLING );
@@ -152,13 +170,13 @@
{
try
{
- invocation.setReturnValue( a_method.invoke( nexus,
+ invocation.setReturnValue( method.invoke( nexus,
invocation.getParameters() ) );
invocation.setState( InvocationStateEnum.POSTINVOCATION );
}
- catch ( Throwable a_throwable )
+ catch ( Throwable throwable )
{
- invocation.setThrowable( a_throwable );
+ invocation.setThrowable( throwable );
invocation.setState( InvocationStateEnum.FAILUREHANDLING );
}
@@ -188,20 +206,20 @@
after.invoke( invocation );
return invocation.getReturnValue();
}
- catch ( Throwable a_throwable )
+ catch ( Throwable throwable )
{
invocation.setState( InvocationStateEnum.FAILUREHANDLING );
- if ( a_throwable instanceof InterceptorException )
+ if ( throwable instanceof InterceptorException )
{
invocation.setAfterFailure( ( InterceptorException )
- a_throwable );
+ throwable );
}
else
{
InterceptorException ie =
new InterceptorException( after, invocation );
- ie.setRootCause( a_throwable );
+ ie.setRootCause( throwable );
invocation.setAfterFailure( ie );
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveLdapContext.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveLdapContext.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/EveLdapContext.java
Sun Oct 24 11:07:04 2004
@@ -1,21 +1,39 @@
-package org.apache.eve.jndi ;
+/*
+ * 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.eve.jndi;
-import java.util.Hashtable ;
+import java.util.Hashtable;
-import javax.naming.NamingException ;
-import javax.naming.ldap.Control ;
-import javax.naming.ldap.ExtendedRequest ;
-import javax.naming.ldap.ExtendedResponse ;
-import javax.naming.ldap.LdapContext ;
+import javax.naming.NamingException;
+import javax.naming.ldap.Control;
+import javax.naming.ldap.ExtendedRequest;
+import javax.naming.ldap.ExtendedResponse;
+import javax.naming.ldap.LdapContext;
-import org.apache.ldap.common.name.LdapName ;
+import org.apache.ldap.common.name.LdapName;
import org.apache.eve.PartitionNexus;
/**
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public class EveLdapContext extends EveDirContext implements LdapContext
{
@@ -23,12 +41,12 @@
/**
* TODO Document me!
*
- * @param a_nexusProxy TODO
- * @param a_env TODO
+ * @param nexusProxy TODO
+ * @param env TODO
*/
- public EveLdapContext( PartitionNexus a_nexusProxy, Hashtable a_env )
throws NamingException
+ public EveLdapContext( PartitionNexus nexusProxy, Hashtable env ) throws
NamingException
{
- super( a_nexusProxy, a_env ) ;
+ super( nexusProxy, env );
}
@@ -36,13 +54,13 @@
* Creates a new EveDirContext with a distinguished name which is used to
* set the PROVIDER_URL to the distinguished name for this context.
*
- * @param a_nexusProxy the intercepting proxy to the nexus
- * @param a_env the environment properties used by this context
- * @param a_dn the distinguished name of this context
+ * @param nexusProxy the intercepting proxy to the nexus
+ * @param env the environment properties used by this context
+ * @param dn the distinguished name of this context
*/
- EveLdapContext( PartitionNexus a_nexusProxy, Hashtable a_env, LdapName
a_dn )
+ EveLdapContext( PartitionNexus nexusProxy, Hashtable env, LdapName dn )
{
- super( a_nexusProxy, a_env, a_dn ) ;
+ super( nexusProxy, env, dn );
}
@@ -50,10 +68,10 @@
* @see javax.naming.ldap.LdapContext#extendedOperation(
* javax.naming.ldap.ExtendedRequest)
*/
- public ExtendedResponse extendedOperation( ExtendedRequest a_request )
+ public ExtendedResponse extendedOperation( ExtendedRequest request )
{
// TODO Auto-generated method stub
- return null ;
+ return null;
}
@@ -61,18 +79,18 @@
* @see javax.naming.ldap.LdapContext#newInstance(
* javax.naming.ldap.Control[])
*/
- public LdapContext newInstance( Control[] a_requestControls )
+ public LdapContext newInstance( Control[] requestControls )
throws NamingException
{
// TODO Auto-generated method stub
- return null ;
+ return null;
}
/**
* @see
javax.naming.ldap.LdapContext#reconnect(javax.naming.ldap.Control[])
*/
- public void reconnect( Control[] a_connCtls ) throws NamingException
+ public void reconnect( Control[] connCtls ) throws NamingException
{
// TODO Auto-generated method stub
}
@@ -86,7 +104,7 @@
public Control[] getConnectControls() throws NamingException
{
// TODO Auto-generated method stub
- return null ;
+ return null;
}
@@ -96,7 +114,7 @@
* @see javax.naming.ldap.LdapContext#setRequestControls(
* javax.naming.ldap.Control[])
*/
- public void setRequestControls( Control[] a_requestControls )
+ public void setRequestControls( Control[] requestControls )
throws NamingException
{
// TODO Auto-generated method stub
@@ -111,7 +129,7 @@
public Control[] getRequestControls() throws NamingException
{
// TODO Auto-generated method stub
- return null ;
+ return null;
}
@@ -123,7 +141,7 @@
public Control[] getResponseControls() throws NamingException
{
// TODO Auto-generated method stub
- return null ;
+ return null;
}
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/FailFastPipeline.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/FailFastPipeline.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/FailFastPipeline.java
Sun Oct 24 11:07:04 2004
@@ -1,4 +1,20 @@
-package org.apache.eve.jndi ;
+/*
+ * 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.eve.jndi;
/**
@@ -6,17 +22,19 @@
* to fail within the invocation chain of the pipeline shorts the invocation of
* interceptors downstream of the error.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public class FailFastPipeline extends InterceptorPipeline
{
/**
* Returns true all the time!
*
- * @see org.apache.ldap.server.jndi.InterceptorPipeline#isFailFast()
+ * @see InterceptorPipeline#isFailFast()
*/
public final boolean isFailFast()
{
- return true ;
+ return true;
}
@@ -26,29 +44,28 @@
* results this method catches it and wraps it within an
* InterceptorException and rethrows the new exception.
*
- * @see
org.apache.ldap.server.jndi.Interceptor#invoke(org.apache.ldap.server.jndi.Invocation)
+ * @see Interceptor#invoke(Invocation)
*/
- public void invoke( Invocation a_invocation ) throws InterceptorException
+ public void invoke( Invocation invocation ) throws InterceptorException
{
- for ( int ii = 0 ; ii < getList().size(); ii++ )
+ for ( int ii = 0; ii < getList().size(); ii++ )
{
- Interceptor l_service = ( Interceptor ) getList().get( ii ) ;
+ Interceptor service = ( Interceptor ) getList().get( ii );
try
{
- l_service.invoke( a_invocation ) ;
+ service.invoke( invocation );
}
- catch ( Throwable a_throwable )
+ catch ( Throwable throwable )
{
- if ( a_throwable instanceof InterceptorException )
+ if ( throwable instanceof InterceptorException )
{
- throw ( InterceptorException ) a_throwable ;
+ throw ( InterceptorException ) throwable;
}
- InterceptorException l_ie =
- new InterceptorException( l_service, a_invocation ) ;
- l_ie.setRootCause( a_throwable ) ;
- throw l_ie ;
+ InterceptorException ie = new InterceptorException( service,
invocation );
+ ie.setRootCause( throwable );
+ throw ie;
}
}
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Interceptor.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Interceptor.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Interceptor.java
Sun Oct 24 11:07:04 2004
@@ -1,4 +1,20 @@
-package org.apache.eve.jndi ;
+/*
+ * 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.eve.jndi;
/**
@@ -6,15 +22,11 @@
* most cases the invocations pass thru a series of Interceptor objects
* before the target object is invoked.
*
- * <p>Interceptors should not store any data relevent to a particular
invocation
- * and potentially should not store any data relevent to a particular target
- * object (It depends on the policy via which Interceptors are created via the
- * [EMAIL PROTECTED] org.realityforge.xinvoke.spi.ProxyManager}).</p>
- *
- * Peter Donald originally wrote this class for XInvoke from the Spice Project.
+ * Got this idea from a class written by Peter Donald who originally wrote it
+ * for XInvoke in the Spice Project at Codehaus.
*
- * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public interface Interceptor
{
@@ -22,13 +34,13 @@
* Process a particular invocation.
* The method must NEVER throw an exception and any exceptions should be
* caught and placed into the invocation via [EMAIL PROTECTED]
Invocation#setThrowable}
- * or [EMAIL PROTECTED] Invocation#addInterceptorThrowable}.
+ * or [EMAIL PROTECTED] Invocation#addFailure(InterceptorException)}.
*
- * <p>Note: most Interceptors should pass control to the next Interceptor
- * in the series.</p>
+ * <p>Note: most Interceptors pass control to the next Interceptor in the
+ * series.</p>
*
- * @param a_invocation the invocation to process
+ * @param invocation the invocation to process
* @throws InterceptorException on failures while handling the invokation
*/
- void invoke( Invocation a_invocation ) throws InterceptorException ;
+ void invoke( Invocation invocation ) throws InterceptorException;
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorException.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorException.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorException.java
Sun Oct 24 11:07:04 2004
@@ -1,50 +1,89 @@
+/*
+ * 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.eve.jndi;
-import javax.naming.NamingException ;
+
+import javax.naming.NamingException;
/**
* Exception thrown by an Interceptor while intercepting an Invocation.
- * Interceptor failures caught from the
- * [EMAIL PROTECTED] org.apache.eve.EveBackendSubsystem#invoke(Object, Method,
Object[])}
- * method are bundled as InterceptorExceptions and rethrown.
+ * Interceptor failures caught from the method are bundled as
+ * InterceptorExceptions and rethrown.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public class InterceptorException extends NamingException
{
/** The Invokation the Interceptor failed on */
- private final Invocation m_invocation ;
+ private final Invocation invocation;
/** The Interceptor causing the failure */
- private final Interceptor m_interceptor ;
+ private final Interceptor interceptor;
/**
* Creates an InterceptorException without a message.
*
- * @param a_interceptor the Interceptor causing the failure
- * @param a_invocation the Invocation the Interceptor failed on
+ * @param interceptor the Interceptor causing the failure
+ * @param invocation the Invocation the Interceptor failed on
*/
- public InterceptorException( Interceptor a_interceptor,
- Invocation a_invocation )
+ public InterceptorException( Interceptor interceptor, Invocation
invocation )
{
- super() ;
- m_invocation = a_invocation ;
- m_interceptor = a_interceptor ;
+ super();
+ this.invocation = invocation;
+ this.interceptor = interceptor;
}
/**
* Creates an InterceptorException with a custom message.
*
- * @param a_interceptor the Interceptor causing the failure
- * @param a_invocation the Invocation the Interceptor failed on
- * @param a_explanation String explanation of why the Interceptor failed
+ * @param interceptor the Interceptor causing the failure
+ * @param invocation the Invocation the Interceptor failed on
+ * @param explanation String explanation of why the Interceptor failed
+ */
+ public InterceptorException( Interceptor interceptor,
+ Invocation invocation, String explanation )
+ {
+ super( explanation );
+ this.invocation = invocation;
+ this.interceptor = interceptor;
+ }
+
+
+ /**
+ * Gets the invovation object this exception is associated with.
+ *
+ * @return the invovation object this exception is associated with
+ */
+ public Invocation getInvocation()
+ {
+ return invocation;
+ }
+
+
+ /**
+ * Gets the interceptor this exception is associated with.
+ *
+ * @return the interceptor this exception is associated with
*/
- public InterceptorException( Interceptor a_interceptor,
- Invocation a_invocation, String a_explanation )
+ public Interceptor getInterceptor()
{
- super( a_explanation ) ;
- m_invocation = a_invocation ;
- m_interceptor = a_interceptor ;
+ return interceptor;
}
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorPipeline.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorPipeline.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InterceptorPipeline.java
Sun Oct 24 11:07:04 2004
@@ -1,55 +1,72 @@
+/*
+ * 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.eve.jndi;
-import java.util.List ;
-import java.util.ArrayList ;
+import java.util.List;
+import java.util.ArrayList;
/**
* An Interceptor composed of a pipeline of interceptors that can be called
* sequentially with one invokation.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
-public abstract class InterceptorPipeline
- implements Interceptor
+public abstract class InterceptorPipeline implements Interceptor
{
/** The List of Interceptors */
- private List m_list = new ArrayList() ;
+ private List list = new ArrayList();
/**
* Adds a Interceptor to this InterceptorPipeline at a specific position.
*
- * @param a_posn the 0 index based position
- * @param a_service the Interceptor to add.
+ * @param posn the 0 index based position
+ * @param service the Interceptor to add.
*/
- public void add( int a_posn, Interceptor a_service )
+ public void add( int posn, Interceptor service )
{
- m_list.add( a_posn, a_service ) ;
+ list.add( posn, service );
}
/**
* Removes an Interceptor from this InterceptorPipeline.
*
- * @param a_posn the 0 index based position
+ * @param posn the 0 index based position
* @return the removed Interceptor
*/
- public Interceptor remove( int a_posn )
+ public Interceptor remove( int posn )
{
- return ( Interceptor ) m_list.remove( a_posn ) ;
+ return ( Interceptor ) list.remove( posn );
}
/**
* Gets the Interceptor in this InterceptorPipeline at a specified.
*
- * @param a_posn the 0 index based position
- * @return the Interceptor at a_posn
+ * @param posn the 0 index based position
+ * @return the Interceptor at posn
*/
- public Interceptor get( int a_posn )
+ public Interceptor get( int posn )
{
- return ( Interceptor ) m_list.get( a_posn ) ;
+ return ( Interceptor ) list.get( posn );
}
@@ -60,7 +77,7 @@
*/
protected List getList()
{
- return m_list ;
+ return list;
}
@@ -73,15 +90,14 @@
* Invokes this InterceptorPipeline which sequencially begins the chain
* of Interceptor invocations on the Interceptors with it.
*
- * @see
org.apache.ldap.server.jndi.Interceptor#invoke(org.apache.ldap.server.jndi.Invocation)
+ * @see Interceptor#invoke(Invocation)
*/
- public abstract void invoke( Invocation a_invocation )
- throws InterceptorException ;
-
+ public abstract void invoke( Invocation invocation ) throws
InterceptorException;
+
/**
* Get whether this pipeline is fail fast or not.
*
* @return whether or not this pipeline is failfast
*/
- public abstract boolean isFailFast() ;
+ public abstract boolean isFailFast();
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Invocation.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Invocation.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/Invocation.java
Sun Oct 24 11:07:04 2004
@@ -1,14 +1,30 @@
+/*
+ * 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.eve.jndi;
import java.util.List;
-import java.util.Stack ;
-import java.util.Iterator ;
-import java.util.ArrayList ;
-import java.util.Collections ;
+import java.util.Stack;
+import java.util.Iterator;
+import java.util.ArrayList;
+import java.util.Collections;
-import java.io.Serializable ;
-import java.lang.reflect.Method ;
+import java.io.Serializable;
+import java.lang.reflect.Method;
/**
@@ -18,69 +34,68 @@
* This class was originally written by Peter Donald for XInvoke from the
Spice
* Group.
*
- * @author <a href="mailto:peter at realityforge.org">Peter Donald</a>
- * @author <a href="mailto:aok123 at bellsouth.net">Alex Karasulu</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
-public class Invocation
- implements Serializable
+public class Invocation implements Serializable
{
/**
* The interceptor processing state of this Invocation.
*/
- private InvocationStateEnum m_state = InvocationStateEnum.PREINVOCATION ;
+ private InvocationStateEnum state = InvocationStateEnum.PREINVOCATION;
/**
- * The invokation state: when call has completed m_isCompleted will be true
+ * The invokation state: when call has completed isCompleted will be true
*/
- private boolean m_isComplete = false ;
+ private boolean isComplete = false;
/**
* InterceptorException thrown by the first interceptor to fail within the
* after invocation InterceptorPipeline which is fail fast.
*/
- private InterceptorException m_before ;
+ private InterceptorException before;
/**
* InterceptorException thrown by the first interceptor to fail within the
* after invocation InterceptorPipeline which is fail fast.
*/
- private InterceptorException m_after ;
+ private InterceptorException after;
/**
* Exceptions thrown by interceptors within the failure pipeline which is
* NOT fail fast - hence the use of a list for potentially many exceptions.
*/
- private List m_failures ;
+ private List failures;
/**
* The proxy on which the method was invoked.
*/
- private Object m_proxy ;
+ private Object proxy;
/**
* The actual method that is being invoked.
*/
- private Method m_method ;
+ private Method method;
/**
* The parameters of method invocation.
*/
- private Object[] m_parameters ;
+ private Object[] parameters;
/**
* The return value of the invocation.
*/
- private Object m_returnValue ;
+ private Object returnValue;
/**
* The exception thrown by the invocation if any.
*/
- private Throwable m_throwable ;
+ private Throwable throwable;
/**
* The context in which invocation occurs.
*/
- private Stack m_contextStack ;
+ private Stack contextStack;
// ------------------------------------------------------------------------
@@ -95,18 +110,18 @@
*/
public InvocationStateEnum getState()
{
- return m_state ;
+ return state;
}
/**
* Sets the state of this Invocation.
*
- * @param a_enum the new state to set
+ * @param enum the new state to set
*/
- void setState( InvocationStateEnum a_enum )
+ void setState( InvocationStateEnum enum )
{
- m_state = a_enum ;
+ state = enum;
}
@@ -118,7 +133,7 @@
*/
public boolean isComplete()
{
- return m_isComplete ;
+ return isComplete;
}
@@ -126,12 +141,12 @@
* Sets the completion state of this invocation. The invocation is
complete
* after the target method on the proxied object returns.
*
- * @param a_isComplete whether or not the call on the proxied object
+ * @param isComplete whether or not the call on the proxied object
* returned
*/
- void setComplete( boolean a_isComplete )
+ void setComplete( boolean isComplete )
{
- m_isComplete = a_isComplete ;
+ this.isComplete = isComplete;
}
@@ -144,12 +159,12 @@
*/
public Iterator listFailures()
{
- if ( null == m_failures )
+ if ( null == failures )
{
- return Collections.EMPTY_LIST.iterator() ;
+ return Collections.EMPTY_LIST.iterator();
}
- return Collections.unmodifiableList( m_failures ).iterator() ;
+ return Collections.unmodifiableList( failures ).iterator();
}
@@ -157,16 +172,16 @@
* Adds a throwable to the list of throwables resulting from the execution
* of Interceptors in the order they were thrown.
*
- * @param a_throwable Throwable resulting from an Interceptor invoke call
+ * @param throwable Throwable resulting from an Interceptor invoke call
*/
- public void addFailure( InterceptorException a_throwable )
+ public void addFailure( InterceptorException throwable )
{
- if ( null == m_failures )
+ if ( null == failures )
{
- m_failures = new ArrayList() ;
+ failures = new ArrayList();
}
- m_failures.add( a_throwable ) ;
+ failures.add( throwable );
}
@@ -179,7 +194,7 @@
*/
public InterceptorException getBeforeFailure()
{
- return m_before ;
+ return before;
}
@@ -187,12 +202,12 @@
* Sets the InterceptorException thrown if at all within the before
* InterceptorPipeline.
*
- * @param a_before the InterceptorException thrown if at all within the
+ * @param before the InterceptorException thrown if at all within the
* before InterceptorPipeline
*/
- public void setBeforeFailure( InterceptorException a_before )
+ public void setBeforeFailure( InterceptorException before )
{
- m_before = a_before ;
+ this.before = before;
}
@@ -205,7 +220,7 @@
*/
public InterceptorException getAfterFailure()
{
- return m_after ;
+ return after;
}
@@ -213,12 +228,12 @@
* Sets the InterceptorException thrown if at all within the after
* InterceptorPipeline.
*
- * @param a_after the InterceptorException thrown if at all within the
+ * @param after the InterceptorException thrown if at all within the
* after InterceptorPipeline
*/
- public void setAfterFailure( InterceptorException a_after )
+ public void setAfterFailure( InterceptorException after )
{
- m_after = a_after ;
+ this.after = after;
}
@@ -229,18 +244,18 @@
*/
public Object getProxy()
{
- return m_proxy ;
+ return proxy;
}
/**
* Set the proxy on which the method was invoked.
*
- * @param a_proxy the proxy on which the method was invoked.
+ * @param proxy the proxy on which the method was invoked.
*/
- public void setProxy( final Object a_proxy )
+ public void setProxy( final Object proxy )
{
- m_proxy = a_proxy ;
+ this.proxy = proxy;
}
@@ -251,18 +266,18 @@
*/
public Method getMethod()
{
- return m_method ;
+ return method;
}
/**
* Set the method that was invoked.
*
- * @param a_method the method that was invoked.
+ * @param method the method that was invoked.
*/
- public void setMethod( final Method a_method )
+ public void setMethod( final Method method )
{
- m_method = a_method ;
+ this.method = method;
}
@@ -273,18 +288,18 @@
*/
public Object[] getParameters()
{
- return m_parameters ;
+ return parameters;
}
/**
* Set the parameters passed to method for invocation.
*
- * @param a_parameters the parameters passed to method for invocation.
+ * @param parameters the parameters passed to method for invocation.
*/
- public void setParameters( final Object[] a_parameters )
+ public void setParameters( final Object[] parameters )
{
- m_parameters = a_parameters ;
+ this.parameters = parameters;
}
@@ -295,18 +310,18 @@
*/
public Object getReturnValue()
{
- return m_returnValue ;
+ return returnValue;
}
/**
* Set the return value of the invocation.
*
- * @param a_returnValue the return value of the invocation.
+ * @param returnValue the return value of the invocation.
*/
- public void setReturnValue( final Object a_returnValue )
+ public void setReturnValue( final Object returnValue )
{
- m_returnValue = a_returnValue ;
+ this.returnValue = returnValue;
}
@@ -317,18 +332,18 @@
*/
public Throwable getThrowable()
{
- return m_throwable ;
+ return throwable;
}
/**
* Set the exception thrown by the invocation if any.
*
- * @param a_throwable the exception thrown by the invocation if any.
+ * @param throwable the exception thrown by the invocation if any.
*/
- public void setThrowable( Throwable a_throwable )
+ public void setThrowable( Throwable throwable )
{
- m_throwable = a_throwable ;
+ this.throwable = throwable;
}
@@ -340,7 +355,7 @@
*/
public Stack getContextStack()
{
- return m_contextStack ;
+ return contextStack;
}
@@ -348,11 +363,11 @@
* Sets the context stack in which this invocation occurs. The context
* stack is a stack of LdapContexts.
*
- * @param a_contextStack a stack of LdapContexts in which the invocation
+ * @param contextStack a stack of LdapContexts in which the invocation
* occurs
*/
- public void setContextStack( final Stack a_contextStack )
+ public void setContextStack( final Stack contextStack )
{
- m_contextStack = a_contextStack ;
+ this.contextStack = contextStack;
}
}
Modified:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InvocationStateEnum.java
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InvocationStateEnum.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/InvocationStateEnum.java
Sun Oct 24 11:07:04 2004
@@ -1,4 +1,20 @@
-package org.apache.eve.jndi ;
+/*
+ * 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.eve.jndi;
import org.apache.ldap.common.util.ValuedEnum;
@@ -7,22 +23,24 @@
/**
* Enumeration type for the states an Invocation object goes through.
*
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
public class InvocationStateEnum extends ValuedEnum
{
/** The enumeration constant value for the preinvocation state */
- public static final int PREINVOCATION_VAL = 0 ;
+ public static final int PREINVOCATION_VAL = 0;
/** The enumeration constant value for the postinvocation state */
- public static final int POSTINVOCATION_VAL = 1 ;
+ public static final int POSTINVOCATION_VAL = 1;
/** The enumeration constant value for the failurehandling state */
- public static final int FAILUREHANDLING_VAL = 2 ;
+ public static final int FAILUREHANDLING_VAL = 2;
/**
* Invocations within the pre-invocation state have begun to be intercepted
* within the before InterceptorPipeline.
*/
public static final InvocationStateEnum PREINVOCATION =
- new InvocationStateEnum( "PREINVOCATION", PREINVOCATION_VAL ) ;
+ new InvocationStateEnum( "PREINVOCATION", PREINVOCATION_VAL );
/**
* Invocations within the post-invocation state have been invoked on the
@@ -30,7 +48,7 @@
* InterceptorPipeline.
*/
public static final InvocationStateEnum POSTINVOCATION =
- new InvocationStateEnum( "POSTINVOCATION", POSTINVOCATION_VAL ) ;
+ new InvocationStateEnum( "POSTINVOCATION", POSTINVOCATION_VAL );
/**
* Invocations within the failure handling state are being handled within
@@ -40,18 +58,18 @@
* determine exactly where the failure occured.
*/
public static final InvocationStateEnum FAILUREHANDLING =
- new InvocationStateEnum( "FAILUREHANDLING", FAILUREHANDLING_VAL ) ;
+ new InvocationStateEnum( "FAILUREHANDLING", FAILUREHANDLING_VAL );
/**
* Private constructor so no other instances can be created other than the
* public static constants in this class.
*
- * @param a_name a string name for the enumeration value.
- * @param a_value the integer value of the enumeration.
+ * @param name a string name for the enumeration value.
+ * @param value the integer value of the enumeration.
*/
- private InvocationStateEnum( final String a_name, final int a_value )
+ private InvocationStateEnum( final String name, final int value )
{
- super( a_name, a_value ) ;
+ super( name, value );
}
}
Copied:
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/JavaLdapSupport.java
(from rev 55390,
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/JavaLdap.java)
==============================================================================
---
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/JavaLdap.java
(original)
+++
incubator/directory/eve/trunk/backend/core/src/java/org/apache/eve/jndi/JavaLdapSupport.java
Sun Oct 24 11:07:04 2004
@@ -1,13 +1,30 @@
-package org.apache.eve.jndi ;
+/*
+ * 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.eve.jndi;
+
-import java.io.ByteArrayInputStream ;
-import java.io.ByteArrayOutputStream ;
-import java.io.IOException ;
-import java.io.ObjectInputStream ;
-import java.io.ObjectOutputStream ;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
-import javax.naming.NamingException ;
-import javax.naming.directory.Attributes ;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
/**
@@ -16,30 +33,32 @@
* objects within an LDAP directory.
*
* @see <a href="http://www.faqs.org/rfcs/rfc2713.html">RFC 2713</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
*/
-public class JavaLdap
+public class JavaLdapSupport
{
// ------------------------------------------------------------------------
// Attribute Id Constants Used By The Java LDAP BootstrapSchema
// ------------------------------------------------------------------------
- /** */
- public static final String TOP_ATTR = "top" ;
- /** */
- public static final String JOBJECT_ATTR = "javaObject" ;
- /** */
- public static final String OBJECTCLASS_ATTR = "objectClass" ;
- /** */
- public static final String JCONTAINER_ATTR = "javaContainer" ;
- /** */
- public static final String JSERIALIZEDOBJ_ATTR = "javaSerializedObject" ;
-
- /** */
- public static final String JCLASSNAME_ATTR = "javaClassName" ;
- /** */
- public static final String JCLASSNAMES_ATTR = "javaClassNames" ;
- /** */
- public static final String JSERIALDATA_ATTR = "javaSerializedData" ;
+ /** objectClass attribute for top */
+ public static final String TOP_ATTR = "top";
+ /** the javaObject attribute */
+ public static final String JOBJECT_ATTR = "javaObject";
+ /** the objectClass attribute */
+ public static final String OBJECTCLASS_ATTR = "objectClass";
+ /** the javaContainer attribute */
+ public static final String JCONTAINER_ATTR = "javaContainer";
+ /** the javaSerializedObject attribute */
+ public static final String JSERIALIZEDOBJ_ATTR = "javaSerializedObject";
+
+ /** the javaClassName attribute */
+ public static final String JCLASSNAME_ATTR = "javaClassName";
+ /** the javaClassNames attribute */
+ public static final String JCLASSNAMES_ATTR = "javaClassNames";
+ /** the javaSerializedData attribute */
+ public static final String JSERIALDATA_ATTR = "javaSerializedData";
// ------------------------------------------------------------------------
@@ -52,42 +71,37 @@
* conforms to the specifications for representing Java Objects in an LDAP
* Directory (RFC 2713).
*
- * @param a_attributes the entry representing a serialized object
+ * @param attributes the entry representing a serialized object
* @return the deserialized object
* @throws NamingException if the object cannot be serialized
*/
- static Object deserialize( Attributes a_attributes )
- throws NamingException
+ static Object deserialize( Attributes attributes ) throws NamingException
{
- ObjectInputStream l_in = null ;
- String l_className = ( String )
- a_attributes.get( JCLASSNAME_ATTR ).get() ;
+ ObjectInputStream in = null;
+ String className = ( String ) attributes.get( JCLASSNAME_ATTR ).get();
try
{
- byte [] l_data = ( byte [] )
- a_attributes.get( JSERIALDATA_ATTR ).get() ;
- l_in = new ObjectInputStream( new ByteArrayInputStream( l_data ) )
;
- Object l_obj = l_in.readObject() ;
- return l_obj ;
+ byte [] data = ( byte [] ) attributes.get( JSERIALDATA_ATTR
).get();
+ in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+ return in.readObject();
}
catch ( Exception e )
{
- NamingException l_ne = new NamingException( "De-serialization of '"
- + l_className + "' instance failed:\n" + e.getMessage() ) ;
- l_ne.setRootCause( e ) ;
- throw l_ne ;
+ NamingException ne = new NamingException( "De-serialization of '"
+ + className + "' instance failed:\n" + e.getMessage() );
+ ne.setRootCause( e );
+ throw ne;
}
finally
{
try
{
- l_in.close() ;
+ in.close();
}
catch ( IOException e )
{
- throw new NamingException(
- "object deserialization stream close() failure" ) ;
+ throw new NamingException( "object deserialization stream
close() failure" );
}
}
}
@@ -96,40 +110,38 @@
/**
* Serializes an object into a byte array.
*
- * @param a_obj the object to serialize
+ * @param obj the object to serialize
* @return the object's serialized byte array form
* @throws NamingException of the object cannot be serialized
*/
- static byte [] serialize( Object a_obj )
- throws NamingException
+ static byte [] serialize( Object obj ) throws NamingException
{
- ByteArrayOutputStream l_bytesOut = null ;
- ObjectOutputStream l_out = null ;
+ ByteArrayOutputStream bytesOut = null;
+ ObjectOutputStream out = null;
try
{
- l_bytesOut = new ByteArrayOutputStream() ;
- l_out = new ObjectOutputStream( l_bytesOut ) ;
- l_out.writeObject( a_obj ) ;
- return l_bytesOut.toByteArray() ;
+ bytesOut = new ByteArrayOutputStream();
+ out = new ObjectOutputStream( bytesOut );
+ out.writeObject( obj );
+ return bytesOut.toByteArray();
}
catch ( Exception e )
{
- NamingException l_ne = new NamingException( "Serialization of '"
- + a_obj + "' failed:\n" + e.getMessage() ) ;
- l_ne.setRootCause( e ) ;
- throw l_ne ;
+ NamingException ne = new NamingException( "Serialization of '"
+ + obj + "' failed:\n" + e.getMessage() );
+ ne.setRootCause( e );
+ throw ne;
}
finally
{
try
{
- l_out.close() ;
+ out.close();
}
catch ( IOException e )
{
- throw new NamingException(
- "object serialization stream close() failure" ) ;
+ throw new NamingException( "object serialization stream
close() failure" );
}
}
}
@@ -139,12 +151,11 @@
* Serializes an object into an entry using the attributes specified in
* RFC 2713 to represent the serialized object.
*
- * @param a_entry the set of attributes representing entry
- * @param a_obj the object to serialize
+ * @param entry the set of attributes representing entry
+ * @param obj the object to serialize
* @throws NamingException if the object cannot be serialized
*/
- static void serialize( Attributes a_entry, Object a_obj )
- throws NamingException
+ static void serialize( Attributes entry, Object obj ) throws
NamingException
{
/* Let's add the object classes first:
* objectClass: top
@@ -152,20 +163,20 @@
* objectClass: javaContainer
* objectClass: javaSerializedObject
*/
- a_entry.put( OBJECTCLASS_ATTR, TOP_ATTR ) ;
- a_entry.put( OBJECTCLASS_ATTR, JOBJECT_ATTR ) ;
- a_entry.put( OBJECTCLASS_ATTR, JCONTAINER_ATTR ) ;
- a_entry.put( OBJECTCLASS_ATTR, JSERIALIZEDOBJ_ATTR ) ;
+ entry.put( OBJECTCLASS_ATTR, TOP_ATTR );
+ entry.put( OBJECTCLASS_ATTR, JOBJECT_ATTR );
+ entry.put( OBJECTCLASS_ATTR, JCONTAINER_ATTR );
+ entry.put( OBJECTCLASS_ATTR, JSERIALIZEDOBJ_ATTR );
// Add the javaClassName and javaSerializedData attributes
- a_entry.put( JCLASSNAME_ATTR, a_obj.getClass().getName() ) ;
- a_entry.put( JSERIALDATA_ATTR, serialize( a_obj ) ) ;
+ entry.put( JCLASSNAME_ATTR, obj.getClass().getName() );
+ entry.put( JSERIALDATA_ATTR, serialize( obj ) );
// Add all the class names this object can be cast to:
- Class [] l_classes = a_obj.getClass().getClasses() ;
- for ( int ii = 0; ii < l_classes.length; ii++ )
+ Class [] classes = obj.getClass().getClasses();
+ for ( int ii = 0; ii < classes.length; ii++ )
{
- a_entry.put( JCLASSNAMES_ATTR, l_classes[ii].getName() ) ;
+ entry.put( JCLASSNAMES_ATTR, classes[ii].getName() );
}
}
}