You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2015/09/27 00:48:51 UTC
svn commit: r1705497 [1/2] - in /directory/apacheds/trunk:
core-api/src/main/java/org/apache/directory/server/core/api/
core-api/src/main/java/org/apache/directory/server/core/api/interceptor/
core-api/src/main/java/org/apache/directory/server/core/api...
Author: seelmann
Date: Sat Sep 26 22:48:49 2015
New Revision: 1705497
URL: http://svn.apache.org/viewvc?rev=1705497&view=rev
Log:
* Introduce AttributeTypeProvider
* Remove non-final static variables that hold AttributeType references
* Fix checkstyle warnings
Added:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/AttributeTypeProvider.java (with props)
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ObjectClassProvider.java (with props)
directory/apacheds/trunk/service/src/checkstyle/
directory/apacheds/trunk/service/src/checkstyle/suppressions.xml (with props)
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/SchemaPartition.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java
directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
directory/apacheds/trunk/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
directory/apacheds/trunk/interceptors/collective/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
directory/apacheds/trunk/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryManager.java
directory/apacheds/trunk/interceptors/subtree/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
directory/apacheds/trunk/interceptors/trigger/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
directory/apacheds/trunk/ldap-client-test/src/main/java/org/apache/directory/shared/client/api/LdapApiIntegrationUtils.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/request/SearchRequestHandler.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/consumer/ReplicationConsumerImpl.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplConsumerManager.java
directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/listener/ConfigChangeListener.java
directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/UberjarMain.java
Added: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/AttributeTypeProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/AttributeTypeProvider.java?rev=1705497&view=auto
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/AttributeTypeProvider.java (added)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/AttributeTypeProvider.java Sat Sep 26 22:48:49 2015
@@ -0,0 +1,292 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.core.api;
+
+
+import org.apache.directory.api.ldap.model.constants.SchemaConstants;
+import org.apache.directory.api.ldap.model.schema.AttributeType;
+import org.apache.directory.api.ldap.model.schema.SchemaManager;
+
+
+/**
+ * Provides commonly used {@link AttributeType}s.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AttributeTypeProvider
+{
+ private final AttributeType accessControlSubentries;
+ private final AttributeType administrativeRole;
+ private final AttributeType collectiveAttributeSubentries;
+ private final AttributeType collectiveExclusions;
+ private final AttributeType creatorsName;
+ private final AttributeType createTimestamp;
+ private final AttributeType entryACI;
+ private final AttributeType entryCSN;
+ private final AttributeType entryDN;
+ private final AttributeType entryUUID;
+ private final AttributeType member;
+ private final AttributeType modifiersName;
+ private final AttributeType modifyTimestamp;
+ private final AttributeType objectClass;
+ private final AttributeType prescriptiveACI;
+ private final AttributeType subentryACI;
+ private final AttributeType subschemaSubentry;
+ private final AttributeType subtreeSpecification;
+ private final AttributeType triggerExecutionSubentries;
+ private final AttributeType uniqueMember;
+ private final AttributeType userPassword;
+
+ private final AttributeType[] subentryOperationalAttributes;
+
+
+ public AttributeTypeProvider( SchemaManager schemaManager )
+ {
+ accessControlSubentries = schemaManager.getAttributeType( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
+ administrativeRole = schemaManager.getAttributeType( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
+ collectiveAttributeSubentries = schemaManager
+ .getAttributeType( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+ collectiveExclusions = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT );
+ creatorsName = schemaManager.getAttributeType( SchemaConstants.CREATORS_NAME_AT );
+ createTimestamp = schemaManager.getAttributeType( SchemaConstants.CREATE_TIMESTAMP_AT );
+ entryACI = schemaManager.getAttributeType( SchemaConstants.ENTRY_ACI_AT_OID );
+ entryCSN = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
+ entryDN = schemaManager.getAttributeType( SchemaConstants.ENTRY_DN_AT );
+ entryUUID = schemaManager.getAttributeType( SchemaConstants.ENTRY_UUID_AT );
+ member = schemaManager.getAttributeType( SchemaConstants.MEMBER_AT );
+ modifiersName = schemaManager.getAttributeType( SchemaConstants.MODIFIERS_NAME_AT );
+ modifyTimestamp = schemaManager.getAttributeType( SchemaConstants.MODIFY_TIMESTAMP_AT );
+ objectClass = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
+ prescriptiveACI = schemaManager.getAttributeType( SchemaConstants.PRESCRIPTIVE_ACI_AT );
+ subentryACI = schemaManager.getAttributeType( SchemaConstants.SUBENTRY_ACI_AT_OID );
+ subschemaSubentry = schemaManager.getAttributeType( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
+ subtreeSpecification = schemaManager.getAttributeType( SchemaConstants.SUBTREE_SPECIFICATION_AT );
+ triggerExecutionSubentries = schemaManager
+ .getAttributeType( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
+ uniqueMember = schemaManager.getAttributeType( SchemaConstants.UNIQUE_MEMBER_AT_OID );
+ userPassword = schemaManager.getAttributeType( SchemaConstants.USER_PASSWORD_AT_OID );
+
+ subentryOperationalAttributes = new AttributeType[]
+ {
+ accessControlSubentries,
+ subschemaSubentry,
+ collectiveAttributeSubentries,
+ triggerExecutionSubentries
+ };
+ }
+
+
+ /**
+ * @return the <code>accessControlSubentries<code> {@link AttributeType}.
+ */
+ public AttributeType getAccessControlSubentries()
+ {
+ return accessControlSubentries;
+ }
+
+
+ /**
+ * @return the <code>administrativeRole<code> {@link AttributeType}.
+ */
+ public AttributeType getAdministrativeRole()
+ {
+ return administrativeRole;
+ }
+
+
+ /**
+ * @return the <code>collectiveAttributeSubentries<code> {@link AttributeType}.
+ */
+ public AttributeType getCollectiveAttributeSubentries()
+ {
+ return collectiveAttributeSubentries;
+ }
+
+
+ /**
+ * @return the <code>collectiveExclusions<code> {@link AttributeType}.
+ */
+ public AttributeType getCollectiveExclusions()
+ {
+ return collectiveExclusions;
+ }
+
+
+ /**
+ * @return the <code>creatorsName<code> {@link AttributeType}.
+ */
+ public AttributeType getCreatorsName()
+ {
+ return creatorsName;
+ }
+
+
+ /**
+ * @return the <code>createTimestamp<code> {@link AttributeType}.
+ */
+ public AttributeType getCreateTimestamp()
+ {
+ return createTimestamp;
+ }
+
+
+ /**
+ * @return the <code>entryACI<code> {@link AttributeType}.
+ */
+ public AttributeType getEntryACI()
+ {
+ return entryACI;
+ }
+
+
+ /**
+ * @return the <code>entryCSN<code> {@link AttributeType}.
+ */
+ public AttributeType getEntryCSN()
+ {
+ return entryCSN;
+ }
+
+
+ /**
+ * @return the <code>entryDN<code> {@link AttributeType}.
+ */
+ public AttributeType getEntryDN()
+ {
+ return entryDN;
+ }
+
+
+ /**
+ * @return the <code>entryUUID<code> {@link AttributeType}.
+ */
+ public AttributeType getEntryUUID()
+ {
+ return entryUUID;
+ }
+
+
+ /**
+ * @return the <code>member<code> {@link AttributeType}.
+ */
+ public AttributeType getMember()
+ {
+ return member;
+ }
+
+
+ /**
+ * @return the <code>modifiersName<code> {@link AttributeType}.
+ */
+ public AttributeType getModifiersName()
+ {
+ return modifiersName;
+ }
+
+
+ /**
+ * @return the <code>modifyTimestamp<code> {@link AttributeType}.
+ */
+ public AttributeType getModifyTimestamp()
+ {
+ return modifyTimestamp;
+ }
+
+
+ /**
+ * @return the <code>objectClass<code> {@link AttributeType}.
+ */
+ public AttributeType getObjectClass()
+ {
+ return objectClass;
+ }
+
+
+ /**
+ * @return the <code>prescriptiveACI<code> {@link AttributeType}.
+ */
+ public AttributeType getPrescriptiveACI()
+ {
+ return prescriptiveACI;
+ }
+
+
+ /**
+ * @return the <code>subentryACI<code> {@link AttributeType}.
+ */
+ public AttributeType getSubentryACI()
+ {
+ return subentryACI;
+ }
+
+
+ /**
+ * @return the <code>subschemaSubentry<code> {@link AttributeType}.
+ */
+ public AttributeType getSubschemaSubentry()
+ {
+ return subschemaSubentry;
+ }
+
+
+ /**
+ * @return the <code>subtreeSpecification<code> {@link AttributeType}.
+ */
+ public AttributeType getSubtreeSpecification()
+ {
+ return subtreeSpecification;
+ }
+
+
+ /**
+ * @return the <code>triggerExecutionSubentries<code> {@link AttributeType}.
+ */
+ public AttributeType getTriggerExecutionSubentries()
+ {
+ return triggerExecutionSubentries;
+ }
+
+
+ /**
+ * @return the <code>uniqueMember<code> {@link AttributeType}.
+ */
+ public AttributeType getUniqueMember()
+ {
+ return uniqueMember;
+ }
+
+
+ /**
+ * @return the <code>userPassword<code> {@link AttributeType}.
+ */
+ public AttributeType getUserPassword()
+ {
+ return userPassword;
+ }
+
+
+ /**
+ * @return the operational attributes of an subentry
+ */
+ public AttributeType[] getSubentryOperationalAttributes()
+ {
+ return subentryOperationalAttributes;
+ }
+
+}
Propchange: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/AttributeTypeProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/DirectoryService.java Sat Sep 26 22:48:49 2015
@@ -614,4 +614,21 @@ public interface DirectoryService extend
* @param cacheService the cache service
*/
void setCacheService( CacheService cacheService );
+
+
+ /**
+ * Gets the {@link AttributeTypeProvider}.
+ *
+ * @return the {@link AttributeTypeProvider}
+ */
+ AttributeTypeProvider getAtProvider();
+
+
+ /**
+ * Gets the {@link ObjectClassProvider}.
+ *
+ * @return the {@link ObjectClassProvider}
+ */
+ ObjectClassProvider getOcProvider();
+
}
Added: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ObjectClassProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ObjectClassProvider.java?rev=1705497&view=auto
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ObjectClassProvider.java (added)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ObjectClassProvider.java Sat Sep 26 22:48:49 2015
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.core.api;
+
+
+import org.apache.directory.api.ldap.model.schema.SchemaManager;
+
+
+/**
+ * Provides commonly used {@link ObjectClass}es.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ObjectClassProvider
+{
+
+ public ObjectClassProvider( SchemaManager schemaManager )
+ {
+ }
+
+}
Propchange: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ObjectClassProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/interceptor/BaseInterceptor.java Sat Sep 26 22:48:49 2015
@@ -23,7 +23,6 @@ package org.apache.directory.server.core
import java.util.HashSet;
import java.util.Set;
-import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.schema.AttributeType;
@@ -74,67 +73,10 @@ public abstract class BaseInterceptor im
/** set of operational attribute types used for representing the password policy state of a user entry */
protected static final Set<AttributeType> PWD_POLICY_STATE_ATTRIBUTE_TYPES = new HashSet<AttributeType>();
- /** The AccessControlSubentries AttributeType */
- protected static AttributeType ACCESS_CONTROL_SUBENTRIES_AT;
-
- /** A reference to the AdministrativeRole AT */
- protected static AttributeType ADMINISTRATIVE_ROLE_AT;
-
- /** The CollectiveAttributeSubentries AttributeType */
- protected static AttributeType COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT;
-
- /** The CollectiveExclusions AttributeType */
- protected static AttributeType COLLECTIVE_EXCLUSIONS_AT;
-
- /** A storage for the createTimestamp attributeType */
- protected static AttributeType CREATE_TIMESTAMP_AT;
-
- /** A storage for the creatorsName attributeType */
- protected static AttributeType CREATORS_NAME_AT;
-
- /** A storage for the entryACI attributeType */
- protected static AttributeType ENTRY_ACI_AT;
-
- /** A reference to the EntryCSN AT */
- protected static AttributeType ENTRY_CSN_AT;
-
- /** A reference to the EntryDN AT */
- protected static AttributeType ENTRY_DN_AT;
-
- /** A reference to the EntryUUID AT */
- protected static AttributeType ENTRY_UUID_AT;
-
- /** A reference to the ModifiersName AT */
- protected static AttributeType MODIFIERS_NAME_AT;
-
- /** A reference to the ModifyTimestamp AT */
- protected static AttributeType MODIFY_TIMESTAMP_AT;
-
- /** The ObjectClass AttributeType */
- protected static AttributeType OBJECT_CLASS_AT;
-
- /** the subentry ACI attribute type */
- protected static AttributeType SUBENTRY_ACI_AT;
-
- /** A reference to the AccessControlSubentries AT */
- protected static AttributeType SUBSCHEMA_SUBENTRY_AT;
-
- /** A reference to the SubtreeSpecification AT */
- protected static AttributeType SUBTREE_SPECIFICATION_AT;
-
- /** A reference to the TriggerExecutionSubentries AT */
- protected static AttributeType TRIGGER_EXECUTION_SUBENTRIES_AT;
-
- /** A storage for the uniqueMember attributeType */
- protected static AttributeType UNIQUE_MEMBER_AT;
-
- /** A storage for the UserPassword attributeType */
- protected static AttributeType USER_PASSWORD_AT;
-
/**
* The final interceptor which acts as a proxy in charge to dialog with the nexus partition.
*/
- private final Interceptor FINAL_INTERCEPTOR = new Interceptor()
+ private final Interceptor finalInterceptor = new Interceptor()
{
private PartitionNexus nexus;
@@ -340,30 +282,7 @@ public abstract class BaseInterceptor im
schemaManager = directoryService.getSchemaManager();
dnFactory = directoryService.getDnFactory();
- // Init the At we use locally
- ACCESS_CONTROL_SUBENTRIES_AT = schemaManager.getAttributeType( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
- ADMINISTRATIVE_ROLE_AT = schemaManager.getAttributeType( SchemaConstants.ADMINISTRATIVE_ROLE_AT );
- COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = schemaManager
- .getAttributeType( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
- COLLECTIVE_EXCLUSIONS_AT = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT );
- CREATORS_NAME_AT = schemaManager.getAttributeType( SchemaConstants.CREATORS_NAME_AT );
- CREATE_TIMESTAMP_AT = schemaManager.getAttributeType( SchemaConstants.CREATE_TIMESTAMP_AT );
- ENTRY_ACI_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_ACI_AT_OID );
- ENTRY_CSN_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT );
- ENTRY_DN_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_DN_AT );
- ENTRY_UUID_AT = schemaManager.getAttributeType( SchemaConstants.ENTRY_UUID_AT );
- MODIFIERS_NAME_AT = schemaManager.getAttributeType( SchemaConstants.MODIFIERS_NAME_AT );
- MODIFY_TIMESTAMP_AT = schemaManager.getAttributeType( SchemaConstants.MODIFY_TIMESTAMP_AT );
- OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
- SUBENTRY_ACI_AT = schemaManager.getAttributeType( SchemaConstants.SUBENTRY_ACI_AT_OID );
- SUBSCHEMA_SUBENTRY_AT = schemaManager.getAttributeType( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
- SUBTREE_SPECIFICATION_AT = schemaManager.getAttributeType( SchemaConstants.SUBTREE_SPECIFICATION_AT );
- TRIGGER_EXECUTION_SUBENTRIES_AT = schemaManager
- .getAttributeType( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
- UNIQUE_MEMBER_AT = schemaManager.getAttributeType( SchemaConstants.UNIQUE_MEMBER_AT_OID );
- USER_PASSWORD_AT = schemaManager.getAttributeType( SchemaConstants.USER_PASSWORD_AT_OID );
-
- FINAL_INTERCEPTOR.init( directoryService );
+ finalInterceptor.init( directoryService );
}
@@ -388,7 +307,7 @@ public abstract class BaseInterceptor im
if ( currentInterceptor.equals( "FINAL" ) )
{
- return FINAL_INTERCEPTOR;
+ return finalInterceptor;
}
Interceptor interceptor = directoryService.getInterceptor( currentInterceptor );
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/SchemaPartition.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/SchemaPartition.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/schema/SchemaPartition.java Sat Sep 26 22:48:49 2015
@@ -121,20 +121,20 @@ public final class SchemaPartition exten
private RegistrySynchronizerAdaptor synchronizer;
/** A static Dn for the ou=schemaModifications entry */
- private static Dn SCHEMA_MODIFICATION_DN;
+ private Dn schemaModificationDN;
/** A static Dn for the ou=schema partition */
- private static Dn SCHEMA_DN;
+ private Dn schemaDN;
/** The ObjectClass AttributeType */
- private static AttributeType OBJECT_CLASS_AT;
+ private AttributeType objectClassAT;
public SchemaPartition( SchemaManager schemaManager )
{
try
{
- SCHEMA_DN = new Dn( schemaManager, SchemaConstants.OU_SCHEMA );
+ schemaDN = new Dn( schemaManager, SchemaConstants.OU_SCHEMA );
}
catch ( LdapInvalidDnException lide )
{
@@ -142,9 +142,9 @@ public final class SchemaPartition exten
}
id = SCHEMA_ID;
- suffixDn = SCHEMA_DN;
+ suffixDn = schemaDN;
this.schemaManager = schemaManager;
- OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT_OID );
+ objectClassAT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT_OID );
}
@@ -212,7 +212,7 @@ public final class SchemaPartition exten
// schema it depends on. This is a minimal mandatory set of schemas.
// -----------------------------------------------------------------------
wrapped.setId( SCHEMA_ID );
- wrapped.setSuffixDn( SCHEMA_DN );
+ wrapped.setSuffixDn( schemaDN );
wrapped.setSchemaManager( schemaManager );
try
@@ -227,7 +227,7 @@ public final class SchemaPartition exten
throw new RuntimeException( e );
}
- SCHEMA_MODIFICATION_DN = new Dn( schemaManager, SchemaConstants.SCHEMA_MODIFICATIONS_DN );
+ schemaModificationDN = new Dn( schemaManager, SchemaConstants.SCHEMA_MODIFICATIONS_DN );
}
}
@@ -293,7 +293,7 @@ public final class SchemaPartition exten
Dn dn = deleteContext.getDn();
SearchRequest searchRequest = new SearchRequestImpl();
searchRequest.setBase( dn );
- ExprNode node = new PresenceNode( OBJECT_CLASS_AT );
+ ExprNode node = new PresenceNode( objectClassAT );
searchRequest.setFilter( node );
searchRequest.setTypesOnly( true );
searchRequest.setScope( SearchScope.ONELEVEL );
@@ -393,7 +393,7 @@ public final class SchemaPartition exten
wrapped.modify( modifyContext );
}
- if ( !modifyContext.getDn().equals( SCHEMA_MODIFICATION_DN ) )
+ if ( !modifyContext.getDn().equals( schemaModificationDN ) )
{
updateSchemaModificationAttributes( modifyContext );
}
@@ -508,7 +508,7 @@ public final class SchemaPartition exten
// have been done, so we can perform the below modification directly on the partition nexus
// without using a a bypass list
CoreSession session = opContext.getSession();
- ModifyOperationContext modifyContext = new ModifyOperationContext( session, SCHEMA_MODIFICATION_DN, mods );
+ ModifyOperationContext modifyContext = new ModifyOperationContext( session, schemaModificationDN, mods );
session.getDirectoryService().getPartitionNexus().modify( modifyContext );
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/subtree/SubentryUtils.java Sat Sep 26 22:48:49 2015
@@ -20,14 +20,12 @@
package org.apache.directory.server.core.api.subtree;
-import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
import org.apache.directory.api.ldap.model.entry.DefaultEntry;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.model.subtree.Subentry;
import org.apache.directory.api.ldap.model.subtree.SubtreeSpecification;
@@ -47,31 +45,11 @@ public class SubentryUtils
/** A reference to the SchemaManager instance */
protected SchemaManager schemaManager;
- /** The AccessControlSubentries AttributeType */
- protected static AttributeType ACCESS_CONTROL_SUBENTRIES_AT;
-
- /** The CollectiveAttributeSubentries AttributeType */
- protected static AttributeType COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT;
-
- /** A reference to the AccessControlSubentries AT */
- protected static AttributeType SUBSCHEMA_SUBENTRY_AT;
-
- /** A reference to the TriggerExecutionSubentries AT */
- protected static AttributeType TRIGGER_EXECUTION_SUBENTRIES_AT;
-
public SubentryUtils( DirectoryService directoryService )
{
this.directoryService = directoryService;
this.schemaManager = directoryService.getSchemaManager();
-
- // Init the At we use locally
- ACCESS_CONTROL_SUBENTRIES_AT = schemaManager.getAttributeType( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
- COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT = schemaManager
- .getAttributeType( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
- SUBSCHEMA_SUBENTRY_AT = schemaManager.getAttributeType( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
- TRIGGER_EXECUTION_SUBENTRIES_AT = schemaManager
- .getAttributeType( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
}
@@ -107,24 +85,24 @@ public class SubentryUtils
if ( subentry.isAccessControlAdminRole() )
{
- operational = subentryAttrs.get( ACCESS_CONTROL_SUBENTRIES_AT );
+ operational = subentryAttrs.get( directoryService.getAtProvider().getAccessControlSubentries() );
if ( operational == null )
{
- operational = new DefaultAttribute( ACCESS_CONTROL_SUBENTRIES_AT );
+ operational = new DefaultAttribute( directoryService.getAtProvider().getAccessControlSubentries() );
subentryAttrs.put( operational );
}
operational.add( subentryDn.getNormName() );
}
-
+
if ( subentry.isSchemaAdminRole() )
{
- operational = subentryAttrs.get( SUBSCHEMA_SUBENTRY_AT );
+ operational = subentryAttrs.get( directoryService.getAtProvider().getSubschemaSubentry() );
if ( operational == null )
{
- operational = new DefaultAttribute( SUBSCHEMA_SUBENTRY_AT );
+ operational = new DefaultAttribute( directoryService.getAtProvider().getSubschemaSubentry() );
subentryAttrs.put( operational );
}
@@ -133,11 +111,13 @@ public class SubentryUtils
if ( subentry.isCollectiveAdminRole() )
{
- operational = subentryAttrs.get( COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+ operational = subentryAttrs.get( directoryService.getAtProvider()
+ .getCollectiveAttributeSubentries() );
if ( operational == null )
{
- operational = new DefaultAttribute( COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
+ operational = new DefaultAttribute( directoryService.getAtProvider()
+ .getCollectiveAttributeSubentries() );
subentryAttrs.put( operational );
}
@@ -146,11 +126,12 @@ public class SubentryUtils
if ( subentry.isTriggersAdminRole() )
{
- operational = subentryAttrs.get( TRIGGER_EXECUTION_SUBENTRIES_AT );
+ operational = subentryAttrs.get( directoryService.getAtProvider().getTriggerExecutionSubentries() );
if ( operational == null )
{
- operational = new DefaultAttribute( TRIGGER_EXECUTION_SUBENTRIES_AT );
+ operational = new DefaultAttribute( directoryService.getAtProvider()
+ .getTriggerExecutionSubentries() );
subentryAttrs.put( operational );
}
Modified: directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java (original)
+++ directory/apacheds/trunk/core-api/src/test/java/org/apache/directory/server/core/api/MockDirectoryService.java Sat Sep 26 22:48:49 2015
@@ -621,4 +621,18 @@ public class MockDirectoryService implem
{
// nothing
}
+
+
+ @Override
+ public AttributeTypeProvider getAtProvider()
+ {
+ return null;
+ }
+
+
+ @Override
+ public ObjectClassProvider getOcProvider()
+ {
+ return null;
+ }
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sat Sep 26 22:48:49 2015
@@ -70,6 +70,7 @@ import org.apache.directory.api.util.Str
import org.apache.directory.api.util.exception.NotImplementedException;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.admin.AdministrativePointInterceptor;
+import org.apache.directory.server.core.api.AttributeTypeProvider;
import org.apache.directory.server.core.api.CacheService;
import org.apache.directory.server.core.api.CoreSession;
import org.apache.directory.server.core.api.DirectoryService;
@@ -77,6 +78,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.InstanceLayout;
import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.ObjectClassProvider;
import org.apache.directory.server.core.api.OperationEnum;
import org.apache.directory.server.core.api.OperationManager;
import org.apache.directory.server.core.api.ReferralManager;
@@ -290,6 +292,12 @@ public class DefaultDirectoryService imp
/** The Subtree evaluator instance */
private SubtreeEvaluator evaluator;
+ /** The attribute type provider */
+ private AttributeTypeProvider atProvider;
+
+ /** The object class provider */
+ private ObjectClassProvider ocProvider;
+
// ------------------------------------------------------------------------
// Constructor
@@ -1812,6 +1820,10 @@ public class DefaultDirectoryService imp
firstStart = createBootstrapEntries();
+ // initialize schema providers
+ atProvider = new AttributeTypeProvider( schemaManager );
+ ocProvider = new ObjectClassProvider( schemaManager );
+
// Initialize the interceptors
initInterceptors();
@@ -2289,4 +2301,24 @@ public class DefaultDirectoryService imp
this.cacheService = cacheService;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeTypeProvider getAtProvider()
+ {
+ return atProvider;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public ObjectClassProvider getOcProvider()
+ {
+ return ocProvider;
+ }
+
}
\ No newline at end of file
Modified: directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Sat Sep 26 22:48:49 2015
@@ -75,17 +75,17 @@ public class KeyDerivationInterceptor ex
/** The service name. */
private static final String NAME = "keyDerivationService";
- /** The KRB5_KEY attributeType */
- private AttributeType KRB5_KEY_AT;
+ /** The krb5Key attribute type */
+ private AttributeType krb5KeyAT;
- /** The KRB5_PRINCIPAL_NAME_AT attributeType */
- private AttributeType KRB5_PRINCIPAL_NAME_AT;
+ /** The krb5PrincipalName attribute type */
+ private AttributeType krb5PrincipalNameAT;
- /** The KRB5_KEY_VERSION_NUMBER_AT attributeType */
- private AttributeType KRB5_KEY_VERSION_NUMBER_AT;
+ /** The krb5KeyVersionNumber attribute type */
+ private AttributeType krb5KeyVersionNumberAT;
- /** The USER_PASSWORD_AT attributeType */
- private AttributeType USER_PASSWORD_AT;
+ /** The userPassword attribute tType */
+ private AttributeType userPasswordAT;
/**
@@ -104,11 +104,11 @@ public class KeyDerivationInterceptor ex
{
super.init( directoryService );
- KRB5_KEY_AT = schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_KEY_AT );
- KRB5_PRINCIPAL_NAME_AT = schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT );
- KRB5_KEY_VERSION_NUMBER_AT = schemaManager
+ krb5KeyAT = schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_KEY_AT );
+ krb5PrincipalNameAT = schemaManager.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT );
+ krb5KeyVersionNumberAT = schemaManager
.lookupAttributeTypeRegistry( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT );
- USER_PASSWORD_AT = schemaManager
+ userPasswordAT = schemaManager
.lookupAttributeTypeRegistry( SchemaConstants.USER_PASSWORD_AT );
LOG_KRB.info( "KeyDerivation Interceptor initialized" );
@@ -135,12 +135,12 @@ public class KeyDerivationInterceptor ex
Entry entry = addContext.getEntry();
- if ( ( entry.get( USER_PASSWORD_AT ) != null ) && ( entry.get( KRB5_PRINCIPAL_NAME_AT ) != null ) )
+ if ( ( entry.get( userPasswordAT ) != null ) && ( entry.get( krb5PrincipalNameAT ) != null ) )
{
LOG.debug( "Adding the entry '{}' for Dn '{}'.", entry, normName.getName() );
// Get the entry's password. We will use the first one.
- BinaryValue userPassword = ( BinaryValue ) entry.get( USER_PASSWORD_AT ).get();
+ BinaryValue userPassword = ( BinaryValue ) entry.get( userPasswordAT ).get();
String strUserPassword = userPassword.getString();
if ( LOG.isDebugEnabled() )
@@ -152,7 +152,7 @@ public class KeyDerivationInterceptor ex
LOG.debug( "Adding Attribute id : 'userPassword', Values : [ {} ]", sb.toString() );
}
- String principalName = entry.get( KRB5_PRINCIPAL_NAME_AT ).getString();
+ String principalName = entry.get( krb5PrincipalNameAT ).getString();
LOG.debug( "Got principal '{}' with userPassword '{}'.", principalName, strUserPassword );
LOG_KRB.debug( "Got principal '{}' with userPassword '{}'.", principalName, strUserPassword );
@@ -160,7 +160,7 @@ public class KeyDerivationInterceptor ex
Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, strUserPassword );
// Set the KVNO to 0 as it's a new entry
- entry.put( KRB5_KEY_VERSION_NUMBER_AT, "0" );
+ entry.put( krb5KeyVersionNumberAT, "0" );
Attribute keyAttribute = getKeyAttribute( keys );
entry.put( keyAttribute );
@@ -254,7 +254,7 @@ public class KeyDerivationInterceptor ex
Attribute attr = mod.getAttribute();
- if ( USER_PASSWORD_AT.equals( attr.getAttributeType() ) )
+ if ( userPasswordAT.equals( attr.getAttributeType() ) )
{
Object firstValue = attr.get();
String password = null;
@@ -285,7 +285,7 @@ public class KeyDerivationInterceptor ex
LOG_KRB.debug( "Got userPassword '{}'.", subContext.getUserPassword() );
}
- if ( KRB5_PRINCIPAL_NAME_AT.equals( attr.getAttributeType() ) )
+ if ( krb5PrincipalNameAT.equals( attr.getAttributeType() ) )
{
subContext.setPrincipalName( attr.getString() );
LOG.debug( "Got principal '{}'.", subContext.getPrincipalName() );
@@ -319,8 +319,8 @@ public class KeyDerivationInterceptor ex
throw new LdapAuthenticationException( I18n.err( I18n.ERR_512, principalDn ) );
}
- if ( !( ( ClonedServerEntry ) userEntry ).getOriginalEntry().contains( OBJECT_CLASS_AT,
- SchemaConstants.KRB5_PRINCIPAL_OC ) )
+ if ( !( ( ClonedServerEntry ) userEntry ).getOriginalEntry().contains(
+ directoryService.getAtProvider().getObjectClass(), SchemaConstants.KRB5_PRINCIPAL_OC ) )
{
return;
}
@@ -334,7 +334,7 @@ public class KeyDerivationInterceptor ex
if ( subContext.getPrincipalName() == null )
{
Attribute principalAttribute = ( ( ClonedServerEntry ) userEntry ).getOriginalEntry().get(
- KRB5_PRINCIPAL_NAME_AT );
+ krb5PrincipalNameAT );
String principalName = principalAttribute.getString();
subContext.setPrincipalName( principalName );
LOG.debug( "Found principal '{}' from lookup.", principalName );
@@ -342,7 +342,7 @@ public class KeyDerivationInterceptor ex
}
Attribute keyVersionNumberAttr = ( ( ClonedServerEntry ) userEntry ).getOriginalEntry().get(
- KRB5_KEY_VERSION_NUMBER_AT );
+ krb5KeyVersionNumberAT );
// Set the KVNO to 0 if it's a password creation,
// otherwise increment it.
@@ -397,7 +397,7 @@ public class KeyDerivationInterceptor ex
new DefaultModification(
ModificationOperation.REPLACE_ATTRIBUTE,
new DefaultAttribute(
- KRB5_PRINCIPAL_NAME_AT,
+ krb5PrincipalNameAT,
principalName ) );
newModsList.add( krb5PrincipalName );
@@ -405,7 +405,7 @@ public class KeyDerivationInterceptor ex
new DefaultModification(
ModificationOperation.REPLACE_ATTRIBUTE,
new DefaultAttribute(
- KRB5_KEY_VERSION_NUMBER_AT,
+ krb5KeyVersionNumberAT,
Integer.toString( kvno ) ) );
newModsList.add( krb5KeyVersionNumber );
@@ -432,7 +432,7 @@ public class KeyDerivationInterceptor ex
private Attribute getKeyAttribute( Map<EncryptionType, EncryptionKey> keys )
throws LdapException
{
- Attribute keyAttribute = new DefaultAttribute( KRB5_KEY_AT );
+ Attribute keyAttribute = new DefaultAttribute( krb5KeyAT );
for ( EncryptionKey encryptionKey : keys.values() )
{
Modified: directory/apacheds/trunk/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java Sat Sep 26 22:48:49 2015
@@ -764,7 +764,7 @@ public class AdministrativePointIntercep
{ SchemaConstants.ADMINISTRATIVE_ROLE_AT, SchemaConstants.ENTRY_UUID_AT } );
// Search for all the adminstrativePoints in the base
- ExprNode filter = new PresenceNode( ADMINISTRATIVE_ROLE_AT );
+ ExprNode filter = new PresenceNode( directoryService.getAtProvider().getAdministrativeRole() );
CoreSession adminSession = directoryService.getAdminSession();
@@ -815,8 +815,8 @@ public class AdministrativePointIntercep
// update the cache
Dn dn = adminPointEntry.getDn();
- String uuid = adminPointEntry.get( ENTRY_UUID_AT ).getString();
- Attribute adminPoint = adminPointEntry.get( ADMINISTRATIVE_ROLE_AT );
+ String uuid = adminPointEntry.get( directoryService.getAtProvider().getEntryUUID() ).getString();
+ Attribute adminPoint = adminPointEntry.get( directoryService.getAtProvider().getAdministrativeRole() );
createAdministrativePoints( adminPoint, dn, uuid );
}
@@ -1181,7 +1181,7 @@ public class AdministrativePointIntercep
Dn dn = entry.getDn();
// Check if we are adding an Administrative Point
- Attribute adminPoint = entry.get( ADMINISTRATIVE_ROLE_AT );
+ Attribute adminPoint = entry.get( directoryService.getAtProvider().getAdministrativeRole() );
if ( adminPoint == null )
{
@@ -1209,7 +1209,7 @@ public class AdministrativePointIntercep
// Ok, we are golden.
next( addContext );
- String apUuid = entry.get( ENTRY_UUID_AT ).getString();
+ String apUuid = entry.get( directoryService.getAtProvider().getEntryUUID() ).getString();
// Now, update the AdminPoint cache
createAdministrativePoints( adminPoint, dn, apUuid );
@@ -1241,7 +1241,7 @@ public class AdministrativePointIntercep
Dn dn = entry.getDn();
// Check if we are deleting an Administrative Point
- Attribute adminPoint = entry.get( ADMINISTRATIVE_ROLE_AT );
+ Attribute adminPoint = entry.get( directoryService.getAtProvider().getAdministrativeRole() );
if ( adminPoint == null )
{
@@ -1307,14 +1307,14 @@ public class AdministrativePointIntercep
// We have to check that the modification is acceptable
List<Modification> modifications = modifyContext.getModItems();
Dn dn = modifyContext.getDn();
- String uuid = modifyContext.getEntry().get( ENTRY_UUID_AT ).getString();
+ String uuid = modifyContext.getEntry().get( directoryService.getAtProvider().getEntryUUID() ).getString();
// Check if we are modifying any AdminRole
boolean adminRolePresent = false;
for ( Modification modification : modifications )
{
- if ( modification.getAttribute().getAttributeType() == ADMINISTRATIVE_ROLE_AT )
+ if ( modification.getAttribute().getAttributeType() == directoryService.getAtProvider().getAdministrativeRole() )
{
adminRolePresent = true;
break;
@@ -1327,12 +1327,12 @@ public class AdministrativePointIntercep
// Create a clone of the current AdminRole AT
Attribute modifiedAdminRole = ( ( ClonedServerEntry ) modifyContext.getEntry() ).getOriginalEntry().get(
- ADMINISTRATIVE_ROLE_AT );
+ directoryService.getAtProvider().getAdministrativeRole() );
if ( modifiedAdminRole == null )
{
// Create the attribute, as it does not already exist in the entry
- modifiedAdminRole = new DefaultAttribute( ADMINISTRATIVE_ROLE_AT );
+ modifiedAdminRole = new DefaultAttribute( directoryService.getAtProvider().getAdministrativeRole() );
}
else
{
@@ -1360,7 +1360,7 @@ public class AdministrativePointIntercep
Attribute attribute = modification.getAttribute();
// Skip all the attributes but AdministrativeRole
- if ( attribute.getAttributeType() == ADMINISTRATIVE_ROLE_AT )
+ if ( attribute.getAttributeType() == directoryService.getAtProvider().getAdministrativeRole() )
{
// Ok, we have a modification impacting the administrative role
// Apply it to a virtual AdministrativeRole attribute
@@ -1463,7 +1463,7 @@ public class AdministrativePointIntercep
Entry entry = moveContext.getOriginalEntry();
// Check if we are moving an Administrative Point
- Attribute adminPoint = entry.get( ADMINISTRATIVE_ROLE_AT );
+ Attribute adminPoint = entry.get( directoryService.getAtProvider().getAdministrativeRole() );
if ( adminPoint == null )
{
@@ -1491,7 +1491,7 @@ public class AdministrativePointIntercep
Entry entry = moveAndRenameContext.getOriginalEntry();
// Check if we are moving and renaming an Administrative Point
- Attribute adminPoint = entry.get( ADMINISTRATIVE_ROLE_AT );
+ Attribute adminPoint = entry.get( directoryService.getAtProvider().getAdministrativeRole() );
if ( adminPoint == null )
{
@@ -1519,7 +1519,7 @@ public class AdministrativePointIntercep
Entry entry = renameContext.getEntry();
// Check if we are renaming an Administrative Point
- Attribute adminPoint = entry.get( ADMINISTRATIVE_ROLE_AT );
+ Attribute adminPoint = entry.get( directoryService.getAtProvider().getAdministrativeRole() );
if ( adminPoint == null )
{
Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Sat Sep 26 22:48:49 2015
@@ -52,7 +52,6 @@ import org.apache.directory.api.ldap.ext
import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyDecorator;
import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
import org.apache.directory.api.ldap.model.constants.LdapSecurityConstants;
-import org.apache.directory.api.ldap.model.constants.PasswordPolicySchemaConstants;
import org.apache.directory.api.ldap.model.constants.SchemaConstants;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.BinaryValue;
@@ -128,34 +127,29 @@ public class AuthenticationInterceptor e
private CoreSession adminSession;
// pwdpolicy state attribute types
- private AttributeType AT_PWD_RESET;
+ private AttributeType pwdResetAT;
- private AttributeType AT_PWD_CHANGED_TIME;
+ private AttributeType pwdChangedTimeAT;
- private AttributeType AT_PWD_HISTORY;
+ private AttributeType pwdHistoryAT;
- private AttributeType AT_PWD_FAILURE_TIME;
+ private AttributeType pwdFailurTimeAT;
- private AttributeType AT_PWD_ACCOUNT_LOCKED_TIME;
+ private AttributeType pwdAccountLockedTimeAT;
- private AttributeType AT_PWD_LAST_SUCCESS;
+ private AttributeType pwdLastSuccessAT;
- private AttributeType AT_PWD_GRACE_USE_TIME;
+ private AttributeType pwdGraceUseTimeAT;
- private AttributeType AT_CREATE_TIMESTAMP;
-
- private AttributeType AT_PWD_POLICY_SUBENTRY;
+ private AttributeType pwdPolicySubentryAT;
- private AttributeType AT_PWD_START_TIME;
+ private AttributeType pwdStartTimeAT;
- private AttributeType AT_PWD_END_TIME;
+ private AttributeType pwdEndTimeAT;
/** a container to hold all the ppolicies */
private PpolicyConfigContainer pwdPolicyContainer;
- /** the pwdPolicySubentry AT */
- private AttributeType pwdPolicySubentryAT;
-
/**
* Creates an authentication service interceptor.
@@ -174,8 +168,6 @@ public class AuthenticationInterceptor e
super.init( directoryService );
adminSession = directoryService.getAdminSession();
- pwdPolicySubentryAT = schemaManager
- .lookupAttributeTypeRegistry( PasswordPolicySchemaConstants.PWD_POLICY_SUBENTRY_AT );
if ( ( authenticators == null ) || ( authenticators.size() == 0 ) )
{
@@ -388,9 +380,9 @@ public class AuthenticationInterceptor e
{
// https://issues.apache.org/jira/browse/DIRSERVER-1978
if ( !addContext.getSession().isAnAdministrator()
- || entry.get( AT_PWD_CHANGED_TIME ) == null )
+ || entry.get( pwdChangedTimeAT ) == null )
{
- Attribute pwdChangedTimeAt = new DefaultAttribute( AT_PWD_CHANGED_TIME );
+ Attribute pwdChangedTimeAt = new DefaultAttribute( pwdChangedTimeAT );
pwdChangedTimeAt.add( pwdChangedTime );
entry.add( pwdChangedTimeAt );
}
@@ -398,14 +390,14 @@ public class AuthenticationInterceptor e
if ( policyConfig.isPwdMustChange() && addContext.getSession().isAnAdministrator() )
{
- Attribute pwdResetAt = new DefaultAttribute( AT_PWD_RESET );
+ Attribute pwdResetAt = new DefaultAttribute( pwdResetAT );
pwdResetAt.add( "TRUE" );
entry.add( pwdResetAt );
}
if ( policyConfig.getPwdInHistory() > 0 )
{
- Attribute pwdHistoryAt = new DefaultAttribute( AT_PWD_HISTORY );
+ Attribute pwdHistoryAt = new DefaultAttribute( pwdHistoryAT );
byte[] pwdHistoryVal = new PasswordHistory( pwdChangedTime, userPassword.getValue() ).getHistoryValue();
pwdHistoryAt.add( pwdHistoryVal );
entry.add( pwdHistoryAt );
@@ -589,11 +581,11 @@ public class AuthenticationInterceptor e
if ( ( policyConfig != null ) && ( userEntry != null ) )
{
- Attribute pwdFailTimeAt = userEntry.get( AT_PWD_FAILURE_TIME );
+ Attribute pwdFailTimeAt = userEntry.get( pwdFailurTimeAT );
if ( pwdFailTimeAt == null )
{
- pwdFailTimeAt = new DefaultAttribute( AT_PWD_FAILURE_TIME );
+ pwdFailTimeAt = new DefaultAttribute( pwdFailurTimeAT );
}
else
{
@@ -615,7 +607,7 @@ public class AuthenticationInterceptor e
// See DIRSERVER-1812 (The default admin account should never get locked forever)
if ( !userEntry.getDn().equals( new Dn( schemaManager, ServerDNConstants.ADMIN_SYSTEM_DN ) ) )
{
- Attribute pwdAccountLockedTimeAt = new DefaultAttribute( AT_PWD_ACCOUNT_LOCKED_TIME );
+ Attribute pwdAccountLockedTimeAt = new DefaultAttribute( pwdAccountLockedTimeAT );
// if zero, lockout permanently, only admin can unlock it
if ( policyConfig.getPwdLockoutDuration() == 0 )
@@ -659,7 +651,8 @@ public class AuthenticationInterceptor e
if ( !mods.isEmpty() )
{
String csnVal = directoryService.getCSN().toString();
- Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, ENTRY_CSN_AT, csnVal );
+ Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, directoryService.getAtProvider()
+ .getEntryCSN(), csnVal );
mods.add( csnMod );
ModifyOperationContext bindModCtx = new ModifyOperationContext( adminSession );
@@ -681,13 +674,13 @@ public class AuthenticationInterceptor e
if ( policyConfig.getPwdMaxIdle() > 0 )
{
- Attribute pwdLastSuccesTimeAt = new DefaultAttribute( AT_PWD_LAST_SUCCESS );
+ Attribute pwdLastSuccesTimeAt = new DefaultAttribute( pwdLastSuccessAT );
pwdLastSuccesTimeAt.add( DateUtils.getGeneralizedTime() );
Modification pwdLastSuccesTimeMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdLastSuccesTimeAt );
mods.add( pwdLastSuccesTimeMod );
}
- Attribute pwdFailTimeAt = userEntry.get( AT_PWD_FAILURE_TIME );
+ Attribute pwdFailTimeAt = userEntry.get( pwdFailurTimeAT );
if ( pwdFailTimeAt != null )
{
@@ -695,7 +688,7 @@ public class AuthenticationInterceptor e
mods.add( pwdFailTimeMod );
}
- Attribute pwdAccLockedTimeAt = userEntry.get( AT_PWD_ACCOUNT_LOCKED_TIME );
+ Attribute pwdAccLockedTimeAt = userEntry.get( pwdAccountLockedTimeAT );
if ( pwdAccLockedTimeAt != null )
{
@@ -706,7 +699,7 @@ public class AuthenticationInterceptor e
// checking the expiration time *after* performing authentication, do we need to care about millisecond precision?
if ( ( policyConfig.getPwdMaxAge() > 0 ) && ( policyConfig.getPwdGraceAuthNLimit() > 0 ) )
{
- Attribute pwdChangeTimeAttr = userEntry.get( AT_PWD_CHANGED_TIME );
+ Attribute pwdChangeTimeAttr = userEntry.get( pwdChangedTimeAT );
if ( pwdChangeTimeAttr != null )
{
@@ -715,7 +708,7 @@ public class AuthenticationInterceptor e
if ( expired )
{
- Attribute pwdGraceUseAttr = userEntry.get( AT_PWD_GRACE_USE_TIME );
+ Attribute pwdGraceUseAttr = userEntry.get( pwdGraceUseTimeAT );
int numGraceAuth = 0;
if ( pwdGraceUseAttr != null )
@@ -724,7 +717,7 @@ public class AuthenticationInterceptor e
}
else
{
- pwdGraceUseAttr = new DefaultAttribute( AT_PWD_GRACE_USE_TIME );
+ pwdGraceUseAttr = new DefaultAttribute( pwdGraceUseTimeAT );
numGraceAuth = policyConfig.getPwdGraceAuthNLimit() - 1;
}
@@ -740,7 +733,8 @@ public class AuthenticationInterceptor e
if ( !mods.isEmpty() )
{
String csnVal = directoryService.getCSN().toString();
- Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, ENTRY_CSN_AT, csnVal );
+ Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, directoryService.getAtProvider()
+ .getEntryCSN(), csnVal );
mods.add( csnMod );
ModifyOperationContext bindModCtx = new ModifyOperationContext( adminSession );
@@ -908,7 +902,8 @@ public class AuthenticationInterceptor e
for ( Modification modification : modifications )
{
- if ( USER_PASSWORD_AT.equals( modification.getAttribute().getAttributeType() ) )
+ if ( directoryService.getAtProvider().getUserPassword()
+ .equals( modification.getAttribute().getAttributeType() ) )
{
invalidateAuthenticatorCaches( modifyContext.getDn() );
break;
@@ -1000,11 +995,11 @@ public class AuthenticationInterceptor e
if ( histSize > 0 )
{
- Attribute pwdHistoryAt = entry.get( AT_PWD_HISTORY );
+ Attribute pwdHistoryAt = entry.get( pwdHistoryAT );
if ( pwdHistoryAt == null )
{
- pwdHistoryAt = new DefaultAttribute( AT_PWD_HISTORY );
+ pwdHistoryAt = new DefaultAttribute( pwdHistoryAT );
}
// Build the Modification containing the password history
@@ -1026,7 +1021,7 @@ public class AuthenticationInterceptor e
if ( ( policyConfig.getPwdMinAge() > 0 ) || ( policyConfig.getPwdMaxAge() > 0 ) )
{
- Attribute pwdChangedTimeAt = new DefaultAttribute( AT_PWD_CHANGED_TIME );
+ Attribute pwdChangedTimeAt = new DefaultAttribute( pwdChangedTimeAT );
pwdChangedTimeAt.add( pwdChangedTime );
Modification pwdChangedTimeMod = new DefaultModification( REPLACE_ATTRIBUTE, pwdChangedTimeAt );
mods.add( pwdChangedTimeMod );
@@ -1044,7 +1039,7 @@ public class AuthenticationInterceptor e
if ( policyConfig.isPwdMustChange() )
{
- Attribute pwdMustChangeAt = new DefaultAttribute( AT_PWD_RESET );
+ Attribute pwdMustChangeAt = new DefaultAttribute( pwdResetAT );
Modification pwdMustChangeMod = null;
if ( modifyContext.getSession().isAnAdministrator() )
@@ -1066,7 +1061,8 @@ public class AuthenticationInterceptor e
processModifyAddPwdAttributes( entry, mods, pwdModDetails );
String csnVal = directoryService.getCSN().toString();
- Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, ENTRY_CSN_AT, csnVal );
+ Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, directoryService.getAtProvider()
+ .getEntryCSN(), csnVal );
mods.add( csnMod );
ModifyOperationContext internalModifyCtx = new ModifyOperationContext( adminSession );
@@ -1131,7 +1127,7 @@ public class AuthenticationInterceptor e
// remove the oldest value
PasswordHistory remPwdHist = ( PasswordHistory ) pwdHistLst.toArray()[histSize - 1];
- Attribute tempAt = new DefaultAttribute( AT_PWD_HISTORY );
+ Attribute tempAt = new DefaultAttribute( pwdHistoryAT );
tempAt.add( remPwdHist.getHistoryValue() );
pwdRemHistMod = new DefaultModification( REMOVE_ATTRIBUTE, tempAt );
}
@@ -1145,14 +1141,14 @@ public class AuthenticationInterceptor e
*/
private void processModifyAddPwdAttributes( Entry entry, List<Modification> mods, PwdModDetailsHolder pwdModDetails )
{
- Attribute pwdFailureTimeAt = entry.get( AT_PWD_FAILURE_TIME );
+ Attribute pwdFailureTimeAt = entry.get( pwdFailurTimeAT );
if ( pwdFailureTimeAt != null )
{
mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdFailureTimeAt ) );
}
- Attribute pwdGraceUseTimeAt = entry.get( AT_PWD_GRACE_USE_TIME );
+ Attribute pwdGraceUseTimeAt = entry.get( pwdGraceUseTimeAT );
if ( pwdGraceUseTimeAt != null )
{
@@ -1161,28 +1157,28 @@ public class AuthenticationInterceptor e
if ( pwdModDetails.isDelete() )
{
- Attribute pwdHistory = entry.get( AT_PWD_HISTORY );
+ Attribute pwdHistory = entry.get( pwdHistoryAT );
if ( pwdHistory != null )
{
mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdHistory ) );
}
- Attribute pwdChangedTimeAt = entry.get( AT_PWD_CHANGED_TIME );
+ Attribute pwdChangedTimeAt = entry.get( pwdChangedTimeAT );
if ( pwdChangedTimeAt != null )
{
mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdChangedTimeAt ) );
}
- Attribute pwdMustChangeAt = entry.get( AT_PWD_RESET );
+ Attribute pwdMustChangeAt = entry.get( pwdResetAT );
if ( pwdMustChangeAt != null )
{
mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdMustChangeAt ) );
}
- Attribute pwdAccountLockedTimeAt = entry.get( AT_PWD_ACCOUNT_LOCKED_TIME );
+ Attribute pwdAccountLockedTimeAt = entry.get( pwdAccountLockedTimeAT );
if ( pwdAccountLockedTimeAt != null )
{
@@ -1367,35 +1363,35 @@ public class AuthenticationInterceptor e
*/
public void loadPwdPolicyStateAttributeTypes() throws LdapException
{
- AT_PWD_RESET = schemaManager.lookupAttributeTypeRegistry( PWD_RESET_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_RESET );
+ pwdResetAT = schemaManager.lookupAttributeTypeRegistry( PWD_RESET_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdResetAT );
- AT_PWD_CHANGED_TIME = schemaManager.lookupAttributeTypeRegistry( PWD_CHANGED_TIME_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_CHANGED_TIME );
+ pwdChangedTimeAT = schemaManager.lookupAttributeTypeRegistry( PWD_CHANGED_TIME_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdChangedTimeAT );
- AT_PWD_HISTORY = schemaManager.lookupAttributeTypeRegistry( PWD_HISTORY_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_HISTORY );
+ pwdHistoryAT = schemaManager.lookupAttributeTypeRegistry( PWD_HISTORY_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdHistoryAT );
- AT_PWD_FAILURE_TIME = schemaManager.lookupAttributeTypeRegistry( PWD_FAILURE_TIME_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_FAILURE_TIME );
+ pwdFailurTimeAT = schemaManager.lookupAttributeTypeRegistry( PWD_FAILURE_TIME_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdFailurTimeAT );
- AT_PWD_ACCOUNT_LOCKED_TIME = schemaManager.lookupAttributeTypeRegistry( PWD_ACCOUNT_LOCKED_TIME_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_ACCOUNT_LOCKED_TIME );
+ pwdAccountLockedTimeAT = schemaManager.lookupAttributeTypeRegistry( PWD_ACCOUNT_LOCKED_TIME_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdAccountLockedTimeAT );
- AT_PWD_LAST_SUCCESS = schemaManager.lookupAttributeTypeRegistry( PWD_LAST_SUCCESS_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_LAST_SUCCESS );
+ pwdLastSuccessAT = schemaManager.lookupAttributeTypeRegistry( PWD_LAST_SUCCESS_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdLastSuccessAT );
- AT_PWD_GRACE_USE_TIME = schemaManager.lookupAttributeTypeRegistry( PWD_GRACE_USE_TIME_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_GRACE_USE_TIME );
+ pwdGraceUseTimeAT = schemaManager.lookupAttributeTypeRegistry( PWD_GRACE_USE_TIME_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdGraceUseTimeAT );
- AT_PWD_POLICY_SUBENTRY = schemaManager.lookupAttributeTypeRegistry( PWD_POLICY_SUBENTRY_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_POLICY_SUBENTRY );
+ pwdPolicySubentryAT = schemaManager.lookupAttributeTypeRegistry( PWD_POLICY_SUBENTRY_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdPolicySubentryAT );
- AT_PWD_START_TIME = schemaManager.lookupAttributeTypeRegistry( PWD_START_TIME_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_START_TIME );
+ pwdStartTimeAT = schemaManager.lookupAttributeTypeRegistry( PWD_START_TIME_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdStartTimeAT );
- AT_PWD_END_TIME = schemaManager.lookupAttributeTypeRegistry( PWD_END_TIME_AT );
- PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( AT_PWD_END_TIME );
+ pwdEndTimeAT = schemaManager.lookupAttributeTypeRegistry( PWD_END_TIME_AT );
+ PWD_POLICY_STATE_ATTRIBUTE_TYPES.add( pwdEndTimeAT );
}
@@ -1473,16 +1469,6 @@ public class AuthenticationInterceptor e
}
- private AttributeType getCreateTimestampAttributeType() throws LdapException
- {
- if ( AT_CREATE_TIMESTAMP == null )
- {
- AT_CREATE_TIMESTAMP = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.CREATE_TIMESTAMP_AT );
- }
- return AT_CREATE_TIMESTAMP;
- }
-
-
private int getPwdTimeBeforeExpiry( Entry userEntry, PasswordPolicyConfiguration policyConfig )
throws LdapException
{
@@ -1498,10 +1484,10 @@ public class AuthenticationInterceptor e
return 0;
}
- Attribute pwdChangedTimeAt = userEntry.get( AT_PWD_CHANGED_TIME );
+ Attribute pwdChangedTimeAt = userEntry.get( pwdChangedTimeAT );
if ( pwdChangedTimeAt == null )
{
- pwdChangedTimeAt = userEntry.get( getCreateTimestampAttributeType() );
+ pwdChangedTimeAt = userEntry.get( directoryService.getAtProvider().getCreateTimestamp() );
}
long changedTime = DateUtils.getDate( pwdChangedTimeAt.getString() ).getTime();
@@ -1559,7 +1545,7 @@ public class AuthenticationInterceptor e
return false;
}
- Attribute pwdChangedTimeAt = userEntry.get( AT_PWD_CHANGED_TIME );
+ Attribute pwdChangedTimeAt = userEntry.get( pwdChangedTimeAT );
if ( pwdChangedTimeAt != null )
{
@@ -1589,7 +1575,7 @@ public class AuthenticationInterceptor e
{
boolean mustChange = false;
- Attribute pwdResetAt = userEntry.get( AT_PWD_RESET );
+ Attribute pwdResetAt = userEntry.get( pwdResetAT );
if ( pwdResetAt != null )
{
Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Sat Sep 26 22:48:49 2015
@@ -189,8 +189,8 @@ public class AciAuthorizationInterceptor
controls.setReturningAttributes( new String[]
{ SchemaConstants.PRESCRIPTIVE_ACI_AT } );
- ExprNode filter =
- new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue( SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) );
+ ExprNode filter = new EqualityNode<String>( directoryService.getAtProvider().getObjectClass(), new StringValue(
+ SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) );
CoreSession adminSession = directoryService.getAdminSession();
@@ -234,8 +234,10 @@ public class AciAuthorizationInterceptor
ExprNode filter =
new OrNode(
- new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue( SchemaConstants.GROUP_OF_NAMES_OC ) ),
- new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ) );
+ new EqualityNode<String>( directoryService.getAtProvider().getObjectClass(),
+ new StringValue( SchemaConstants.GROUP_OF_NAMES_OC ) ),
+ new EqualityNode<String>( directoryService.getAtProvider().getObjectClass(),
+ new StringValue( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ) );
CoreSession adminSession = directoryService.getAdminSession();
@@ -290,7 +292,8 @@ public class AciAuthorizationInterceptor
engine = new ACDFEngine( schemaManager );
// stuff for dealing with subentries (garbage for now)
- Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
+ Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue(
+ directoryService.getAtProvider().getSubschemaSubentry() );
Dn subschemaSubentryDnName = dnFactory.create( subschemaSubentry.getString() );
subschemaSubentryDn = subschemaSubentryDnName.getNormName();
@@ -351,7 +354,7 @@ public class AciAuthorizationInterceptor
originalEntry = entry;
}
- Attribute oc = originalEntry.get( OBJECT_CLASS_AT );
+ Attribute oc = originalEntry.get( directoryService.getAtProvider().getObjectClass() );
/*
* If the protected entry is a subentry, then the entry being evaluated
@@ -372,7 +375,7 @@ public class AciAuthorizationInterceptor
originalEntry = directoryService.getPartitionNexus().lookup( lookupContext );
}
- Attribute subentries = originalEntry.get( ACCESS_CONTROL_SUBENTRIES_AT );
+ Attribute subentries = originalEntry.get( directoryService.getAtProvider().getAccessControlSubentries() );
if ( subentries == null )
{
@@ -397,7 +400,7 @@ public class AciAuthorizationInterceptor
*/
private void addEntryAciTuples( Collection<ACITuple> tuples, Entry entry ) throws LdapException
{
- Attribute entryAci = entry.get( ENTRY_ACI_AT );
+ Attribute entryAci = entry.get( directoryService.getAtProvider().getEntryACI() );
if ( entryAci == null )
{
@@ -455,7 +458,7 @@ public class AciAuthorizationInterceptor
Entry administrativeEntry = ( ( ClonedServerEntry ) directoryService.getPartitionNexus().lookup( lookupContext ) )
.getOriginalEntry();
- Attribute subentryAci = administrativeEntry.get( SUBENTRY_ACI_AT );
+ Attribute subentryAci = administrativeEntry.get( directoryService.getAtProvider().getSubentryACI() );
if ( subentryAci == null )
{
Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java Sat Sep 26 22:48:49 2015
@@ -143,7 +143,7 @@ public class DefaultAuthorizationInterce
return;
}
- Attribute uniqueMember = adminGroup.get( UNIQUE_MEMBER_AT );
+ Attribute uniqueMember = adminGroup.get( directoryService.getAtProvider().getUniqueMember() );
for ( Value<?> value : uniqueMember )
{
Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/GroupCache.java Sat Sep 26 22:48:49 2015
@@ -73,14 +73,8 @@ public class GroupCache
/** a handle on the partition nexus */
private final PartitionNexus nexus;
- /** A storage for the ObjectClass attributeType */
- private AttributeType OBJECT_CLASS_AT;
-
- /** A storage for the member attributeType */
- private AttributeType MEMBER_AT;
-
- /** A storage for the uniqueMember attributeType */
- private AttributeType UNIQUE_MEMBER_AT;
+ /** the directory service */
+ private final DirectoryService directoryService;
/**
* the schema manager
@@ -99,6 +93,7 @@ public class GroupCache
private Cache ehCache;
+
/**
* Creates a static group cache.
*
@@ -107,12 +102,10 @@ public class GroupCache
*/
public GroupCache( DirectoryService dirService ) throws LdapException
{
+ this.directoryService = dirService;
schemaManager = dirService.getSchemaManager();
dnFactory = dirService.getDnFactory();
nexus = dirService.getPartitionNexus();
- OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
- MEMBER_AT = schemaManager.getAttributeType( SchemaConstants.MEMBER_AT );
- UNIQUE_MEMBER_AT = schemaManager.getAttributeType( SchemaConstants.UNIQUE_MEMBER_AT );
// stuff for dealing with the admin group
administratorsGroupDn = parseNormalized( ServerDNConstants.ADMINISTRATORS_GROUP_DN );
@@ -143,10 +136,10 @@ public class GroupCache
// didn't use clone() cause it is creating List objects, which IMO is not worth calling
// in this initialization phase
BranchNode filter = new OrNode();
- filter.addNode( new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
- SchemaConstants.GROUP_OF_NAMES_OC ) ) );
- filter.addNode( new EqualityNode<String>( OBJECT_CLASS_AT, new StringValue(
- SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ) );
+ filter.addNode( new EqualityNode<String>( directoryService.getAtProvider().getObjectClass(),
+ new StringValue( SchemaConstants.GROUP_OF_NAMES_OC ) ) );
+ filter.addNode( new EqualityNode<String>( directoryService.getAtProvider().getObjectClass(),
+ new StringValue( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ) );
Dn baseDn = dnFactory.create( suffix );
SearchControls ctls = new SearchControls();
@@ -207,14 +200,14 @@ public class GroupCache
*/
private Attribute getMemberAttribute( Entry entry ) throws LdapException
{
- Attribute member = entry.get( MEMBER_AT );
+ Attribute member = entry.get( directoryService.getAtProvider().getMember() );
if ( member != null )
{
return member;
}
- Attribute uniqueMember = entry.get( UNIQUE_MEMBER_AT );
+ Attribute uniqueMember = entry.get( directoryService.getAtProvider().getUniqueMember() );
if ( uniqueMember != null )
{
@@ -391,18 +384,18 @@ public class GroupCache
{
Attribute members = null;
AttributeType memberAttr = null;
- Attribute oc = entry.get( OBJECT_CLASS_AT );
+ Attribute oc = entry.get( directoryService.getAtProvider().getObjectClass() );
if ( oc.contains( SchemaConstants.GROUP_OF_NAMES_OC ) )
{
- members = entry.get( MEMBER_AT );
- memberAttr = schemaManager.getAttributeType( SchemaConstants.MEMBER_AT );
+ memberAttr = directoryService.getAtProvider().getMember();
+ members = entry.get( memberAttr );
}
if ( oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) )
{
- members = entry.get( UNIQUE_MEMBER_AT );
- memberAttr = schemaManager.getAttributeType( SchemaConstants.UNIQUE_MEMBER_AT );
+ memberAttr = directoryService.getAtProvider().getUniqueMember();
+ members = entry.get( memberAttr );
}
if ( members == null )
Modified: directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=1705497&r1=1705496&r2=1705497&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Sat Sep 26 22:48:49 2015
@@ -47,11 +47,11 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.message.AliasDerefMode;
import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
import org.apache.directory.api.ldap.model.schema.normalizers.ConcreteNameComponentNormalizer;
import org.apache.directory.api.ldap.model.schema.normalizers.NameComponentNormalizer;
import org.apache.directory.server.core.api.CoreSession;
+import org.apache.directory.server.core.api.DirectoryService;
import org.apache.directory.server.core.api.DnFactory;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
@@ -76,6 +76,9 @@ public class TupleCache
/** a map of strings to ACITuple collections */
private final Map<String, List<ACITuple>> tuples = new HashMap<String, List<ACITuple>>();
+ /** the directory service */
+ private final DirectoryService directoryService;
+
/** the Dn factory */
private final DnFactory dnFactory;
@@ -85,12 +88,6 @@ public class TupleCache
/** a normalizing ACIItem parser */
private final ACIItemParser aciParser;
- /** A storage for the PrescriptiveACI attributeType */
- private AttributeType PRESCRIPTIVE_ACI_AT;
-
- /** A storage for the ObjectClass attributeType */
- private AttributeType OBJECT_CLASS_AT;
-
/**
* Creates a ACITuple cache.
@@ -100,13 +97,12 @@ public class TupleCache
*/
public TupleCache( CoreSession session ) throws LdapException
{
- SchemaManager schemaManager = session.getDirectoryService().getSchemaManager();
- this.dnFactory = session.getDirectoryService().getDnFactory();
- this.nexus = session.getDirectoryService().getPartitionNexus();
+ this.directoryService = session.getDirectoryService();
+ SchemaManager schemaManager = directoryService.getSchemaManager();
+ this.dnFactory = directoryService.getDnFactory();
+ this.nexus = directoryService.getPartitionNexus();
NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( schemaManager );
aciParser = new ACIItemParser( ncn, schemaManager );
- PRESCRIPTIVE_ACI_AT = schemaManager.getAttributeType( SchemaConstants.PRESCRIPTIVE_ACI_AT );
- OBJECT_CLASS_AT = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
initialize( session );
}
@@ -128,7 +124,7 @@ public class TupleCache
for ( String suffix : suffixes )
{
Dn baseDn = parseNormalized( suffix );
- ExprNode filter = new EqualityNode<String>( OBJECT_CLASS_AT,
+ ExprNode filter = new EqualityNode<String>( directoryService.getAtProvider().getObjectClass(),
new StringValue( SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) );
SearchControls ctls = new SearchControls();
ctls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -147,7 +143,7 @@ public class TupleCache
{
Entry result = results.get();
Dn subentryDn = result.getDn().apply( session.getDirectoryService().getSchemaManager() );
- Attribute aci = result.get( PRESCRIPTIVE_ACI_AT );
+ Attribute aci = result.get( directoryService.getAtProvider().getPrescriptiveACI() );
if ( aci == null )
{
@@ -175,11 +171,12 @@ public class TupleCache
private boolean hasPrescriptiveACI( Entry entry ) throws LdapException
{
// only do something if the entry contains prescriptiveACI
- Attribute aci = entry.get( PRESCRIPTIVE_ACI_AT );
+ Attribute aci = entry.get( directoryService.getAtProvider().getPrescriptiveACI() );
if ( aci == null )
{
- if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) )
+ if ( entry.contains( directoryService.getAtProvider().getObjectClass(),
+ SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) )
{
// should not be necessary because of schema interceptor but schema checking
// can be turned off and in this case we must protect against being able to
@@ -205,7 +202,7 @@ public class TupleCache
}
// Get the prescriptiveACI
- Attribute prescriptiveAci = entry.get( PRESCRIPTIVE_ACI_AT );
+ Attribute prescriptiveAci = entry.get( directoryService.getAtProvider().getPrescriptiveACI() );
List<ACITuple> entryTuples = new ArrayList<ACITuple>();
@@ -255,7 +252,7 @@ public class TupleCache
for ( Modification mod : mods )
{
- if ( mod.getAttribute().isInstanceOf( PRESCRIPTIVE_ACI_AT ) )
+ if ( mod.getAttribute().isInstanceOf( directoryService.getAtProvider().getPrescriptiveACI() ) )
{
subentryDeleted( normName, entry );
subentryAdded( normName, entry );
@@ -271,7 +268,7 @@ public class TupleCache
return;
}
- if ( mods.get( PRESCRIPTIVE_ACI_AT ) != null )
+ if ( mods.get( directoryService.getAtProvider().getPrescriptiveACI() ) != null )
{
subentryDeleted( normName, entry );
subentryAdded( normName, entry );