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 2011/11/13 00:58:42 UTC
svn commit: r1201362 [5/6] - in /directory/apacheds/branches/apacheds-osgi:
interceptor-kerberos/
interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/
interceptors/admin/
interceptors/admin/src/main/java/org/apache/directory/se...
Modified: directory/apacheds/branches/apacheds-osgi/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=1201362&r1=1201361&r2=1201362&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-osgi/interceptors/normalization/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Sat Nov 12 23:58:40 2011
@@ -23,15 +23,15 @@ package org.apache.directory.server.core
import java.util.List;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.HasEntryOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ModifyOperationContext;
@@ -80,6 +80,15 @@ public class NormalizationInterceptor ex
private FilterNormalizingVisitor normVisitor;
/**
+ * Creates a new instance of a NormalizationInterceptor.
+ */
+ public NormalizationInterceptor()
+ {
+ super( InterceptorEnum.NORMALIZATION_INTERCEPTOR );
+ }
+
+
+ /**
* Initialize the registries, normalizers.
*/
public void init( DirectoryService directoryService ) throws LdapException
@@ -107,19 +116,62 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
- public void add( NextInterceptor nextInterceptor, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
{
addContext.getDn().apply( schemaManager );
addContext.getEntry().getDn().apply( schemaManager );
addRdnAttributesToEntry( addContext.getDn(), addContext.getEntry() );
- nextInterceptor.add( addContext );
+ next( addContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void bind( BindOperationContext bindContext ) throws LdapException
+ {
+ bindContext.getDn().apply( schemaManager );
+ next( bindContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
+ {
+ if ( !compareContext.getDn().isSchemaAware() )
+ {
+ compareContext.getDn().apply( schemaManager );
+ }
+
+ // Get the attributeType from the OID
+ try
+ {
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() );
+
+ // Translate the value from binary to String if the AT is HR
+ if ( attributeType.getSyntax().isHumanReadable() && ( !compareContext.getValue().isHumanReadable() ) )
+ {
+ String value = compareContext.getValue().getString();
+ compareContext.setValue( new StringValue( value ) );
+ }
+
+ compareContext.setAttributeType( attributeType );
+ }
+ catch ( LdapException le )
+ {
+ throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
+ }
+
+ return next( compareContext );
}
/**
* {@inheritDoc}
*/
- public void delete( NextInterceptor nextInterceptor, DeleteOperationContext deleteContext ) throws LdapException
+ public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
Dn dn = deleteContext.getDn();
@@ -128,61 +180,78 @@ public class NormalizationInterceptor ex
dn.apply( schemaManager );
}
- nextInterceptor.delete( deleteContext );
+ next( deleteContext );
}
/**
* {@inheritDoc}
*/
- public void modify( NextInterceptor nextInterceptor, ModifyOperationContext modifyContext ) throws LdapException
+ public boolean hasEntry( HasEntryOperationContext hasEntryContext ) throws LdapException
{
- if ( !modifyContext.getDn().isSchemaAware() )
- {
- modifyContext.getDn().apply( schemaManager );
- }
+ hasEntryContext.getDn().apply( schemaManager );
- if ( modifyContext.getModItems() != null )
- {
- for ( Modification modification : modifyContext.getModItems() )
- {
- AttributeType attributeType = schemaManager.getAttributeType( modification.getAttribute().getId() );
- modification.apply( attributeType );
- }
- }
-
- nextInterceptor.modify( modifyContext );
+ return next( hasEntryContext );
}
/**
* {@inheritDoc}
*/
- public void rename( NextInterceptor nextInterceptor, RenameOperationContext renameContext ) throws LdapException
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
{
- // Normalize the new Rdn and the Dn if needed
+ listContext.getDn().apply( schemaManager );
- if ( !renameContext.getDn().isSchemaAware() )
+ return next( listContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
+ {
+ lookupContext.getDn().apply( schemaManager );
+
+ List<String> attrIds = lookupContext.getAttrsId();
+
+ if ( ( attrIds != null ) && ( attrIds.size() > 0 ) )
{
- renameContext.getDn().apply( schemaManager );
+ // We have to normalize the requested IDs
+ lookupContext.setAttrsId( normalizeAttrsId( lookupContext.getAttrsIdArray() ) );
}
- renameContext.getNewRdn().apply( schemaManager );
+ return next( lookupContext );
+ }
- if ( !renameContext.getNewDn().isSchemaAware() )
+
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ if ( !modifyContext.getDn().isSchemaAware() )
{
- renameContext.getNewDn().apply( schemaManager );
+ modifyContext.getDn().apply( schemaManager );
}
- // Push to the next interceptor
- nextInterceptor.rename( renameContext );
+ if ( modifyContext.getModItems() != null )
+ {
+ for ( Modification modification : modifyContext.getModItems() )
+ {
+ AttributeType attributeType = schemaManager.getAttributeType( modification.getAttribute().getId() );
+ modification.apply( attributeType );
+ }
+ }
+
+ next( modifyContext );
}
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor nextInterceptor, MoveOperationContext moveContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
if ( !moveContext.getDn().isSchemaAware() )
{
@@ -209,17 +278,15 @@ public class NormalizationInterceptor ex
moveContext.getRdn().apply( schemaManager );
}
- nextInterceptor.move( moveContext );
+ next( moveContext );
}
/**
* {@inheritDoc}
*/
- public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext moveAndRenameContext )
- throws LdapException
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
-
if ( !moveAndRenameContext.getNewRdn().isSchemaAware() )
{
moveAndRenameContext.getNewRdn().apply( schemaManager );
@@ -240,15 +307,38 @@ public class NormalizationInterceptor ex
moveAndRenameContext.getNewSuperiorDn().apply( schemaManager );
}
- nextInterceptor.moveAndRename( moveAndRenameContext );
+ next( moveAndRenameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void rename( RenameOperationContext renameContext ) throws LdapException
+ {
+ // Normalize the new Rdn and the Dn if needed
+
+ if ( !renameContext.getDn().isSchemaAware() )
+ {
+ renameContext.getDn().apply( schemaManager );
+ }
+
+ renameContext.getNewRdn().apply( schemaManager );
+
+ if ( !renameContext.getNewDn().isSchemaAware() )
+ {
+ renameContext.getNewDn().apply( schemaManager );
+ }
+
+ // Push to the next interceptor
+ next( renameContext );
}
/**
* {@inheritDoc}
*/
- public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext )
- throws LdapException
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
Dn dn = searchContext.getDn();
@@ -278,7 +368,7 @@ public class NormalizationInterceptor ex
searchContext.setFilter( filter );
// TODO Normalize the returned Attributes, storing the UP attributes to format the returned values.
- return nextInterceptor.search( searchContext );
+ return next( searchContext );
}
}
@@ -286,27 +376,6 @@ public class NormalizationInterceptor ex
/**
* {@inheritDoc}
*/
- public boolean hasEntry( NextInterceptor nextInterceptor, EntryOperationContext hasEntryContext ) throws LdapException
- {
- hasEntryContext.getDn().apply( schemaManager );
- return nextInterceptor.hasEntry( hasEntryContext );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext )
- throws LdapException
- {
- listContext.getDn().apply( schemaManager );
- return nextInterceptor.list( listContext );
- }
-
-
- /**
- * {@inheritDoc}
- */
private String[] normalizeAttrsId( String[] attrIds ) throws LdapException
{
if ( attrIds == null )
@@ -327,72 +396,10 @@ public class NormalizationInterceptor ex
}
- /**
- * {@inheritDoc}
- */
- public Entry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws LdapException
- {
- lookupContext.getDn().apply( schemaManager );
-
- List<String> attrIds = lookupContext.getAttrsId();
-
- if ( ( attrIds != null ) && ( attrIds.size() > 0 ) )
- {
- // We have to normalize the requested IDs
- lookupContext.setAttrsId( normalizeAttrsId( lookupContext.getAttrsIdArray() ) );
- }
-
- return nextInterceptor.lookup( lookupContext );
- }
-
-
// ------------------------------------------------------------------------
// Normalize all Name based arguments for other interface operations
// ------------------------------------------------------------------------
/**
- * {@inheritDoc}
- */
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
- {
- if ( !compareContext.getDn().isSchemaAware() )
- {
- compareContext.getDn().apply( schemaManager );
- }
-
- // Get the attributeType from the OID
- try
- {
- AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( compareContext.getOid() );
-
- // Translate the value from binary to String if the AT is HR
- if ( attributeType.getSyntax().isHumanReadable() && ( !compareContext.getValue().isHumanReadable() ) )
- {
- String value = compareContext.getValue().getString();
- compareContext.setValue( new StringValue( value ) );
- }
-
- compareContext.setAttributeType( attributeType );
- }
- catch ( LdapException le )
- {
- throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
- }
-
- return next.compare( compareContext );
- }
-
-
- /**
- * {@inheritDoc}
- */
- public void bind( NextInterceptor next, BindOperationContext bindContext ) throws LdapException
- {
- bindContext.getDn().apply( schemaManager );
- next.bind( bindContext );
- }
-
-
- /**
* Adds missing Rdn's attributes and values to the entry.
*
* @param dn the Dn
Propchange: directory/apacheds/branches/apacheds-osgi/interceptors/operational/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Nov 12 23:58:40 2011
@@ -0,0 +1,10 @@
+/directory/apacheds/branches/apacheds-codec-merge/interceptors/operational:982369-987590
+/directory/apacheds/branches/apacheds-config/interceptors/operational:1023442-1029077
+/directory/apacheds/branches/apacheds-kerberos-codec-2.0/interceptors/operational:1040956-1043765
+/directory/apacheds/branches/apacheds-replication/interceptors/operational:749790-764110
+/directory/apacheds/branches/apacheds-schema/interceptors/operational:806623-896441
+/directory/apacheds/branches/apacheds-subtree/interceptors/operational:965203-965686
+/directory/apacheds/branches/milestones/interceptors/operational:1072812-1075328
+/directory/apacheds/branches/xdbm-refactoring/interceptors/operational:945827-946347
+/directory/apacheds/trunk/interceptors/operational:1066126-1067785,1068026-1072718,1072800-1075329,1185681-1201347
+/directory/studio/trunk/interceptors/operational:1067786-1067997
Modified: directory/apacheds/branches/apacheds-osgi/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1201362&r1=1201361&r2=1201362&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-osgi/interceptors/operational/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Sat Nov 12 23:58:40 2011
@@ -6,16 +6,16 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.core.operational;
@@ -29,12 +29,12 @@ import java.util.UUID;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.filtering.EntryFilter;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
import org.apache.directory.server.core.api.interceptor.Interceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -80,6 +80,16 @@ public class OperationalAttributeInterce
/** The LoggerFactory used by this Interceptor */
private static Logger LOG = LoggerFactory.getLogger( OperationalAttributeInterceptor.class );
+ private final EntryFilter DENORMALIZING_SEARCH_FILTER = new OperationalAttributeDenormalizingSearchFilter();
+
+ private final EntryFilter SEARCH_FILTER = new OperationalAttributeSearchFilter();
+
+ /** The subschemasubentry Dn */
+ private Dn subschemaSubentryDn;
+
+ /** The admin Dn */
+ private Dn adminDn;
+
/**
* the search result filter to use for collective attribute injection
*/
@@ -95,8 +105,7 @@ public class OperationalAttributeInterce
return filterDenormalized( entry );
}
}
-
- private final EntryFilter DENORMALIZING_SEARCH_FILTER = new OperationalAttributeDenormalizingSearchFilter();
+
/**
* the database search result filter to register with filter service
@@ -106,23 +115,17 @@ public class OperationalAttributeInterce
public boolean accept( SearchingOperationContext operation, Entry entry ) throws Exception
{
return operation.getSearchControls().getReturningAttributes() != null
- || filterOperationalAttributes( entry );
+ || filterOperationalAttributes( entry );
}
}
- private final EntryFilter SEARCH_FILTER = new OperationalAttributeSearchFilter();
-
- /** The subschemasubentry Dn */
- private Dn subschemaSubentryDn;
-
- /** The admin Dn */
- private Dn adminDn;
-
+
/**
* Creates the operational attribute management service interceptor.
*/
public OperationalAttributeInterceptor()
{
+ super( InterceptorEnum.OPERATIONAL_ATTRIBUTE_INTERCEPTOR );
}
@@ -131,7 +134,7 @@ public class OperationalAttributeInterce
super.init( directoryService );
// stuff for dealing with subentries (garbage for now)
- Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDSE( null ).get(
+ Value<?> subschemaSubentry = directoryService.getPartitionNexus().getRootDse( null ).get(
SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
@@ -178,9 +181,12 @@ public class OperationalAttributeInterce
* - creatorsName
* - createTimestamp
* - entryCSN
- * - entryUUID
+ * - entryUUID
*/
- public void add( NextInterceptor nextInterceptor, AddOperationContext addContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void add( AddOperationContext addContext ) throws LdapException
{
String principal = getPrincipal( addContext ).getName();
@@ -228,14 +234,48 @@ public class OperationalAttributeInterce
// The SubSchemaSybentry attribute
checkAddOperationalAttribute( isAdmin, entry, SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
- nextInterceptor.add( addContext );
+ next( addContext );
}
/**
* {@inheritDoc}
*/
- public void modify( NextInterceptor nextInterceptor, ModifyOperationContext modifyContext ) throws LdapException
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
+ {
+ EntryFilteringCursor cursor = next( listContext );
+ cursor.addEntryFilter( SEARCH_FILTER );
+
+ return cursor;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
+ {
+ Entry result = next( lookupContext );
+
+ if ( lookupContext.getAttrsId() == null )
+ {
+ filterOperationalAttributes( result );
+ }
+ else if ( !lookupContext.hasAllOperational() )
+ {
+ filter( lookupContext, result );
+ }
+
+ denormalizeEntryOpAttrs( result );
+
+ return result;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
// We must check that the user hasn't injected either the modifiersName
// or the modifyTimestamp operational attributes : they are not supposed to be
@@ -249,7 +289,8 @@ public class OperationalAttributeInterce
boolean modifierAtPresent = false;
boolean modifiedTimeAtPresent = false;
boolean entryCsnAtPresent = false;
-
+ Dn dn = modifyContext.getDn();
+
for ( Modification modification : mods )
{
AttributeType attributeType = modification.getAttribute().getAttributeType();
@@ -304,61 +345,49 @@ public class OperationalAttributeInterce
}
}
- if ( !modifierAtPresent )
+ // Add the modification AT only if we are not trying to modify the SubentrySubschema
+ if ( !dn.equals( subschemaSubentryDn ) )
{
- // Inject the ModifiersName AT if it's not present
- Attribute attribute = new DefaultAttribute( MODIFIERS_NAME_AT, getPrincipal( modifyContext )
- .getName() );
+ if ( !modifierAtPresent )
+ {
+ // Inject the ModifiersName AT if it's not present
+ Attribute attribute = new DefaultAttribute( MODIFIERS_NAME_AT, getPrincipal( modifyContext )
+ .getName() );
- Modification modifiersName = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+ Modification modifiersName = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
- mods.add( modifiersName );
- }
+ mods.add( modifiersName );
+ }
- if ( !modifiedTimeAtPresent )
- {
- // Inject the ModifyTimestamp AT if it's not present
- Attribute attribute = new DefaultAttribute( MODIFY_TIMESTAMP_AT, DateUtils
- .getGeneralizedTime() );
+ if ( !modifiedTimeAtPresent )
+ {
+ // Inject the ModifyTimestamp AT if it's not present
+ Attribute attribute = new DefaultAttribute( MODIFY_TIMESTAMP_AT, DateUtils
+ .getGeneralizedTime() );
- Modification timestamp = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+ Modification timestamp = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
- mods.add( timestamp );
- }
+ mods.add( timestamp );
+ }
- if ( !entryCsnAtPresent )
- {
- String csn = directoryService.getCSN().toString();
- Attribute attribute = new DefaultAttribute( ENTRY_CSN_AT, csn );
- Modification updatedCsn = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
- mods.add( updatedCsn );
+ if ( !entryCsnAtPresent )
+ {
+ String csn = directoryService.getCSN().toString();
+ Attribute attribute = new DefaultAttribute( ENTRY_CSN_AT, csn );
+ Modification updatedCsn = new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, attribute );
+ mods.add( updatedCsn );
+ }
}
-
- // Go down in the chain
- nextInterceptor.modify( modifyContext );
- }
-
-
- public void rename( NextInterceptor nextInterceptor, RenameOperationContext renameContext ) throws LdapException
- {
- Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
- entry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
- entry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- Entry modifiedEntry = renameContext.getOriginalEntry().clone();
- modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
- modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
- //modifiedEntry.setDn( renameContext.getNewDn() );
- renameContext.setModifiedEntry( modifiedEntry );
-
- nextInterceptor.rename( renameContext );
+ // Go down in the chain
+ next( modifyContext );
}
/**
* {@inheritDoc}
*/
- public void move( NextInterceptor nextInterceptor, MoveOperationContext moveContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
Entry modifiedEntry = moveContext.getOriginalEntry().clone();
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( moveContext ).getName() );
@@ -366,12 +395,14 @@ public class OperationalAttributeInterce
modifiedEntry.setDn( moveContext.getNewDn() );
moveContext.setModifiedEntry( modifiedEntry );
- nextInterceptor.move( moveContext );
+ next( moveContext );
}
- public void moveAndRename( NextInterceptor nextInterceptor, MoveAndRenameOperationContext moveAndRenameContext )
- throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
Entry modifiedEntry = moveAndRenameContext.getOriginalEntry().clone();
modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( moveAndRenameContext ).getName() );
@@ -379,41 +410,35 @@ public class OperationalAttributeInterce
modifiedEntry.setDn( moveAndRenameContext.getNewDn() );
moveAndRenameContext.setModifiedEntry( modifiedEntry );
- nextInterceptor.moveAndRename( moveAndRenameContext );
+ next( moveAndRenameContext );
}
- public Entry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void rename( RenameOperationContext renameContext ) throws LdapException
{
- Entry result = nextInterceptor.lookup( lookupContext );
-
- if ( lookupContext.getAttrsId() == null )
- {
- filterOperationalAttributes( result );
- }
- else if ( !lookupContext.hasAllOperational() )
- {
- filter( lookupContext, result );
- }
-
- denormalizeEntryOpAttrs( result );
- return result;
- }
+ Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
+ entry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
+ entry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+ Entry modifiedEntry = renameContext.getOriginalEntry().clone();
+ modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
+ modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+ //modifiedEntry.setDn( renameContext.getNewDn() );
+ renameContext.setModifiedEntry( modifiedEntry );
- public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext )
- throws LdapException
- {
- EntryFilteringCursor cursor = nextInterceptor.list( listContext );
- cursor.addEntryFilter( SEARCH_FILTER );
- return cursor;
+ next( renameContext );
}
- public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext )
- throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
{
- EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
+ EntryFilteringCursor cursor = next( searchContext );
if ( searchContext.isAllOperationalAttributes()
|| ( searchContext.getReturningAttributes() != null && !searchContext.getReturningAttributes().isEmpty() ) )
@@ -427,6 +452,7 @@ public class OperationalAttributeInterce
}
cursor.addEntryFilter( SEARCH_FILTER );
+
return cursor;
}
@@ -447,7 +473,7 @@ public class OperationalAttributeInterce
for ( Attribute attribute : attributes.getAttributes() )
{
AttributeType attributeType = attribute.getAttributeType();
-
+
if ( attributeType.getUsage() != UsageEnum.USER_APPLICATIONS )
{
removedAttributes.add( attributeType );
@@ -550,7 +576,7 @@ public class OperationalAttributeInterce
for ( int pos = 0; pos < size; pos++ )
{
Rdn rdn = dn.getRdn( size - 1 - pos );
-
+
if ( rdn.size() == 0 )
{
newDn = newDn.add( new Rdn() );
Propchange: directory/apacheds/branches/apacheds-osgi/interceptors/referral/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Nov 12 23:58:40 2011
@@ -0,0 +1,10 @@
+/directory/apacheds/branches/apacheds-codec-merge/interceptors/referral:982369-987590
+/directory/apacheds/branches/apacheds-config/interceptors/referral:1023442-1029077
+/directory/apacheds/branches/apacheds-kerberos-codec-2.0/interceptors/referral:1040956-1043765
+/directory/apacheds/branches/apacheds-replication/interceptors/referral:749790-764110
+/directory/apacheds/branches/apacheds-schema/interceptors/referral:806623-896441
+/directory/apacheds/branches/apacheds-subtree/interceptors/referral:965203-965686
+/directory/apacheds/branches/milestones/interceptors/referral:1072812-1075328
+/directory/apacheds/branches/xdbm-refactoring/interceptors/referral:945827-946347
+/directory/apacheds/trunk/interceptors/referral:1066126-1067785,1068026-1072718,1072800-1075329,1185681-1201347
+/directory/studio/trunk/interceptors/referral:1067786-1067997
Modified: directory/apacheds/branches/apacheds-osgi/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=1201362&r1=1201361&r2=1201362&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-osgi/interceptors/referral/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Sat Nov 12 23:58:40 2011
@@ -6,28 +6,27 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.core.referral;
import javax.naming.Context;
-import org.apache.directory.server.core.shared.ReferralManagerImpl;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.ReferralManager;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.DeleteOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -36,6 +35,7 @@ import org.apache.directory.server.core.
import org.apache.directory.server.core.api.interceptor.context.MoveOperationContext;
import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
import org.apache.directory.server.core.api.partition.PartitionNexus;
+import org.apache.directory.server.core.shared.ReferralManagerImpl;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.Attribute;
@@ -53,9 +53,9 @@ import org.slf4j.LoggerFactory;
/**
- * An service which is responsible referral handling behavoirs. It manages
+ * An service which is responsible referral handling behavoirs. It manages
* referral handling behavoir when the {@link Context#REFERRAL} is implicitly
- * or explicitly set to "ignore", when set to "throw" and when set to "follow".
+ * or explicitly set to "ignore", when set to "throw" and when set to "follow".
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
@@ -140,7 +140,7 @@ public class ReferralInterceptor extends
static private boolean isReferral( Entry entry ) throws LdapException
{
// Check that the entry is not null, otherwise return FALSE.
- // This is typically to cover the case where the entry has not
+ // This is typically to cover the case where the entry has not
// been added into the context because it does not exists.
if ( entry == null )
{
@@ -192,6 +192,14 @@ public class ReferralInterceptor extends
}
}
+ /**
+ * Creates a new instance of a ReferralInterceptor.
+ */
+ public ReferralInterceptor()
+ {
+ super( InterceptorEnum.REFERRAL_INTERCEPTOR );
+ }
+
public void init( DirectoryService directoryService ) throws LdapException
{
@@ -203,7 +211,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.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
}
@@ -216,16 +224,19 @@ public class ReferralInterceptor extends
*
* Case (1) is easy : we inject the entry into the server and we are done.
* Case (2) is the same as case (1), but we have to update the referral manager.
- * Case (3) is handled by the LdapProcotol handler, as we have to return a
- * LdapResult containing a list of this entry's parent's referrals URL, if the
- * ManageDSAIT control is not present, or the parent's entry if the control
- * is present.
+ * Case (3) is handled by the LdapProcotol handler, as we have to return a
+ * LdapResult containing a list of this entry's parent's referrals URL, if the
+ * ManageDSAIT control is not present, or the parent's entry if the control
+ * is present.
*
* Of course, if the entry already exists, nothing will be done, as we will get an
* entryAlreadyExists error.
- *
+ *
+ */
+ /**
+ * {@inheritDoc}
*/
- public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+ public void add( AddOperationContext addContext ) throws LdapException
{
Entry entry = addContext.getEntry();
@@ -233,9 +244,9 @@ public class ReferralInterceptor extends
boolean isReferral = isReferral( entry );
// We add the entry into the server
- next.add( addContext );
+ next( addContext );
- // If the addition is successful, we update the referralManager
+ // If the addition is successful, we update the referralManager
if ( isReferral )
{
// We have to add it to the referralManager
@@ -255,16 +266,19 @@ public class ReferralInterceptor extends
* (3) the entry is a referral
*
* Case (1) is handled by removing the entry from the server
- * In case (2), we return an exception build using the parent referral
+ * In case (2), we return an exception build using the parent referral
* For case(3), we remove the entry from the server and remove the referral
* from the referral manager.
*
* If the entry does not exist in the server, we will get a NoSuchObject error
*/
- public void delete( NextInterceptor next, DeleteOperationContext deleteContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void delete( DeleteOperationContext deleteContext ) throws LdapException
{
// First delete the entry into the server
- next.delete( deleteContext );
+ next( deleteContext );
Entry entry = deleteContext.getEntry();
@@ -284,15 +298,61 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ Dn dn = modifyContext.getDn();
+
+ // handle a normal modify without following referrals
+ next( modifyContext );
+
+ // Check if we are trying to modify the schema or the rootDSE,
+ // if so, we don't modify the referralManager
+ if ( dn.isEmpty() || dn.equals( subschemaSubentryDn ) )
+ {
+ // Do nothing
+ return;
+ }
+
+ // Update the referralManager. We have to read the entry again
+ // as it has been modified, before updating the ReferralManager
+ // TODO: this can be spare, as we already have the altered entry
+ // into the opContext, but for an unknow reason, this will fail
+ // on eferral tests...
+ LookupOperationContext lookupContext = new LookupOperationContext( modifyContext.getSession(), dn );
+ lookupContext.setAttrsId( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
+
+ Entry newEntry = nexus.lookup( lookupContext );
+
+ // Update the referralManager.
+ // Check that we have the entry, just in case
+ // TODO : entries should be locked until the operation is done on it.
+ if ( newEntry != null )
+ {
+ referralManager.lockWrite();
+
+ if ( referralManager.isReferral( newEntry.getDn() ) )
+ {
+ referralManager.removeReferral( modifyContext.getEntry() );
+ referralManager.addReferral( newEntry );
+ }
+
+ referralManager.unlock();
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
**/
- public void move( NextInterceptor next, MoveOperationContext moveContext ) throws LdapException
+ public void move( MoveOperationContext moveContext ) throws LdapException
{
Dn newDn = moveContext.getNewDn();
// Check if the entry is a referral itself
boolean isReferral = isReferral( moveContext.getOriginalEntry() );
- next.move( moveContext );
+ next( moveContext );
if ( isReferral )
{
@@ -310,12 +370,12 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
**/
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
+ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
{
// Check if the entry is a referral itself
boolean isReferral = isReferral( moveAndRenameContext.getOriginalEntry() );
- next.moveAndRename( moveAndRenameContext );
+ next( moveAndRenameContext );
if ( isReferral )
{
@@ -335,12 +395,12 @@ public class ReferralInterceptor extends
/**
* {@inheritDoc}
**/
- public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
+ public void rename( RenameOperationContext renameContext ) throws LdapException
{
// Check if the entry is a referral itself
boolean isReferral = isReferral( renameContext.getOriginalEntry() );
- next.rename( renameContext );
+ next( renameContext );
if ( isReferral )
{
@@ -359,50 +419,4 @@ public class ReferralInterceptor extends
referralManager.unlock();
}
}
-
-
- /**
- * Modify an entry in the server.
- */
- public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
- {
- Dn dn = modifyContext.getDn();
-
- // handle a normal modify without following referrals
- next.modify( modifyContext );
-
- // Check if we are trying to modify the schema or the rootDSE,
- // if so, we don't modify the referralManager
- if ( dn.isEmpty() || dn.equals( subschemaSubentryDn ) )
- {
- // Do nothing
- return;
- }
-
- // Update the referralManager. We have to read the entry again
- // as it has been modified, before updating the ReferralManager
- // TODO: this can be spare, as we already have the altered entry
- // into the opContext, but for an unknow reason, this will fail
- // on eferral tests...
- LookupOperationContext lookupContext = new LookupOperationContext( modifyContext.getSession(), dn );
- lookupContext.setAttrsId( SchemaConstants.ALL_ATTRIBUTES_ARRAY );
-
- Entry newEntry = nexus.lookup( lookupContext );
-
- // Update the referralManager.
- // Check that we have the entry, just in case
- // TODO : entries should be locked until the operation is done on it.
- if ( newEntry != null )
- {
- referralManager.lockWrite();
-
- if ( referralManager.isReferral( newEntry.getDn() ) )
- {
- referralManager.removeReferral( modifyContext.getEntry() );
- referralManager.addReferral( newEntry );
- }
-
- referralManager.unlock();
- }
- }
}
Propchange: directory/apacheds/branches/apacheds-osgi/interceptors/schema/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Nov 12 23:58:40 2011
@@ -0,0 +1,10 @@
+/directory/apacheds/branches/apacheds-codec-merge/interceptors/schema:982369-987590
+/directory/apacheds/branches/apacheds-config/interceptors/schema:1023442-1029077
+/directory/apacheds/branches/apacheds-kerberos-codec-2.0/interceptors/schema:1040956-1043765
+/directory/apacheds/branches/apacheds-replication/interceptors/schema:749790-764110
+/directory/apacheds/branches/apacheds-schema/interceptors/schema:806623-896441
+/directory/apacheds/branches/apacheds-subtree/interceptors/schema:965203-965686
+/directory/apacheds/branches/milestones/interceptors/schema:1072812-1075328
+/directory/apacheds/branches/xdbm-refactoring/interceptors/schema:945827-946347
+/directory/apacheds/trunk/interceptors/schema:1066126-1067785,1068026-1072718,1072800-1075329,1185681-1201347
+/directory/studio/trunk/interceptors/schema:1067786-1067997
Modified: directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1201362&r1=1201361&r2=1201362&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Sat Nov 12 23:58:40 2011
@@ -34,12 +34,12 @@ import javax.naming.directory.SearchCont
import org.apache.directory.server.core.shared.SchemaService;
import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.filtering.BaseEntryFilteringCursor;
import org.apache.directory.server.core.api.filtering.EntryFilter;
import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
import org.apache.directory.server.core.api.interceptor.BaseInterceptor;
-import org.apache.directory.server.core.api.interceptor.NextInterceptor;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
import org.apache.directory.server.core.api.interceptor.context.CompareOperationContext;
import org.apache.directory.server.core.api.interceptor.context.ListOperationContext;
@@ -135,9 +135,7 @@ public class SchemaInterceptor extends B
/** The SubschemaSubentry Dn */
private Dn subschemaSubentryDn;
- /**
- * the normalized name for the schema modification attributes
- */
+ /** The normalized name for the schema modification attributes */
private Dn schemaModificationAttributesDn;
/** The schema manager */
@@ -158,6 +156,14 @@ public class SchemaInterceptor extends B
/** A map used to store all the objectClasses allowed attributes (may + must) */
private Map<String, List<AttributeType>> allowed;
+ /**
+ * Creates a new instance of a SchemaInterceptor.
+ */
+ public SchemaInterceptor()
+ {
+ super( InterceptorEnum.SCHEMA_INTERCEPTOR );
+ }
+
/**
* Initialize the Schema Service
@@ -183,7 +189,7 @@ 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.getRootDse( null ).get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
subschemaSubentryDn = directoryService.getDnFactory().create( subschemaSubentry.getString() );
subschemaSubentryDn.apply( schemaManager );
subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
@@ -300,8 +306,7 @@ public class SchemaInterceptor extends B
* As a result, we will gather all of these three ObjectClasses in 'inetOrgPerson' ObjectClasse
* superiors.
*/
- private void computeOCSuperiors( ObjectClass objectClass, List<ObjectClass> superiors, Set<String> ocSeen )
- throws LdapException
+ private void computeOCSuperiors( ObjectClass objectClass, List<ObjectClass> superiors, Set<String> ocSeen ) throws LdapException
{
List<ObjectClass> parents = objectClass.getSuperiors();
@@ -371,38 +376,6 @@ public class SchemaInterceptor extends B
}
- public EntryFilteringCursor list( NextInterceptor nextInterceptor, ListOperationContext listContext )
- throws LdapException
- {
- EntryFilteringCursor cursor = nextInterceptor.list( listContext );
- cursor.addEntryFilter( binaryAttributeFilter );
- return cursor;
- }
-
-
- /**
- * {@inheritDoc}
- */
- public boolean compare( NextInterceptor next, CompareOperationContext compareContext ) throws LdapException
- {
- if ( IS_DEBUG )
- {
- LOG.debug( "Operation Context: {}", compareContext );
- }
-
- // Check that the requested AT exists
- // complain if we do not recognize the attribute being compared
- if ( !schemaManager.getAttributeTypeRegistry().contains( compareContext.getOid() ) )
- {
- throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
- }
-
- boolean result = next.compare( compareContext );
-
- return result;
- }
-
-
/**
* Remove all unknown attributes from the searchControls, to avoid an exception.
*
@@ -572,9 +545,9 @@ public class SchemaInterceptor extends B
}
}
else if ( ( filter instanceof SubstringNode ) ||
- ( filter instanceof PresenceNode ) ||
- ( filter instanceof AssertionNode ) ||
- ( filter instanceof ScopeNode ) )
+ ( filter instanceof PresenceNode ) ||
+ ( filter instanceof AssertionNode ) ||
+ ( filter instanceof ScopeNode ) )
{
// Nothing to do
}
@@ -631,123 +604,6 @@ public class SchemaInterceptor extends B
}
- public EntryFilteringCursor search( NextInterceptor nextInterceptor, SearchOperationContext searchContext )
- throws LdapException
- {
- Dn base = searchContext.getDn();
- SearchControls searchCtls = searchContext.getSearchControls();
- ExprNode filter = searchContext.getFilter();
-
- // We have to eliminate bad attributes from the request, accordingly
- // to RFC 2251, chap. 4.5.1. Basically, all unknown attributes are removed
- // from the list
- if ( searchCtls.getReturningAttributes() != null )
- {
- filterAttributesToReturn( searchCtls );
- }
-
- // We also have to check the H/R flag for the filter attributes
- checkFilter( filter );
-
- String baseNormForm = ( base.isSchemaAware() ? base.getNormName() : base.getNormName() );
-
- // Deal with the normal case : searching for a normal value (not subSchemaSubEntry)
- if ( !subschemaSubentryDnNorm.equals( baseNormForm ) )
- {
- EntryFilteringCursor cursor = nextInterceptor.search( searchContext );
-
- if ( searchCtls.getReturningAttributes() != null )
- {
- cursor.addEntryFilter( topFilter );
- return cursor;
- }
-
- for ( EntryFilter ef : filters )
- {
- cursor.addEntryFilter( ef );
- }
-
- return cursor;
- }
-
- // The user was searching into the subSchemaSubEntry
- // This kind of search _must_ be limited to OBJECT scope (the subSchemaSubEntry
- // does not have any sub level)
- if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
- {
- // The filter can be an equality or a presence, but nothing else
- if ( filter instanceof SimpleNode)
- {
- // We should get the value for the filter.
- // only 'top' and 'subSchema' are valid values
- SimpleNode node = ( SimpleNode ) filter;
- String objectClass;
-
- objectClass = node.getValue().getString();
-
- String objectClassOid = null;
-
- if ( schemaManager.getObjectClassRegistry().contains( objectClass ) )
- {
- objectClassOid = schemaManager.lookupObjectClassRegistry( objectClass ).getOid();
- }
- else
- {
- return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
- }
-
- AttributeType nodeAt = node.getAttributeType();
-
- // see if node attribute is objectClass
- if ( nodeAt.equals( OBJECT_CLASS_AT )
- && ( objectClassOid.equals( SchemaConstants.TOP_OC_OID ) || objectClassOid
- .equals( SchemaConstants.SUBSCHEMA_OC_OID ) ) && ( node instanceof EqualityNode ) )
- {
- // call.setBypass( true );
- Entry serverEntry = SchemaService.getSubschemaEntry( directoryService, searchCtls.getReturningAttributes() );
- serverEntry.setDn( base );
- return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
- }
- else
- {
- return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
- }
- }
- else if ( filter instanceof PresenceNode )
- {
- PresenceNode node = ( PresenceNode ) filter;
-
- // see if node attribute is objectClass
- if ( node.getAttributeType().equals( OBJECT_CLASS_AT ) )
- {
- // call.setBypass( true );
- Entry serverEntry = SchemaService.getSubschemaEntry( directoryService, searchCtls.getReturningAttributes() );
- serverEntry.setDn( base );
- EntryFilteringCursor cursor = new BaseEntryFilteringCursor(
- new SingletonCursor<Entry>( serverEntry ), searchContext );
- return cursor;
- }
- }
- }
-
- // In any case not handled previously, just return an empty result
- return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
- }
-
-
- /**
- * Search for an entry, using its Dn. Binary attributes and ObjectClass attribute are removed.
- */
- public Entry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws LdapException
- {
- Entry result = nextInterceptor.lookup( lookupContext );
-
- filterBinaryAttributes( result );
-
- return result;
- }
-
-
private void getSuperiors( ObjectClass oc, Set<String> ocSeen, List<ObjectClass> result ) throws LdapException
{
for ( ObjectClass parent : oc.getSuperiors() )
@@ -927,63 +783,6 @@ public class SchemaInterceptor extends B
}
- public void rename( NextInterceptor next, RenameOperationContext renameContext ) throws LdapException
- {
- Dn oldDn = renameContext.getDn();
- Rdn newRdn = renameContext.getNewRdn();
- boolean deleteOldRn = renameContext.getDeleteOldRdn();
- Entry entry = ((ClonedServerEntry)renameContext.getEntry()).getClonedEntry();
-
- /*
- * Note: This is only a consistency checks, to the ensure that all
- * mandatory attributes are available after deleting the old Rdn.
- * The real modification is done in the XdbmStore class.
- * - TODO: this check is missing in the moveAndRename() method
- */
- if ( deleteOldRn )
- {
- Rdn oldRdn = oldDn.getRdn();
-
- // Delete the old Rdn means we remove some attributes and values.
- // We must make sure that after this operation all must attributes
- // are still present in the entry.
- for ( Ava atav : oldRdn)
- {
- AttributeType type = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() );
- entry.remove( type, atav.getUpValue() );
- }
-
- // Check that no operational attributes are removed
- for ( Ava atav : oldRdn)
- {
- AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() );
-
- if ( !attributeType.isUserModifiable() )
- {
- throw new LdapNoPermissionException( "Cannot modify the attribute '" + atav.getUpType() + "'" );
- }
- }
- }
-
- for ( Ava atav : newRdn )
- {
- AttributeType type = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() );
-
- if ( !entry.contains( type, atav.getNormValue() ) )
- {
- entry.add( new DefaultAttribute( type, atav.getNormValue() ) );
- }
- }
-
- // Substitute the Rdn and check if the new entry is correct
- entry.setDn( renameContext.getNewDn() );
-
- check( renameContext.getNewDn(), entry );
-
- next.rename( renameContext );
- }
-
-
/**
* Create a new attribute using the given values
*/
@@ -1026,7 +825,7 @@ public class SchemaInterceptor extends B
&& ( !attributeType.equals( MODIFIERS_NAME_AT )
&& ( !attributeType.equals( MODIFY_TIMESTAMP_AT ) )
&& ( !attributeType.equals( ENTRY_CSN_AT ) )
- && ( !PWD_POLICY_STATE_ATTRIBUTE_TYPES.contains( attributeType ) ) ) )
+ && ( !PWD_POLICY_STATE_ATTRIBUTE_TYPES.contains( attributeType ) ) ) )
{
String msg = I18n.err( I18n.ERR_52, attributeType );
LOG.error( msg );
@@ -1065,7 +864,7 @@ public class SchemaInterceptor extends B
// point, as one of the following modification can change the
// ObjectClasses.
Attribute newAttribute = attribute.clone();
-
+
// Check that the attribute allows null values if we don'y have any value
if ( ( newAttribute.size() == 0 ) && !newAttribute.isValid( attributeType ) )
{
@@ -1182,64 +981,6 @@ public class SchemaInterceptor extends B
/**
- * {@inheritDoc}
- */
- public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws LdapException
- {
- // A modification on a simple entry will be done in three steps :
- // - get the original entry (it should already been in the context)
- // - apply the modification on it
- // - check that the entry is still correct
- // - add the operational attributes (modifiersName/modifyTimeStamp)
- // - store the modified entry on the backend.
- //
- // A modification done on the schema is a bit different, as there is two more
- // steps
- // - We have to update the registries
- // - We have to modify the ou=schemaModifications entry
- //
-
- // First, check that the entry is either a subschemaSubentry or a schema element.
- // This is the case if it's a child of cn=schema or ou=schema
- Dn dn = modifyContext.getDn();
-
- // Gets the stored entry on which the modification must be applied
- if ( dn.equals( subschemaSubentryDn ) )
- {
- LOG.debug( "Modification attempt on schema subentry {}: \n{}", dn, modifyContext );
-
- // We can get rid of the modifiersName and modifyTimestamp, they are useless.
- List<Modification> mods = modifyContext.getModItems();
- List<Modification> cleanMods = new ArrayList<Modification>();
-
- for ( Modification mod : mods )
- {
- AttributeType at = ( ( DefaultModification ) mod ).getAttribute().getAttributeType();
-
- if ( !MODIFIERS_NAME_AT.equals( at ) && !MODIFY_TIMESTAMP_AT.equals( at ) )
- {
- cleanMods.add( mod );
- }
- }
-
- modifyContext.setModItems( cleanMods );
-
- // Now that the entry has been modified, update the SSSE
- schemaSubEntryManager.modifySchemaSubentry( modifyContext, modifyContext
- .hasRequestControl( Cascade.OID ) );
-
- return;
- }
-
- Entry entry = modifyContext.getEntry();
- List<Modification> modifications = modifyContext.getModItems();
- checkModifyEntry( dn, entry, modifications );
-
- next.modify( modifyContext );
- }
-
-
- /**
* Filter the attributes by removing the ones which are not allowed
*/
// This will suppress PMD.EmptyCatchBlock warnings in this method
@@ -1325,7 +1066,7 @@ public class SchemaInterceptor extends B
public boolean accept( SearchingOperationContext operation, Entry entry ) throws Exception
{
filterBinaryAttributes( entry );
-
+
return true;
}
}
@@ -1339,7 +1080,7 @@ public class SchemaInterceptor extends B
public boolean accept( SearchingOperationContext operation, Entry entry ) throws Exception
{
filterAttributeTypes( operation, entry );
-
+
return true;
}
}
@@ -1481,7 +1222,10 @@ public class SchemaInterceptor extends B
/**
* Check that all the attributes exist in the schema for this entry.
*/
- public void add( NextInterceptor next, AddOperationContext addContext ) throws LdapException
+ /**
+ * {@inheritDoc}
+ */
+ public void add( AddOperationContext addContext ) throws LdapException
{
Dn name = addContext.getDn();
Entry entry = addContext.getEntry();
@@ -1496,7 +1240,7 @@ public class SchemaInterceptor extends B
if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.META_SCHEMA_OC ) )
{
- next.add( addContext );
+ next( addContext );
if ( schemaManager.isSchemaLoaded( schemaName ) )
{
@@ -1509,16 +1253,16 @@ public class SchemaInterceptor extends B
// This is an ObjectClass addition
checkOcSuperior( addContext.getEntry() );
- next.add( addContext );
+ next( addContext );
// Update the structures now that the schema element has been added
Schema schema = schemaManager.getLoadedSchema( schemaName );
if ( ( schema != null ) && schema.isEnabled() )
{
- Attribute oidAT = entry.get( MetaSchemaConstants.M_OID_AT );
+ Attribute oidAT = entry.get( MetaSchemaConstants.M_OID_AT );
String ocOid = oidAT.getString();
-
+
ObjectClass addedOC = schemaManager.lookupObjectClassRegistry( ocOid );
computeSuperior( addedOC );
}
@@ -1526,32 +1270,304 @@ public class SchemaInterceptor extends B
else if ( entry.contains( OBJECT_CLASS_AT, SchemaConstants.META_ATTRIBUTE_TYPE_OC ) )
{
// This is an AttributeType addition
- next.add( addContext );
+ next( addContext );
}
else
{
- next.add( addContext );
+ next( addContext );
}
}
else
{
- next.add( addContext );
+ next( addContext );
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean compare( CompareOperationContext compareContext ) throws LdapException
+ {
+ if ( IS_DEBUG )
+ {
+ LOG.debug( "Operation Context: {}", compareContext );
+ }
+
+ // Check that the requested AT exists
+ // complain if we do not recognize the attribute being compared
+ if ( !schemaManager.getAttributeTypeRegistry().contains( compareContext.getOid() ) )
+ {
+ throw new LdapInvalidAttributeTypeException( I18n.err( I18n.ERR_266, compareContext.getOid() ) );
+ }
+
+ boolean result = next( compareContext );
+
+ return result;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
+ {
+ EntryFilteringCursor cursor = next( listContext );
+ cursor.addEntryFilter( binaryAttributeFilter );
+
+ return cursor;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
+ {
+ Entry result = next( lookupContext );
+
+ filterBinaryAttributes( result );
+
+ return result;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void modify( ModifyOperationContext modifyContext ) throws LdapException
+ {
+ // A modification on a simple entry will be done in three steps :
+ // - get the original entry (it should already been in the context)
+ // - apply the modification on it
+ // - check that the entry is still correct
+ // - add the operational attributes (modifiersName/modifyTimeStamp)
+ // - store the modified entry on the backend.
+ //
+ // A modification done on the schema is a bit different, as there is two more
+ // steps
+ // - We have to update the registries
+ // - We have to modify the ou=schemaModifications entry
+ //
+
+ // First, check that the entry is either a subschemaSubentry or a schema element.
+ // This is the case if it's a child of cn=schema or ou=schema
+ Dn dn = modifyContext.getDn();
+
+ // Gets the stored entry on which the modification must be applied
+ if ( dn.equals( subschemaSubentryDn ) )
+ {
+ LOG.debug( "Modification attempt on schema subentry {}: \n{}", dn, modifyContext );
+
+ // We can get rid of the modifiersName and modifyTimestamp, they are useless.
+ List<Modification> mods = modifyContext.getModItems();
+ List<Modification> cleanMods = new ArrayList<Modification>();
+
+ for ( Modification mod : mods )
+ {
+ AttributeType at = ( ( DefaultModification ) mod ).getAttribute().getAttributeType();
+
+ if ( !MODIFIERS_NAME_AT.equals( at ) && !MODIFY_TIMESTAMP_AT.equals( at ) && !ENTRY_CSN_AT.equals( at ) )
+ {
+ cleanMods.add( mod );
+ }
+ }
+
+ modifyContext.setModItems( cleanMods );
+
+ // Now that the entry has been modified, update the SSSE
+ schemaSubEntryManager.modifySchemaSubentry( modifyContext, modifyContext
+ .hasRequestControl( Cascade.OID ) );
+
+ return;
}
+
+ Entry entry = modifyContext.getEntry();
+ List<Modification> modifications = modifyContext.getModItems();
+ checkModifyEntry( dn, entry, modifications );
+
+ next( modifyContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public void rename( RenameOperationContext renameContext ) throws LdapException
+ {
+ Dn oldDn = renameContext.getDn();
+ Rdn newRdn = renameContext.getNewRdn();
+ boolean deleteOldRn = renameContext.getDeleteOldRdn();
+ Entry entry = ((ClonedServerEntry)renameContext.getEntry()).getClonedEntry();
+
+ /*
+ * Note: This is only a consistency checks, to the ensure that all
+ * mandatory attributes are available after deleting the old Rdn.
+ * The real modification is done in the XdbmStore class.
+ * - TODO: this check is missing in the moveAndRename() method
+ */
+ if ( deleteOldRn )
+ {
+ Rdn oldRdn = oldDn.getRdn();
+
+ // Delete the old Rdn means we remove some attributes and values.
+ // We must make sure that after this operation all must attributes
+ // are still present in the entry.
+ for ( Ava atav : oldRdn)
+ {
+ AttributeType type = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() );
+ entry.remove( type, atav.getUpValue() );
+ }
+
+ // Check that no operational attributes are removed
+ for ( Ava atav : oldRdn)
+ {
+ AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() );
+
+ if ( !attributeType.isUserModifiable() )
+ {
+ throw new LdapNoPermissionException( "Cannot modify the attribute '" + atav.getUpType() + "'" );
+ }
+ }
+ }
+
+ for ( Ava atav : newRdn )
+ {
+ AttributeType type = schemaManager.lookupAttributeTypeRegistry( atav.getUpType() );
+
+ if ( !entry.contains( type, atav.getNormValue() ) )
+ {
+ entry.add( new DefaultAttribute( type, atav.getNormValue() ) );
+ }
+ }
+
+ // Substitute the Rdn and check if the new entry is correct
+ entry.setDn( renameContext.getNewDn() );
+
+ check( renameContext.getNewDn(), entry );
+
+ next( renameContext );
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public EntryFilteringCursor search( SearchOperationContext searchContext ) throws LdapException
+ {
+ Dn base = searchContext.getDn();
+ SearchControls searchCtls = searchContext.getSearchControls();
+ ExprNode filter = searchContext.getFilter();
+
+ // We have to eliminate bad attributes from the request, accordingly
+ // to RFC 2251, chap. 4.5.1. Basically, all unknown attributes are removed
+ // from the list
+ if ( searchCtls.getReturningAttributes() != null )
+ {
+ filterAttributesToReturn( searchCtls );
+ }
+
+ // We also have to check the H/R flag for the filter attributes
+ checkFilter( filter );
+
+ String baseNormForm = ( base.isSchemaAware() ? base.getNormName() : base.getNormName() );
+
+ // Deal with the normal case : searching for a normal value (not subSchemaSubEntry)
+ if ( !subschemaSubentryDnNorm.equals( baseNormForm ) )
+ {
+ EntryFilteringCursor cursor = next( searchContext );
+
+ if ( searchCtls.getReturningAttributes() != null )
+ {
+ cursor.addEntryFilter( topFilter );
+ return cursor;
+ }
+
+ for ( EntryFilter ef : filters )
+ {
+ cursor.addEntryFilter( ef );
+ }
+
+ return cursor;
+ }
+
+ // The user was searching into the subSchemaSubEntry
+ // This kind of search _must_ be limited to OBJECT scope (the subSchemaSubEntry
+ // does not have any sub level)
+ if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
+ {
+ // The filter can be an equality or a presence, but nothing else
+ if ( filter instanceof SimpleNode)
+ {
+ // We should get the value for the filter.
+ // only 'top' and 'subSchema' are valid values
+ SimpleNode node = ( SimpleNode ) filter;
+ String objectClass;
+
+ objectClass = node.getValue().getString();
+
+ String objectClassOid = null;
+
+ if ( schemaManager.getObjectClassRegistry().contains( objectClass ) )
+ {
+ objectClassOid = schemaManager.lookupObjectClassRegistry( objectClass ).getOid();
+ }
+ else
+ {
+ return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
+ }
+
+ AttributeType nodeAt = node.getAttributeType();
+
+ // see if node attribute is objectClass
+ if ( nodeAt.equals( OBJECT_CLASS_AT )
+ && ( objectClassOid.equals( SchemaConstants.TOP_OC_OID ) || objectClassOid
+ .equals( SchemaConstants.SUBSCHEMA_OC_OID ) ) && ( node instanceof EqualityNode ) )
+ {
+ // call.setBypass( true );
+ Entry serverEntry = SchemaService.getSubschemaEntry( directoryService, searchCtls.getReturningAttributes() );
+ serverEntry.setDn( base );
+ return new BaseEntryFilteringCursor( new SingletonCursor<Entry>( serverEntry ), searchContext );
+ }
+ else
+ {
+ return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
+ }
+ }
+ else if ( filter instanceof PresenceNode )
+ {
+ PresenceNode node = ( PresenceNode ) filter;
+
+ // see if node attribute is objectClass
+ if ( node.getAttributeType().equals( OBJECT_CLASS_AT ) )
+ {
+ // call.setBypass( true );
+ Entry serverEntry = SchemaService.getSubschemaEntry( directoryService, searchCtls.getReturningAttributes() );
+ serverEntry.setDn( base );
+ EntryFilteringCursor cursor = new BaseEntryFilteringCursor(
+ new SingletonCursor<Entry>( serverEntry ), searchContext );
+ return cursor;
+ }
+ }
+ }
+
+ // In any case not handled previously, just return an empty result
+ return new BaseEntryFilteringCursor( new EmptyCursor<Entry>(), searchContext );
}
private String getSchemaName( Dn dn ) throws LdapException
{
int size = dn.size();
-
+
if ( size < 2 )
{
throw new LdapException( I18n.err( I18n.ERR_276 ) );
}
Rdn rdn = dn.getRdn( size - 2 );
-
+
return rdn.getNormValue().getString();
}
@@ -1605,8 +1621,7 @@ public class SchemaInterceptor extends B
/**
* Checks to see numbers of values of attributes conforms to the schema
*/
- private void assertNumberOfAttributeValuesValid( Attribute attribute )
- throws LdapInvalidAttributeValueException
+ private void assertNumberOfAttributeValuesValid( Attribute attribute ) throws LdapInvalidAttributeValueException
{
if ( attribute.size() > 1 && attribute.getAttributeType().isSingleValued() )
{
@@ -1631,25 +1646,25 @@ public class SchemaInterceptor extends B
// include AT names for better error reporting
StringBuilder sb = new StringBuilder();
sb.append( '[' );
-
+
for( String oid: must )
{
String name = schemaManager.getAttributeType( oid ).getName();
sb.append( name )
- .append( '(' )
- .append( oid )
- .append( "), " );
+ .append( '(' )
+ .append( oid )
+ .append( "), " );
}
-
+
int end = sb.length();
sb.replace( end - 2, end, "" ); // remove the trailing ', '
sb.append( ']' );
-
+
throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_279,
sb, dn.getName() ) );
}
}
-
+
/**
* Checck that OC does not conflict :
Modified: directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java?rev=1201362&r1=1201361&r2=1201362&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java (original)
+++ directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaLdifToPartitionExtractor.java Sat Nov 12 23:58:40 2011
@@ -32,7 +32,7 @@ import java.util.UUID;
import java.util.regex.Pattern;
import org.apache.directory.server.core.api.interceptor.context.AddOperationContext;
-import org.apache.directory.server.core.api.interceptor.context.EntryOperationContext;
+import org.apache.directory.server.core.api.interceptor.context.HasEntryOperationContext;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -95,7 +95,7 @@ public class SchemaLdifToPartitionExtrac
this.partition = partition;
Dn dn = new Dn( schemaManager, SchemaConstants.OU_SCHEMA );
- EntryOperationContext hasEntryContext = new EntryOperationContext( null, dn );
+ HasEntryOperationContext hasEntryContext = new HasEntryOperationContext( null, dn );
if ( partition.hasEntry( hasEntryContext ) )
{
LOG.info( "Schema entry 'ou=schema' exists: extracted state set to true." );
Modified: directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=1201362&r1=1201361&r2=1201362&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/branches/apacheds-osgi/interceptors/schema/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Sat Nov 12 23:58:40 2011
@@ -6,16 +6,16 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.server.core.schema;
@@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.Set;
import org.apache.directory.server.core.api.DnFactory;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.interceptor.context.OperationContext;
import org.apache.directory.shared.ldap.model.constants.MetaSchemaConstants;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -52,7 +53,7 @@ import org.apache.directory.shared.util.
/**
- * Responsible for translating modify operations on the subschemaSubentry into
+ * Responsible for translating modify operations on the subschemaSubentry into
* operations against entries within the schema partition.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -64,11 +65,11 @@ public class SchemaSubentryModifier
static
{
Set<String> c = new HashSet<String>();
- c.add( "AuthenticationInterceptor" );
- c.add( "AciAuthorizationInterceptor" );
- c.add( "DefaultAuthorizationInterceptor" );
- c.add( "ExceptionInterceptor" );
- c.add( "SchemaInterceptor" );
+ c.add( InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName() );
+ c.add( InterceptorEnum.ACI_AUTHORIZATION_INTERCEPTOR.getName() );
+ c.add( InterceptorEnum.DEFAULT_AUTHORIZATION_INTERCEPTOR.getName() );
+ c.add( InterceptorEnum.EXCEPTION_INTERCEPTOR.getName() );
+ c.add( InterceptorEnum.SCHEMA_INTERCEPTOR.getName() );
BYPASS = Collections.unmodifiableCollection( c );
}
@@ -140,7 +141,7 @@ public class SchemaSubentryModifier
public void add( OperationContext opContext, LdapComparatorDescription comparatorDescription ) throws LdapException
{
- String schemaName = getSchema( comparatorDescription );
+ String schemaName = getSchema( comparatorDescription );
Dn dn = dnFactory.create(
"m-oid=" + comparatorDescription.getOid(),
SchemaConstants.COMPARATORS_PATH,
@@ -149,7 +150,7 @@ public class SchemaSubentryModifier
Entry entry = getEntry( dn, comparatorDescription );
- opContext.add( (Entry)entry, BYPASS );
+ opContext.add( entry, BYPASS );
}
@@ -158,13 +159,13 @@ public class SchemaSubentryModifier
String schemaName = getSchema( normalizerDescription );
Dn dn = dnFactory.create(
"m-oid=" + normalizerDescription.getOid(),
- SchemaConstants.NORMALIZERS_PATH ,
+ SchemaConstants.NORMALIZERS_PATH ,
"cn=" + schemaName,
SchemaConstants.OU_SCHEMA );
Entry entry = getEntry( dn, normalizerDescription );
- opContext.add( (Entry)entry, BYPASS );
+ opContext.add( entry, BYPASS );
}
@@ -174,11 +175,11 @@ public class SchemaSubentryModifier
Dn dn = dnFactory.create(
"m-oid=" + syntaxCheckerDescription.getOid(),
SchemaConstants.SYNTAX_CHECKERS_PATH,
- "cn=" + schemaName,
+ "cn=" + schemaName,
SchemaConstants.OU_SCHEMA );
Entry entry = getEntry( dn, syntaxCheckerDescription );
- opContext.add( (Entry)entry, BYPASS );
+ opContext.add( entry, BYPASS );
}
@@ -196,7 +197,7 @@ public class SchemaSubentryModifier
public void deleteSchemaObject( OperationContext opContext, SchemaObject obj ) throws LdapException
{
Dn dn = getDn( obj );
- opContext.delete( dn, BYPASS );
+ opContext.delete( dn );
}
@@ -206,10 +207,10 @@ public class SchemaSubentryModifier
Dn dn = dnFactory.create(
"m-oid=" + normalizerDescription.getOid(),
SchemaConstants.NORMALIZERS_PATH,
- "cn=" + schemaName,
+ "cn=" + schemaName,
SchemaConstants.OU_SCHEMA );
- opContext.delete( dn, BYPASS );
+ opContext.delete( dn );
}
@@ -217,11 +218,11 @@ public class SchemaSubentryModifier
{
String schemaName = getSchema( syntaxCheckerDescription );
Dn dn = dnFactory.create(
- "m-oid=" + syntaxCheckerDescription.getOid(),
+ "m-oid=" + syntaxCheckerDescription.getOid(),
SchemaConstants.SYNTAX_CHECKERS_PATH,
"cn=" + schemaName,
SchemaConstants.OU_SCHEMA );
- opContext.delete( dn, BYPASS );
+ opContext.delete( dn );
}
@@ -234,7 +235,7 @@ public class SchemaSubentryModifier
"cn=" + schemaName,
SchemaConstants.OU_SCHEMA );
- opContext.delete( dn, BYPASS );
+ opContext.delete( dn );
}
@@ -242,8 +243,8 @@ public class SchemaSubentryModifier
{
Entry entry = new DefaultEntry( schemaManager, dn );
- entry.put( SchemaConstants.OBJECT_CLASS_AT,
- SchemaConstants.TOP_OC,
+ entry.put( SchemaConstants.OBJECT_CLASS_AT,
+ SchemaConstants.TOP_OC,
MetaSchemaConstants.META_TOP_OC,
MetaSchemaConstants.META_COMPARATOR_OC );
@@ -252,7 +253,7 @@ public class SchemaSubentryModifier
if ( comparatorDescription.getBytecode() != null )
{
- entry.put( MetaSchemaConstants.M_BYTECODE_AT,
+ entry.put( MetaSchemaConstants.M_BYTECODE_AT,
Base64.decode( comparatorDescription.getBytecode().toCharArray() ) );
}
@@ -269,8 +270,8 @@ public class SchemaSubentryModifier
{
Entry entry = new DefaultEntry( schemaManager, dn );
- entry.put( SchemaConstants.OBJECT_CLASS_AT,
- SchemaConstants.TOP_OC,
+ entry.put( SchemaConstants.OBJECT_CLASS_AT,
+ SchemaConstants.TOP_OC,
MetaSchemaConstants.META_TOP_OC,
MetaSchemaConstants.META_NORMALIZER_OC );
@@ -279,7 +280,7 @@ public class SchemaSubentryModifier
if ( normalizerDescription.getBytecode() != null )
{
- entry.put( MetaSchemaConstants.M_BYTECODE_AT,
+ entry.put( MetaSchemaConstants.M_BYTECODE_AT,
Base64.decode( normalizerDescription.getBytecode().toCharArray() ) );
}
@@ -292,7 +293,7 @@ public class SchemaSubentryModifier
}
- private String getSchema( SchemaObject desc )
+ private String getSchema( SchemaObject desc )
{
if ( desc.getExtensions().containsKey( MetaSchemaConstants.X_SCHEMA ) )
{
@@ -307,8 +308,8 @@ public class SchemaSubentryModifier
{
Entry entry = new DefaultEntry( schemaManager, dn );
- entry.put( SchemaConstants.OBJECT_CLASS_AT,
- SchemaConstants.TOP_OC,
+ entry.put( SchemaConstants.OBJECT_CLASS_AT,
+ SchemaConstants.TOP_OC,
MetaSchemaConstants.META_TOP_OC,
MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
Propchange: directory/apacheds/branches/apacheds-osgi/interceptors/subtree/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Nov 12 23:58:40 2011
@@ -0,0 +1,10 @@
+/directory/apacheds/branches/apacheds-codec-merge/interceptors/subtree:982369-987590
+/directory/apacheds/branches/apacheds-config/interceptors/subtree:1023442-1029077
+/directory/apacheds/branches/apacheds-kerberos-codec-2.0/interceptors/subtree:1040956-1043765
+/directory/apacheds/branches/apacheds-replication/interceptors/subtree:749790-764110
+/directory/apacheds/branches/apacheds-schema/interceptors/subtree:806623-896441
+/directory/apacheds/branches/apacheds-subtree/interceptors/subtree:965203-965686
+/directory/apacheds/branches/milestones/interceptors/subtree:1072812-1075328
+/directory/apacheds/branches/xdbm-refactoring/interceptors/subtree:945827-946347
+/directory/apacheds/trunk/interceptors/subtree:1066126-1067785,1068026-1072718,1072800-1075329,1185681-1201347
+/directory/studio/trunk/interceptors/subtree:1067786-1067997