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 2007/10/06 08:48:45 UTC
svn commit: r582462 [3/10] - in /directory: apacheds/branches/bigbang/
apacheds/branches/bigbang/core-unit/src/main/java/org/apache/directory/server/core/unit/
apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/
apacheds...
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java Fri Oct 5 23:48:35 2007
@@ -20,24 +20,7 @@
package org.apache.directory.server.core.authz;
-import java.text.ParseException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.naming.Name;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.authn.LdapPrincipal;
import org.apache.directory.server.core.authz.support.ACDFEngine;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
@@ -45,18 +28,7 @@
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.InterceptorChain;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerContext;
@@ -72,6 +44,7 @@
import org.apache.directory.shared.ldap.aci.MicroOperation;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -79,6 +52,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.text.ParseException;
+import java.util.*;
+
/**
* An ACI based authorization service.
@@ -91,7 +71,7 @@
public class AuthorizationService extends BaseInterceptor
{
/** the logger for this class */
- private static final Logger log = LoggerFactory.getLogger( AuthorizationService.class );
+ private static final Logger LOG = LoggerFactory.getLogger( AuthorizationService.class );
/**
* the multivalued op attr used to track the perscriptive access control
@@ -167,17 +147,15 @@
private AttributeTypeRegistry attrRegistry;
/** whether or not this interceptor is activated */
- private boolean enabled = false;
+ private boolean enabled;
/** the system wide subschemaSubentryDn */
private String subschemaSubentryDn;
private AttributeType objectClassType;
private AttributeType acSubentryType;
-
- private String objectClassOid;
+
private String subentryOid;
- private String acSubentryOid;
/** A storage for the entryACI attributeType */
private AttributeType entryAciType;
@@ -191,34 +169,34 @@
* Initializes this interceptor based service by getting a handle on the nexus, setting up
* the tupe and group membership caches and the ACIItem parser and the ACDF engine.
*
- * @param factoryCfg the ContextFactory configuration for the server
+ * @param directoryService the directory service core
* @throws NamingException if there are problems during initialization
*/
- public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+ public void init( DirectoryService directoryService ) throws NamingException
{
- super.init( factoryCfg);
- tupleCache = new TupleCache( factoryCfg );
- groupCache = new GroupCache( factoryCfg );
- attrRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
- OidRegistry oidRegistry = factoryCfg.getRegistries().getOidRegistry();
+ super.init( directoryService );
+ tupleCache = new TupleCache( directoryService );
+ groupCache = new GroupCache( directoryService );
+ attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+ OidRegistry oidRegistry = directoryService.getRegistries().getOidRegistry();
// look up some constant information
- objectClassOid = oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT );
+ String objectClassOid = oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT );
subentryOid = oidRegistry.getOid( SchemaConstants.SUBENTRY_OC );
- acSubentryOid = oidRegistry.getOid( AC_SUBENTRY_ATTR );
+ String acSubentryOid = oidRegistry.getOid( AC_SUBENTRY_ATTR );
objectClassType = attrRegistry.lookup( objectClassOid );
acSubentryType = attrRegistry.lookup( acSubentryOid );
entryAciType = attrRegistry.lookup( SchemaConstants.ENTRY_ACI_AT_OID );
subentryAciType = attrRegistry.lookup( SchemaConstants.SUBENTRY_ACI_AT_OID );
aciParser = new ACIItemParser( new ConcreteNameComponentNormalizer( attrRegistry, oidRegistry ), attrRegistry.getNormalizerMapping() );
- engine = new ACDFEngine( factoryCfg.getRegistries().getOidRegistry(), attrRegistry );
- chain = factoryCfg.getInterceptorChain();
- enabled = factoryCfg.getStartupConfiguration().isAccessControlEnabled();
+ engine = new ACDFEngine( directoryService.getRegistries().getOidRegistry(), attrRegistry );
+ chain = directoryService.getInterceptorChain();
+ enabled = directoryService.isAccessControlEnabled();
// stuff for dealing with subentries (garbage for now)
String subschemaSubentry =
- ( String ) factoryCfg.getPartitionNexus().getRootDSE( null ).
+ ( String ) directoryService.getPartitionNexus().getRootDSE( null ).
get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
LdapDN subschemaSubentryDnName = new LdapDN( subschemaSubentry );
subschemaSubentryDnName.normalize( attrRegistry.getNormalizerMapping() );
@@ -246,6 +224,7 @@
* @param dn the normalized distinguished name of the protected entry
* @param entry the target entry that access to is being controled
* @throws NamingException if there are problems accessing attribute values
+ * @param proxy the partition nexus proxy object
*/
private void addPerscriptiveAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn,
Attributes entry ) throws NamingException
@@ -313,7 +292,7 @@
catch ( ParseException e )
{
String msg = "failed to parse entryACI: " + aciString;
- log.error( msg, e );
+ LOG.error( msg, e );
throw new LdapNamingException( msg, ResultCodeEnum.OPERATIONS_ERROR );
}
@@ -330,6 +309,7 @@
* @param dn the normalized distinguished name of the protected entry
* @param entry the target entry that access to is being regulated
* @throws NamingException if there are problems accessing attribute values
+ * @param proxy the partition nexus proxy object
*/
private void addSubentryAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn, Attributes entry )
throws NamingException
@@ -366,7 +346,7 @@
catch ( ParseException e )
{
String msg = "failed to parse subentryACI: " + aciString;
- log.error( msg, e );
+ LOG.error( msg, e );
throw new LdapNamingException( msg, ResultCodeEnum.OPERATIONS_ERROR );
}
@@ -417,7 +397,7 @@
if ( isPrincipalAnAdministrator( principalDn ) )
{
next.add( addContext );
- tupleCache.subentryAdded( name.getUpName(), name, entry );
+ tupleCache.subentryAdded( name, entry );
groupCache.groupAdded( name, entry );
return;
}
@@ -465,7 +445,7 @@
// if the entry added is a subentry or a groupOf[Unique]Names we must
// update the ACITuple cache and the groups cache to keep them in sync
- tupleCache.subentryAdded( name.getUpName(), name, entry );
+ tupleCache.subentryAdded( name, entry );
groupCache.groupAdded( name, entry );
}
@@ -531,7 +511,7 @@
return;
}
- List<ModificationItem> mods = opContext.getModItems();
+ List<ModificationItemImpl> mods = opContext.getModItems();
// bypass authz code but manage caches if operation is performed by the admin
if ( isPrincipalAnAdministrator( principalDn ) )
@@ -557,13 +537,13 @@
Collection<MicroOperation> perms = null;
- for ( ModificationItem mod:mods )
+ for ( ModificationItemImpl mod : mods )
{
Attribute attr = mod.getAttribute();
-
+
switch ( mod.getModificationOp() )
{
- case ( DirContext.ADD_ATTRIBUTE ):
+ case ( DirContext.ADD_ATTRIBUTE ):
perms = ADD_PERMS;
// If the attribute is being created with an initial value ...
@@ -571,29 +551,29 @@
{
// ... we also need to check if adding the attribute is permitted
engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name,
- attr.getID(), null, perms, tuples, entry );
+ attr.getID(), null, perms, tuples, entry );
}
break;
-
- case ( DirContext.REMOVE_ATTRIBUTE ):
+
+ case ( DirContext.REMOVE_ATTRIBUTE ):
perms = REMOVE_PERMS;
Attribute entryAttr = entry.get( attr.getID() );
-
- if ( entryAttr != null )
+
+ if ( entryAttr != null )
{
// If there is only one value remaining in the attribute ...
if ( entryAttr.size() == 1 )
{
// ... we also need to check if removing the attribute at all is permitted
engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name,
- attr.getID(), null, perms, tuples, entry );
+ attr.getID(), null, perms, tuples, entry );
}
}
break;
-
- case ( DirContext.REPLACE_ATTRIBUTE ):
+
+ case ( DirContext.REPLACE_ATTRIBUTE ):
perms = REPLACE_PERMS;
break;
}
@@ -601,7 +581,7 @@
for ( int jj = 0; jj < attr.size(); jj++ )
{
engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name,
- attr.getID(), attr.get( jj ), perms, tuples, entry );
+ attr.getID(), attr.get( jj ), perms, tuples, entry );
}
}
@@ -628,14 +608,7 @@
if ( isPrincipalAnAdministrator( principalDn ) || !enabled || ( name.size() == 0 ) ) // no checks on the rootdse
{
// No need to go down to the stack, if the dn is empty : it's the rootDSE, and it exists !
- if ( name.size() == 0 )
- {
- return true;
- }
- else
- {
- return next.hasEntry( entryContext );
- }
+ return name.size() == 0 || next.hasEntry( entryContext );
}
Set<Name> userGroups = groupCache.getGroups( principalDn.toNormName() );
@@ -665,7 +638,7 @@
* @param principal the user associated with the call
* @param dn the name of the entry being looked up
* @param entry the raw entry pulled from the nexus
- * @throws NamingException
+ * @throws NamingException if undlying access to the DIT fails
*/
private void checkLookupAccess( LdapPrincipal principal, LdapDN dn, Attributes entry ) throws NamingException
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationService.java Fri Oct 5 23:48:35 2007
@@ -20,34 +20,13 @@
package org.apache.directory.server.core.authz;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.Name;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NoPermissionException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-import javax.naming.ldap.LdapContext;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.Interceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerContext;
@@ -64,6 +43,19 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.NoPermissionException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import javax.naming.ldap.LdapContext;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
/**
* An {@link Interceptor} that controls access to {@link PartitionNexus}.
@@ -79,7 +71,7 @@
public class DefaultAuthorizationService extends BaseInterceptor
{
/** the logger for this class */
- private static final Logger log = LoggerFactory.getLogger( DefaultAuthorizationService.class );
+ private static final Logger LOG = LoggerFactory.getLogger( DefaultAuthorizationService.class );
/**
* the base distinguished {@link Name} for all users
@@ -107,9 +99,6 @@
private Map<String, OidNormalizer> normalizerMapping;
private PartitionNexus nexus;
-
- /** attribute type registry */
- private AttributeTypeRegistry attrRegistry;
/** A starage for the uniqueMember attributeType */
private AttributeType uniqueMemberAT;
@@ -123,13 +112,13 @@
}
- public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+ public void init( DirectoryService directoryService ) throws NamingException
{
- nexus = factoryCfg.getPartitionNexus();
- normalizerMapping = factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
+ nexus = directoryService.getPartitionNexus();
+ normalizerMapping = directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
// disable this static module if basic access control mechanisms are enabled
- enabled = !factoryCfg.getStartupConfiguration().isAccessControlEnabled();
+ enabled = ! directoryService.isAccessControlEnabled();
USER_BASE_DN = PartitionNexus.getUsersBaseName();
USER_BASE_DN.normalize( normalizerMapping );
@@ -139,8 +128,8 @@
ADMIN_GROUP_DN = new LdapDN( ServerDNConstants.ADMINISTRATORS_GROUP_DN );
ADMIN_GROUP_DN.normalize( normalizerMapping );
-
- attrRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+
+ AttributeTypeRegistry attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
uniqueMemberAT = attrRegistry.lookup( SchemaConstants.UNIQUE_MEMBER_AT_OID );
@@ -191,14 +180,14 @@
if ( name.isEmpty() )
{
String msg = "The rootDSE cannot be deleted!";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
if ( name.getNormName().equals( ADMIN_GROUP_DN.getNormName() ) )
{
String msg = "The Administrators group cannot be deleted!";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -207,7 +196,7 @@
String msg = "User " + principalDn.getUpName();
msg += " does not have permission to delete the admin account.";
msg += " No one not even the admin can delete this account!";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -220,7 +209,7 @@
String msg = "User " + principalDn.getUpName();
msg += " does not have permission to delete the user account: ";
msg += name.getUpName() + ". Only the admin can delete user accounts.";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -229,7 +218,7 @@
String msg = "User " + principalDn.getUpName();
msg += " does not have permission to delete the group entry: ";
msg += name.getUpName() + ". Only the admin can delete groups.";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
}
@@ -239,20 +228,16 @@
}
- private final boolean isTheAdministrator( LdapDN normalizedDn )
+ private boolean isTheAdministrator( LdapDN normalizedDn )
{
return normalizedDn.getNormName().equals( PartitionNexus.ADMIN_PRINCIPAL_NORMALIZED );
}
- private final boolean isAnAdministrator( LdapDN normalizedDn )
+ private boolean isAnAdministrator( LdapDN normalizedDn )
{
- if ( isTheAdministrator( normalizedDn ) )
- {
- return true;
- }
-
- return administrators.contains( normalizedDn.getNormName() );
+ return isTheAdministrator( normalizedDn ) || administrators.contains( normalizedDn.getNormName() );
+
}
@@ -296,7 +281,7 @@
if ( dn.isEmpty() )
{
String msg = "The rootDSE cannot be modified!";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -313,7 +298,7 @@
String msg = "User " + principalDn.getUpName();
msg += " does not have permission to modify the account of the";
msg += " admin user.";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -326,7 +311,7 @@
msg += " user " + dn.getUpName() + ".\nEven the owner of an account cannot";
msg += " modify it.\nUser accounts can only be modified by the";
msg += " administrator.";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -335,7 +320,7 @@
String msg = "User " + principalDn.getUpName();
msg += " does not have permission to modify the group entry ";
msg += dn.getUpName() + ".\nGroups can only be modified by the admin.";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
}
@@ -393,14 +378,14 @@
if ( dn.isEmpty() )
{
String msg = "The rootDSE cannot be moved or renamed!";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
if ( dn.getNormName().equals( ADMIN_GROUP_DN.getNormName() ) )
{
String msg = "The Administrators group cannot be moved or renamed!";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -410,7 +395,7 @@
msg += "' does not have permission to move or rename the admin";
msg += " account. No one not even the admin can move or";
msg += " rename " + dn.getUpName() + "!";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -420,7 +405,7 @@
msg += "' does not have permission to move or rename the user";
msg += " account: " + dn.getUpName() + ". Only the admin can move or";
msg += " rename user accounts.";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -468,7 +453,7 @@
String msg = "Access to user account '" + normalizedDn.getUpName() + "' not permitted";
msg += " for user '" + principalDn.getUpName() + "'. Only the admin can";
msg += " access user account information";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
@@ -483,7 +468,7 @@
String msg = "Access to group '" + normalizedDn.getUpName() + "' not permitted";
msg += " for user '" + principalDn.getUpName() + "'. Only the admin can";
msg += " access group information";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
}
@@ -499,7 +484,7 @@
String msg = "Access to admin account not permitted for user '";
msg += principalDn.getUpName() + "'. Only the admin can";
msg += " access admin account information";
- log.error( msg );
+ LOG.error( msg );
throw new LdapNoPermissionException( msg );
}
}
@@ -589,11 +574,7 @@
}
// Non-admin users cannot read the admin entry
- if ( isTheAdministrator( dn ) )
- {
- return false;
- }
-
- return true;
+ return ! isTheAdministrator( dn );
+
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java Fri Oct 5 23:48:35 2007
@@ -19,15 +19,7 @@
*/
package org.apache.directory.server.core.authz;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -36,6 +28,7 @@
import org.apache.directory.shared.ldap.filter.BranchNode;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.OrNode;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
@@ -44,14 +37,10 @@
import org.slf4j.LoggerFactory;
import javax.naming.Name;
-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.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.util.*;
/**
@@ -63,10 +52,10 @@
public class GroupCache
{
/** the logger for this class */
- private static final Logger log = LoggerFactory.getLogger( GroupCache.class );
+ private static final Logger LOG = LoggerFactory.getLogger( GroupCache.class );
/** Speedup for logs */
- private static final boolean IS_DEBUG = log.isDebugEnabled();
+ private static final boolean IS_DEBUG = LOG.isDebugEnabled();
/** String key for the DN of a group to a Set (HashSet) for the Strings of member DNs */
private final Map<String, Set<String>> groups = new HashMap<String, Set<String>>();
@@ -77,9 +66,6 @@
/** the env to use for searching */
private final Map<?, ?> env;
- /** Stores a reference to the AttributeType registry */
- private AttributeTypeRegistry attributeTypeRegistry;
-
/** A storage for the member attributeType */
private AttributeType memberAT;
@@ -99,14 +85,15 @@
/**
* Creates a static group cache.
*
- * @param factoryCfg the context factory configuration for the server
+ * @param directoryService the directory service core
+ * @throws NamingException if there are failures on initialization
*/
- public GroupCache( DirectoryServiceConfiguration factoryCfg ) throws NamingException
+ public GroupCache( DirectoryService directoryService ) throws NamingException
{
- normalizerMap = factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
- nexus = factoryCfg.getPartitionNexus();
- env = ( Map<?, ?> ) factoryCfg.getEnvironment().clone();
- attributeTypeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+ normalizerMap = directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
+ nexus = directoryService.getPartitionNexus();
+ env = ( Map<?, ?> ) directoryService.getEnvironment().clone();
+ AttributeTypeRegistry attributeTypeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
memberAT = attributeTypeRegistry.lookup( SchemaConstants.MEMBER_AT_OID );
uniqueMemberAT = attributeTypeRegistry.lookup( SchemaConstants.UNIQUE_MEMBER_AT_OID );
@@ -160,7 +147,7 @@
}
else
{
- log.warn( "Found group '{}' without any member or uniqueMember attributes", groupDn.getUpName() );
+ LOG.warn( "Found group '{}' without any member or uniqueMember attributes", groupDn.getUpName() );
}
}
@@ -169,7 +156,7 @@
if ( IS_DEBUG )
{
- log.debug( "group cache contents on startup:\n {}", groups );
+ LOG.debug( "group cache contents on startup:\n {}", groups );
}
}
@@ -240,7 +227,7 @@
}
catch ( NamingException e )
{
- log.warn( "Malformed member DN in groupOf[Unique]Names entry. Member not added to GroupCache.", e );
+ LOG.warn( "Malformed member DN in groupOf[Unique]Names entry. Member not added to GroupCache.", e );
}
memberSet.add( memberDn );
@@ -268,7 +255,7 @@
}
catch ( NamingException e )
{
- log.warn( "Malformed member DN in groupOf[Unique]Names entry. Member not removed from GroupCache.", e );
+ LOG.warn( "Malformed member DN in groupOf[Unique]Names entry. Member not removed from GroupCache.", e );
}
memberSet.remove( memberDn );
@@ -280,8 +267,7 @@
* Adds a groups members to the cache. Called by interceptor to account for new
* group additions.
*
- * @param upName the user provided name for the group entry
- * @param normName the normalized name for the group entry
+ * @param name the user provided name for the group entry
* @param entry the group entry's attributes
* @throws NamingException if there are problems accessing the attr values
*/
@@ -300,7 +286,7 @@
if ( IS_DEBUG )
{
- log.debug( "group cache contents after adding '{}' :\n {}", name.getUpName(), groups );
+ LOG.debug( "group cache contents after adding '{}' :\n {}", name.getUpName(), groups );
}
}
@@ -325,7 +311,7 @@
if ( IS_DEBUG )
{
- log.debug( "group cache contents after deleting '{}' :\n {}", name.getUpName(), groups );
+ LOG.debug( "group cache contents after deleting '{}' :\n {}", name.getUpName(), groups );
}
}
@@ -376,7 +362,7 @@
* @param entry the group entry being modified
* @throws NamingException if there are problems accessing attribute values
*/
- public void groupModified( LdapDN name, List<ModificationItem> mods, Attributes entry ) throws NamingException
+ public void groupModified( LdapDN name, List<ModificationItemImpl> mods, Attributes entry ) throws NamingException
{
Attribute members = null;
String memberAttrId = null;
@@ -418,7 +404,7 @@
if ( IS_DEBUG )
{
- log.debug( "group cache contents after modifying '{}' :\n {}", name.getUpName(), groups );
+ LOG.debug( "group cache contents after modifying '{}' :\n {}", name.getUpName(), groups );
}
}
@@ -430,10 +416,9 @@
* @param name the normalized name of the group entry modified
* @param modOp the modify operation being performed
* @param mods the modifications being performed
- * @param entry the entry being modified
* @throws NamingException if there are problems accessing attribute values
*/
- public void groupModified( LdapDN name, int modOp, Attributes mods, Attributes entry ) throws NamingException
+ public void groupModified( LdapDN name, int modOp, Attributes mods ) throws NamingException
{
Attribute members = getMemberAttribute( mods );
@@ -451,7 +436,7 @@
if ( IS_DEBUG )
{
- log.debug( "group cache contents after modifying '{}' :\n {}", name.getUpName(), groups );
+ LOG.debug( "group cache contents after modifying '{}' :\n {}", name.getUpName(), groups );
}
}
@@ -474,7 +459,7 @@
if ( members == null )
{
- log.warn( "What do you mean there is no administrators group? This is bad news." );
+ LOG.warn( "What do you mean there is no administrators group? This is bad news." );
return false;
}
@@ -492,7 +477,7 @@
*/
public Set<Name> getGroups( String member ) throws NamingException
{
- LdapDN normMember = null;
+ LdapDN normMember;
try
{
@@ -500,7 +485,7 @@
}
catch ( NamingException e )
{
- log.warn( "Malformed member DN. Could not find groups for member '{}' in GroupCache. Returning empty set for groups!", member, e );
+ LOG.warn( "Malformed member DN. Could not find groups for member '{}' in GroupCache. Returning empty set for groups!", member, e );
return EMPTY_GROUPS;
}
@@ -545,7 +530,7 @@
if ( IS_DEBUG )
{
- log.debug( "group cache contents after renaming '{}' :\n{}", oldName.getUpName(), groups );
+ LOG.debug( "group cache contents after renaming '{}' :\n{}", oldName.getUpName(), groups );
}
return true;
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Fri Oct 5 23:48:35 2007
@@ -19,25 +19,7 @@
*/
package org.apache.directory.server.core.authz;
-
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.Name;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
@@ -50,6 +32,7 @@
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
@@ -59,6 +42,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.text.ParseException;
+import java.util.*;
+
/**
* A cache for tuple sets which responds to specific events to perform
@@ -71,7 +61,7 @@
public class TupleCache
{
/** the logger for this class */
- private static final Logger log = LoggerFactory.getLogger( TupleCache.class );
+ private static final Logger LOG = LoggerFactory.getLogger( TupleCache.class );
/** cloned startup environment properties we use for subentry searching */
private final Map<?, ?> env;
@@ -85,9 +75,6 @@
/** a normalizing ACIItem parser */
private final ACIItemParser aciParser;
- /** Stores a reference to the AttributeType registry */
- private AttributeTypeRegistry attributeTypeRegistry;
-
/** A starage for the PrescriptiveACI attributeType */
private AttributeType prescriptiveAciAT;
@@ -99,17 +86,18 @@
/**
* Creates a ACITuple cache.
*
- * @param factoryCfg the context factory configuration for the server
+ * @param directoryService the context factory configuration for the server
+ * @throws NamingException if initialization fails
*/
- public TupleCache( DirectoryServiceConfiguration factoryCfg ) throws NamingException
+ public TupleCache( DirectoryService directoryService ) throws NamingException
{
- normalizerMap = factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
- this.nexus = factoryCfg.getPartitionNexus();
- attributeTypeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
- OidRegistry oidRegistry = factoryCfg.getRegistries().getOidRegistry();
+ normalizerMap = directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
+ this.nexus = directoryService.getPartitionNexus();
+ AttributeTypeRegistry attributeTypeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+ OidRegistry oidRegistry = directoryService.getRegistries().getOidRegistry();
NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeTypeRegistry, oidRegistry );
aciParser = new ACIItemParser( ncn, normalizerMap );
- env = ( Map<?, ?> ) factoryCfg.getEnvironment().clone();
+ env = ( Map<?, ?> ) directoryService.getEnvironment().clone();
prescriptiveAciAT = attributeTypeRegistry.lookup( SchemaConstants.PRESCRIPTIVE_ACI_AT );
initialize();
}
@@ -148,12 +136,12 @@
if ( aci == null )
{
- log.warn( "Found accessControlSubentry '" + subentryDn + "' without any " + SchemaConstants.PRESCRIPTIVE_ACI_AT );
+ LOG.warn( "Found accessControlSubentry '" + subentryDn + "' without any " + SchemaConstants.PRESCRIPTIVE_ACI_AT );
continue;
}
LdapDN normName = parseNormalized( subentryDn );
- subentryAdded( subentryDn, normName, result.getAttributes() );
+ subentryAdded( normName, result.getAttributes() );
}
results.close();
@@ -186,7 +174,7 @@
}
- public void subentryAdded( String upName, LdapDN normName, Attributes entry ) throws NamingException
+ public void subentryAdded( LdapDN normName, Attributes entry ) throws NamingException
{
// only do something if the entry contains prescriptiveACI
Attribute aci = AttributeUtils.getAttribute( entry, prescriptiveAciAT );
@@ -214,11 +202,10 @@
"Cannnot add ACITuples to TupleCache.\n" +
"Check that the syntax of the ACI item is correct. \nUntil this error " +
"is fixed your security settings will not be as expected.";
- log.error( msg, e );
+ LOG.error( msg, e );
// do not process this ACI Item because it will be null
// continue on to process the next ACI item in the entry
- continue;
}
}
@@ -237,29 +224,27 @@
}
- public void subentryModified( LdapDN normName, List<ModificationItem> mods, Attributes entry ) throws NamingException
+ public void subentryModified( LdapDN normName, List<ModificationItemImpl> mods, Attributes entry ) throws NamingException
{
if ( !hasPrescriptiveACI( entry ) )
{
return;
}
-
- for (ModificationItem mod:mods )
+
+ for ( ModificationItemImpl mod : mods )
{
String attrID = mod.getAttribute().getID();
-
if ( attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT ) ||
- attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT_OID ) )
+ attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT_OID ) )
{
subentryDeleted( normName, entry );
- subentryAdded( normName.getUpName(), normName, entry );
- continue;
+ subentryAdded( normName, entry );
}
}
}
- public void subentryModified( LdapDN normName, int modOp, Attributes mods, Attributes entry ) throws NamingException
+ public void subentryModified( LdapDN normName, Attributes mods, Attributes entry ) throws NamingException
{
if ( !hasPrescriptiveACI( entry ) )
{
@@ -269,7 +254,7 @@
if ( AttributeUtils.getAttribute( mods, prescriptiveAciAT ) != null )
{
subentryDeleted( normName, entry );
- subentryAdded( normName.getUpName(), normName, entry );
+ subentryAdded( normName, entry );
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java Fri Oct 5 23:48:35 2007
@@ -33,7 +33,6 @@
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
-import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.core.normalization.NormalizationService;
@@ -115,9 +114,8 @@
continue;
}
- for ( Iterator<ProtectedItem> j = tuple.getProtectedItems().iterator(); j.hasNext(); )
+ for ( ProtectedItem item : tuple.getProtectedItems() )
{
- ProtectedItem item = j.next();
if ( item instanceof ProtectedItem.MaxImmSub )
{
if ( immSubCount < 0 )
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Fri Oct 5 23:48:35 2007
@@ -1,45 +1,36 @@
package org.apache.directory.server.core.changelog;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Queue;
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerContext;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
-
import org.apache.directory.shared.ldap.ldif.ChangeType;
import org.apache.directory.shared.ldap.ldif.Entry;
import org.apache.directory.shared.ldap.ldif.LdifUtils;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.util.Base64;
import org.apache.directory.shared.ldap.util.DateUtils;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.DirContext;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
/**
- * An interceptor which maintains a change log as it intercepts changes to the
- * directory. It mainains a changes.log file using the LDIF format for changes.
+ * An interceptor which maintains a change LOG as it intercepts changes to the
+ * directory. It mainains a changes.LOG file using the LDIF format for changes.
* It appends changes to this file so the entire LDIF file can be loaded to
* replicate the state of the server.
*
@@ -47,25 +38,25 @@
public class ChangeLogInterceptor extends BaseInterceptor implements Runnable
{
/** logger used by this class */
- private static final Logger log = LoggerFactory.getLogger( ChangeLogInterceptor.class );
+ private static final Logger LOG = LoggerFactory.getLogger( ChangeLogInterceptor.class );
/** time to wait before automatically waking up the writer thread */
private static final long WAIT_TIMEOUT_MILLIS = 1000;
- /** the changes.log file's stream which we append change log messages to */
- private PrintWriter out = null;
+ /** the changes.LOG file's stream which we append change LOG messages to */
+ private PrintWriter out;
- /** queue of string buffers awaiting serialization to the log file */
- private Queue<StringBuilder> queue = new LinkedList<StringBuilder>();
+ /** queue of string buffers awaiting serialization to the LOG file */
+ private final Queue<StringBuilder> queue = new LinkedList<StringBuilder>();
/** a handle on the attributeType registry to determine the binary nature of attributes */
- private AttributeTypeRegistry registry = null;
+ private AttributeTypeRegistry registry;
/** determines if this service has been activated */
- private boolean isActive = false;
+ private boolean isActive;
/** thread used to asynchronously write change logs to disk */
- private Thread writer = null;
+ private Thread writer;
// -----------------------------------------------------------------------
@@ -73,15 +64,15 @@
// -----------------------------------------------------------------------
- public void init( DirectoryServiceConfiguration dsConfig ) throws NamingException
+ public void init( DirectoryService directoryService ) throws NamingException
{
- super.init( dsConfig );
+ super.init( directoryService );
// Get a handle on the attribute registry to check if attributes are binary
- registry = dsConfig.getRegistries().getAttributeTypeRegistry();
+ registry = directoryService.getRegistries().getAttributeTypeRegistry();
// Open a print stream to use for flushing LDIFs into
- File changes = new File( dsConfig.getStartupConfiguration().getWorkingDirectory(), "changes.log" );
+ File changes = new File( directoryService.getWorkingDirectory(), "changes.LOG" );
try
{
@@ -96,7 +87,7 @@
}
catch( Exception e )
{
- log.error( "Failed to open the change log file: " + changes, e );
+ LOG.error( "Failed to open the change LOG file: " + changes, e );
}
out.println( "# -----------------------------------------------------------------------------" );
@@ -130,7 +121,7 @@
}
catch ( InterruptedException e )
{
- log.error( "Failed to sleep while waiting for writer to die", e );
+ LOG.error( "Failed to sleep while waiting for writer to die", e );
}
} while ( writer.isAlive() );
@@ -148,7 +139,7 @@
}
}
- // Print message that we're stopping log service, flush and close
+ // Print message that we're stopping LOG service, flush and close
out.println( "# -----------------------------------------------------------------------------" );
out.println( "# Deactivating changelog service: " + DateUtils.getGeneralizedTime() );
out.println( "# -----------------------------------------------------------------------------" );
@@ -168,7 +159,7 @@
{
while ( isActive )
{
- StringBuilder buf = null;
+ StringBuilder buf;
// Grab semphore to queue and dequeue from it
synchronized( queue )
@@ -179,7 +170,7 @@
}
catch ( InterruptedException e )
{
- log.error( "Failed to to wait() on queue", e );
+ LOG.error( "Failed to to wait() on queue", e );
}
buf = queue.poll();
@@ -230,7 +221,7 @@
/**
* The delete operation has to be stored with a way to restore the deleted element.
- * There is no way to do that but reading the entry and dump it into the log.
+ * There is no way to do that but reading the entry and dump it into the LOG.
*/
public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
{
@@ -285,9 +276,9 @@
buf.append( opContext.getDn() );
buf.append( "\nchangetype: modify" );
- List<ModificationItem> mods = opContext.getModItems();
+ List<ModificationItemImpl> mods = opContext.getModItems();
- for ( ModificationItem mod:mods )
+ for ( ModificationItemImpl mod :mods )
{
append( buf, mod.getAttribute(), getModOpStr( mod.getModificationOp() ) );
}
@@ -330,8 +321,8 @@
buf.append( "\ndn: " );
buf.append( renameContext.getDn() );
buf.append( "\nchangetype: modrdn" );
- buf.append( "\nnewrdn: " + renameContext.getNewRdn() );
- buf.append( "\ndeleteoldrdn: " + ( renameContext.getDelOldDn() ? "1" : "0" ) );
+ buf.append( "\nnewrdn: " ).append( renameContext.getNewRdn() );
+ buf.append( "\ndeleteoldrdn: " ).append( renameContext.getDelOldDn() ? "1" : "0" );
buf.append( "\n" );
@@ -367,9 +358,9 @@
buf.append( "\ndn: " );
buf.append( moveAndRenameOperationContext.getDn() );
buf.append( "\nchangetype: modrdn" ); // FIXME: modrdn --> moddn ?
- buf.append( "\nnewrdn: " + moveAndRenameOperationContext.getNewRdn() );
- buf.append( "\ndeleteoldrdn: " + ( moveAndRenameOperationContext.getDelOldDn() ? "1" : "0" ) );
- buf.append( "\nnewsperior: " + moveAndRenameOperationContext.getParent() );
+ buf.append( "\nnewrdn: " ).append( moveAndRenameOperationContext.getNewRdn() );
+ buf.append( "\ndeleteoldrdn: " ).append( moveAndRenameOperationContext.getDelOldDn() ? "1" : "0" );
+ buf.append( "\nnewsperior: " ).append( moveAndRenameOperationContext.getParent() );
buf.append( "\n" );
@@ -403,8 +394,8 @@
// Append the LDIF record now
buf.append( "\ndn: " );
buf.append( moveOperationContext.getDn() );
- buf.append( "\nchangetype: moddn" );
- buf.append( "\nnewsperior: " + moveOperationContext.getParent() );
+ buf.append( "\nchangetype: moddn" );
+ buf.append( "\nnewsperior: " ).append( moveOperationContext.getParent() );
buf.append( "\n" );
@@ -433,7 +424,7 @@
*/
private StringBuilder append( StringBuilder buf, Attribute attr ) throws NamingException
{
- String id = ( String ) attr.getID();
+ String id = attr.getID();
int sz = attr.size();
boolean isBinary = ! registry.lookup( id ).getSyntax().isHumanReadable();
@@ -457,7 +448,7 @@
}
catch ( UnsupportedEncodingException e )
{
- log.error( "can't convert to UTF-8: " + encoded, e );
+ LOG.error( "can't convert to UTF-8: " + encoded, e );
}
}
else
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java Fri Oct 5 23:48:35 2007
@@ -20,27 +20,12 @@
package org.apache.directory.server.core.collective;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
-import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.PartitionNexus;
@@ -52,6 +37,15 @@
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.util.AttributeUtils;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* An interceptor based service dealing with collective attribute
@@ -92,17 +86,17 @@
}
};
- private AttributeTypeRegistry attrTypeRegistry = null;
- private PartitionNexus nexus = null;
+ private AttributeTypeRegistry attrTypeRegistry;
+ private PartitionNexus nexus;
- private CollectiveAttributesSchemaChecker collectiveAttributesSchemaChecker = null;
+ private CollectiveAttributesSchemaChecker collectiveAttributesSchemaChecker;
- public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+ public void init( DirectoryService directoryService ) throws NamingException
{
- super.init( factoryCfg);
- nexus = factoryCfg.getPartitionNexus();
- attrTypeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+ super.init( directoryService );
+ nexus = directoryService.getPartitionNexus();
+ attrTypeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
collectiveAttributesSchemaChecker = new CollectiveAttributesSchemaChecker(nexus, attrTypeRegistry);
}
@@ -120,8 +114,9 @@
*/
private void addCollectiveAttributes( LdapDN normName, Attributes entry, String[] retAttrs ) throws NamingException
{
- Attribute caSubentries = null;
-
+ Attribute caSubentries;
+
+ //noinspection StringEquality
if ( ( retAttrs == null ) || ( retAttrs.length != 1 ) || ( retAttrs[0] != SchemaConstants.ALL_USER_ATTRIBUTES ) )
{
Attributes entryWithCAS = nexus.lookup( new LookupOperationContext( normName, new String[] {
@@ -224,19 +219,16 @@
}
Set<AttributeType> allSuperTypes = getAllSuperTypes( attrType );
- Iterator<String> it = retIdsSet.iterator();
-
- while ( it.hasNext() )
+
+ for ( String retId : retIdsSet )
{
- String retId = it.next();
-
if ( retId.equals( SchemaConstants.ALL_USER_ATTRIBUTES ) || retId.equals( SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES ) )
{
continue;
}
-
+
AttributeType retType = attrTypeRegistry.lookup( retId );
-
+
if ( allSuperTypes.contains( retType ) )
{
retIdsSet.add( attrId );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Fri Oct 5 23:48:35 2007
@@ -82,7 +82,7 @@
public void checkModify( LdapDN normName, int modOp, Attributes mods ) throws NamingException
{
- List<ModificationItem> modsAsArray = new ArrayList<ModificationItem>( mods.size() );
+ ArrayList<ModificationItemImpl> modsAsArray = new ArrayList<ModificationItemImpl>( mods.size() );
NamingEnumeration<? extends Attribute> allAttrs = mods.getAll();
while ( allAttrs.hasMoreElements() )
@@ -95,7 +95,7 @@
}
- public void checkModify( LdapDN normName, List<ModificationItem> mods ) throws NamingException
+ public void checkModify( LdapDN normName, List<ModificationItemImpl> mods ) throws NamingException
{
Attributes originalEntry = nexus.lookup( new LookupOperationContext( normName ) );
Attributes targetEntry = SchemaUtils.getTargetEntry( mods, originalEntry );
@@ -118,7 +118,7 @@
}
- private boolean addsAnyCollectiveAttributes( List<ModificationItem> mods ) throws NamingException
+ private boolean addsAnyCollectiveAttributes( List<ModificationItemImpl> mods ) throws NamingException
{
for ( ModificationItem mod:mods )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/AttributesPropertyEditor.java Fri Oct 5 23:48:35 2007
@@ -19,6 +19,18 @@
*/
package org.apache.directory.server.core.configuration;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.shared.ldap.ldif.LdifComposer;
+import org.apache.directory.shared.ldap.ldif.LdifComposerImpl;
+import org.apache.directory.shared.ldap.ldif.LdifReader;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.util.MultiMap;
+import org.apache.directory.shared.ldap.util.StringTools;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorSupport;
import java.io.BufferedReader;
@@ -28,19 +40,6 @@
import java.util.Map;
import java.util.Set;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-
-import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.shared.ldap.ldif.LdifComposer;
-import org.apache.directory.shared.ldap.ldif.LdifComposerImpl;
-import org.apache.directory.shared.ldap.ldif.LdifReader;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.util.MultiMap;
-import org.apache.directory.shared.ldap.util.StringTools;
-
/**
* A JavaBeans {@link PropertyEditor} that can convert {@link Attributes} to
@@ -168,9 +167,10 @@
return composer.compose( map );
}
- catch (Exception e)
+ catch ( Exception e )
{
- throw new ConfigurationException( e );
+ e.printStackTrace();
+ return null;
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventService.java Fri Oct 5 23:48:35 2007
@@ -20,38 +20,10 @@
package org.apache.directory.server.core.event;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.Binding;
-import javax.naming.Name;
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.SearchControls;
-import javax.naming.event.EventContext;
-import javax.naming.event.NamespaceChangeListener;
-import javax.naming.event.NamingEvent;
-import javax.naming.event.NamingListener;
-import javax.naming.event.ObjectChangeListener;
-import javax.naming.directory.ModificationItem;
-
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.normalization.NormalizingVisitor;
@@ -60,19 +32,22 @@
import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
-import org.apache.directory.shared.ldap.filter.AndNode;
-import org.apache.directory.shared.ldap.filter.BranchNode;
-import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.LeafNode;
-import org.apache.directory.shared.ldap.filter.NotNode;
-import org.apache.directory.shared.ldap.filter.ScopeNode;
+import org.apache.directory.shared.ldap.filter.*;
import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.name.NameComponentNormalizer;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.naming.Binding;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.SearchControls;
+import javax.naming.event.*;
+import java.util.*;
+
/**
* An interceptor based serivice for notifying NamingListeners of EventContext
@@ -89,21 +64,21 @@
private PartitionNexus nexus;
private Map<NamingListener, Object> sources = new HashMap<NamingListener, Object>();
- private Evaluator evaluator = null;
+ private Evaluator evaluator;
private AttributeTypeRegistry attributeRegistry;
private NormalizingVisitor visitor;
- public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+ public void init( DirectoryService directoryService ) throws NamingException
{
- super.init( factoryCfg);
+ super.init( directoryService );
- OidRegistry oidRegistry = factoryCfg.getRegistries().getOidRegistry();
- attributeRegistry = factoryCfg.getRegistries().getAttributeTypeRegistry();
+ OidRegistry oidRegistry = directoryService.getRegistries().getOidRegistry();
+ attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
evaluator = new ExpressionEvaluator( oidRegistry, attributeRegistry );
- nexus = factoryCfg.getPartitionNexus();
+ nexus = directoryService.getPartitionNexus();
NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeRegistry, oidRegistry );
- visitor = new NormalizingVisitor( ncn, factoryCfg.getRegistries().getOidRegistry() );
+ visitor = new NormalizingVisitor( ncn, directoryService.getRegistries().getOidRegistry() );
}
@@ -115,6 +90,7 @@
* @param filter the filter to use for evaluating event triggering
* @param searchControls the search controls to use when evaluating triggering
* @param namingListener the naming listener to register
+ * @throws NamingException if there are failures adding the naming listener
*/
public void addNamingListener( EventContext ctx, Name name, ExprNode filter, SearchControls searchControls,
NamingListener namingListener ) throws NamingException
@@ -197,7 +173,8 @@
}
else if ( obj instanceof List )
{
- List<Object> list = (List<Object>)obj;
+ //noinspection unchecked
+ List<Object> list = (List<Object>) obj;
list.add( rec );
}
}
@@ -287,7 +264,7 @@
}
Iterator<EventSourceRecord> list = selecting.iterator();
-
+
while ( list.hasNext() )
{
EventSourceRecord rec = ( EventSourceRecord ) list.next();
@@ -304,7 +281,7 @@
}
- private void notifyOnModify( LdapDN name, List<ModificationItem> mods, Attributes oriEntry ) throws NamingException
+ private void notifyOnModify( LdapDN name, List<ModificationItemImpl> mods, Attributes oriEntry ) throws NamingException
{
Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java Fri Oct 5 23:48:35 2007
@@ -19,51 +19,31 @@
*/
package org.apache.directory.server.core.exception;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.DirContext;
-import javax.naming.directory.ModificationItem;
-import javax.naming.directory.SearchResult;
-
import org.apache.commons.collections.map.LRUMap;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.directory.server.core.DirectoryService;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
+import org.apache.directory.server.core.interceptor.context.*;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.exception.LdapAttributeInUseException;
-import org.apache.directory.shared.ldap.exception.LdapContextNotEmptyException;
-import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
-import org.apache.directory.shared.ldap.exception.LdapNameNotFoundException;
-import org.apache.directory.shared.ldap.exception.LdapNamingException;
-import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.exception.*;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.OidNormalizer;
import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.apache.directory.shared.ldap.util.EmptyEnumeration;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.*;
+import java.util.List;
+import java.util.Map;
+
/**
* An {@link org.apache.directory.server.core.interceptor.Interceptor} that detects any operations that breaks integrity
@@ -104,7 +84,7 @@
* We need to be sure that frequently used DNs are always in cache, and not discarded.
* We will use a LRU cache for this purpose.
*/
- private LRUMap notAliasCache;
+ private final LRUMap notAliasCache = new LRUMap( DEFAULT_CACHE_SIZE );
/** Declare a default for this cache. 100 entries seems to be enough */
private static final int DEFAULT_CACHE_SIZE = 100;
@@ -118,14 +98,13 @@
}
- public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+ public void init( DirectoryService directoryService ) throws NamingException
{
- nexus = factoryCfg.getPartitionNexus();
- normalizerMap = factoryCfg.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
+ nexus = directoryService.getPartitionNexus();
+ normalizerMap = directoryService.getRegistries().getAttributeTypeRegistry().getNormalizerMapping();
Attribute attr = nexus.getRootDSE( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
subschemSubentryDn = new LdapDN( ( String ) attr.get() );
subschemSubentryDn.normalize( normalizerMap );
- notAliasCache = new LRUMap( DEFAULT_CACHE_SIZE );
}
@@ -160,18 +139,18 @@
parentDn.remove( name.size() - 1 );
// check if we're trying to add to a parent that is an alias
- boolean notAnAlias = false;
+ boolean notAnAlias;
synchronized( notAliasCache )
{
notAnAlias = notAliasCache.containsKey( parentDn.getNormName() );
}
- if ( notAnAlias == false )
+ if ( ! notAnAlias )
{
// We don't know if the parent is an alias or not, so we will launch a
// lookup, and update the cache if it's not an alias
- Attributes attrs = null;
+ Attributes attrs;
try
{
@@ -315,9 +294,9 @@
assertHasEntry( nextInterceptor, msg, opContext.getDn() );
Attributes entry = nexus.lookup( new LookupOperationContext( opContext.getDn() ) );
- List<ModificationItem> items = opContext.getModItems();
-
- for ( ModificationItem item:items )
+ List<ModificationItemImpl> items = opContext.getModItems();
+
+ for ( ModificationItemImpl item : items )
{
if ( item.getModificationOp() == DirContext.ADD_ATTRIBUTE )
{
@@ -328,11 +307,11 @@
{
for ( int jj = 0; jj < modAttr.size(); jj++ )
{
- // TODO Fix DIRSERVER-832
+ // TODO Fix DIRSERVER-832
if ( entryAttr.contains( modAttr.get( jj ) ) )
{
throw new LdapAttributeInUseException( "Trying to add existing value '" + modAttr.get( jj )
- + "' to attribute " + modAttr.getID() );
+ + "' to attribute " + modAttr.getID() );
}
}
}
@@ -525,7 +504,7 @@
{
NamingEnumeration<SearchResult> result = nextInterceptor.search( opContext );
- if ( result.hasMoreElements() == false )
+ if ( ! result.hasMoreElements() )
{
if ( !base.isEmpty() && !( subschemSubentryDn.toNormName() ).equalsIgnoreCase( base.toNormName() ) )
{
@@ -552,6 +531,7 @@
* @param msg the message to prefix to the distinguished name for explanation
* @param dn the distinguished name of the entry that is asserted
* @throws NamingException if the entry does not exist
+ * @param nextInterceptor the next interceptor in the chain
*/
private void assertHasEntry( NextInterceptor nextInterceptor, String msg, LdapDN dn ) throws NamingException
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/BaseInterceptor.java Fri Oct 5 23:48:35 2007
@@ -20,7 +20,12 @@
package org.apache.directory.server.core.interceptor;
-import java.util.Iterator;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.authn.LdapPrincipal;
+import org.apache.directory.server.core.interceptor.context.*;
+import org.apache.directory.server.core.invocation.InvocationStack;
+import org.apache.directory.server.core.jndi.ServerContext;
+import org.apache.directory.shared.ldap.name.LdapDN;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
@@ -28,31 +33,7 @@
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchResult;
import javax.naming.ldap.LdapContext;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.authn.LdapPrincipal;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.invocation.InvocationStack;
-import org.apache.directory.server.core.jndi.ServerContext;
-import org.apache.directory.shared.ldap.name.LdapDN;
+import java.util.Iterator;
/**
@@ -79,6 +60,7 @@
/**
* Returns {@link LdapPrincipal} of current context.
+ * @return the authenticated principal
*/
public static LdapPrincipal getPrincipal()
{
@@ -89,6 +71,7 @@
/**
* Returns the current JNDI {@link Context}.
+ * @return the context on the invocation stack
*/
public static LdapContext getContext()
{
@@ -107,7 +90,7 @@
/**
* This method does nothing by default.
*/
- public void init(DirectoryServiceConfiguration factoryCfg) throws NamingException
+ public void init( DirectoryService directoryService ) throws NamingException
{
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java?rev=582462&r1=582461&r2=582462&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/Interceptor.java Fri Oct 5 23:48:35 2007
@@ -20,36 +20,17 @@
package org.apache.directory.server.core.interceptor;
-import java.util.Iterator;
+import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.interceptor.context.*;
+import org.apache.directory.server.core.partition.Partition;
+import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.shared.ldap.name.LdapDN;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.SearchResult;
-
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.interceptor.context.BindOperationContext;
-import org.apache.directory.server.core.interceptor.context.CompareOperationContext;
-import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetRootDSEOperationContext;
-import org.apache.directory.server.core.interceptor.context.GetSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListOperationContext;
-import org.apache.directory.server.core.interceptor.context.ListSuffixOperationContext;
-import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
-import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
-import org.apache.directory.server.core.interceptor.context.RemoveContextPartitionOperationContext;
-import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
-import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
-import org.apache.directory.server.core.interceptor.context.UnbindOperationContext;
-import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.shared.ldap.name.LdapDN;
+import java.util.Iterator;
/**
@@ -127,7 +108,7 @@
* Intializes this interceptor. This is invoked by {@link InterceptorChain}
* when this intercepter is loaded into interceptor chain.
*/
- void init(DirectoryServiceConfiguration factoryCfg) throws NamingException;
+ void init( DirectoryService directoryService ) throws NamingException;
/**