You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/06/06 07:38:04 UTC
svn commit: r663827 - in
/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core:
collective/ event/ exception/ partition/ schema/ subtree/ trigger/
Author: akarasulu
Date: Thu Jun 5 22:38:03 2008
New Revision: 663827
URL: http://svn.apache.org/viewvc?rev=663827&view=rev
Log:
Utilizing proper means to handle secondary LookUp operations
Modified:
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributeInterceptor.java Thu Jun 5 22:38:03 2008
@@ -35,6 +35,7 @@
import org.apache.directory.server.core.interceptor.context.OperationContext;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -195,7 +196,7 @@
{
String subentryDnStr = ( String ) value.get();
LdapDN subentryDn = new LdapDN( subentryDnStr );
- ServerEntry subentry = nexus.lookup( new LookupOperationContext( opContext.getSession(), subentryDn ) );
+ ServerEntry subentry = opContext.lookup( subentryDn, ByPassConstants.LOOKUP_BYPASS );
for ( AttributeType attributeType:subentry.getAttributeTypes() )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java Thu Jun 5 22:38:03 2008
@@ -30,6 +30,7 @@
import org.apache.directory.server.core.entry.ServerEntryUtils;
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -78,9 +79,10 @@
}
}
+
public void checkModify( OperationContext opContext, LdapDN normName, List<Modification> mods ) throws Exception
{
- ServerEntry originalEntry = nexus.lookup( new LookupOperationContext( opContext.getSession(), normName ) );
+ ServerEntry originalEntry = opContext.lookup( normName, ByPassConstants.LOOKUP_BYPASS );
ServerEntry targetEntry = ServerEntryUtils.toServerEntry(
SchemaUtils.getTargetEntry( ServerEntryUtils.toModificationItemImpl( mods ), ServerEntryUtils.toAttributesImpl( originalEntry ) ),
normName,
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java Thu Jun 5 22:38:03 2008
@@ -275,7 +275,7 @@
public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
{
LdapDN name = opContext.getDn();
- ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getSession(), name ) );
+ ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
next.delete( opContext );
//super.delete( next, opContext );
@@ -308,7 +308,7 @@
private void notifyOnModify( OperationContext opContext, LdapDN name, List<Modification> mods, ServerEntry oriEntry )
throws Exception
{
- ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getSession(), name ) );
+ ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
Set<EventSourceRecord> selecting = getSelectingSources( name, entry );
if ( selecting.isEmpty() )
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/exception/ExceptionInterceptor.java Thu Jun 5 22:38:03 2008
@@ -42,6 +42,7 @@
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.partition.ByPassConstants;
import org.apache.directory.server.core.partition.Partition;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -172,7 +173,7 @@
try
{
- attrs = nextInterceptor.lookup( opContext.newLookupContext( parentDn ) );
+ attrs = opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS );
}
catch ( Exception e )
{
@@ -312,7 +313,7 @@
assertHasEntry( nextInterceptor, opContext, msg, opContext.getDn() );
- ServerEntry entry = nexus.lookup( opContext.newLookupContext( opContext.getDn() ) );
+ ServerEntry entry = opContext.lookup( opContext.getDn(), ByPassConstants.LOOKUP_BYPASS );
List<Modification> items = opContext.getModItems();
for ( Modification item : items )
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/AbstractPartition.java Thu Jun 5 22:38:03 2008
@@ -26,7 +26,6 @@
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
/**
@@ -56,7 +55,7 @@
* {@link #doInit()} returns without any errors. {@link #destroy()} is called automatically
* as a clean-up process if {@link #doInit()} throws an exception.
*/
- public final void init( DirectoryService directoryService ) throws NamingException
+ public final void init( DirectoryService directoryService ) throws Exception
{
if ( initialized )
{
@@ -138,7 +137,7 @@
/**
* This method does nothing by default.
*/
- public void sync() throws NamingException
+ public void sync() throws Exception
{
}
@@ -148,11 +147,11 @@
* if it returns an entry by default. Please override this method if
* there is more effective way for your implementation.
*/
- public boolean hasEntry( EntryOperationContext entryContext ) throws NamingException
+ public boolean hasEntry( EntryOperationContext entryContext ) throws Exception
{
try
{
- return lookup( entryContext.newLookupContext( entryContext.getDn() ) ) != null;
+ return entryContext.lookup( entryContext.getDn(), ByPassConstants.LOOKUP_BYPASS ) != null;
}
catch ( NameNotFoundException e )
{
@@ -166,7 +165,7 @@
* with null <tt>attributeIds</tt> by default. Please override
* this method if there is more effective way for your implementation.
*/
- public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws NamingException
+ public ClonedServerEntry lookup( LookupOperationContext lookupContext ) throws Exception
{
return null;
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Thu Jun 5 22:38:03 2008
@@ -46,6 +46,7 @@
import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.ObjectClassRegistry;
@@ -1098,7 +1099,7 @@
{
LdapDN oriChildName = opContext.getDn();
- ClonedServerEntry entry = nexus.lookup( opContext.newLookupContext( oriChildName ) );
+ ClonedServerEntry entry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
if ( oriChildName.startsWith( schemaBaseDN ) )
{
@@ -1113,7 +1114,7 @@
{
LdapDN oriChildName = opContext.getDn();
- ClonedServerEntry entry = nexus.lookup( opContext.newLookupContext( oriChildName ) );
+ ClonedServerEntry entry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
if ( oriChildName.startsWith( schemaBaseDN ) )
{
@@ -1130,7 +1131,7 @@
Rdn newRdn = opContext.getNewRdn();
boolean deleteOldRn = opContext.getDelOldDn();
- ServerEntry entry = nexus.lookup( opContext.newLookupContext( name ) );
+ ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
if ( name.startsWith( schemaBaseDN ) )
{
@@ -1156,7 +1157,7 @@
}
else
{
- entry = nexus.lookup( opContext.newLookupContext( name ) );
+ entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
}
// First, we get the entry from the backend. If it does not exist, then we throw an exception
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java Thu Jun 5 22:38:03 2008
@@ -48,6 +48,7 @@
import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
import org.apache.directory.server.core.interceptor.context.SearchingOperationContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
import org.apache.directory.server.schema.registries.OidRegistry;
@@ -414,7 +415,7 @@
// get the name of the administrative point and its administrativeRole attributes
LdapDN apName = ( LdapDN ) name.clone();
apName.remove( name.size() - 1 );
- ServerEntry ap = nexus.lookup( new LookupOperationContext( addContext.getSession(), apName ) );
+ ServerEntry ap = addContext.lookup( apName, ByPassConstants.LOOKUP_BYPASS );
EntryAttribute administrativeRole = ap.get( "administrativeRole" );
// check that administrativeRole has something valid in it for us
@@ -587,7 +588,7 @@
public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
{
LdapDN name = opContext.getDn();
- ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getSession(), name ) );
+ ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
EntryAttribute objectClasses = entry.get( objectClassType );
if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
@@ -746,7 +747,7 @@
{
LdapDN name = opContext.getDn();
- ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getSession(), name ) );
+ ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
EntryAttribute objectClasses = entry.get( objectClassType );
@@ -822,7 +823,7 @@
LdapDN oriChildName = opContext.getDn();
LdapDN parent = opContext.getParent();
- ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getSession(), oriChildName ) );
+ ServerEntry entry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
EntryAttribute objectClasses = entry.get( objectClassType );
@@ -897,7 +898,7 @@
LdapDN oriChildName = opContext.getDn();
LdapDN newParentName = opContext.getParent();
- ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getSession(), oriChildName ) );
+ ServerEntry entry = opContext.lookup( oriChildName, ByPassConstants.LOOKUP_BYPASS );
EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
@@ -1013,7 +1014,7 @@
LdapDN name = opContext.getDn();
List<Modification> mods = opContext.getModItems();
- ServerEntry entry = nexus.lookup( new LookupOperationContext( opContext.getSession(), name ) );
+ ServerEntry entry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
ServerEntry oldEntry = ( ServerEntry ) entry.clone();
EntryAttribute objectClasses = entry.get( objectClassType );
@@ -1101,7 +1102,7 @@
if ( !objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
{
- ServerEntry newEntry = nexus.lookup( new LookupOperationContext( opContext.getSession(), name ) );
+ ServerEntry newEntry = opContext.lookup( name, ByPassConstants.LOOKUP_BYPASS );
List<Modification> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AbstractStoredProcedureParameterInjector.java Thu Jun 5 22:38:03 2008
@@ -32,6 +32,7 @@
import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
import org.apache.directory.server.core.interceptor.context.OperationContext;
+import org.apache.directory.server.core.partition.ByPassConstants;
import org.apache.directory.shared.ldap.name.LdapDN;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter;
import org.apache.directory.shared.ldap.trigger.StoredProcedureParameter.Generic_LDAP_CONTEXT;
@@ -111,8 +112,7 @@
{
Generic_LDAP_CONTEXT ldapCtxParam = ( Generic_LDAP_CONTEXT ) param;
LdapDN ldapCtxName = ldapCtxParam.getCtxName();
- LookupOperationContext lookupContext = new LookupOperationContext( opContext.getSession(), ldapCtxName );
- return opContext.getSession().getDirectoryService().getOperationManager().lookup( lookupContext );
+ return opContext.lookup( ldapCtxName, ByPassConstants.LOOKUP_BYPASS );
}
};
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java Thu Jun 5 22:38:03 2008
@@ -74,11 +74,6 @@
* Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes
* especially subentry related ones like "triggerExecutionSubentries".
*/
- LookupOperationContext lookupContext = new LookupOperationContext( opContext.getSession(), deletedEntryName );
- lookupContext.setByPassed( ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
- ClonedServerEntry deletedEntry = opContext.getSession().getDirectoryService()
- .getOperationManager().lookup( lookupContext );
-
- return deletedEntry;
+ return opContext.lookup( deletedEntryName, ByPassConstants.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
}
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=663827&r1=663826&r2=663827&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java Thu Jun 5 22:38:03 2008
@@ -132,9 +132,7 @@
LdapDN parentDn = ( LdapDN ) dn.clone();
parentDn.remove( dn.size() - 1 );
- LookupOperationContext lookupContext = new LookupOperationContext( opContext.getSession(), parentDn );
- lookupContext.setByPassed( ByPassConstants.LOOKUP_BYPASS );
- entry = opContext.getSession().getDirectoryService().getOperationManager().lookup( lookupContext );
+ entry = opContext.lookup( parentDn, ByPassConstants.LOOKUP_BYPASS );
}
EntryAttribute subentries = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );