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 2010/06/09 14:10:46 UTC
svn commit: r952975 - in /directory:
apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/
apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/
apacheds/trunk/core...
Author: elecharny
Date: Wed Jun 9 12:10:45 2010
New Revision: 952975
URL: http://svn.apache.org/viewvc?rev=952975&view=rev
Log:
o Added computed rdn, oldSuperior into the MoveOperationContext class
o Renamed the 'parent' to newSuperior in the MoveOperatioContext class
o The DN.getParent() method does not throw anymore an exception
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/MoveOperationContext.java Wed Jun 9 12:10:45 2010
@@ -26,6 +26,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.controls.ManageDsaITControl;
import org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest;
import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.name.RDN;
/**
@@ -36,8 +37,14 @@ import org.apache.directory.shared.ldap.
*/
public class MoveOperationContext extends AbstractChangeOperationContext
{
- /** The parent DN */
- private DN parent;
+ /** The old superior */
+ private DN oldSuperior;
+
+ /** The entry RDN */
+ private RDN rdn;
+
+ /** The newSuperior DN */
+ private DN newSuperior;
/** The New target DN */
private DN newDn;
@@ -55,19 +62,22 @@ public class MoveOperationContext extend
/**
* Creates a new instance of MoveOperationContext.
*/
- public MoveOperationContext( CoreSession session, DN oldDn, DN parent )
+ public MoveOperationContext( CoreSession session, DN oldDn, DN newSuperior )
{
super( session, oldDn );
- this.parent = parent;
+ this.newSuperior = newSuperior;
+ oldSuperior = oldDn.getParent();
+ rdn = ( RDN )(oldDn.getRdn().clone());
+ newDn = ((DN)(newSuperior.clone())).add( rdn );
}
public MoveOperationContext( CoreSession session, InternalModifyDnRequest modifyDnRequest )
{
super( session, modifyDnRequest.getName() );
- this.parent = modifyDnRequest.getNewSuperior();
+ this.newSuperior = modifyDnRequest.getNewSuperior();
- if ( parent == null )
+ if ( newSuperior == null )
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_326_NEW_SUPERIROR_CANNOT_BE_NULL, modifyDnRequest ) );
}
@@ -87,30 +97,23 @@ public class MoveOperationContext extend
{
throwReferral();
}
+
+ oldSuperior = modifyDnRequest.getName().getParent();
+ rdn = ( RDN )(modifyDnRequest.getName().getRdn().clone());
+ newDn = ((DN)(newSuperior.clone())).add( rdn );
}
/**
- * @return The parent DN
+ * @return The newSuperior DN
*/
- public DN getParent()
+ public DN getNewSuperior()
{
- return parent;
+ return newSuperior;
}
/**
- * Set the parent DN
- *
- * @param parent The parent
- */
- public void setParent( DN parent )
- {
- this.parent = parent;
- }
-
-
- /**
* @return The new DN
*/
public DN getNewDn()
@@ -120,17 +123,6 @@ public class MoveOperationContext extend
/**
- * Set the new DN
- *
- * @param newDn The new DN
- */
- public void setNewDn( DN newDn )
- {
- this.newDn = newDn;
- }
-
-
- /**
* @return the operation name
*/
public String getName()
@@ -145,6 +137,6 @@ public class MoveOperationContext extend
public String toString()
{
return "ReplaceContext for old DN '" + getDn().getName() + "'" +
- ", parent '" + parent + "'";
+ ", newSuperior '" + newSuperior + "'";
}
}
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java Wed Jun 9 12:10:45 2010
@@ -356,14 +356,14 @@ public class RegistrySynchronizerAdaptor
if ( objectClass2synchronizerMap.containsKey( oid ) )
{
RegistrySynchronizer synchronizer = objectClass2synchronizerMap.get( oid );
- synchronizer.move( opContext.getDn(), opContext.getParent(), entry, cascade );
+ synchronizer.move( opContext.getDn(), opContext.getNewSuperior(), entry, cascade );
return;
}
}
if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
{
- schemaSynchronizer.move( opContext.getDn(), opContext.getParent(), entry, cascade );
+ schemaSynchronizer.move( opContext.getDn(), opContext.getNewSuperior(), entry, cascade );
return;
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultOperationManager.java Wed Jun 9 12:10:45 2010
@@ -662,7 +662,7 @@ public class DefaultOperationManager imp
dn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
// Normalize the opContext DN
- DN parentDn = opContext.getParent();
+ DN parentDn = opContext.getNewSuperior();
parentDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
// We have to deal with the referral first
@@ -732,11 +732,6 @@ public class DefaultOperationManager imp
// Unlock the ReferralManager
directoryService.getReferralManager().unlock();
- // Create the newDN now
- DN newDn = (DN)(opContext.getParent().clone());
- newDn.add( dn.getRdn() );
- opContext.setNewDn( newDn );
-
// Call the Add method
InterceptorChain interceptorChain = directoryService.getInterceptorChain();
interceptorChain.move( opContext );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Wed Jun 9 12:10:45 2010
@@ -364,9 +364,9 @@ public class ChangeLogInterceptor extend
LdifEntry forward = new LdifEntry();
forward.setChangeType( ChangeType.ModDn );
forward.setDn( opCtx.getDn() );
- forward.setNewSuperior( opCtx.getParent().getName() );
+ forward.setNewSuperior( opCtx.getNewSuperior().getName() );
- LdifEntry reverse = LdifRevertor.reverseMove( opCtx.getParent(), opCtx.getDn() );
+ LdifEntry reverse = LdifRevertor.reverseMove( opCtx.getNewSuperior(), opCtx.getDn() );
opCtx.setChangeLogEvent( changeLog.log( getPrincipal(), forward, reverse ) );
}
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Wed Jun 9 12:10:45 2010
@@ -385,7 +385,7 @@ public class ExceptionInterceptor extend
public void move( NextInterceptor nextInterceptor, MoveOperationContext opContext ) throws LdapException
{
DN oriChildName = opContext.getDn();
- DN newParentName = opContext.getParent();
+ DN newParentName = opContext.getNewSuperior();
if ( oriChildName.equals( subschemSubentryDn ) )
{
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/journal/JournalInterceptor.java Wed Jun 9 12:10:45 2010
@@ -341,7 +341,7 @@ public class JournalInterceptor extends
LdifEntry ldif = new LdifEntry();
ldif.setChangeType( ChangeType.ModDn );
ldif.setDn( opContext.getDn() );
- ldif.setNewSuperior( opContext.getParent().getNormName() );
+ ldif.setNewSuperior( opContext.getNewSuperior().getNormName() );
journal.log( getPrincipal(), opRevision, ldif );
}
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/normalization/NormalizationInterceptor.java Wed Jun 9 12:10:45 2010
@@ -181,9 +181,9 @@ public class NormalizationInterceptor ex
opContext.getDn().normalize( schemaManager.getNormalizerMapping() );
}
- if ( !opContext.getParent().isNormalized() )
+ if ( !opContext.getNewSuperior().isNormalized() )
{
- opContext.getParent().normalize( schemaManager.getNormalizerMapping() );
+ opContext.getNewSuperior().normalize( schemaManager.getNormalizerMapping() );
}
if ( !opContext.getNewDn().isNormalized() )
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java Wed Jun 9 12:10:45 2010
@@ -339,7 +339,7 @@ public class OperationalAttributeInterce
List<Modification> items = ModifyOperationContext.createModItems( serverEntry,
ModificationOperation.REPLACE_ATTRIBUTE );
- ModifyOperationContext newModify = new ModifyOperationContext( opContext.getSession(), opContext.getParent(),
+ ModifyOperationContext newModify = new ModifyOperationContext( opContext.getSession(), opContext.getNewSuperior(),
items );
service.getPartitionNexus().modify( newModify );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Wed Jun 9 12:10:45 2010
@@ -964,7 +964,7 @@ public class SubentryInterceptor extends
public void move( NextInterceptor next, MoveOperationContext opContext ) throws LdapException
{
DN oriChildName = opContext.getDn();
- DN newParentName = opContext.getParent();
+ DN newParentName = opContext.getNewSuperior();
Entry entry = opContext.getEntry();
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Wed Jun 9 12:10:45 2010
@@ -490,7 +490,7 @@ public class TriggerInterceptor extends
}
DN oriChildName = opContext.getDn();
- DN newParentName = opContext.getParent();
+ DN newParentName = opContext.getNewSuperior();
// Gather supplementary data.
Entry movedEntry = opContext.getEntry();
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java Wed Jun 9 12:10:45 2010
@@ -257,7 +257,7 @@ public class SyncReplSearchListener impl
try
{
- if( ! opContext.getParent().isChildOf( clientMsgLog.getSearchCriteria().getBase() ) )
+ if( ! opContext.getNewSuperior().isChildOf( clientMsgLog.getSearchCriteria().getBase() ) )
{
sendDeletedEntry( opContext.getEntry() );
return;
@@ -265,7 +265,7 @@ public class SyncReplSearchListener impl
SyncModifyDnControl modDnControl = new SyncModifyDnControl( SyncModifyDnType.MOVE );
modDnControl.setEntryDn( opContext.getDn().getNormName() );
- modDnControl.setNewSuperiorDn( opContext.getParent().getNormName() );
+ modDnControl.setNewSuperiorDn( opContext.getNewSuperior().getNormName() );
if ( pushInRealTime )
{
Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/xdbm/AbstractXdbmPartition.java Wed Jun 9 12:10:45 2010
@@ -352,11 +352,11 @@ public abstract class AbstractXdbmPartit
public final void move( MoveOperationContext moveContext ) throws LdapException
{
- checkIsValidMove( moveContext.getDn(), moveContext.getParent() );
+ checkIsValidMove( moveContext.getDn(), moveContext.getNewSuperior() );
try
{
- store.move( moveContext.getDn(), moveContext.getParent() );
+ store.move( moveContext.getDn(), moveContext.getNewSuperior() );
}
catch ( Exception e )
{
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java?rev=952975&r1=952974&r2=952975&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java Wed Jun 9 12:10:45 2010
@@ -1284,9 +1284,8 @@ public class DN implements Cloneable, Se
* is the empty DN.
*
* @return the parent DN of this DN
- * @throws LdapInvalidDnException
*/
- public DN getParent() throws LdapInvalidDnException
+ public DN getParent()
{
if ( isEmpty() )
{