You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2008/05/21 22:50:35 UTC
svn commit: r658861 [2/2] -
/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/
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=658861&r1=658860&r2=658861&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 Wed May 21 13:50:34 2008
@@ -22,6 +22,7 @@
import org.apache.directory.server.constants.ServerDNConstants;
import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.cursor.Cursor;
import org.apache.directory.server.core.entry.DefaultServerAttribute;
import org.apache.directory.server.core.entry.ServerAttribute;
import org.apache.directory.server.core.entry.ServerBinaryValue;
@@ -30,7 +31,6 @@
import org.apache.directory.server.core.entry.ServerSearchResult;
import org.apache.directory.server.core.entry.ServerStringValue;
import org.apache.directory.server.core.enumeration.SearchResultFilter;
-import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.core.interceptor.NextInterceptor;
import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -85,13 +85,10 @@
import org.apache.directory.shared.ldap.schema.UsageEnum;
import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
-import org.apache.directory.shared.ldap.util.EmptyEnumeration;
-import org.apache.directory.shared.ldap.util.SingletonEnumeration;
import org.apache.directory.shared.ldap.util.StringTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
import javax.naming.directory.InvalidAttributeValueException;
@@ -186,9 +183,9 @@
* Initialize the Schema Service
*
* @param directoryService the directory service core
- * @throws NamingException if there are problems during initialization
+ * @throws Exception if there are problems during initialization
*/
- public void init( DirectoryService directoryService ) throws NamingException
+ public void init( DirectoryService directoryService ) throws Exception
{
if ( IS_DEBUG )
{
@@ -233,9 +230,9 @@
*
* @param atSeen ???
* @param objectClass the object class to gather MUST attributes for
- * @throws NamingException if there are problems resolving schema entitites
+ * @throws Exception if there are problems resolving schema entitites
*/
- private void computeMustAttributes( ObjectClass objectClass, Set<String> atSeen ) throws NamingException
+ private void computeMustAttributes( ObjectClass objectClass, Set<String> atSeen ) throws Exception
{
List<ObjectClass> parents = superiors.get( objectClass.getOid() );
@@ -277,9 +274,9 @@
*
* @param atSeen ???
* @param objectClass the object class to get all the MAY attributes for
- * @throws NamingException with problems accessing registries
+ * @throws Exception with problems accessing registries
*/
- private void computeMayAttributes( ObjectClass objectClass, Set<String> atSeen ) throws NamingException
+ private void computeMayAttributes( ObjectClass objectClass, Set<String> atSeen ) throws Exception
{
List<ObjectClass> parents = superiors.get( objectClass.getOid() );
@@ -324,7 +321,7 @@
* superiors.
*/
private void computeOCSuperiors( ObjectClass objectClass, List<ObjectClass> superiors, Set<String> ocSeen )
- throws NamingException
+ throws Exception
{
ObjectClass[] parents = objectClass.getSuperClasses();
@@ -356,9 +353,9 @@
/**
* Compute all ObjectClasses superiors, MAY and MUST attributes.
- * @throws NamingException
+ * @throws Exception
*/
- private void computeSuperiors() throws NamingException
+ private void computeSuperiors() throws Exception
{
Iterator<ObjectClass> objectClasses = registries.getObjectClassRegistry().iterator();
superiors = new HashMap<String, List<ObjectClass>>();
@@ -387,13 +384,15 @@
/**
*
*/
- public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext )
- throws NamingException
+ public Cursor<ServerEntry> list( NextInterceptor nextInterceptor, ListOperationContext opContext )
+ throws Exception
{
- NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext );
+ Cursor<ServerEntry> result = nextInterceptor.list( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
- return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, binaryAttributeFilter,
- "List Schema Filter" );
+ // TODO FixMe
+ //return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, binaryAttributeFilter,
+ // "List Schema Filter" );
+ return null;
}
@@ -467,7 +466,7 @@
hasAttributes = true;
}
- catch ( NamingException ne )
+ catch ( Exception ne )
{
/* Do nothing, the attribute does not exist */
}
@@ -508,7 +507,7 @@
}
- private Value<?> convert( String id, Object value ) throws NamingException
+ private Value<?> convert( String id, Object value ) throws Exception
{
AttributeType at = atRegistry.lookup( id );
@@ -554,7 +553,7 @@
* a HumanReadible filter should have a String value. The substring filter should
* not be used with binary attributes.
*/
- private void checkFilter( ExprNode filter ) throws NamingException
+ private void checkFilter( ExprNode filter ) throws Exception
{
if ( filter == null )
{
@@ -665,8 +664,8 @@
/**
*
*/
- public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor,
- SearchOperationContext opContext ) throws NamingException
+ public Cursor<ServerEntry> search( NextInterceptor nextInterceptor,
+ SearchOperationContext opContext ) throws Exception
{
LdapDN base = opContext.getDn();
SearchControls searchCtls = opContext.getSearchControls();
@@ -685,18 +684,22 @@
// Deal with the normal case : searching for a normal value (not subSchemaSubEntry)
if ( !subschemaSubentryDnNorm.equals( baseNormForm ) )
{
- NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext );
+ Cursor<ServerEntry> result = nextInterceptor.search( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
if ( searchCtls.getReturningAttributes() != null )
{
- return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, topFilter,
- "Search Schema Filter top" );
+ // TODO FixMe
+ //return new SearchResultFilteringEnumeration( result, new SearchControls(), invocation, topFilter,
+ // "Search Schema Filter top" );
+ return null;
}
- return new SearchResultFilteringEnumeration( result, searchCtls, invocation, filters,
- "Search Schema Filter" );
+ // TODO FixMe
+ //return new SearchResultFilteringEnumeration( result, searchCtls, invocation, filters,
+ // "Search Schema Filter" );
+ return null;
}
// The user was searching into the subSchemaSubEntry
@@ -729,7 +732,9 @@
}
else
{
- return new EmptyEnumeration<ServerSearchResult>();
+ // TODO FixMe
+ //return new EmptyEnumeration<ServerSearchResult>();
+ return null;
}
String nodeOid = registries.getOidRegistry().getOid( node.getAttribute() );
@@ -742,11 +747,15 @@
// call.setBypass( true );
ServerEntry serverEntry = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
ServerSearchResult result = new ServerSearchResult( base, null, serverEntry );
- return new SingletonEnumeration<ServerSearchResult>( result );
+ // TODO FixMe
+ //return new SingletonEnumeration<ServerSearchResult>( result );
+ return null;
}
else
{
- return new EmptyEnumeration<ServerSearchResult>();
+ // TODO FixMe
+ //return new EmptyEnumeration<ServerSearchResult>();
+ return null;
}
}
else if ( filter instanceof PresenceNode )
@@ -759,13 +768,17 @@
// call.setBypass( true );
ServerEntry serverEntry = schemaService.getSubschemaEntry( searchCtls.getReturningAttributes() );
ServerSearchResult result = new ServerSearchResult( base, null, serverEntry, false );
- return new SingletonEnumeration<ServerSearchResult>( result );
+ // TODO FixMe
+ //return new SingletonEnumeration<ServerSearchResult>( result );
+ return null;
}
}
}
// In any case not handled previously, just return an empty result
- return new EmptyEnumeration<ServerSearchResult>();
+ // TODO FixMe
+ //return new EmptyEnumeration<ServerSearchResult>();
+ return null;
}
@@ -773,7 +786,7 @@
* Search for an entry, using its DN. Binary attributes and ObjectClass attribute are removed.
*/
public ServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext opContext )
- throws NamingException
+ throws Exception
{
ServerEntry result = nextInterceptor.lookup( opContext );
@@ -789,7 +802,7 @@
}
- private void getSuperiors( ObjectClass oc, Set<String> ocSeen, List<ObjectClass> result ) throws NamingException
+ private void getSuperiors( ObjectClass oc, Set<String> ocSeen, List<ObjectClass> result ) throws Exception
{
for ( ObjectClass parent : oc.getSuperClasses() )
{
@@ -818,9 +831,9 @@
* @param attrId the attribute to test if required by a set of objectClass values
* @param objectClass the objectClass values
* @return true if the objectClass values require the attribute, false otherwise
- * @throws NamingException if the attribute is not recognized
+ * @throws Exception if the attribute is not recognized
*/
- private boolean isRequired( String attrId, EntryAttribute objectClasses ) throws NamingException
+ private boolean isRequired( String attrId, EntryAttribute objectClasses ) throws Exception
{
OidRegistry oidRegistry = registries.getOidRegistry();
ObjectClassRegistry registry = registries.getObjectClassRegistry();
@@ -857,9 +870,9 @@
* @param change
* @param entry
* @return
- * @throws NamingException
+ * @throws Exception
*/
- private boolean isCompleteRemoval( ServerAttribute change, ServerEntry entry ) throws NamingException
+ private boolean isCompleteRemoval( ServerAttribute change, ServerEntry entry ) throws Exception
{
// if change size is 0 then all values are deleted then we're in trouble
if ( change.size() == 0 )
@@ -888,10 +901,10 @@
* @param changes
* @param existing
* @return
- * @throws NamingException
+ * @throws Exception
*/
private EntryAttribute getResultantObjectClasses( ModificationOperation modOp, EntryAttribute changes,
- EntryAttribute existing ) throws NamingException
+ EntryAttribute existing ) throws Exception
{
if ( ( changes == null ) && ( existing == null ) )
{
@@ -939,7 +952,7 @@
}
- private boolean getObjectClasses( EntryAttribute objectClasses, List<ObjectClass> result ) throws NamingException
+ private boolean getObjectClasses( EntryAttribute objectClasses, List<ObjectClass> result ) throws Exception
{
Set<String> ocSeen = new HashSet<String>();
ObjectClassRegistry registry = registries.getObjectClassRegistry();
@@ -979,7 +992,7 @@
}
- private Set<String> getAllMust( EntryAttribute objectClasses ) throws NamingException
+ private Set<String> getAllMust( EntryAttribute objectClasses ) throws Exception
{
Set<String> must = new HashSet<String>();
@@ -1005,7 +1018,7 @@
}
- private Set<String> getAllAllowed( EntryAttribute objectClasses, Set<String> must ) throws NamingException
+ private Set<String> getAllAllowed( EntryAttribute objectClasses, Set<String> must ) throws Exception
{
Set<String> allowed = new HashSet<String>( must );
@@ -1043,9 +1056,9 @@
* <a href="http://docs.safehaus.org:8080/x/kBE">here</a>.
*
* @param objectClassAttr the objectClass attribute to modify
- * @throws NamingException if there are problems
+ * @throws Exception if there are problems
*/
- private void alterObjectClasses( EntryAttribute objectClassAttr ) throws NamingException
+ private void alterObjectClasses( EntryAttribute objectClassAttr ) throws Exception
{
Set<String> objectClasses = new HashSet<String>();
Set<String> objectClassesUP = new HashSet<String>();
@@ -1097,7 +1110,7 @@
}
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws NamingException
+ public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws Exception
{
LdapDN oriChildName = opContext.getDn();
@@ -1113,7 +1126,7 @@
}
- public void move( NextInterceptor next, MoveOperationContext opContext ) throws NamingException
+ public void move( NextInterceptor next, MoveOperationContext opContext ) throws Exception
{
LdapDN oriChildName = opContext.getDn();
@@ -1129,7 +1142,7 @@
}
- public void rename( NextInterceptor next, RenameOperationContext opContext ) throws NamingException
+ public void rename( NextInterceptor next, RenameOperationContext opContext ) throws Exception
{
LdapDN name = opContext.getDn();
Rdn newRdn = opContext.getNewRdn();
@@ -1147,7 +1160,7 @@
}
- public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
+ public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws Exception
{
ServerEntry entry;
LdapDN name = opContext.getDn();
@@ -1450,7 +1463,7 @@
}
- private void filterObjectClass( ServerEntry entry ) throws NamingException
+ private void filterObjectClass( ServerEntry entry ) throws Exception
{
List<ObjectClass> objectClasses = new ArrayList<ObjectClass>();
EntryAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
@@ -1474,7 +1487,7 @@
}
- private void filterBinaryAttributes( ServerEntry entry ) throws NamingException
+ private void filterBinaryAttributes( ServerEntry entry ) throws Exception
{
/*
* start converting values of attributes to byte[]s which are not
@@ -1519,7 +1532,7 @@
private class BinaryAttributeFilter implements SearchResultFilter
{
public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
- throws NamingException
+ throws Exception
{
filterBinaryAttributes( result.getServerEntry() );
return true;
@@ -1532,7 +1545,7 @@
private class TopFilter implements SearchResultFilter
{
public boolean accept( Invocation invocation, ServerSearchResult result, SearchControls controls )
- throws NamingException
+ throws Exception
{
filterObjectClass( result.getServerEntry() );
@@ -1546,7 +1559,7 @@
*
* We also check the syntaxes
*/
- private void check( LdapDN dn, ServerEntry entry ) throws NamingException
+ private void check( LdapDN dn, ServerEntry entry ) throws Exception
{
// ---------------------------------------------------------------
// First, make sure all attributes are valid schema defined attributes
@@ -1611,7 +1624,7 @@
/**
* Check that all the attributes exist in the schema for this entry.
*/
- public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
+ public void add( NextInterceptor next, AddOperationContext addContext ) throws Exception
{
LdapDN name = addContext.getDn();
ServerEntry entry = addContext.getEntry();
@@ -1632,9 +1645,9 @@
* set of objectClass attribute values.
*
* @return true if the objectClass values require the attribute, false otherwise
- * @throws NamingException if the attribute is not recognized
+ * @throws Exception if the attribute is not recognized
*/
- private void assertAllAttributesAllowed( LdapDN dn, ServerEntry entry, Set<String> allowed ) throws NamingException
+ private void assertAllAttributesAllowed( LdapDN dn, ServerEntry entry, Set<String> allowed ) throws Exception
{
// Never check the attributes if the extensibleObject objectClass is
// declared for this entry
@@ -1664,7 +1677,7 @@
}
- public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
+ public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws Exception
{
LdapDN name = opContext.getDn();
@@ -1682,7 +1695,7 @@
* Checks to see number of values of an attribute conforms to the schema
*/
private void assertNumberOfAttributeValuesValid( Entry entry ) throws InvalidAttributeValueException,
- NamingException
+ Exception
{
for ( EntryAttribute attribute : entry )
{
@@ -1695,7 +1708,7 @@
* Checks to see numbers of values of attributes conforms to the schema
*/
private void assertNumberOfAttributeValuesValid( EntryAttribute attribute ) throws InvalidAttributeValueException,
- NamingException
+ Exception
{
if ( attribute.size() > 1 && ( ( ServerAttribute ) attribute ).getAttributeType().isSingleValue() )
{
@@ -1708,7 +1721,7 @@
/**
* Checks to see the presence of all required attributes within an entry.
*/
- private void assertRequiredAttributesPresent( LdapDN dn, Entry entry, Set<String> must ) throws NamingException
+ private void assertRequiredAttributesPresent( LdapDN dn, Entry entry, Set<String> must ) throws Exception
{
for ( EntryAttribute attribute : entry )
{
@@ -1729,7 +1742,7 @@
* inheritance tree
* - we must have at least one STRUCTURAL OC
*/
- private void assertObjectClasses( LdapDN dn, List<ObjectClass> ocs ) throws NamingException
+ private void assertObjectClasses( LdapDN dn, List<ObjectClass> ocs ) throws Exception
{
Set<ObjectClass> structuralObjectClasses = new HashSet<ObjectClass>();
@@ -1799,7 +1812,7 @@
/**
* Check the entry attributes syntax, using the syntaxCheckers
*/
- private void assertSyntaxes( Entry entry ) throws NamingException
+ private void assertSyntaxes( Entry entry ) throws Exception
{
// First, loop on all attributes
for ( EntryAttribute attribute : entry )
@@ -1821,7 +1834,7 @@
{
syntaxChecker.assertSyntax( value.get() );
}
- catch ( NamingException ne )
+ catch ( Exception ne )
{
String message = "Attribute value '"
+ ( value instanceof ServerStringValue ? value.get() : StringTools.dumpBytes( ( byte[] ) value
@@ -1840,7 +1853,7 @@
*
* If this is the case, try to change it to a String value.
*/
- private boolean checkHumanReadable( EntryAttribute attribute ) throws NamingException
+ private boolean checkHumanReadable( EntryAttribute attribute ) throws Exception
{
boolean isModified = false;
@@ -1882,7 +1895,7 @@
*
* If this is the case, try to change it to a binary value.
*/
- private boolean checkNotHumanReadable( EntryAttribute attribute ) throws NamingException
+ private boolean checkNotHumanReadable( EntryAttribute attribute ) throws Exception
{
boolean isModified = false;
@@ -1929,7 +1942,7 @@
* to valid String if they are stored as byte[], and that non Human Readable attributes
* stored as String can be transformed to byte[]
*/
- private void assertHumanReadable( ServerEntry entry ) throws NamingException
+ private void assertHumanReadable( ServerEntry entry ) throws Exception
{
boolean isModified = false;
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java?rev=658861&r1=658860&r2=658861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java Wed May 21 13:50:34 2008
@@ -194,7 +194,7 @@
public SchemaOperationControl( Registries registries, PartitionSchemaLoader loader, SchemaPartitionDao dao )
- throws NamingException
+ throws Exception
{
this.registries = registries;
this.objectClassAT = this.registries.getAttributeTypeRegistry()
@@ -287,7 +287,7 @@
}
- public void add( LdapDN name, ServerEntry entry ) throws NamingException
+ public void add( LdapDN name, ServerEntry entry ) throws Exception
{
EntryAttribute oc = entry.get( objectClassAT );
@@ -336,7 +336,7 @@
}
- public void delete( LdapDN name, ServerEntry entry, boolean doCascadeDelete ) throws NamingException
+ public void delete( LdapDN name, ServerEntry entry, boolean doCascadeDelete ) throws Exception
{
EntryAttribute oc = entry.get( objectClassAT );
@@ -385,7 +385,7 @@
public void modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry entry,
- ServerEntry targetEntry, boolean cascade ) throws NamingException
+ ServerEntry targetEntry, boolean cascade ) throws Exception
{
EntryAttribute oc = entry.get( objectClassAT );
@@ -414,7 +414,7 @@
public void modify( LdapDN name, List<Modification> mods, ServerEntry entry, ServerEntry targetEntry,
- boolean doCascadeModify ) throws NamingException
+ boolean doCascadeModify ) throws Exception
{
EntryAttribute oc = entry.get( objectClassAT );
@@ -445,7 +445,7 @@
public void modifyRn( LdapDN name, Rdn newRdn, boolean deleteOldRn, ServerEntry entry, boolean doCascadeModify )
- throws NamingException
+ throws Exception
{
EntryAttribute oc = entry.get( objectClassAT );
@@ -474,7 +474,7 @@
public void replace( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry,
- boolean cascade ) throws NamingException
+ boolean cascade ) throws Exception
{
EntryAttribute oc = entry.get( objectClassAT );
@@ -503,7 +503,7 @@
public void move( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn,
- ServerEntry entry, boolean cascade ) throws NamingException
+ ServerEntry entry, boolean cascade ) throws Exception
{
EntryAttribute oc = entry.get( objectClassAT );
@@ -545,7 +545,7 @@
* @throws NamingException if the operation fails
*/
public void modifySchemaSubentry( LdapDN name, List<Modification> mods, ServerEntry subentry,
- ServerEntry targetSubentry, boolean doCascadeModify ) throws NamingException
+ ServerEntry targetSubentry, boolean doCascadeModify ) throws Exception
{
for ( Modification mod : mods )
{
@@ -599,7 +599,7 @@
* @throws NamingException if the modify fails
*/
public void modifySchemaSubentry( LdapDN name, int modOp, ServerEntry mods, ServerEntry subentry,
- ServerEntry targetSubentry, boolean doCascadeModify ) throws NamingException
+ ServerEntry targetSubentry, boolean doCascadeModify ) throws Exception
{
Set<AttributeType> attributeTypes = mods.getAttributeTypes();
@@ -661,7 +661,7 @@
* schema partition
*/
private void modifyRemoveOperation( String opAttrOid, EntryAttribute mods, boolean doCascadeModify )
- throws NamingException
+ throws Exception
{
int index = opAttr2handlerIndex.get( opAttrOid );
SchemaChangeHandler handler = opAttr2handlerMap.get( opAttrOid );
@@ -794,7 +794,7 @@
* @throws NamingException if there are problems updating the registries and the
* schema partition
*/
- private void modifyAddOperation( String opAttrOid, EntryAttribute mods, boolean doCascadeModify ) throws NamingException
+ private void modifyAddOperation( String opAttrOid, EntryAttribute mods, boolean doCascadeModify ) throws Exception
{
if ( doCascadeModify )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?rev=658861&r1=658860&r2=658861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java Wed May 21 13:50:34 2008
@@ -29,10 +29,10 @@
import org.apache.directory.server.constants.MetaSchemaConstants;
import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.cursor.Cursor;
import org.apache.directory.server.core.entry.DefaultServerAttribute;
import org.apache.directory.server.core.entry.ServerEntry;
import org.apache.directory.server.core.entry.ServerModification;
-import org.apache.directory.server.core.entry.ServerSearchResult;
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.SearchOperationContext;
@@ -63,7 +63,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.SearchControls;
@@ -128,7 +127,7 @@
* @param registries the bootstrap registries that were used to start up the schema partition
* @throws NamingException if there are problems initializing this schema partion dao
*/
- public SchemaPartitionDao( Partition partition, Registries registries ) throws NamingException
+ public SchemaPartitionDao( Partition partition, Registries registries ) throws Exception
{
this.partition = partition;
this.registries = registries;
@@ -155,15 +154,15 @@
}
- public Map<String, Schema> getSchemas() throws NamingException
+ public Map<String, Schema> getSchemas() throws Exception
{
Map<String, Schema> schemas = new HashMap<String, Schema>();
- NamingEnumeration<ServerSearchResult> list = listSchemas();
+ Cursor<ServerEntry> list = listSchemas();
- while ( list.hasMore() )
+ while ( list.next() )
{
- ServerSearchResult sr = list.next();
- Schema schema = factory.getSchema( sr.getServerEntry() );
+ ServerEntry sr = list.get();
+ Schema schema = factory.getSchema( sr );
schemas.put( schema.getSchemaName(), schema );
}
@@ -171,22 +170,22 @@
}
- public Set<String> getSchemaNames() throws NamingException
+ public Set<String> getSchemaNames() throws Exception
{
Set<String> schemaNames = new HashSet<String>();
- NamingEnumeration<ServerSearchResult> list = listSchemas();
+ Cursor<ServerEntry> list = listSchemas();
- while ( list.hasMore() )
+ while ( list.next() )
{
- ServerSearchResult sr = list.next();
- schemaNames.add( sr.getServerEntry().get( SchemaConstants.CN_AT ).getString() );
+ ServerEntry sr = list.get();
+ schemaNames.add( sr.get( SchemaConstants.CN_AT ).getString() );
}
return schemaNames;
}
- private NamingEnumeration<ServerSearchResult> listSchemas() throws NamingException
+ private Cursor<ServerEntry> listSchemas() throws Exception
{
LdapDN base = new LdapDN( ServerDNConstants.OU_SCHEMA_DN );
base.normalize( attrRegistry.getNormalizerMapping() );
@@ -200,7 +199,7 @@
}
- public Schema getSchema( String schemaName ) throws NamingException
+ public Schema getSchema( String schemaName ) throws Exception
{
LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -208,7 +207,7 @@
}
- public boolean hasMatchingRule( String oid ) throws NamingException
+ public boolean hasMatchingRule( String oid ) throws Exception
{
BranchNode filter = new AndNode();
filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
@@ -225,20 +224,19 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- if ( !ne.hasMore() )
+ if ( !ne.next() )
{
return false;
}
- ne.next();
- if ( ne.hasMore() )
+ if ( ne.next() )
{
throw new NamingException( "Got more than one matchingRule for oid of " + oid );
}
@@ -255,7 +253,7 @@
}
- public boolean hasAttributeType( String oid ) throws NamingException
+ public boolean hasAttributeType( String oid ) throws Exception
{
BranchNode filter = new AndNode();
filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
@@ -272,20 +270,19 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- if ( !ne.hasMore() )
+ if ( !ne.next() )
{
return false;
}
- ne.next();
- if ( ne.hasMore() )
+ if ( ne.next() )
{
throw new NamingException( "Got more than one attributeType for oid of " + oid );
}
@@ -302,7 +299,7 @@
}
- public boolean hasObjectClass( String oid ) throws NamingException
+ public boolean hasObjectClass( String oid ) throws Exception
{
BranchNode filter = new AndNode();
filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
@@ -319,20 +316,19 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- if ( !ne.hasMore() )
+ if ( !ne.next() )
{
return false;
}
- ne.next();
- if ( ne.hasMore() )
+ if ( ne.next() )
{
throw new NamingException( "Got more than one attributeType for oid of " + oid );
}
@@ -349,7 +345,7 @@
}
- public boolean hasSyntax( String oid ) throws NamingException
+ public boolean hasSyntax( String oid ) throws Exception
{
BranchNode filter = new AndNode();
filter
@@ -366,20 +362,19 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- if ( !ne.hasMore() )
+ if ( !ne.next() )
{
return false;
}
- ne.next();
- if ( ne.hasMore() )
+ if ( ne.next() )
{
throw new NamingException( "Got more than one syntax for oid of " + oid );
}
@@ -396,7 +391,7 @@
}
- public boolean hasSyntaxChecker( String oid ) throws NamingException
+ public boolean hasSyntaxChecker( String oid ) throws Exception
{
BranchNode filter = new AndNode();
filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
@@ -413,20 +408,19 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- if ( !ne.hasMore() )
+ if ( !ne.next() )
{
return false;
}
- ne.next();
- if ( ne.hasMore() )
+ if ( ne.next() )
{
throw new NamingException( "Got more than one syntaxChecker for oid of " + oid );
}
@@ -457,7 +451,7 @@
* @throws NamingException if more than one entity has the name, or if there
* are underlying data access problems
*/
- public String findSchema( String entityName ) throws NamingException
+ public String findSchema( String entityName ) throws Exception
{
LdapDN dn = findDn( entityName );
if ( dn == null )
@@ -476,9 +470,9 @@
}
- public LdapDN findDn( String entityName ) throws NamingException
+ public LdapDN findDn( String entityName ) throws Exception
{
- ServerSearchResult sr = find( entityName );
+ ServerEntry sr = find( entityName );
LdapDN dn = sr.getDn();
dn.normalize( attrRegistry.getNormalizerMapping() );
return dn;
@@ -499,7 +493,7 @@
* @throws NamingException if more than one entity has the name, or if there
* are underlying data access problems
*/
- public ServerSearchResult find( String entityName ) throws NamingException
+ public ServerEntry find( String entityName ) throws Exception
{
BranchNode filter = new OrNode();
SimpleNode nameAVA = new EqualityNode( M_NAME_OID, new ClientStringValue( entityName.toLowerCase() ) );
@@ -508,20 +502,21 @@
filter.addNode( oidAVA );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- if ( !ne.hasMore() )
+ if ( !ne.next() )
{
return null;
}
- ServerSearchResult sr = ne.next();
- if ( ne.hasMore() )
+ ServerEntry sr = ne.get();
+
+ if ( ne.next() )
{
throw new NamingException( "Got more than one result for the entity name: " + entityName );
}
@@ -568,7 +563,7 @@
* @param schemaName the name of the schema to enable
* @throws NamingException if there is a problem updating the schema entry
*/
- public void enableSchema( String schemaName ) throws NamingException
+ public void enableSchema( String schemaName ) throws Exception
{
LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -612,9 +607,9 @@
* @return the set of matchingRules and attributeTypes depending on a syntax
* @throws NamingException if the dao fails to perform search operations
*/
- public Set<ServerSearchResult> listSyntaxDependents( String numericOid ) throws NamingException
+ public Set<ServerEntry> listSyntaxDependents( String numericOid ) throws Exception
{
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
+ Set<ServerEntry> set = new HashSet<ServerEntry>();
BranchNode filter = new AndNode();
// subfilter for (| (objectClass=metaMatchingRule) (objectClass=metaAttributeType))
@@ -629,15 +624,16 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while ( ne.hasMore() )
+
+ while ( ne.next() )
{
- set.add( ne.next() );
+ set.add( ne.get() );
}
}
finally
@@ -652,9 +648,9 @@
}
- public Set<ServerSearchResult> listMatchingRuleDependents( MatchingRule mr ) throws NamingException
+ public Set<ServerEntry> listMatchingRuleDependents( MatchingRule mr ) throws Exception
{
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
+ Set<ServerEntry> set = new HashSet<ServerEntry>();
BranchNode filter = new AndNode();
// ( objectClass = metaAttributeType )
@@ -679,15 +675,16 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while ( ne.hasMore() )
+
+ while ( ne.next() )
{
- set.add( ne.next() );
+ set.add( ne.get() );
}
}
finally
@@ -702,7 +699,7 @@
}
- public NamingEnumeration<ServerSearchResult> listAllNames() throws NamingException
+ public Cursor<ServerEntry> listAllNames() throws Exception
{
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -716,7 +713,7 @@
}
- public Set<ServerSearchResult> listAttributeTypeDependents( AttributeType at ) throws NamingException
+ public Set<ServerEntry> listAttributeTypeDependents( AttributeType at ) throws Exception
{
/*
* Right now the following inefficient filter is being used:
@@ -736,7 +733,7 @@
* )
*/
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
+ Set<ServerEntry> set = new HashSet<ServerEntry>();
BranchNode filter = new AndNode();
// ( objectClass = metaAttributeType )
@@ -755,15 +752,16 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while ( ne.hasMore() )
+
+ while ( ne.next() )
{
- set.add( ne.next() );
+ set.add( ne.get() );
}
}
finally
@@ -785,7 +783,7 @@
* @return a set of SearchResults over the schemas whose m-dependency attribute contains schemaName
* @throws NamingException if there is a problem while searching the schema partition
*/
- public Set<ServerSearchResult> listSchemaDependents( String schemaName ) throws NamingException
+ public Set<ServerEntry> listSchemaDependents( String schemaName ) throws Exception
{
/*
* The following filter is being used:
@@ -793,7 +791,7 @@
* ( & ( objectClass = metaSchema ) ( m-dependencies = $schemaName ) )
*/
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
+ Set<ServerEntry> set = new HashSet<ServerEntry>();
BranchNode filter = new AndNode();
filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC
@@ -802,15 +800,16 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while ( ne.hasMore() )
+
+ while ( ne.next() )
{
- set.add( ne.next() );
+ set.add( ne.get() );
}
}
finally
@@ -828,13 +827,13 @@
/**
* Lists the SearchResults of metaSchema objects that depend on a schema.
*
- * @param schemaName the name of the schema to search for dependees
+ * @param schemaName the name of the schema to search for dependencies
* @return a set of SearchResults over the schemas whose m-dependency attribute contains schemaName
* @throws NamingException if there is a problem while searching the schema partition
*/
- public Set<ServerSearchResult> listEnabledSchemaDependents( String schemaName ) throws NamingException
+ public Set<ServerEntry> listEnabledSchemaDependents( String schemaName ) throws Exception
{
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
+ Set<ServerEntry> set = new HashSet<ServerEntry>();
BranchNode filter = new AndNode();
filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC
@@ -843,17 +842,17 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while ( ne.hasMore() )
+ while ( ne.next() )
{
- ServerSearchResult sr = ne.next();
- EntryAttribute disabled = sr.getServerEntry().get( disabledAttributeType );
+ ServerEntry sr = ne.get();
+ EntryAttribute disabled = sr.get( disabledAttributeType );
if ( disabled == null )
{
@@ -877,7 +876,7 @@
}
- public Set<ServerSearchResult> listObjectClassDependents( ObjectClass oc ) throws NamingException
+ public Set<ServerEntry> listObjectClassDependents( ObjectClass oc ) throws Exception
{
/*
* Right now the following inefficient filter is being used:
@@ -903,7 +902,7 @@
* )
*/
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
+ Set<ServerEntry> set = new HashSet<ServerEntry>();
BranchNode filter = new AndNode();
BranchNode or = new OrNode();
@@ -923,15 +922,16 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> ne = null;
+ Cursor<ServerEntry> ne = null;
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while ( ne.hasMore() )
+
+ while ( ne.next() )
{
- set.add( ne.next() );
+ set.add( ne.get() );
}
}
finally
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=658861&r1=658860&r2=658861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Wed May 21 13:50:34 2008
@@ -380,7 +380,7 @@
* @return the schemaSubentry
* @throws NamingException if there is a failure to access schema timestamps
*/
- public ServerEntry getSubschemaEntryImmutable() throws NamingException
+ public ServerEntry getSubschemaEntryImmutable() throws Exception
{
if ( schemaSubentry == null )
{
@@ -398,7 +398,7 @@
* @return the schemaSubentry
* @throws NamingException if there is a failure to access schema timestamps
*/
- public ServerEntry getSubschemaEntryCloned() throws NamingException
+ public ServerEntry getSubschemaEntryCloned() throws Exception
{
if ( schemaSubentry == null )
{
@@ -418,7 +418,7 @@
* @return the subschema entry with the ids provided
* @throws NamingException if there are failures during schema info access
*/
- public ServerEntry getSubschemaEntry( String[] ids ) throws NamingException
+ public ServerEntry getSubschemaEntry( String[] ids ) throws Exception
{
if ( ids == null )
{
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java?rev=658861&r1=658860&r2=658861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.java Wed May 21 13:50:34 2008
@@ -143,7 +143,7 @@
}
- public void addSchemaObject( Registries registries, SchemaObject obj ) throws NamingException
+ public void addSchemaObject( Registries registries, SchemaObject obj ) throws Exception
{
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
Schema schema = dao.getSchema( obj.getSchema() );