You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/10/04 13:45:56 UTC
svn commit: r581861 [1/2] - in /directory/apacheds/branches/bigbang:
bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/
core-unit/src/test/java/org/apache/directory/server/core/authz/
core-unit/src/test/java/org/apache/di...
Author: elecharny
Date: Thu Oct 4 04:45:53 2007
New Revision: 581861
URL: http://svn.apache.org/viewvc?rev=581861&view=rev
Log:
- Replaced the ModificationItemp[] by a List<ModificationItem> to ease the modification manipulations.
- Fixed the bug Stefan found about missing modify operationalAttributes
- Removed a lot of warnings (generics)
Modified:
directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationITest.java
directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AuthorizationService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
Modified: directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java (original)
+++ directory/apacheds/branches/bigbang/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java Thu Oct 4 04:45:53 2007
@@ -46,6 +46,8 @@
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -798,9 +800,12 @@
LdapDN dn = new LdapDN( SchemaConstants.CN_AT + "=" + schemaName
+ "," + SchemaConstants.OU_AT + "=schema" );
dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+
ModificationItemImpl mod = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
new AttributeImpl( MetaSchemaConstants.M_DISABLED_AT, "TRUE" ) );
- ModificationItemImpl[] mods = new ModificationItemImpl[] {mod};
+
+ List<ModificationItem> mods = new ArrayList<ModificationItem>();
+ mods.add( mod );
store.modify( dn, mods );
}
Modified: directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationITest.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationITest.java (original)
+++ directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationITest.java Thu Oct 4 04:45:53 2007
@@ -113,11 +113,24 @@
// Gives grantCompare, and grantRead perm to all users in the Administrators group for
// entries and all attribute types and values
- createAccessControlSubentry( "administratorAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
- + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
- + "userClasses { userGroup { \"cn=Administrators,ou=groups,ou=system\" } }, " + "userPermissions { { "
- + "protectedItems {entry, allUserAttributeTypesAndValues}, "
- + "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
+ createAccessControlSubentry( "administratorAdd",
+ "{ identificationTag \"addAci\", " +
+ " precedence 14, " +
+ " authenticationLevel none, " +
+ " itemOrUserFirst userFirst: { " +
+ " userClasses { " +
+ " userGroup { " +
+ " \"cn=Administrators,ou=groups,ou=system\" " +
+ " } " +
+ " }, " +
+ " userPermissions { " +
+ " { " +
+ " protectedItems { entry, allUserAttributeTypesAndValues }, " +
+ " grantsAndDenials { grantCompare, grantRead, grantBrowse } " +
+ " } " +
+ " } " +
+ " } " +
+ "}" );
// see if we can now add that test entry which we could not before
// add op should still fail since billd is not in the admin group
Modified: directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java (original)
+++ directory/apacheds/branches/bigbang/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java Thu Oct 4 04:45:53 2007
@@ -130,6 +130,25 @@
}
+ public SearchResult getEntry( String name ) throws NamingException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
+ controls.setReturningAttributes( new String[]
+ { "+", "*" } );
+
+ NamingEnumeration<SearchResult> results = sysRoot.search( name, "(objectClass=*)", controls );
+
+ while ( results.hasMore() )
+ {
+ SearchResult result = results.next();
+ return result;
+ }
+
+ return null;
+ }
+
+
public Map<String, Attributes> getAllEntriesRestrictAttributes() throws NamingException
{
Map<String, Attributes> resultMap = new HashMap<String, Attributes>();
@@ -171,6 +190,9 @@
// -------------------------------------------------------------------
addAdministrativeRole( "collectiveAttributeSpecificArea" );
+
+ SearchResult result = getEntry( "" );
+
super.sysRoot.createSubcontext( "cn=testsubentry", getTestSubentry() );
// -------------------------------------------------------------------
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -24,6 +24,7 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.naming.Name;
@@ -32,13 +33,13 @@
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.authn.LdapPrincipal;
import org.apache.directory.server.core.authz.support.ACDFEngine;
-import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
@@ -71,7 +72,6 @@
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;
@@ -531,7 +531,7 @@
return;
}
- ModificationItemImpl[] mods = opContext.getModItems();
+ List<ModificationItem> mods = opContext.getModItems();
// bypass authz code but manage caches if operation is performed by the admin
if ( isPrincipalAnAdministrator( principalDn ) )
@@ -557,14 +557,15 @@
Collection<MicroOperation> perms = null;
- for ( int ii = 0; ii < mods.length; ii++ )
+ for ( ModificationItem mod:mods )
{
- Attribute attr = mods[ii].getAttribute();
+ Attribute attr = mod.getAttribute();
- switch ( mods[ii].getModificationOp() )
+ switch ( mod.getModificationOp() )
{
case ( DirContext.ADD_ATTRIBUTE ):
perms = ADD_PERMS;
+
// If the attribute is being created with an initial value ...
if ( entry.get( attr.getID() ) == null )
{
@@ -572,11 +573,13 @@
engine.checkPermission( proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name,
attr.getID(), null, perms, tuples, entry );
}
+
break;
case ( DirContext.REMOVE_ATTRIBUTE ):
perms = REMOVE_PERMS;
Attribute entryAttr = entry.get( attr.getID() );
+
if ( entryAttr != null )
{
// If there is only one value remaining in the attribute ...
@@ -587,6 +590,7 @@
attr.getID(), null, perms, tuples, entry );
}
}
+
break;
case ( DirContext.REPLACE_ATTRIBUTE ):
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -35,7 +36,6 @@
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;
@@ -376,7 +376,7 @@
* @param entry the group entry being modified
* @throws NamingException if there are problems accessing attribute values
*/
- public void groupModified( LdapDN name, ModificationItemImpl[] mods, Attributes entry ) throws NamingException
+ public void groupModified( LdapDN name, List<ModificationItem> mods, Attributes entry ) throws NamingException
{
Attribute members = null;
String memberAttrId = null;
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -33,6 +33,7 @@
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;
@@ -49,7 +50,6 @@
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;
@@ -237,16 +237,17 @@
}
- public void subentryModified( LdapDN normName, ModificationItemImpl[] mods, Attributes entry ) throws NamingException
+ public void subentryModified( LdapDN normName, List<ModificationItem> mods, Attributes entry ) throws NamingException
{
if ( !hasPrescriptiveACI( entry ) )
{
return;
}
- for ( int ii = 0; ii < mods.length; ii++ )
+ for (ModificationItem mod:mods )
{
- String attrID = mods[ii].getAttribute().getID();
+ String attrID = mod.getAttribute().getID();
+
if ( attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT ) ||
attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT_OID ) )
{
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -38,16 +38,12 @@
import org.apache.directory.server.core.partition.PartitionNexusProxy;
import org.apache.directory.server.core.normalization.NormalizationService;
import org.apache.directory.server.core.authn.AuthenticationService;
-import org.apache.directory.server.core.referral.ReferralService;
import org.apache.directory.server.core.authz.AuthorizationService;
import org.apache.directory.server.core.authz.DefaultAuthorizationService;
-import org.apache.directory.server.core.exception.ExceptionService;
import org.apache.directory.server.core.operational.OperationalAttributeService;
import org.apache.directory.server.core.schema.SchemaService;
import org.apache.directory.server.core.subtree.SubentryService;
-import org.apache.directory.server.core.collective.CollectiveAttributeService;
import org.apache.directory.server.core.event.EventService;
-import org.apache.directory.server.core.trigger.TriggerService;
import org.apache.directory.shared.ldap.aci.ACITuple;
import org.apache.directory.shared.ldap.aci.AuthenticationLevel;
import org.apache.directory.shared.ldap.aci.MicroOperation;
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -6,6 +6,7 @@
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.LinkedList;
+import java.util.List;
import java.util.Queue;
import javax.naming.NamingException;
@@ -284,11 +285,13 @@
buf.append( opContext.getDn() );
buf.append( "\nchangetype: modify" );
- ModificationItem[] mods = opContext.getModItems();
- for ( int ii = 0; ii < mods.length; ii++ )
+ List<ModificationItem> mods = opContext.getModItems();
+
+ for ( ModificationItem mod:mods )
{
- append( buf, mods[ii].getAttribute(), getModOpStr( mods[ii].getModificationOp() ) );
+ append( buf, mod.getAttribute(), getModOpStr( mod.getModificationOp() ) );
}
+
buf.append( "\n" );
// Enqueue the buffer onto a queue that is emptied by another thread asynchronously.
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -360,7 +360,6 @@
collectiveAttributesSchemaChecker.checkAdd( opContext.getDn(), opContext.getEntry() );
next.add( opContext );
- //super.add( next, opContext );
}
@@ -369,6 +368,5 @@
collectiveAttributesSchemaChecker.checkModify( opContext.getDn(), opContext.getModItems() );
next.modify( opContext );
- //super.modify( next, opContext );
}
}
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -20,11 +20,15 @@
package org.apache.directory.server.core.collective;
+import java.util.ArrayList;
+import java.util.List;
+
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 org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.partition.PartitionNexus;
@@ -78,22 +82,20 @@
public void checkModify( LdapDN normName, int modOp, Attributes mods ) throws NamingException
{
- ModificationItemImpl[] modsAsArray = new ModificationItemImpl[ mods.size() ];
+ List<ModificationItem> modsAsArray = new ArrayList<ModificationItem>( mods.size() );
NamingEnumeration<? extends Attribute> allAttrs = mods.getAll();
- int i = 0;
while ( allAttrs.hasMoreElements() )
{
Attribute attr = allAttrs.nextElement();
- modsAsArray[i] = new ModificationItemImpl( modOp, attr );
- i++;
+ modsAsArray.add( new ModificationItemImpl( modOp, attr ) );
}
checkModify( normName, modsAsArray );
}
- public void checkModify( LdapDN normName, ModificationItemImpl[] mods ) throws NamingException
+ public void checkModify( LdapDN normName, List<ModificationItem> mods ) throws NamingException
{
Attributes originalEntry = nexus.lookup( new LookupOperationContext( normName ) );
Attributes targetEntry = SchemaUtils.getTargetEntry( mods, originalEntry );
@@ -116,9 +118,9 @@
}
- private boolean addsAnyCollectiveAttributes( ModificationItemImpl[] mods ) throws NamingException
+ private boolean addsAnyCollectiveAttributes( List<ModificationItem> mods ) throws NamingException
{
- for ( ModificationItemImpl mod:mods )
+ for ( ModificationItem mod:mods )
{
Attribute attr = mod.getAttribute();
String attrID = attr.getID();
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java Thu Oct 4 04:45:53 2007
@@ -47,10 +47,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.naming.directory.Attributes;
-import java.io.File;
-import java.util.*;
-
/**
* A {@link Configuration} that starts up ApacheDS.
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -39,6 +39,8 @@
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.interceptor.BaseInterceptor;
@@ -65,7 +67,6 @@
import org.apache.directory.shared.ldap.filter.NotNode;
import org.apache.directory.shared.ldap.filter.ScopeNode;
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;
@@ -245,18 +246,18 @@
LdapDN name = opContext.getDn();
Attributes entry = opContext.getEntry();
- Set selecting = getSelectingSources( name, entry );
+ Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
if ( selecting.isEmpty() )
{
return;
}
- Iterator list = selecting.iterator();
+ Iterator<EventSourceRecord> list = selecting.iterator();
while ( list.hasNext() )
{
- EventSourceRecord rec = ( EventSourceRecord ) list.next();
+ EventSourceRecord rec = list.next();
NamingListener listener = rec.getNamingListener();
if ( listener instanceof NamespaceChangeListener )
@@ -278,14 +279,14 @@
next.delete( opContext );
//super.delete( next, opContext );
- Set selecting = getSelectingSources( name, entry );
+ Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
if ( selecting.isEmpty() )
{
return;
}
- Iterator list = selecting.iterator();
+ Iterator<EventSourceRecord> list = selecting.iterator();
while ( list.hasNext() )
{
@@ -303,19 +304,21 @@
}
- private void notifyOnModify( LdapDN name, ModificationItemImpl[] mods, Attributes oriEntry ) throws NamingException
+ private void notifyOnModify( LdapDN name, List<ModificationItem> mods, Attributes oriEntry ) throws NamingException
{
Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
- Set selecting = getSelectingSources( name, entry );
+ Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
+
if ( selecting.isEmpty() )
{
return;
}
- Iterator list = selecting.iterator();
+ Iterator<EventSourceRecord> list = selecting.iterator();
+
while ( list.hasNext() )
{
- EventSourceRecord rec = ( EventSourceRecord ) list.next();
+ EventSourceRecord rec =list.next();
NamingListener listener = rec.getNamingListener();
if ( listener instanceof ObjectChangeListener )
@@ -345,16 +348,18 @@
private void notifyOnNameChange( LdapDN oldName, LdapDN newName ) throws NamingException
{
Attributes entry = nexus.lookup( new LookupOperationContext( newName ) );
- Set selecting = getSelectingSources( oldName, entry );
+ Set<EventSourceRecord> selecting = getSelectingSources( oldName, entry );
+
if ( selecting.isEmpty() )
{
return;
}
- Iterator list = selecting.iterator();
+ Iterator<EventSourceRecord> list = selecting.iterator();
+
while ( list.hasNext() )
{
- EventSourceRecord rec = ( EventSourceRecord ) list.next();
+ EventSourceRecord rec = list.next();
NamingListener listener = rec.getNamingListener();
if ( listener instanceof NamespaceChangeListener )
@@ -407,15 +412,15 @@
}
- Set getSelectingSources( LdapDN name, Attributes entry ) throws NamingException
+ Set<EventSourceRecord> getSelectingSources( LdapDN name, Attributes entry ) throws NamingException
{
if ( sources.isEmpty() )
{
return Collections.EMPTY_SET;
}
- Set<Object> selecting = new HashSet<Object>();
- Iterator list = sources.values().iterator();
+ Set<EventSourceRecord> selecting = new HashSet<EventSourceRecord>();
+ Iterator<Object> list = sources.values().iterator();
while ( list.hasNext() )
{
@@ -427,18 +432,18 @@
if ( evaluator.evaluate( rec.getFilter(), name.toNormName(), entry ) )
{
- selecting.add( obj );
+ selecting.add( rec );
}
}
else if ( obj instanceof List )
{
- List records = ( List ) obj;
- for ( int ii = 0; ii < records.size(); ii++ )
+ List<EventSourceRecord> records = ( List<EventSourceRecord> ) obj;
+
+ for ( EventSourceRecord rec:records )
{
- EventSourceRecord rec = ( EventSourceRecord ) records.get( ii );
if ( evaluator.evaluate( rec.getFilter(), name.toNormName(), entry ) )
{
- selecting.add( obj );
+ selecting.add( rec );
}
}
}
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=581861&r1=581860&r2=581861&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 Thu Oct 4 04:45:53 2007
@@ -20,6 +20,7 @@
package org.apache.directory.server.core.exception;
+import java.util.List;
import java.util.Map;
import javax.naming.NamingEnumeration;
@@ -27,6 +28,7 @@
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;
@@ -314,13 +316,13 @@
assertHasEntry( nextInterceptor, msg, opContext.getDn() );
Attributes entry = nexus.lookup( new LookupOperationContext( opContext.getDn() ) );
- ModificationItemImpl[] items = opContext.getModItems();
+ List<ModificationItem> items = opContext.getModItems();
- for ( int ii = 0; ii < items.length; ii++ )
+ for ( ModificationItem item:items )
{
- if ( items[ii].getModificationOp() == DirContext.ADD_ATTRIBUTE )
+ if ( item.getModificationOp() == DirContext.ADD_ATTRIBUTE )
{
- Attribute modAttr = items[ii].getAttribute();
+ Attribute modAttr = item.getAttribute();
Attribute entryAttr = entry.get( modAttr.getID() );
if ( entryAttr != null )
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java Thu Oct 4 04:45:53 2007
@@ -19,6 +19,9 @@
*/
package org.apache.directory.server.core.interceptor.context;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
@@ -40,7 +43,7 @@
public class ModifyOperationContext extends AbstractOperationContext
{
/** The modification items */
- private ModificationItemImpl[] modItems;
+ private List<ModificationItem> modItems;
/**
*
@@ -57,7 +60,7 @@
* Creates a new instance of ModifyOperationContext.
*
*/
- public ModifyOperationContext( LdapDN dn, ModificationItemImpl[] modItems )
+ public ModifyOperationContext( LdapDN dn, List<ModificationItem> modItems )
{
super( dn );
this.modItems = modItems;
@@ -67,7 +70,7 @@
* Set the modified attributes
* @param modItems The modified attributes
*/
- public void setModItems( ModificationItemImpl[] modItems )
+ public void setModItems( List<ModificationItem> modItems )
{
this.modItems = modItems;
}
@@ -75,20 +78,20 @@
/**
* @return The modifications
*/
- public ModificationItemImpl[] getModItems()
+ public List<ModificationItem> getModItems()
{
return modItems;
}
- public static ModificationItemImpl[] createModItems( Attributes attributes, int modOp ) throws NamingException
+ @SuppressWarnings( value = "unchecked" )
+ public static List<ModificationItem> createModItems( Attributes attributes, int modOp ) throws NamingException
{
- ModificationItemImpl[] items = new ModificationItemImpl[attributes.size()];
- NamingEnumeration e = attributes.getAll();
- int i = 0;
+ List<ModificationItem> items = new ArrayList<ModificationItem>( attributes.size() );
+ NamingEnumeration<Attribute> e = (NamingEnumeration<Attribute>)attributes.getAll();
while ( e.hasMore() )
{
- items[i++] = new ModificationItemImpl( modOp, ( Attribute ) e.next() );
+ items.add( new ModificationItemImpl( modOp, e.next() ) );
}
return items;
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Thu Oct 4 04:45:53 2007
@@ -40,6 +40,7 @@
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.event.EventContext;
@@ -375,7 +376,7 @@
/**
* Used to encapsulate [de]marshalling of controls before and after modify operations.
*/
- protected void doModifyOperation( LdapDN dn, ModificationItemImpl[] modItems ) throws NamingException
+ protected void doModifyOperation( LdapDN dn, List<ModificationItem> modItems ) throws NamingException
{
// setup the op context and populate with request controls
ModifyOperationContext opCtx = new ModifyOperationContext( dn, modItems );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Thu Oct 4 04:45:53 2007
@@ -22,8 +22,10 @@
import java.io.Serializable;
import java.text.ParseException;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import javax.naming.Name;
import javax.naming.NamingEnumeration;
@@ -159,17 +161,17 @@
*/
public void modifyAttributes( Name name, int modOp, Attributes attrs ) throws NamingException
{
- ModificationItemImpl[] modItems = null;
+ List<ModificationItem> modItems = null;
if ( attrs != null )
{
- modItems = new ModificationItemImpl[attrs.size()];
- NamingEnumeration e = attrs.getAll();
+ modItems = new ArrayList<ModificationItem>( attrs.size() );
+ NamingEnumeration<Attribute> e = (NamingEnumeration<Attribute>)attrs.getAll();
int i = 0;
while ( e.hasMore() )
{
- modItems[i++] = new ModificationItemImpl( modOp, ( Attribute ) e.next() ) ;
+ modItems.add( new ModificationItemImpl( modOp, ( Attribute ) e.next() ) );
}
}
@@ -216,11 +218,11 @@
*/
public void modifyAttributes( Name name, ModificationItem[] mods ) throws NamingException
{
- ModificationItemImpl[] newMods = new ModificationItemImpl[ mods.length ];
+ List<ModificationItem> newMods = new ArrayList<ModificationItem>( mods.length );
- for ( int i = 0; i < mods.length; i++ )
+ for ( ModificationItem mod:mods )
{
- newMods[i] = new ModificationItemImpl( mods[i] );
+ newMods.add( new ModificationItemImpl( mod ) );
}
doModifyOperation( buildTarget( new LdapDN( name ) ), newMods );
@@ -231,7 +233,7 @@
* @see javax.naming.directory.DirContext#modifyAttributes(
* javax.naming.Name, javax.naming.directory.ModificationItem[])
*/
- public void modifyAttributes( Name name, ModificationItemImpl[] mods ) throws NamingException
+ public void modifyAttributes( Name name, List<ModificationItem> mods ) throws NamingException
{
doModifyOperation( buildTarget( new LdapDN( name ) ), mods );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationService.java Thu Oct 4 04:45:53 2007
@@ -21,10 +21,12 @@
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -32,8 +34,8 @@
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
-import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.Interceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -215,30 +217,32 @@
void detectPasswordModification( ModifyOperationContext modContext, ModifySubContext subContext )
throws NamingException
{
- ModificationItemImpl[] mods = modContext.getModItems();
+ List<ModificationItem> mods = modContext.getModItems();
String operation = null;
// Loop over attributes being modified to pick out 'userPassword' and 'krb5PrincipalName'.
- for ( int ii = 0; ii < mods.length; ii++ )
+ for ( ModificationItem mod:mods )
{
if ( log.isDebugEnabled() )
{
- switch ( mods[ii].getModificationOp() )
+ switch ( mod.getModificationOp() )
{
case DirContext.ADD_ATTRIBUTE:
operation = "Adding";
break;
+
case DirContext.REMOVE_ATTRIBUTE:
operation = "Removing";
break;
+
case DirContext.REPLACE_ATTRIBUTE:
operation = "Replacing";
break;
}
}
- Attribute attr = mods[ii].getAttribute();
+ Attribute attr = mod.getAttribute();
String attrId = attr.getID();
if ( attrId.equalsIgnoreCase( "userPassword" ) )
@@ -352,7 +356,7 @@
*/
void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext )
{
- ModificationItemImpl[] mods = modContext.getModItems();
+ List<ModificationItem> mods = modContext.getModItems();
String principalName = subContext.getPrincipalName();
String userPassword = subContext.getUserPassword();
@@ -362,12 +366,12 @@
Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
- Set<ModificationItemImpl> newModsList = new HashSet<ModificationItemImpl>();
+ List<ModificationItem> newModsList = new ArrayList<ModificationItem>();
// Make sure we preserve any other modification items.
- for ( int ii = 0; ii < mods.length; ii++ )
+ for ( ModificationItem mod:mods )
{
- newModsList.add( mods[ii] );
+ newModsList.add( mod );
}
// Add our modification items.
@@ -377,9 +381,7 @@
KerberosAttribute.VERSION, Integer.toString( kvno ) ) ) );
newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, getKeyAttribute( keys ) ) );
- ModificationItemImpl[] newMods = newModsList.toArray( mods );
-
- modContext.setModItems( newMods );
+ modContext.setModItems( newModsList );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyService.java Thu Oct 4 04:45:53 2007
@@ -27,6 +27,7 @@
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.Interceptor;
@@ -34,7 +35,6 @@
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.util.AttributeUtils;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -126,11 +126,11 @@
{
LdapDN name = modContext.getDn();
- ModificationItemImpl[] mods = modContext.getModItems();
+ List<ModificationItem> mods = modContext.getModItems();
String operation = null;
- for ( ModificationItemImpl mod:mods )
+ for ( ModificationItem mod:mods )
{
if ( log.isDebugEnabled() )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java Thu Oct 4 04:45:53 2007
@@ -21,7 +21,6 @@
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -32,6 +31,7 @@
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;
@@ -174,27 +174,37 @@
public void modify( NextInterceptor nextInterceptor, ModifyOperationContext opContext )
throws NamingException
{
+ nextInterceptor.modify( opContext );
+
+ if ( opContext.getDn().getNormName().equals( subschemaSubentryDn.getNormName() ) )
+ {
+ return;
+ }
+
// -------------------------------------------------------------------
// Add the operational attributes for the modifier first
// -------------------------------------------------------------------
-
- List<ModificationItemImpl> modItemList =
- new ArrayList<ModificationItemImpl>( opContext.getModItems().length + 2 );
- Collections.addAll( modItemList, opContext.getModItems() );
+
+ List<ModificationItem> modItemList = new ArrayList<ModificationItem>(2);
Attribute attribute = new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT );
attribute.add( getPrincipal().getName() );
- modItemList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute ) );
+ ModificationItemImpl modifiers = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute );
+ modifiers.setServerModified();
+ modItemList.add( modifiers );
attribute = new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT );
attribute.add( DateUtils.getGeneralizedTime() );
- modItemList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute ) );
+ ModificationItemImpl timestamp = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute );
+ timestamp.setServerModified();
+ modItemList.add( timestamp );
// -------------------------------------------------------------------
// Make the modify() call happen
// -------------------------------------------------------------------
- nextInterceptor.modify( opContext );
+ ModifyOperationContext newModify = new ModifyOperationContext( opContext.getDn(), modItemList );
+ nexus.modify( newModify );
}
@@ -218,7 +228,7 @@
newDn.add( opContext.getNewRdn() );
newDn.normalize( registry.getNormalizerMapping() );
- ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+ List<ModificationItem> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
ModifyOperationContext newModify = new ModifyOperationContext( newDn, items );
@@ -240,7 +250,7 @@
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+ List<ModificationItem> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
ModifyOperationContext newModify =
@@ -265,11 +275,12 @@
attribute.add( DateUtils.getGeneralizedTime() );
attributes.put( attribute );
- ModificationItemImpl[] items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
+ List<ModificationItem> items = ModifyOperationContext.createModItems( attributes, DirContext.REPLACE_ATTRIBUTE );
ModifyOperationContext newModify =
new ModifyOperationContext(
opContext.getParent(), items );
+
nexus.modify( newModify );
}
@@ -334,11 +345,11 @@
*/
private boolean filter( Attributes attributes ) throws NamingException
{
- NamingEnumeration list = attributes.getIDs();
+ NamingEnumeration<String> list = attributes.getIDs();
while ( list.hasMore() )
{
- String attrId = ( String ) list.next();
+ String attrId = list.next();
AttributeType type = null;
@@ -378,11 +389,11 @@
idsSet.add( id.toLowerCase() );
}
- NamingEnumeration list = entry.getIDs();
+ NamingEnumeration<String> list = entry.getIDs();
while ( list.hasMore() )
{
- String attrId = ( ( String ) list.nextElement() ).toLowerCase();
+ String attrId = list.nextElement().toLowerCase();
if ( !idsSet.contains( attrId ) )
{
@@ -470,12 +481,13 @@
// below we only process multi-valued rdns
StringBuffer buf = new StringBuffer();
- for ( Iterator jj = rdn.iterator(); jj.hasNext(); /**/ )
+ for ( Iterator<AttributeTypeAndValue> atavs = rdn.iterator(); atavs.hasNext(); /**/ )
{
- AttributeTypeAndValue atav = ( AttributeTypeAndValue ) jj.next();
+ AttributeTypeAndValue atav = atavs.next();
String type = registry.lookup( rdn.getNormType() ).getName();
buf.append( type ).append( '=' ).append( atav.getValue() );
- if ( jj.hasNext() )
+
+ if ( atavs.hasNext() )
{
buf.append( '+' );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/PartitionNexusProxy.java Thu Oct 4 04:45:53 2007
@@ -167,8 +167,8 @@
c.add( AuthorizationService.class.getName() );
c.add( DefaultAuthorizationService.class.getName() );
// c.add( ExceptionService.class.getName() );
- c.add( OperationalAttributeService.class.getName() );
c.add( SchemaService.class.getName() );
+ c.add( OperationalAttributeService.class.getName() );
c.add( SubentryService.class.getName() );
// c.add( CollectiveAttributeService.class.getName() );
c.add( EventService.class.getName() );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Thu Oct 4 04:45:53 2007
@@ -34,6 +34,7 @@
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;
@@ -79,7 +80,6 @@
import org.apache.directory.shared.ldap.exception.LdapReferralException;
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.schema.AttributeType;
@@ -110,7 +110,7 @@
private ReferralLut lut = new ReferralLut();
private PartitionNexus nexus;
- private Hashtable env;
+ private Hashtable<String, Object> env;
private AttributeTypeRegistry attrRegistry;
private OidRegistry oidRegistry;
@@ -287,11 +287,11 @@
oidRegistry = dsConfig.getRegistries().getOidRegistry();
env = dsConfig.getEnvironment();
- Iterator suffixes = nexus.listSuffixes( null );
+ Iterator<String> suffixes = nexus.listSuffixes( null );
while ( suffixes.hasNext() )
{
- LdapDN suffix = new LdapDN( ( String ) suffixes.next() );
+ LdapDN suffix = new LdapDN( suffixes.next() );
addReferrals(
nexus.search(
new SearchOperationContext( suffix, env, getReferralFilter(), getControls() ) ), suffix );
@@ -766,7 +766,7 @@
}
- private void checkModify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+ private void checkModify( LdapDN name, List<ModificationItem> mods ) throws NamingException
{
boolean isTargetReferral = lut.isReferral( name );
@@ -774,13 +774,13 @@
// Check and update lut if we change the objectClass
// -------------------------------------------------------------------
- for ( int ii = 0; ii < mods.length; ii++ )
+ for ( ModificationItem mod:mods )
{
- if ( mods[ii].getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
+ if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
{
- boolean modsOcHasReferral = hasValue( mods[ii].getAttribute(), SchemaConstants.REFERRAL_OC );
+ boolean modsOcHasReferral = hasValue( mod.getAttribute(), SchemaConstants.REFERRAL_OC );
- switch ( mods[ii].getModificationOp() )
+ switch ( mod.getModificationOp() )
{
/*
* if ADD op where refferal is added to objectClass of a
@@ -791,6 +791,7 @@
{
lut.referralAdded( name );
}
+
break;
/*
@@ -802,6 +803,7 @@
{
lut.referralDeleted( name );
}
+
break;
/*
@@ -821,6 +823,7 @@
{
lut.referralAdded( name );
}
+
break;
default:
@@ -839,7 +842,7 @@
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
LdapDN name = opContext.getDn();
- ModificationItemImpl[] mods = opContext.getModItems();
+ List<ModificationItem> mods = opContext.getModItems();
// handle a normal modify without following referrals
if ( refval == null || refval.equals( IGNORE ) )
@@ -899,7 +902,7 @@
Partition partition = opContext.getPartition();
LdapDN suffix = partition.getSuffixDn();
Invocation invocation = InvocationStack.getInstance().peek();
- NamingEnumeration list = invocation.getProxy().search(
+ NamingEnumeration<SearchResult> list = invocation.getProxy().search(
new SearchOperationContext( suffix, env, getReferralFilter(), getControls() ),
SEARCH_BYPASS );
addReferrals( list, suffix );
@@ -910,7 +913,7 @@
{
// remove referrals immediately before removing the partition
Invocation invocation = InvocationStack.getInstance().peek();
- NamingEnumeration list = invocation.getProxy().search(
+ NamingEnumeration<SearchResult> list = invocation.getProxy().search(
new SearchOperationContext(
opContext.getDn(),
env,
@@ -924,11 +927,11 @@
}
- private void addReferrals( NamingEnumeration referrals, LdapDN base ) throws NamingException
+ private void addReferrals( NamingEnumeration<SearchResult> referrals, LdapDN base ) throws NamingException
{
while ( referrals.hasMore() )
{
- SearchResult r = ( SearchResult ) referrals.next();
+ SearchResult r = referrals.next();
LdapDN referral = null;
LdapDN result = new LdapDN( r.getName() );
result.normalize( attrRegistry.getNormalizerMapping() );
@@ -949,11 +952,11 @@
}
- private void deleteReferrals( NamingEnumeration referrals, LdapDN base ) throws NamingException
+ private void deleteReferrals( NamingEnumeration<SearchResult> referrals, LdapDN base ) throws NamingException
{
while ( referrals.hasMore() )
{
- SearchResult r = ( SearchResult ) referrals.next();
+ SearchResult r = referrals.next();
LdapDN referral = null;
LdapDN result = new LdapDN( r.getName() );
result.normalize( attrRegistry.getNormalizerMapping() );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java Thu Oct 4 04:45:53 2007
@@ -21,18 +21,19 @@
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchResult;
import org.apache.directory.server.constants.MetaSchemaConstants;
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.schema.registries.Registries;
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;
@@ -108,7 +109,7 @@
}
- public final void modify( LdapDN name, ModificationItemImpl[] mods, Attributes entry,
+ public final void modify( LdapDN name, List<ModificationItem> mods, Attributes entry,
Attributes targetEntry, boolean cascade ) throws NamingException
{
modify( name, entry, targetEntry, cascade );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Thu Oct 4 04:45:53 2007
@@ -21,6 +21,7 @@
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -28,6 +29,7 @@
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
import org.apache.directory.server.constants.MetaSchemaConstants;
import org.apache.directory.server.schema.bootstrap.Schema;
@@ -36,7 +38,6 @@
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
-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;
@@ -123,11 +124,12 @@
* @param mods the attribute modifications as an ModificationItem arry
* @param entry the entry after the modifications have been applied
*/
- public void modify( LdapDN name, ModificationItemImpl[] mods, Attributes entry,
+ public void modify( LdapDN name, List<ModificationItem> mods, Attributes entry,
Attributes targetEntry, boolean cascade ) throws NamingException
{
Attribute disabledInEntry = AttributeUtils.getAttribute( entry, disabledAT );
- ModificationItemImpl disabledModification = AttributeUtils.getModificationItem( mods, disabledAT );
+ ModificationItem disabledModification = AttributeUtils.getModificationItem( mods, disabledAT );
+
if ( disabledModification != null )
{
disable( name, disabledModification.getModificationOp(), disabledModification.getAttribute(),
@@ -137,6 +139,7 @@
// check if the new schema is enabled or disabled
boolean isEnabled = false;
Attribute disabled = AttributeUtils.getAttribute( targetEntry, this.disabledAT );
+
if ( disabled == null )
{
isEnabled = true;
@@ -147,6 +150,7 @@
}
Attribute dependencies = AttributeUtils.getAttribute( mods, dependenciesAT );
+
if ( dependencies != null )
{
checkForDependencies( isEnabled, targetEntry );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaChangeHandler.java Thu Oct 4 04:45:53 2007
@@ -20,10 +20,12 @@
package org.apache.directory.server.core.schema;
+import java.util.List;
+
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -37,13 +39,19 @@
public interface SchemaChangeHandler
{
void add( LdapDN name, Attributes entry ) throws NamingException;
+
void delete( LdapDN name, Attributes entry, boolean cascaded ) throws NamingException;
+
void rename( LdapDN name, Attributes entry, String newRdn, boolean cascaded ) throws NamingException;
+
void modify( LdapDN name, int modOp, Attributes mods, Attributes entry, Attributes targetEntry, boolean cascaded )
throws NamingException;
- void modify( LdapDN name, ModificationItemImpl[] mods, Attributes entry, Attributes targetEntry, boolean cascaded )
+
+ void modify( LdapDN name, List<ModificationItem> mods, Attributes entry, Attributes targetEntry, boolean cascaded )
throws NamingException;
+
void move( LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn, Attributes entry,
boolean cascaded ) throws NamingException;
+
void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry, boolean cascaded ) throws NamingException;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java Thu Oct 4 04:45:53 2007
@@ -20,10 +20,12 @@
package org.apache.directory.server.core.schema;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -32,6 +34,7 @@
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.MetaSchemaConstants;
@@ -410,7 +413,7 @@
}
- public void modify( LdapDN name, ModificationItemImpl[] mods, Attributes entry, Attributes targetEntry,
+ public void modify( LdapDN name, List<ModificationItem> mods, Attributes entry, Attributes targetEntry,
boolean doCascadeModify ) throws NamingException
{
Attribute oc = AttributeUtils.getAttribute( entry, objectClassAT );
@@ -418,6 +421,7 @@
for ( int ii = 0; ii < oc.size(); ii++ )
{
String oid = globalRegistries.getOidRegistry().getOid( ( String ) oc.get( ii ) );
+
if ( objectClass2handlerMap.containsKey( oid ) )
{
SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
@@ -533,20 +537,23 @@
* @param subentry the attributes of the subentry
* @param targetSubentry the target subentry after being modified
*/
- public void modifySchemaSubentry( LdapDN name, ModificationItemImpl[] mods, Attributes subentry,
+ public void modifySchemaSubentry( LdapDN name, List<ModificationItem> mods, Attributes subentry,
Attributes targetSubentry, boolean doCascadeModify ) throws NamingException
{
- for ( ModificationItemImpl mod : mods )
+ for ( ModificationItem mod : mods )
{
String opAttrOid = globalRegistries.getOidRegistry().getOid( mod.getAttribute().getID() );
+
switch ( mod.getModificationOp() )
{
case( DirContext.ADD_ATTRIBUTE ):
modifyAddOperation( opAttrOid, mod.getAttribute(), doCascadeModify );
break;
+
case( DirContext.REMOVE_ATTRIBUTE ):
modifyRemoveOperation( opAttrOid, mod.getAttribute(), doCascadeModify );
break;
+
case( DirContext.REPLACE_ATTRIBUTE ):
throw new LdapOperationNotSupportedException(
"Modify REPLACE operations on schema subentries are not allowed: " +
@@ -554,12 +561,13 @@
"that reside in schema operational attributes. Instead use \na " +
"targeted combination of modify ADD and REMOVE operations.",
ResultCodeEnum.UNWILLING_TO_PERFORM );
+
default:
throw new IllegalStateException( "Undefined modify operation: " + mod.getModificationOp() );
}
}
- if ( mods != null || mods.length > 0 )
+ if ( mods.size() > 0 )
{
updateSchemaModificationAttributes();
}
@@ -905,11 +913,14 @@
String modifiersName = ctx.getPrincipal().getJndiName().getNormName();
String modifyTimestamp = DateUtils.getGeneralizedTime();
- ModificationItemImpl[] mods = new ModificationItemImpl[2];
- mods[0] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
- new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, modifyTimestamp ) );
- mods[1] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
- new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, modifiersName ) );
+ List<ModificationItem> mods = new ArrayList<ModificationItem>( 2 );
+
+ mods.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
+ new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, modifyTimestamp ) ) );
+
+ mods.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
+ new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, modifiersName ) ) );
+
LdapDN name = new LdapDN( "cn=schemaModifications,ou=schema" );
name.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping() );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Thu Oct 4 04:45:53 2007
@@ -20,8 +20,10 @@
package org.apache.directory.server.core.schema;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -31,6 +33,7 @@
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;
@@ -558,7 +561,7 @@
dn.normalize( attrRegistry.getNormalizerMapping() );
Attributes entry = partition.lookup( new LookupOperationContext( dn ) );
Attribute disabledAttr = AttributeUtils.getAttribute( entry, disabledAttributeType );
- ModificationItemImpl[] mods = new ModificationItemImpl[3];
+ List<ModificationItem> mods = new ArrayList<ModificationItem>( 3 );
if ( disabledAttr == null )
{
@@ -573,12 +576,14 @@
return;
}
- mods[0] = new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE,
- new AttributeImpl( MetaSchemaConstants.M_DISABLED_AT ) );
- mods[1] = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
- new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT, PartitionNexus.ADMIN_PRINCIPAL ) );
- mods[2] = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
- new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ) );
+ mods.add( new ModificationItemImpl( DirContext.REMOVE_ATTRIBUTE,
+ new AttributeImpl( MetaSchemaConstants.M_DISABLED_AT ) ) );
+
+ mods.add( new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
+ new AttributeImpl( SchemaConstants.MODIFIERS_NAME_AT, PartitionNexus.ADMIN_PRINCIPAL ) ) );
+
+ mods.add( new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
+ new AttributeImpl( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ) ) );
partition.modify( new ModifyOperationContext( dn, mods ) );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Thu Oct 4 04:45:53 2007
@@ -37,6 +37,7 @@
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InvalidAttributeValueException;
+import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
@@ -353,7 +354,7 @@
*/
private void computeSuperiors() throws NamingException
{
- Iterator objectClasses = registries.getObjectClassRegistry().iterator();
+ Iterator<ObjectClass> objectClasses = registries.getObjectClassRegistry().iterator();
superiors = new HashMap<String, List<ObjectClass>>();
allMust = new HashMap<String, List<AttributeType>>();
allMay = new HashMap<String, List<AttributeType>>();
@@ -363,7 +364,7 @@
{
List<ObjectClass> ocSuperiors = new ArrayList<ObjectClass>();
- ObjectClass objectClass = (ObjectClass)objectClasses.next();
+ ObjectClass objectClass = objectClasses.next();
superiors.put( objectClass.getOid(), ocSuperiors );
computeOCSuperiors( objectClass, ocSuperiors, new HashSet<String>() );
@@ -724,11 +725,11 @@
if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.MATCHING_RULE_USE_AT_OID ) )
{
attr = new AttributeImpl( SchemaConstants.MATCHING_RULE_USE_AT );
- Iterator list = registries.getMatchingRuleUseRegistry().iterator();
+ Iterator<MatchingRuleUse> list = registries.getMatchingRuleUseRegistry().iterator();
while ( list.hasNext() )
{
- MatchingRuleUse mru = ( MatchingRuleUse ) list.next();
+ MatchingRuleUse mru = list.next();
attr.add( SchemaUtils.render( mru ).toString() );
}
@@ -766,11 +767,11 @@
if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.DIT_STRUCTURE_RULES_AT_OID ) )
{
attr = new AttributeImpl( SchemaConstants.DIT_STRUCTURE_RULES_AT );
- Iterator list = registries.getDitStructureRuleRegistry().iterator();
+ Iterator<DITStructureRule> list = registries.getDitStructureRuleRegistry().iterator();
while ( list.hasNext() )
{
- DITStructureRule dsr = ( DITStructureRule ) list.next();
+ DITStructureRule dsr =list.next();
attr.add( SchemaUtils.render( dsr ).toString() );
}
@@ -780,11 +781,11 @@
if ( returnAllOperationalAttributes || setOids.contains( SchemaConstants.NAME_FORMS_AT_OID ) )
{
attr = new AttributeImpl( SchemaConstants.NAME_FORMS_AT );
- Iterator list = registries.getNameFormRegistry().iterator();
+ Iterator<NameForm> list = registries.getNameFormRegistry().iterator();
while ( list.hasNext() )
{
- NameForm nf = ( NameForm ) list.next();
+ NameForm nf = list.next();
attr.add( SchemaUtils.render( nf ).toString() );
}
@@ -1050,13 +1051,13 @@
// We must select all the ObjectClasses, except 'top',
// but including all the inherited ObjectClasses
- NamingEnumeration ocs = objectClasses.getAll();
+ NamingEnumeration<String> ocs = (NamingEnumeration<String>)objectClasses.getAll();
boolean hasExtensibleObject = false;
while ( ocs.hasMoreElements() )
{
- String objectClassName = (String)ocs.nextElement();
+ String objectClassName = ocs.nextElement();
if ( SchemaConstants.TOP_OC.equals( objectClassName ) )
{
@@ -1084,14 +1085,14 @@
return hasExtensibleObject;
}
- private Set<String> getAllMust( NamingEnumeration objectClasses ) throws NamingException
+ private Set<String> getAllMust( NamingEnumeration<String> objectClasses ) throws NamingException
{
Set<String> must = new HashSet<String>();
// Loop on all objectclasses
while ( objectClasses.hasMoreElements() )
{
- String ocName = (String)objectClasses.nextElement();
+ String ocName = objectClasses.nextElement();
ObjectClass oc = registries.getObjectClassRegistry().lookup( ocName );
AttributeType[] types = oc.getMustList();
@@ -1109,7 +1110,7 @@
return must;
}
- private Set<String> getAllAllowed( NamingEnumeration objectClasses, Set<String> must ) throws NamingException
+ private Set<String> getAllAllowed( NamingEnumeration<String> objectClasses, Set<String> must ) throws NamingException
{
Set<String> allowed = new HashSet<String>( must );
@@ -1119,7 +1120,7 @@
// Loop on all objectclasses
while ( objectClasses.hasMoreElements() )
{
- String ocName = (String)objectClasses.nextElement();
+ String ocName = objectClasses.nextElement();
ObjectClass oc = registries.getObjectClassRegistry().lookup( ocName );
AttributeType[] types = oc.getMayList();
@@ -1158,11 +1159,11 @@
objectClassesUP.add( SchemaConstants.TOP_OC );
// Construct the new list of ObjectClasses
- NamingEnumeration ocList = objectClassAttr.getAll();
+ NamingEnumeration<String> ocList = (NamingEnumeration<String>)objectClassAttr.getAll();
while ( ocList.hasMoreElements() )
{
- String ocName = ( String ) ocList.nextElement();
+ String ocName = ocList.nextElement();
if ( !ocName.equalsIgnoreCase( SchemaConstants.TOP_OC ) )
{
@@ -1260,7 +1261,7 @@
{
Attributes entry = null;
LdapDN name = opContext.getDn();
- ModificationItemImpl[] mods = opContext.getModItems();
+ List<ModificationItem> mods = opContext.getModItems();
// handle operations against the schema subentry in the schema service
// and never try to look it up in the nexus below
@@ -1287,14 +1288,14 @@
Attributes tmpEntry = ( Attributes ) entry.clone();
Set<String> modset = new HashSet<String>();
- ModificationItemImpl objectClassMod = null;
+ ModificationItem objectClassMod = null;
// Check that we don't have two times the same modification.
// This is somehow useless, as modification operations are supposed to
// be atomic, so we may have a sucession of Add, DEL, ADD operations
// for the same attribute, and this will be legal.
// @TODO : check if we can remove this test.
- for ( ModificationItemImpl mod:mods )
+ for ( ModificationItem mod:mods )
{
if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
{
@@ -1354,17 +1355,17 @@
// (deletion) causes an error
// -------------------------------------------------------------------
- if ( ( mods.length == 1 ) &&
- ( mods[0].getAttribute().size() == 0 ) &&
- ( mods[0].getModificationOp() == DirContext.REPLACE_ATTRIBUTE ) &&
- ! atRegistry.hasAttributeType( mods[0].getAttribute().getID() ) )
+ if ( ( mods.size() == 1 ) &&
+ ( mods.get( 0 ).getAttribute().size() == 0 ) &&
+ ( mods.get( 0 ).getModificationOp() == DirContext.REPLACE_ATTRIBUTE ) &&
+ ! atRegistry.hasAttributeType( mods.get( 0 ).getAttribute().getID() ) )
{
return;
}
// Now, apply the modifications on the cloned entry before applying it on the
// real object.
- for ( ModificationItemImpl mod:mods )
+ for ( ModificationItem mod:mods )
{
int modOp = mod.getModificationOp();
Attribute change = mod.getAttribute();
@@ -1375,7 +1376,7 @@
throw new LdapInvalidAttributeIdentifierException();
}
- // We will forbid modification of operationnal attributes which are not
+ // We will forbid modification of operational attributes which are not
// user modifiable.
AttributeType attributeType = atRegistry.lookup( change.getID() );
@@ -1734,8 +1735,8 @@
alterObjectClasses( objectClassAttr );
// Now we can process the MUST and MAY attributes
- Set<String> must = getAllMust( objectClassAttr.getAll() );
- Set<String> allowed = getAllAllowed( objectClassAttr.getAll(), must );
+ Set<String> must = getAllMust( (NamingEnumeration<String>)objectClassAttr.getAll() );
+ Set<String> allowed = getAllAllowed( (NamingEnumeration<String>)objectClassAttr.getAll(), must );
boolean hasExtensibleObject = getObjectClasses( objectClassAttr, ocs );