You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2007/05/24 02:27:07 UTC
svn commit: r541123 [11/25] - in
/directory/apacheds/branches/apacheds-sasl-branch: ./ benchmarks/
bootstrap-extract/ bootstrap-extract/src/ bootstrap-extract/src/main/
bootstrap-extract/src/main/java/ bootstrap-extract/src/main/java/org/
bootstrap-ext...
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/SearchResultDialog.java Wed May 23 17:26:40 2007
@@ -24,7 +24,6 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
-import java.math.BigInteger;
import javax.swing.JButton;
import javax.swing.JDialog;
@@ -158,7 +157,7 @@
{
if ( selectionModel.isSelectedIndex( ii ) && !an_event.getValueIsAdjusting() )
{
- BigInteger id = ( BigInteger ) m_resultsTbl.getModel().getValueAt( ii, 0 );
+ Long id = ( Long ) m_resultsTbl.getModel().getValueAt( ii, 0 );
( ( PartitionFrame ) getParent() ).selectTreeNode( id );
}
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Wed May 23 17:26:40 2007
@@ -21,7 +21,6 @@
import java.io.File;
-import java.math.BigInteger;
import java.util.Iterator;
import java.util.List;
@@ -31,15 +30,19 @@
import org.apache.directory.server.core.DirectoryServiceConfiguration;
import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.impl.btree.BTreePartition;
import org.apache.directory.server.core.partition.impl.btree.BTreePartitionConfiguration;
import org.apache.directory.server.core.partition.impl.btree.Index;
import org.apache.directory.server.core.partition.impl.btree.IndexNotFoundException;
import org.apache.directory.server.schema.registries.Registries;
-
import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -265,31 +268,31 @@
}
- public final BigInteger getEntryId( String dn ) throws NamingException
+ public final Long getEntryId( String dn ) throws NamingException
{
return store.getEntryId( dn );
}
- public final String getEntryDn( BigInteger id ) throws NamingException
+ public final String getEntryDn( Long id ) throws NamingException
{
return store.getEntryDn( id );
}
- public final BigInteger getParentId( String dn ) throws NamingException
+ public final Long getParentId( String dn ) throws NamingException
{
return store.getParentId( dn );
}
- public final BigInteger getParentId( BigInteger childId ) throws NamingException
+ public final Long getParentId( Long childId ) throws NamingException
{
return store.getParentId( childId );
}
- public final String getEntryUpdn( BigInteger id ) throws NamingException
+ public final String getEntryUpdn( Long id ) throws NamingException
{
return store.getEntryUpdn( id );
}
@@ -307,31 +310,31 @@
}
- public final void add( LdapDN normName, Attributes entry ) throws NamingException
+ public final void add( OperationContext addContext ) throws NamingException
{
- store.add( normName, entry );
+ store.add( addContext.getDn(), ((AddOperationContext)addContext).getEntry() );
}
- public final Attributes lookup( BigInteger id ) throws NamingException
+ public final Attributes lookup( Long id ) throws NamingException
{
return store.lookup( id );
}
- public final void delete( BigInteger id ) throws NamingException
+ public final void delete( Long id ) throws NamingException
{
store.delete( id );
}
- public final NamingEnumeration list( BigInteger id ) throws NamingException
+ public final NamingEnumeration list( Long id ) throws NamingException
{
return store.list( id );
}
- public final int getChildCount( BigInteger id ) throws NamingException
+ public final int getChildCount( Long id ) throws NamingException
{
return store.getChildCount( id );
}
@@ -366,43 +369,49 @@
}
- public final Attributes getIndices( BigInteger id ) throws NamingException
+ public final Attributes getIndices( Long id ) throws NamingException
{
return store.getIndices( id );
}
- public final void modify( LdapDN dn, int modOp, Attributes mods ) throws NamingException
+ public final void modify( OperationContext modifyContext ) throws NamingException
{
- store.modify( dn, modOp, mods );
+ ModifyOperationContext ctx = (ModifyOperationContext)modifyContext;
+ store.modify( ctx.getDn(), ctx.getModItems() );
}
-
- public final void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
+ public final void rename( OperationContext renameContext ) throws NamingException
{
- store.modify( dn, mods );
+ RenameOperationContext ctx = (RenameOperationContext)renameContext;
+ store.rename( ctx.getDn(), ctx.getNewRdn(), ctx.getDelOldDn() );
}
- public final void modifyRn( LdapDN dn, String newRdn, boolean deleteOldRdn ) throws NamingException
+ public final void moveAndRename( OperationContext moveAndRenameContext ) throws NamingException
{
- store.modifyRn( dn, newRdn, deleteOldRdn );
+ MoveAndRenameOperationContext ctx = (MoveAndRenameOperationContext)moveAndRenameContext;
+ store.move( ctx.getDn(), ctx.getParent(), ctx.getNewRdn(), ctx.getDelOldDn() );
}
- public final void move( LdapDN oldChildDn, LdapDN newParentDn, String newRdn, boolean deleteOldRdn ) throws NamingException
+ public final void move( OperationContext moveContext ) throws NamingException
{
- store.move( oldChildDn, newParentDn, newRdn, deleteOldRdn );
+ MoveOperationContext ctx = (MoveOperationContext)moveContext;
+ store.move( ctx.getDn(), ctx.getParent() );
}
- public final void move( LdapDN oldChildDn, LdapDN newParentDn ) throws NamingException
+ public final void bind( LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException
{
- store.move( oldChildDn, newParentDn );
+ // does nothing
+ throw new LdapAuthenticationNotSupportedException(
+ "Bind requests only tunnel down into partitions if there are no authenticators to handle the mechanism.\n"
+ + "Check to see if you have correctly configured authenticators for the server.",
+ ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED );
}
-
- public final void bind( LdapDN bindDn, byte[] credentials, List mechanisms, String saslAuthId ) throws NamingException
+ public final void bind( OperationContext bindContext ) throws NamingException
{
// does nothing
throw new LdapAuthenticationNotSupportedException(
@@ -412,7 +421,7 @@
}
- public final void unbind( LdapDN bindDn ) throws NamingException
+ public final void unbind( OperationContext unbindContext ) throws NamingException
{
}
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Wed May 23 17:26:40 2007
@@ -43,6 +43,7 @@
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
import org.apache.directory.server.core.jndi.CoreContextFactory;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -191,10 +192,10 @@
private void setUpNode( String name ) throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute attr = new AttributeImpl( "objectClass" );
- attr.add( "top" );
+ Attribute attr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
+ attr.add( SchemaConstants.TOP_OC );
attr.add( "prefNode" );
- attr.add( "extensibleObject" );
+ attr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
attrs.put( attr );
attr = new AttributeImpl( "prefNodeName" );
attr.add( name );
@@ -316,7 +317,7 @@
while ( ids.hasMore() )
{
String id = ( String ) ids.next();
- if ( id.equals( "objectClass" ) || id.equals( "prefNodeName" ) )
+ if ( id.equals( SchemaConstants.OBJECT_CLASS_AT ) || id.equals( "prefNodeName" ) )
{
continue;
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralLut.java Wed May 23 17:26:40 2007
@@ -40,8 +40,9 @@
{
/** the logger for this class */
private static final Logger log = LoggerFactory.getLogger( ReferralLut.class );
+
/** the set of names in the LUT */
- private Set names = new HashSet();
+ private Set<String> names = new HashSet<String>();
// -----------------------------------------------------------------------
@@ -56,8 +57,11 @@
public boolean isReferral( LdapDN dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
- return names.contains( dn.toString() );
+ }
+
+ return names.contains( dn.getNormName() );
}
@@ -69,7 +73,10 @@
public boolean isReferral( String dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
+ }
+
return names.contains( dn );
}
@@ -84,24 +91,23 @@
public LdapDN getFarthestReferralAncestor( LdapDN dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
+ }
+
LdapDN farthest = new LdapDN();
+
for ( int ii = 0; ii < dn.size(); ii++ )
{
- try
- {
- farthest.add( dn.get( ii ) );
- }
- catch ( InvalidNameException e )
- {
- log.error( "Should never get this when moving names from a proper normalized name!", e );
- }
+ farthest.addNormalized( dn.getRdn( ii ) );
+
// do not return dn if it is the farthest referral
- if ( isReferral( farthest ) && farthest.size() != dn.size() )
+ if ( isReferral( farthest ) && ( farthest.size() != dn.size() ) )
{
return farthest;
}
}
+
return null;
}
@@ -116,7 +122,10 @@
public LdapDN getNearestReferralAncestor( LdapDN dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
+ }
+
LdapDN cloned = ( LdapDN ) dn.clone();
// do not return the argument dn if it is a referral (skip it)
@@ -136,7 +145,7 @@
return null;
}
- while ( !isReferral( cloned ) && cloned.size() > 0 )
+ while ( !isReferral( cloned ) && ( cloned.size() > 0 ) )
{
try
{
@@ -147,6 +156,7 @@
log.error( "Should never get this when removing from a cloned normalized name!", e );
}
}
+
return cloned.isEmpty() ? null : cloned;
}
@@ -163,10 +173,13 @@
public void referralAdded( LdapDN dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
- if ( !names.add( dn.toString() ) && log.isWarnEnabled() )
+ }
+
+ if ( !names.add( dn.getNormName() ) && log.isWarnEnabled() )
{
- log.warn( "found " + dn + " in refname lut while adding it" );
+ log.warn( "found " + dn.getUpName() + " in refname lut while adding it" );
}
}
@@ -179,7 +192,10 @@
public void referralAdded( String dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
+ }
+
if ( !names.add( dn ) && log.isWarnEnabled() )
{
log.warn( "found " + dn + " in refname lut while adding it" );
@@ -195,10 +211,13 @@
public void referralDeleted( LdapDN dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
- if ( !names.remove( dn.toString() ) && log.isWarnEnabled() )
+ }
+
+ if ( !names.remove( dn.getNormName() ) && log.isWarnEnabled() )
{
- log.warn( "cound not find " + dn + " in refname lut while deleting it" );
+ log.warn( "cound not find " + dn.getUpName() + " in refname lut while deleting it" );
}
}
@@ -211,7 +230,10 @@
public void referralDeleted( String dn )
{
if ( dn == null )
+ {
throw new IllegalArgumentException( "dn cannot be null" );
+ }
+
if ( !names.remove( dn ) && log.isWarnEnabled() )
{
log.warn( "cound not find " + dn + " in refname lut while deleting it" );
@@ -228,15 +250,19 @@
*/
public void referralChanged( LdapDN oldDn, LdapDN newDn )
{
- if ( oldDn == null || newDn == null )
+ if ( ( oldDn == null ) || ( newDn == null ) )
+ {
throw new IllegalArgumentException( "old or new dn cannot be null" );
- if ( !names.remove( oldDn.toString() ) && log.isWarnEnabled() )
+ }
+
+ if ( !names.remove( oldDn.getNormName() ) && log.isWarnEnabled() )
{
- log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
+ log.warn( "cound not find old name (" + oldDn.getUpName() + ") in refname lut while moving or renaming it" );
}
- if ( !names.add( newDn.toString() ) && log.isWarnEnabled() )
+
+ if ( !names.add( newDn.getNormName() ) && log.isWarnEnabled() )
{
- log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
+ log.warn( "found new name (" + newDn.getUpName() + ") in refname lut while moving or renaming " + oldDn );
}
}
@@ -250,12 +276,16 @@
*/
public void referralChanged( String oldDn, String newDn )
{
- if ( oldDn == null || newDn == null )
+ if ( ( oldDn == null ) || ( newDn == null ) )
+ {
throw new IllegalArgumentException( "old or new dn cannot be null" );
+ }
+
if ( !names.remove( oldDn ) && log.isWarnEnabled() )
{
log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
}
+
if ( !names.add( newDn ) && log.isWarnEnabled() )
{
log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
@@ -272,12 +302,16 @@
*/
public void referralChanged( LdapDN oldDn, String newDn )
{
- if ( oldDn == null || newDn == null )
+ if ( ( oldDn == null ) || ( newDn == null ) )
+ {
throw new IllegalArgumentException( "old or new dn cannot be null" );
- if ( !names.remove( oldDn.toString() ) && log.isWarnEnabled() )
+ }
+
+ if ( !names.remove( oldDn.getNormName() ) && log.isWarnEnabled() )
{
- log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
+ log.warn( "cound not find old name (" + oldDn.getUpName() + ") in refname lut while moving or renaming it" );
}
+
if ( !names.add( newDn ) && log.isWarnEnabled() )
{
log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
@@ -294,15 +328,19 @@
*/
public void referralChanged( String oldDn, LdapDN newDn )
{
- if ( oldDn == null || newDn == null )
+ if ( ( oldDn == null ) || ( newDn == null ) )
+ {
throw new IllegalArgumentException( "old or new dn cannot be null" );
+ }
+
if ( !names.remove( oldDn ) && log.isWarnEnabled() )
{
log.warn( "cound not find old name (" + oldDn + ") in refname lut while moving or renaming it" );
}
- if ( !names.add( newDn ) && log.isWarnEnabled() )
+
+ if ( !names.add( newDn.getNormName() ) && log.isWarnEnabled() )
{
- log.warn( "found new name (" + newDn + ") in refname lut while moving or renaming " + oldDn );
+ log.warn( "found new name (" + newDn.getUpName() + ") in refname lut while moving or renaming " + oldDn );
}
}
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Wed May 23 17:26:40 2007
@@ -27,7 +27,6 @@
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
@@ -39,25 +38,42 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.authn.AuthenticationService;
+import org.apache.directory.server.core.authz.AuthorizationService;
+import org.apache.directory.server.core.authz.DefaultAuthorizationService;
import org.apache.directory.server.core.configuration.InterceptorConfiguration;
import org.apache.directory.server.core.enumeration.ReferralHandlingEnumeration;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
+import org.apache.directory.server.core.event.EventService;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
+import org.apache.directory.server.core.interceptor.context.AddContextPartitionOperationContext;
+import org.apache.directory.server.core.interceptor.context.AddOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.invocation.InvocationStack;
import org.apache.directory.server.core.jndi.ServerLdapContext;
+import org.apache.directory.server.core.normalization.NormalizationService;
+import org.apache.directory.server.core.operational.OperationalAttributeService;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.partition.PartitionNexusProxy;
+import org.apache.directory.server.core.schema.SchemaService;
+import org.apache.directory.server.core.subtree.SubentryService;
+import org.apache.directory.server.core.trigger.TriggerService;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
-
-import org.apache.directory.shared.ldap.codec.util.LdapURL;
import org.apache.directory.shared.ldap.NotImplementedException;
+import org.apache.directory.shared.ldap.codec.util.LdapURL;
import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.exception.LdapReferralException;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
@@ -68,7 +84,6 @@
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.schema.AttributeType;
import org.apache.directory.shared.ldap.util.AttributeUtils;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -83,14 +98,15 @@
*/
public class ReferralService extends BaseInterceptor
{
+ /** The service name */
public static final String NAME = "referralService";
+
private static final Logger log = LoggerFactory.getLogger( ReferralService.class );
private static final String IGNORE = "ignore";
private static final String THROW_FINDING_BASE = "throw-finding-base";
private static final String THROW = "throw";
private static final String FOLLOW = "follow";
private static final String REFERRAL_OC = "referral";
- private static final String OBJCLASS_ATTR = "objectClass";
private static final Collection<String> SEARCH_BYPASS;
private static final String REF_ATTR = "ref";
@@ -108,16 +124,16 @@
* partitions of the system during startup and during add/remove partition ops
*/
Collection<String> c = new HashSet<String>();
- c.add( "normalizationService" );
- c.add( "authenticationService" );
- c.add( "authorizationService" );
- c.add( "defaultAuthorizationService" );
- c.add( "schemaService" );
- c.add( "subentryService" );
- c.add( "operationalAttributeService" );
- c.add( "referralService" );
- c.add( "eventService" );
- c.add( "triggerService" );
+ c.add( NormalizationService.NAME );
+ c.add( AuthenticationService.NAME );
+ c.add( AuthorizationService.NAME );
+ c.add( DefaultAuthorizationService.NAME );
+ c.add( SchemaService.NAME );
+ c.add( SubentryService.NAME );
+ c.add( OperationalAttributeService.NAME );
+ c.add( ReferralService.NAME );
+ c.add( EventService.NAME );
+ c.add( TriggerService.NAME );
SEARCH_BYPASS = Collections.unmodifiableCollection( c );
}
@@ -145,7 +161,7 @@
static boolean isReferral( Attributes entry ) throws NamingException
{
- Attribute oc = entry.get( OBJCLASS_ATTR );
+ Attribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
if ( oc == null )
{
log.warn( "could not find objectClass attribute in entry: " + entry );
@@ -169,11 +185,14 @@
oidRegistry = dsConfig.getRegistries().getOidRegistry();
env = dsConfig.getEnvironment();
- Iterator suffixes = nexus.listSuffixes();
+ Iterator suffixes = nexus.listSuffixes( null );
+
while ( suffixes.hasNext() )
{
LdapDN suffix = new LdapDN( ( String ) suffixes.next() );
- addReferrals( nexus.search( suffix, env, getReferralFilter(), getControls() ), suffix );
+ addReferrals(
+ nexus.search(
+ new SearchOperationContext( suffix, env, getReferralFilter(), getControls() ) ), suffix );
}
}
@@ -207,12 +226,14 @@
LdapDN urlDn = new LdapDN( ldapUrl.getDn().toNormName() );
urlDn.normalize( attrRegistry.getNormalizerMapping() );
+
if ( urlDn.equals( farthest ) )
{
// according to the protocol there is no need for the dn since it is the same as this request
StringBuffer buf = new StringBuffer();
buf.append( ldapUrl.getScheme() );
buf.append( ldapUrl.getHost() );
+
if ( ldapUrl.getPort() > 0 )
{
buf.append( ":" );
@@ -230,6 +251,7 @@
*/
int diff = targetUpdn.size() - farthest.size();
LdapDN extra = new LdapDN();
+
for ( int jj = 0; jj < diff; jj++ )
{
extra.add( targetUpdn.get( farthest.size() + jj ) );
@@ -239,11 +261,13 @@
StringBuffer buf = new StringBuffer();
buf.append( ldapUrl.getScheme() );
buf.append( ldapUrl.getHost() );
+
if ( ldapUrl.getPort() > 0 )
{
buf.append( ":" );
buf.append( ldapUrl.getPort() );
}
+
buf.append( "/" );
buf.append( LdapURL.urlEncode( urlDn.getUpName(), false ) );
list.add( buf.toString() );
@@ -254,40 +278,45 @@
}
- public void add(NextInterceptor next, LdapDN normName, Attributes entry) throws NamingException
+ public void add(NextInterceptor next, OperationContext opContext ) throws NamingException
{
Invocation invocation = InvocationStack.getInstance().peek();
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
+ LdapDN name = opContext.getDn();
+ Attributes entry = ((AddOperationContext)opContext).getEntry();
// handle a normal add without following referrals
- if ( refval == null || refval.equals( IGNORE ) )
+ if ( ( refval == null ) || refval.equals( IGNORE ) )
{
- next.add(normName, entry );
+ next.add( opContext );
+
if ( isReferral( entry ) )
{
- lut.referralAdded( normName );
+ lut.referralAdded( name );
}
+
return;
}
-
- if ( refval.equals( THROW ) )
+ else if ( refval.equals( THROW ) )
{
- LdapDN farthest = lut.getFarthestReferralAncestor( normName );
+ LdapDN farthest = lut.getFarthestReferralAncestor( name );
+
if ( farthest == null )
{
- next.add(normName, entry );
+ next.add( opContext );
+
if ( isReferral( entry ) )
{
- lut.referralAdded( normName );
+ lut.referralAdded( name );
}
return;
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
AttributeType refsType = attrRegistry.lookup( oidRegistry.getOid( REF_ATTR ) );
Attribute refs = AttributeUtils.getAttribute( referral, refsType );
- doReferralException( farthest, new LdapDN( normName.getUpName() ), refs );
+ doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
}
else if ( refval.equals( FOLLOW ) )
{
@@ -301,8 +330,10 @@
}
- public boolean compare( NextInterceptor next, LdapDN normName, String oid, Object value ) throws NamingException
+ public boolean compare( NextInterceptor next, OperationContext opContext ) throws NamingException
{
+ LdapDN name = opContext.getDn();
+
Invocation invocation = InvocationStack.getInstance().peek();
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
@@ -310,20 +341,20 @@
// handle a normal add without following referrals
if ( refval == null || refval.equals( IGNORE ) )
{
- return next.compare( normName, oid, value );
+ return next.compare( opContext );
}
if ( refval.equals( THROW ) )
{
- LdapDN farthest = lut.getFarthestReferralAncestor( normName );
+ LdapDN farthest = lut.getFarthestReferralAncestor( name );
if ( farthest == null )
{
- return next.compare( normName, oid, value );
+ return next.compare( opContext );
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
- doReferralException( farthest, new LdapDN( normName.getUpName() ), refs );
+ doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
// we really can't get here since doReferralException will throw an exception
return false;
@@ -340,8 +371,9 @@
}
- public void delete( NextInterceptor next, LdapDN normName ) throws NamingException
+ public void delete( NextInterceptor next, OperationContext opContext ) throws NamingException
{
+ LdapDN name = opContext.getDn();
Invocation invocation = InvocationStack.getInstance().peek();
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
@@ -349,30 +381,35 @@
// handle a normal delete without following referrals
if ( refval == null || refval.equals( IGNORE ) )
{
- next.delete( normName );
- if ( lut.isReferral( normName ) )
+ next.delete( opContext );
+
+ if ( lut.isReferral( name ) )
{
- lut.referralDeleted( normName );
+ lut.referralDeleted( name );
}
+
return;
}
if ( refval.equals( THROW ) )
{
- LdapDN farthest = lut.getFarthestReferralAncestor( normName );
+ LdapDN farthest = lut.getFarthestReferralAncestor( name );
+
if ( farthest == null )
{
- next.delete( normName );
- if ( lut.isReferral( normName ) )
+ next.delete( opContext );
+
+ if ( lut.isReferral( name ) )
{
- lut.referralDeleted( normName );
+ lut.referralDeleted( name );
}
+
return;
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
- doReferralException( farthest, new LdapDN( normName.getUpName() ), refs );
+ doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
}
else if ( refval.equals( FOLLOW ) )
{
@@ -401,22 +438,26 @@
* -----------------------------------------------------------------------
*/
- public void move( NextInterceptor next, LdapDN oldName, LdapDN newParent ) throws NamingException
+ public void move( NextInterceptor next, OperationContext opContext ) throws NamingException
{
+ LdapDN oldName = opContext.getDn();
+
Invocation invocation = InvocationStack.getInstance().peek();
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
- LdapDN newName = ( LdapDN ) newParent.clone();
+ LdapDN newName = ( LdapDN ) ((MoveOperationContext)opContext).getParent().clone();
newName.add( oldName.get( oldName.size() - 1 ) );
// handle a normal modify without following referrals
if ( refval == null || refval.equals( IGNORE ) )
{
- next.move( oldName, newParent );
+ next.move( opContext );
+
if ( lut.isReferral( oldName ) )
{
lut.referralChanged( oldName, newName );
}
+
return;
}
@@ -426,16 +467,18 @@
LdapDN farthestDst = lut.getFarthestReferralAncestor( newName ); // note will not return newName so safe
if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
{
- next.move( oldName, newParent );
+ next.move( opContext );
+
if ( lut.isReferral( oldName ) )
{
lut.referralChanged( oldName, newName );
}
+
return;
}
else if ( farthestSrc != null )
{
- Attributes referral = invocation.getProxy().lookup( farthestSrc,
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthestSrc ),
PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
@@ -467,19 +510,21 @@
}
- public void move( NextInterceptor next, LdapDN oldName, LdapDN newParent, String newRdn, boolean deleteOldRdn )
+ public void moveAndRename( NextInterceptor next, OperationContext opContext )
throws NamingException
{
+ LdapDN oldName = opContext.getDn();
+
Invocation invocation = InvocationStack.getInstance().peek();
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
- LdapDN newName = ( LdapDN ) newParent.clone();
- newName.add( newRdn );
+ LdapDN newName = ( LdapDN ) ((MoveAndRenameOperationContext)opContext).getParent().clone();
+ newName.add( ((MoveAndRenameOperationContext)opContext).getNewRdn() );
// handle a normal modify without following referrals
if ( refval == null || refval.equals( IGNORE ) )
{
- next.move( oldName, newParent, newRdn, deleteOldRdn );
+ next.moveAndRename( opContext );
if ( lut.isReferral( oldName ) )
{
lut.referralChanged( oldName, newName );
@@ -493,7 +538,7 @@
LdapDN farthestDst = lut.getFarthestReferralAncestor( newName ); // safe to use - does not return newName
if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
{
- next.move( oldName, newParent, newRdn, deleteOldRdn );
+ next.moveAndRename( opContext );
if ( lut.isReferral( oldName ) )
{
lut.referralChanged( oldName, newName );
@@ -502,7 +547,7 @@
}
else if ( farthestSrc != null )
{
- Attributes referral = invocation.getProxy().lookup( farthestSrc,
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthestSrc ),
PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
@@ -534,27 +579,31 @@
}
- public void modifyRn( NextInterceptor next, LdapDN oldName, String newRdn, boolean deleteOldRdn )
+ public void rename( NextInterceptor next, OperationContext opContext )
throws NamingException
{
+ LdapDN oldName = opContext.getDn();
+
Invocation invocation = InvocationStack.getInstance().peek();
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
LdapDN newName = ( LdapDN ) oldName.clone();
newName.remove( oldName.size() - 1 );
- LdapDN newRdnName = new LdapDN( newRdn );
+ LdapDN newRdnName = new LdapDN( ((RenameOperationContext)opContext).getNewRdn() );
newRdnName.normalize( attrRegistry.getNormalizerMapping() );
newName.add( newRdnName.toNormName() );
// handle a normal modify without following referrals
if ( refval == null || refval.equals( IGNORE ) )
{
- next.modifyRn( oldName, newRdn, deleteOldRdn );
+ next.rename( opContext );
+
if ( lut.isReferral( oldName ) )
{
lut.referralChanged( oldName, newName );
}
+
return;
}
@@ -562,18 +611,22 @@
{
LdapDN farthestSrc = lut.getFarthestReferralAncestor( oldName );
LdapDN farthestDst = lut.getFarthestReferralAncestor( newName );
+
if ( farthestSrc == null && farthestDst == null && !lut.isReferral( newName ) )
{
- next.modifyRn( oldName, newRdn, deleteOldRdn );
+ next.rename( opContext );
+
if ( lut.isReferral( oldName ) )
{
lut.referralChanged( oldName, newName );
}
+
return;
}
+
if ( farthestSrc != null )
{
- Attributes referral = invocation.getProxy().lookup( farthestSrc,
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthestSrc ),
PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthestSrc, new LdapDN( oldName.getUpName() ), refs );
@@ -605,104 +658,6 @@
}
- private void checkModify( LdapDN name, int modOp, Attributes mods ) throws NamingException
- {
- // -------------------------------------------------------------------
- // Check and update lut if we change the objectClass
- // -------------------------------------------------------------------
-
- boolean isTargetReferral = lut.isReferral( name );
- boolean isOcChange = mods.get( OBJCLASS_ATTR ) != null;
- boolean modsOcHasReferral = hasValue( mods.get( OBJCLASS_ATTR ), REFERRAL_OC );
- if ( isOcChange )
- {
- switch ( modOp )
- {
- /*
- * if ADD op where refferal is added to objectClass of a
- * non-referral entry then we add a new referral to lut
- */
- case ( DirContext.ADD_ATTRIBUTE ):
- if ( modsOcHasReferral && !isTargetReferral )
- {
- lut.referralAdded( name );
- }
- break;
- /*
- * if REMOVE op where refferal is removed from objectClass of a
- * referral entry then we remove the referral from lut
- */
- case ( DirContext.REMOVE_ATTRIBUTE ):
- if ( modsOcHasReferral && isTargetReferral )
- {
- lut.referralDeleted( name );
- }
- break;
- /*
- * if REPLACE op on referral has new set of OC values which does
- * not contain a referral value then we remove the referral from
- * the lut
- *
- * if REPLACE op on non-referral has new set of OC values with
- * referral value then we add the new referral to the lut
- */
- case ( DirContext.REPLACE_ATTRIBUTE ):
- if ( isTargetReferral && !modsOcHasReferral )
- {
- lut.referralDeleted( name );
- }
- else if ( !isTargetReferral && modsOcHasReferral )
- {
- lut.referralAdded( name );
- }
- break;
- default:
- throw new IllegalStateException( "undefined modification operation" );
- }
- }
- }
-
-
- public void modify( NextInterceptor next, LdapDN name, int modOp, Attributes mods ) throws NamingException
- {
- Invocation invocation = InvocationStack.getInstance().peek();
- ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
- String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
-
- // handle a normal modify without following referrals
- if ( refval == null || refval.equals( IGNORE ) )
- {
- next.modify( name, modOp, mods );
- checkModify( name, modOp, mods );
- return;
- }
-
- if ( refval.equals( THROW ) )
- {
- LdapDN farthest = lut.getFarthestReferralAncestor( name );
- if ( farthest == null )
- {
- next.modify( name, modOp, mods );
- checkModify( name, modOp, mods );
- return;
- }
-
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
- Attribute refs = referral.get( REF_ATTR );
- doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
- }
- else if ( refval.equals( FOLLOW ) )
- {
- throw new NotImplementedException( FOLLOW + " referral handling mode not implemented" );
- }
- else
- {
- throw new LdapNamingException( "Undefined value for " + Context.REFERRAL + " key: " + refval,
- ResultCodeEnum.OTHER );
- }
- }
-
-
private void checkModify( LdapDN name, ModificationItemImpl[] mods ) throws NamingException
{
boolean isTargetReferral = lut.isReferral( name );
@@ -713,7 +668,7 @@
for ( int ii = 0; ii < mods.length; ii++ )
{
- if ( mods[ii].getAttribute().getID().equalsIgnoreCase( OBJCLASS_ATTR ) )
+ if ( mods[ii].getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
{
boolean modsOcHasReferral = hasValue( mods[ii].getAttribute(), REFERRAL_OC );
@@ -767,16 +722,18 @@
}
- public void modify( NextInterceptor next, LdapDN name, ModificationItemImpl[] mods ) throws NamingException
+ public void modify( NextInterceptor next, OperationContext opContext ) throws NamingException
{
Invocation invocation = InvocationStack.getInstance().peek();
ServerLdapContext caller = ( ServerLdapContext ) invocation.getCaller();
String refval = ( String ) caller.getEnvironment().get( Context.REFERRAL );
+ LdapDN name = opContext.getDn();
+ ModificationItemImpl[] mods = ((ModifyOperationContext)opContext).getModItems();
// handle a normal modify without following referrals
if ( refval == null || refval.equals( IGNORE ) )
{
- next.modify( name, mods );
+ next.modify( opContext );
checkModify( name, mods );
return;
}
@@ -786,12 +743,12 @@
LdapDN farthest = lut.getFarthestReferralAncestor( name );
if ( farthest == null )
{
- next.modify( name, mods );
+ next.modify( opContext );
checkModify( name, mods );
return;
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralException( farthest, new LdapDN( name.getUpName() ), refs );
}
@@ -809,7 +766,7 @@
static ExprNode getReferralFilter()
{
- return new SimpleNode( OBJCLASS_ATTR, REFERRAL_OC, AssertionEnum.EQUALITY );
+ return new SimpleNode( SchemaConstants.OBJECT_CLASS_AT, REFERRAL_OC, AssertionEnum.EQUALITY );
}
@@ -822,29 +779,36 @@
}
- public void addContextPartition( NextInterceptor next, PartitionConfiguration cfg ) throws NamingException
+ public void addContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
{
- next.addContextPartition( cfg );
+ next.addContextPartition( opContext );
// add referrals immediately after adding the new partition
- Partition partition = cfg.getContextPartition();
+ Partition partition = ((AddContextPartitionOperationContext)opContext).getCfg().getContextPartition();
LdapDN suffix = partition.getSuffix();
Invocation invocation = InvocationStack.getInstance().peek();
- NamingEnumeration list = invocation.getProxy().search( suffix, env, getReferralFilter(), getControls(),
+ NamingEnumeration list = invocation.getProxy().search(
+ new SearchOperationContext( suffix, env, getReferralFilter(), getControls() ),
SEARCH_BYPASS );
addReferrals( list, suffix );
}
- public void removeContextPartition( NextInterceptor next, LdapDN suffix ) throws NamingException
+ public void removeContextPartition( NextInterceptor next, OperationContext opContext ) throws NamingException
{
// remove referrals immediately before removing the partition
Invocation invocation = InvocationStack.getInstance().peek();
- NamingEnumeration list = invocation.getProxy().search( suffix, env, getReferralFilter(), getControls(),
+ NamingEnumeration list = invocation.getProxy().search(
+ new SearchOperationContext(
+ opContext.getDn(),
+ env,
+ getReferralFilter(),
+ getControls() ),
SEARCH_BYPASS );
- deleteReferrals( list, suffix );
+
+ deleteReferrals( list, opContext.getDn() );
- next.removeContextPartition( suffix );
+ next.removeContextPartition( opContext );
}
@@ -898,7 +862,7 @@
}
- public NamingEnumeration search( NextInterceptor next, LdapDN base, Map env, ExprNode filter, SearchControls controls )
+ public NamingEnumeration<SearchResult> search( NextInterceptor next, OperationContext opContext )
throws NamingException
{
Invocation invocation = InvocationStack.getInstance().peek();
@@ -908,8 +872,12 @@
// handle a normal modify without following referrals
if ( refval == null || refval.equals( IGNORE ) )
{
- return next.search( base, env, filter, controls );
+ return next.search( opContext );
}
+
+ LdapDN base = opContext.getDn();
+ SearchControls controls = ((SearchOperationContext)opContext).getSearchControls();
+
/**
* THROW_FINDING_BASE is a special setting which allows for finding base to
@@ -920,40 +888,43 @@
{
if ( lut.isReferral( base ) )
{
- Attributes referral = invocation.getProxy().lookup( base, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( base ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
}
LdapDN farthest = lut.getFarthestReferralAncestor( base );
+
if ( farthest == null )
{
- return next.search( base, env, filter, controls );
+ return next.search( opContext );
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( farthest, new LdapDN( base.getUpName() ), refs, controls.getSearchScope() );
throw new IllegalStateException( "Should never get here: shutting up compiler" );
}
+
if ( refval.equals( THROW ) )
{
if ( lut.isReferral( base ) )
{
- Attributes referral = invocation.getProxy().lookup( base, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( base ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( base, refs, controls.getSearchScope() );
}
LdapDN farthest = lut.getFarthestReferralAncestor( base );
+
if ( farthest == null )
{
- SearchResultFilteringEnumeration srfe = ( SearchResultFilteringEnumeration ) next.search( base, env,
- filter, controls );
+ SearchResultFilteringEnumeration srfe =
+ ( SearchResultFilteringEnumeration ) next.search( opContext );
return new ReferralHandlingEnumeration( srfe, lut, attrRegistry, nexus, controls.getSearchScope(), true );
}
- Attributes referral = invocation.getProxy().lookup( farthest, PartitionNexusProxy.LOOKUP_BYPASS );
+ Attributes referral = invocation.getProxy().lookup( new LookupOperationContext( farthest ), PartitionNexusProxy.LOOKUP_BYPASS );
Attribute refs = referral.get( REF_ATTR );
doReferralExceptionOnSearchBase( farthest, new LdapDN( base.getUpName() ), refs, controls.getSearchScope() );
throw new IllegalStateException( "Should never get here: shutting up compiler" );
@@ -1108,7 +1079,13 @@
throw lre;
}
-
+ /**
+ * Check if the given name is a referral or not.
+ *
+ * @param name The DN to check
+ * @return <code>true</code> if the DN is a referral
+ * @throws NamingException I fthe DN is incorrect
+ */
public boolean isReferral( String name ) throws NamingException
{
if ( lut.isReferral( name ) )
@@ -1119,11 +1096,18 @@
LdapDN dn = new LdapDN( name );
dn.normalize( attrRegistry.getNormalizerMapping() );
- if ( lut.isReferral( dn ) )
- {
- return true;
- }
+ return lut.isReferral( dn );
+ }
- return false;
+ /**
+ * Check if the given name is a referral or not.
+ *
+ * @param name The DN to check
+ * @return <code>true</code> if the DN is a referral
+ * @throws NamingException I fthe DN is incorrect
+ */
+ public boolean isReferral( LdapDN name ) throws NamingException
+ {
+ return lut.isReferral( name.isNormalized() ? name : LdapDN.normalize( name, attrRegistry.getNormalizerMapping() ) );
}
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/AbstractSchemaChangeHandler.java Wed May 23 17:26:40 2007
@@ -46,8 +46,6 @@
*/
public abstract class AbstractSchemaChangeHandler implements SchemaChangeHandler
{
- protected static final String OU_OID = "2.5.4.11";
-
protected final Registries targetRegistries;
protected final PartitionSchemaLoader loader;
protected final AttributeType m_oidAT;
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java Wed May 23 17:26:40 2007
@@ -28,6 +28,7 @@
import org.apache.directory.server.constants.MetaSchemaConstants;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
@@ -391,7 +392,8 @@
{
for ( String superior : desc.getSuperiorObjectClasses() )
{
- if ( superior.equals( "2.5.6.0" ) || superior.equalsIgnoreCase( "top" ) )
+ if ( superior.equals( SchemaConstants.TOP_OC_OID ) ||
+ superior.equalsIgnoreCase( SchemaConstants.TOP_OC ) )
{
continue;
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java Wed May 23 17:26:40 2007
@@ -30,6 +30,8 @@
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -205,7 +207,7 @@
}
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
throws NamingException
{
checkNewParent( newParentName );
@@ -246,13 +248,13 @@
}
Rdn rdn = newParent.getRdn();
- if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID ) )
+ if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a attributeType should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );
}
- if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( "attributeTypes" ) )
+ if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.ATTRIBUTE_TYPES_AT ) )
{
throw new LdapInvalidNameException(
"The parent entry of a attributeType should have a relative name of ou=attributeTypes.",
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java Wed May 23 17:26:40 2007
@@ -33,6 +33,8 @@
import org.apache.directory.server.schema.registries.ComparatorRegistry;
import org.apache.directory.server.schema.registries.MatchingRuleRegistry;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -55,8 +57,6 @@
*/
public class MetaComparatorHandler implements SchemaChangeHandler
{
- private static final String OU_OID = "2.5.4.11";
-
private final PartitionSchemaLoader loader;
private final SchemaEntityFactory factory;
private final Registries targetRegistries;
@@ -276,7 +276,7 @@
}
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
throws NamingException
{
checkNewParent( newParentName );
@@ -318,13 +318,13 @@
}
Rdn rdn = newParent.getRdn();
- if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID ) )
+ if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a comparator should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );
}
- if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( "comparators" ) )
+ if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.COMPARATORS_AT ) )
{
throw new LdapInvalidNameException(
"The parent entry of a comparator should have a relative name of ou=comparators.",
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitContentRuleHandler.java Wed May 23 17:26:40 2007
@@ -89,7 +89,7 @@
/* (non-Javadoc)
* @see org.apache.directory.server.core.schema.SchemaChangeHandler#move(org.apache.directory.shared.ldap.name.LdapDN, org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes)
*/
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
{
// TODO Auto-generated method stub
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaDitStructureRuleHandler.java Wed May 23 17:26:40 2007
@@ -89,7 +89,7 @@
/* (non-Javadoc)
* @see org.apache.directory.server.core.schema.SchemaChangeHandler#move(org.apache.directory.shared.ldap.name.LdapDN, org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes)
*/
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
{
// TODO Auto-generated method stub
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java Wed May 23 17:26:40 2007
@@ -30,6 +30,7 @@
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.schema.registries.MatchingRuleRegistry;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -190,7 +191,7 @@
}
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
throws NamingException
{
checkNewParent( newParentName );
@@ -231,13 +232,13 @@
}
Rdn rdn = newParent.getRdn();
- if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID ) )
+ if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a matchingRule should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );
}
- if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( "matchingRules" ) )
+ if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.MATCHING_RULES_AT ) )
{
throw new LdapInvalidNameException(
"The parent entry of a syntax should have a relative name of ou=matchingRules.",
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleUseHandler.java Wed May 23 17:26:40 2007
@@ -85,7 +85,7 @@
/* (non-Javadoc)
* @see org.apache.directory.server.core.schema.SchemaChangeHandler#move(org.apache.directory.shared.ldap.name.LdapDN, org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes)
*/
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
{
// TODO Auto-generated method stub
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNameFormHandler.java Wed May 23 17:26:40 2007
@@ -89,7 +89,7 @@
/* (non-Javadoc)
* @see org.apache.directory.server.core.schema.SchemaChangeHandler#move(org.apache.directory.shared.ldap.name.LdapDN, org.apache.directory.shared.ldap.name.LdapDN, javax.naming.directory.Attributes)
*/
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
{
// TODO Auto-generated method stub
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java Wed May 23 17:26:40 2007
@@ -32,6 +32,7 @@
import org.apache.directory.server.schema.registries.MatchingRuleRegistry;
import org.apache.directory.server.schema.registries.NormalizerRegistry;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -55,8 +56,6 @@
*/
public class MetaNormalizerHandler implements SchemaChangeHandler
{
- private static final String OU_OID = "2.5.4.11";
-
private final PartitionSchemaLoader loader;
private final SchemaEntityFactory factory;
private final Registries targetRegistries;
@@ -276,7 +275,7 @@
}
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
throws NamingException
{
checkNewParent( newParentName );
@@ -318,13 +317,13 @@
}
Rdn rdn = newParent.getRdn();
- if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID ) )
+ if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a normalizer should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );
}
- if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( "normalizers" ) )
+ if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.NORMALIZERS_AT ) )
{
throw new LdapInvalidNameException(
"The parent entry of a normalizer should have a relative name of ou=normalizers.",
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java Wed May 23 17:26:40 2007
@@ -30,6 +30,7 @@
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.schema.registries.ObjectClassRegistry;
import org.apache.directory.server.schema.registries.Registries;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -192,7 +193,7 @@
}
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
throws NamingException
{
checkNewParent( newParentName );
@@ -233,13 +234,13 @@
}
Rdn rdn = newParent.getRdn();
- if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID ) )
+ if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a objectClass should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );
}
- if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( "objectClasses" ) )
+ if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.OBJECT_CLASSES_AT ) )
{
throw new LdapInvalidNameException(
"The parent entry of a attributeType should have a relative name of ou=objectClasses.",
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Wed May 23 17:26:40 2007
@@ -29,12 +29,11 @@
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
-import org.apache.directory.server.constants.CoreSchemaConstants;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.server.schema.registries.SchemaObjectRegistry;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -68,9 +67,9 @@
this.globalRegistries = globalRegistries;
this.disabledAT = globalRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_DISABLED_AT );
this.loader = loader;
- this.OU_OID = globalRegistries.getOidRegistry().getOid( CoreSchemaConstants.OU_AT );
+ this.OU_OID = globalRegistries.getOidRegistry().getOid( SchemaConstants.OU_AT );
this.factory = new SchemaEntityFactory( globalRegistries );
- this.cnAT = globalRegistries.getAttributeTypeRegistry().lookup( SystemSchemaConstants.CN_AT );
+ this.cnAT = globalRegistries.getAttributeTypeRegistry().lookup( SchemaConstants.CN_AT );
this.dependenciesAT = globalRegistries.getAttributeTypeRegistry()
.lookup( MetaSchemaConstants.M_DEPENDENCIES_AT );
}
@@ -349,7 +348,7 @@
* Moves are not allowed for metaSchema objects so this always throws an
* UNWILLING_TO_PERFORM LdapException.
*/
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry ) throws NamingException
{
throw new LdapOperationNotSupportedException( "Moving around schemas is not allowed.",
ResultCodeEnum.UNWILLING_TO_PERFORM );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java Wed May 23 17:26:40 2007
@@ -32,6 +32,7 @@
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.server.schema.registries.SyntaxCheckerRegistry;
import org.apache.directory.server.schema.registries.SyntaxRegistry;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -56,8 +57,6 @@
*/
public class MetaSyntaxCheckerHandler implements SchemaChangeHandler
{
- private static final String OU_OID = "2.5.4.11";
-
private final PartitionSchemaLoader loader;
private final SchemaEntityFactory factory;
private final Registries targetRegistries;
@@ -282,7 +281,7 @@
}
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
throws NamingException
{
checkNewParent( newParentName );
@@ -325,13 +324,13 @@
}
Rdn rdn = newParent.getRdn();
- if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID ) )
+ if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a syntaxChecker should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );
}
- if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( "syntaxCheckers" ) )
+ if ( ! ( ( String ) rdn.getValue() ).equalsIgnoreCase( SchemaConstants.SYNTAX_CHECKERS_AT ) )
{
throw new LdapInvalidNameException(
"The parent entry of a normalizer should have a relative name of ou=syntaxCheckers.",
Modified: directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java Wed May 23 17:26:40 2007
@@ -30,6 +30,7 @@
import org.apache.directory.server.schema.bootstrap.Schema;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.server.schema.registries.SyntaxRegistry;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -201,7 +202,7 @@
}
- public void move( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
+ public void replace( LdapDN oriChildName, LdapDN newParentName, Attributes entry )
throws NamingException
{
checkNewParent( newParentName );
@@ -244,7 +245,7 @@
}
Rdn rdn = newParent.getRdn();
- if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID ) )
+ if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
{
throw new LdapInvalidNameException( "The parent entry of a syntax should be an organizationalUnit.",
ResultCodeEnum.NAMING_VIOLATION );