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 2013/08/21 08:49:13 UTC
svn commit: r1516096 - in /directory/apacheds/trunk/interceptors:
authz/src/main/java/org/apache/directory/server/core/authz/
exception/src/main/java/org/apache/directory/server/core/exception/
operational/src/main/java/org/apache/directory/server/core...
Author: elecharny
Date: Wed Aug 21 06:49:12 2013
New Revision: 1516096
URL: http://svn.apache.org/r1516096
Log:
o Leveraging the new getRootDseValue() method in some interceptors
o Cleanup in some intecreptors (removal of duplicate AT declarations, removal of useless Dn.apply(schemaManager))
Modified:
directory/apacheds/trunk/interceptors/authz/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.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
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=1516096&r1=1516095&r2=1516096&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 Wed Aug 21 06:49:12 2013
@@ -290,8 +290,7 @@ public class AciAuthorizationInterceptor
engine = new ACDFEngine( schemaManager );
// stuff for dealing with subentries (garbage for now)
- Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDse( null ).get(
- SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
Dn subschemaSubentryDnName = directoryService.getDnFactory().create( subschemaSubentry.getString() );
subschemaSubentryDn = subschemaSubentryDnName.getNormName();
Modified: directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=1516096&r1=1516095&r2=1516096&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/exception/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Aug 21 06:49:12 2013
@@ -104,7 +104,7 @@ public class ExceptionInterceptor extend
{
super.init( directoryService );
nexus = directoryService.getPartitionNexus();
- Value<?> attr = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ Value<?> attr = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
subschemSubentryDn = directoryService.getDnFactory().create( attr.getString() );
}
@@ -155,7 +155,8 @@ public class ExceptionInterceptor extend
try
{
CoreSession session = addContext.getSession();
- LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn, SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+ LookupOperationContext lookupContext = new LookupOperationContext( session, parentDn,
+ SchemaConstants.ALL_ATTRIBUTES_ARRAY );
attrs = directoryService.getPartitionNexus().lookup( lookupContext );
}
Modified: directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1516096&r1=1516095&r2=1516096&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Wed Aug 21 06:49:12 2013
@@ -82,17 +82,7 @@ public class OperationalAttributeInterce
/** The admin Dn */
private Dn adminDn;
-
- /** Some attributeTypes we use locally */
- private static AttributeType entryUuidAT;
- private static AttributeType entryCsnAT;
- private static AttributeType creatorsNameAT;
- private static AttributeType createTimeStampAT;
- private static AttributeType accessControlSubentriesAT;
- private static AttributeType collectiveAttributeSubentriesAT;
- private static AttributeType triggerExecutionSubentriesAT;
- private static AttributeType subschemaSubentryAT;
-
+
/**
* the search result filter to use for collective attribute injection
*/
@@ -107,14 +97,14 @@ public class OperationalAttributeInterce
{
return true;
}
-
+
// Denormalize the operational Attributes
denormalizeEntryOpAttrs( entry );
-
+
return true;
}
-
-
+
+
/**
* {@inheritDoc}
*/
@@ -139,22 +129,11 @@ public class OperationalAttributeInterce
super.init( directoryService );
// stuff for dealing with subentries (garbage for now)
- Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDse( null ).get(
- SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
// Create the Admin Dn
adminDn = directoryService.getDnFactory().create( ServerDNConstants.ADMIN_SYSTEM_DN );
-
- // Initialize the AttributeType we use locally
- entryUuidAT = schemaManager.getAttributeType( SchemaConstants.ENTRY_UUID_AT_OID );
- entryCsnAT = schemaManager.getAttributeType( SchemaConstants.ENTRY_CSN_AT_OID );
- creatorsNameAT = schemaManager.getAttributeType( SchemaConstants.CREATORS_NAME_AT );
- createTimeStampAT = schemaManager.getAttributeType( SchemaConstants.CREATE_TIMESTAMP_AT_OID );
- accessControlSubentriesAT = schemaManager.getAttributeType( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT_OID );
- collectiveAttributeSubentriesAT = schemaManager.getAttributeType( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT_OID );
- triggerExecutionSubentriesAT = schemaManager.getAttributeType( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
- subschemaSubentryAT = schemaManager.getAttributeType( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
}
@@ -166,7 +145,8 @@ public class OperationalAttributeInterce
/**
* Check if we have to add an operational attribute, or if the admin has injected one
*/
- private boolean checkAddOperationalAttribute( boolean isAdmin, Entry entry, AttributeType attribute ) throws LdapException
+ private boolean checkAddOperationalAttribute( boolean isAdmin, Entry entry, AttributeType attribute )
+ throws LdapException
{
if ( entry.containsAttribute( attribute ) )
{
@@ -213,41 +193,41 @@ public class OperationalAttributeInterce
ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
// The EntryUUID attribute
- if ( !checkAddOperationalAttribute( isAdmin, entry, entryUuidAT ) )
+ if ( !checkAddOperationalAttribute( isAdmin, entry, ENTRY_UUID_AT ) )
{
- entry.put( entryUuidAT, UUID.randomUUID().toString() );
+ entry.put( ENTRY_UUID_AT, UUID.randomUUID().toString() );
}
// The EntryCSN attribute
- if ( !checkAddOperationalAttribute( isAdmin, entry, entryCsnAT ) )
+ if ( !checkAddOperationalAttribute( isAdmin, entry, ENTRY_CSN_AT ) )
{
- entry.put( entryCsnAT, directoryService.getCSN().toString() );
+ entry.put( ENTRY_CSN_AT, directoryService.getCSN().toString() );
}
// The CreatorsName attribute
- if ( !checkAddOperationalAttribute( isAdmin, entry, creatorsNameAT ) )
+ if ( !checkAddOperationalAttribute( isAdmin, entry, CREATORS_NAME_AT ) )
{
- entry.put( creatorsNameAT, principal );
+ entry.put( CREATORS_NAME_AT, principal );
}
// The CreateTimeStamp attribute
- if ( !checkAddOperationalAttribute( isAdmin, entry, createTimeStampAT ) )
+ if ( !checkAddOperationalAttribute( isAdmin, entry, CREATE_TIMESTAMP_AT ) )
{
- entry.put( createTimeStampAT, DateUtils.getGeneralizedTime() );
+ entry.put( CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
}
// Now, check that the user does not add operational attributes
// The accessControlSubentries attribute
- checkAddOperationalAttribute( isAdmin, entry, accessControlSubentriesAT );
+ checkAddOperationalAttribute( isAdmin, entry, ACCESS_CONTROL_SUBENTRIES_AT );
// The CollectiveAttributeSubentries attribute
- checkAddOperationalAttribute( isAdmin, entry, collectiveAttributeSubentriesAT );
+ checkAddOperationalAttribute( isAdmin, entry, COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
// The TriggerExecutionSubentries attribute
- checkAddOperationalAttribute( isAdmin, entry, triggerExecutionSubentriesAT );
+ checkAddOperationalAttribute( isAdmin, entry, TRIGGER_EXECUTION_SUBENTRIES_AT );
// The SubSchemaSybentry attribute
- checkAddOperationalAttribute( isAdmin, entry, subschemaSubentryAT );
+ checkAddOperationalAttribute( isAdmin, entry, SUBSCHEMA_SUBENTRY_AT );
next( addContext );
}
@@ -397,7 +377,7 @@ public class OperationalAttributeInterce
Entry modifiedEntry = moveContext.getOriginalEntry().clone();
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( moveContext ).getName() );
modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-
+
Attribute csnAt = new DefaultAttribute( ENTRY_CSN_AT, directoryService.getCSN().toString() );
modifiedEntry.put( csnAt );
@@ -417,7 +397,7 @@ public class OperationalAttributeInterce
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( moveAndRenameContext ).getName() );
modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
modifiedEntry.setDn( moveAndRenameContext.getNewDn() );
-
+
Attribute csnAt = new DefaultAttribute( ENTRY_CSN_AT, directoryService.getCSN().toString() );
modifiedEntry.put( csnAt );
@@ -439,7 +419,7 @@ public class OperationalAttributeInterce
Entry modifiedEntry = renameContext.getOriginalEntry().clone();
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-
+
Attribute csnAt = new DefaultAttribute( ENTRY_CSN_AT, directoryService.getCSN().toString() );
modifiedEntry.put( csnAt );
@@ -475,7 +455,7 @@ public class OperationalAttributeInterce
public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
// insert a new CSN into the entry, this is for replication
- Entry entry = deleteContext.getEntry();
+ Entry entry = deleteContext.getEntry();
Attribute csnAt = new DefaultAttribute( ENTRY_CSN_AT, directoryService.getCSN().toString() );
entry.put( csnAt );
Modified: directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=1516096&r1=1516095&r2=1516096&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Wed Aug 21 06:49:12 2013
@@ -213,7 +213,7 @@ public class ReferralInterceptor extends
referralManager = new ReferralManagerImpl( directoryService );
directoryService.setReferralManager( referralManager );
- Value<?> subschemaSubentry = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ Value<?> subschemaSubentry = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
}
Modified: directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1516096&r1=1516095&r2=1516096&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Wed Aug 21 06:49:12 2013
@@ -180,14 +180,12 @@ public class SchemaInterceptor extends B
schemaBaseDn = directoryService.getDnFactory().create( SchemaConstants.OU_SCHEMA );
// stuff for dealing with subentries (garbage for now)
- Value<?> subschemaSubentry = nexus.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
+ Value<?> subschemaSubentry = nexus.getRootDseValue( SUBSCHEMA_SUBENTRY_AT );
subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
- subschemaSubentryDn.apply( schemaManager );
subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
schemaModificationAttributesDn = directoryService.getDnFactory().create(
SchemaConstants.SCHEMA_MODIFICATIONS_DN );
- schemaModificationAttributesDn.apply( schemaManager );
computeSuperiors();