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/01 02:06:46 UTC
svn commit: r652410 [11/14] - in /directory: apacheds/branches/bigbang/
apacheds/branches/bigbang/apacheds-jdbm/
apacheds/branches/bigbang/apacheds-jdbm/src/
apacheds/branches/bigbang/apacheds-jdbm/src/etc/
apacheds/branches/bigbang/apacheds-jdbm/src/e...
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=652410&r1=652409&r2=652410&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 Apr 30 17:06:41 2008
@@ -44,6 +44,7 @@
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
import org.apache.directory.shared.ldap.entry.Modification;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.filter.AndNode;
import org.apache.directory.shared.ldap.filter.BranchNode;
import org.apache.directory.shared.ldap.filter.EqualityNode;
@@ -91,20 +92,16 @@
/** static class logger */
private final Logger LOG = LoggerFactory.getLogger( getClass() );
private static final NumericOidSyntaxChecker NUMERIC_OID_CHECKER = new NumericOidSyntaxChecker();
- private static final String[] SCHEMA_ATTRIBUTES = new String[] {
- SchemaConstants.CREATORS_NAME_AT,
- "m-dependencies",
- SchemaConstants.OBJECT_CLASS_AT,
- SchemaConstants.CN_AT,
- "m-disabled" };
-
+ private static final String[] SCHEMA_ATTRIBUTES = new String[]
+ { SchemaConstants.CREATORS_NAME_AT, "m-dependencies", SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.CN_AT,
+ "m-disabled" };
private final Partition partition;
private final Registries registries;
private final SchemaEntityFactory factory;
private final OidRegistry oidRegistry;
private final AttributeTypeRegistry attrRegistry;
-
+
private final String M_NAME_OID;
private final String CN_OID;
private final String M_OID_OID;
@@ -120,10 +117,10 @@
private final String M_OC_OID;
private final String M_SUP_OBJECT_CLASS_OID;
private final String M_DEPENDENCIES_OID;
-
+
private final AttributeType disabledAttributeType;
-
-
+
+
/**
* Creates a schema dao object backing information within a schema partition.
*
@@ -138,7 +135,7 @@
this.factory = new SchemaEntityFactory( registries );
this.oidRegistry = registries.getOidRegistry();
this.attrRegistry = registries.getAttributeTypeRegistry();
-
+
this.M_NAME_OID = oidRegistry.getOid( MetaSchemaConstants.M_NAME_AT );
this.CN_OID = oidRegistry.getOid( SchemaConstants.CN_AT );
this.disabledAttributeType = attrRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT );
@@ -158,47 +155,48 @@
}
- public Map<String,Schema> getSchemas() throws NamingException
+ public Map<String, Schema> getSchemas() throws NamingException
{
- Map<String,Schema> schemas = new HashMap<String,Schema>();
+ Map<String, Schema> schemas = new HashMap<String, Schema>();
NamingEnumeration<ServerSearchResult> list = listSchemas();
-
- while( list.hasMore() )
+
+ while ( list.hasMore() )
{
- ServerSearchResult sr = list.next();
+ ServerSearchResult sr = list.next();
Schema schema = factory.getSchema( sr.getServerEntry() );
schemas.put( schema.getSchemaName(), schema );
}
-
+
return schemas;
}
-
+
public Set<String> getSchemaNames() throws NamingException
{
Set<String> schemaNames = new HashSet<String>();
NamingEnumeration<ServerSearchResult> list = listSchemas();
-
- while( list.hasMore() )
+
+ while ( list.hasMore() )
{
- ServerSearchResult sr = list.next();
+ ServerSearchResult sr = list.next();
schemaNames.add( sr.getServerEntry().get( SchemaConstants.CN_AT ).getString() );
}
-
+
return schemaNames;
}
-
+
private NamingEnumeration<ServerSearchResult> listSchemas() throws NamingException
{
LdapDN base = new LdapDN( ServerDNConstants.OU_SCHEMA_DN );
base.normalize( attrRegistry.getNormalizerMapping() );
- ExprNode filter = new EqualityNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ), MetaSchemaConstants.META_SCHEMA_OC );
+ ExprNode filter = new EqualityNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ),
+ new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC ) );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
searchControls.setReturningAttributes( SCHEMA_ATTRIBUTES );
- return partition.search(
- new SearchOperationContext( registries, base, AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+ return partition.search( new SearchOperationContext( registries, base, AliasDerefMode.DEREF_ALWAYS, filter,
+ searchControls ) );
}
@@ -206,25 +204,25 @@
{
LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
dn.normalize( attrRegistry.getNormalizerMapping() );
- return factory.getSchema(
- partition.lookup( new LookupOperationContext( registries, dn ) ) );
+ return factory.getSchema( partition.lookup( new LookupOperationContext( registries, dn ) ) );
}
public boolean hasMatchingRule( String oid ) throws NamingException
{
BranchNode filter = new AndNode();
- filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_MATCHING_RULE_OC ) );
+ filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_MATCHING_RULE_OC ) ) );
if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
{
- filter.addNode( new EqualityNode( M_OID_OID, oid ) );
+ filter.addNode( new EqualityNode( M_OID_OID, new ClientStringValue( oid ) ) );
}
else
{
- filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
+ filter.addNode( new EqualityNode( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
}
-
+
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
@@ -232,13 +230,13 @@
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
- if ( ! ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+
+ if ( !ne.hasMore() )
{
return false;
}
-
+
ne.next();
if ( ne.hasMore() )
{
@@ -255,36 +253,37 @@
}
}
}
-
-
+
+
public boolean hasAttributeType( String oid ) throws NamingException
{
BranchNode filter = new AndNode();
- filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC ) );
+ filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC ) ) );
if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
{
- filter.addNode( new EqualityNode( M_OID_OID, oid ) );
+ filter.addNode( new EqualityNode( M_OID_OID, new ClientStringValue( oid ) ) );
}
else
{
- filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
+ filter.addNode( new EqualityNode( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
}
-
+
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
try
{
- ne = partition.search( new SearchOperationContext(
- registries, partition.getSuffixDn(), AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
- if ( ! ne.hasMore() )
+ ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+
+ if ( !ne.hasMore() )
{
return false;
}
-
+
ne.next();
if ( ne.hasMore() )
{
@@ -301,22 +300,23 @@
}
}
}
-
-
+
+
public boolean hasObjectClass( String oid ) throws NamingException
{
BranchNode filter = new AndNode();
- filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_OBJECT_CLASS_OC ) );
+ filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_OBJECT_CLASS_OC ) ) );
if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
{
- filter.addNode( new EqualityNode( M_OID_OID, oid ) );
+ filter.addNode( new EqualityNode( M_OID_OID, new ClientStringValue( oid ) ) );
}
else
{
- filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
+ filter.addNode( new EqualityNode( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
}
-
+
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
@@ -324,13 +324,13 @@
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
- if ( ! ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+
+ if ( !ne.hasMore() )
{
return false;
}
-
+
ne.next();
if ( ne.hasMore() )
{
@@ -347,22 +347,23 @@
}
}
}
-
-
+
+
public boolean hasSyntax( String oid ) throws NamingException
{
BranchNode filter = new AndNode();
- filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_SYNTAX_OC ) );
+ filter
+ .addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_SYNTAX_OC ) ) );
if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
{
- filter.addNode( new EqualityNode( M_OID_OID, oid ) );
+ filter.addNode( new EqualityNode( M_OID_OID, new ClientStringValue( oid ) ) );
}
else
{
- filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
+ filter.addNode( new EqualityNode( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
}
-
+
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
@@ -370,13 +371,13 @@
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
- if ( ! ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+
+ if ( !ne.hasMore() )
{
return false;
}
-
+
ne.next();
if ( ne.hasMore() )
{
@@ -393,36 +394,37 @@
}
}
}
-
-
+
+
public boolean hasSyntaxChecker( String oid ) throws NamingException
{
BranchNode filter = new AndNode();
- filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_SYNTAX_CHECKER_OC ) );
+ filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_SYNTAX_CHECKER_OC ) ) );
if ( NUMERIC_OID_CHECKER.isValidSyntax( oid ) )
{
- filter.addNode( new EqualityNode( M_OID_OID, oid ) );
+ filter.addNode( new EqualityNode( M_OID_OID, new ClientStringValue( oid ) ) );
}
else
{
- filter.addNode( new EqualityNode( M_NAME_OID, oid.toLowerCase() ) );
+ filter.addNode( new EqualityNode( M_NAME_OID, new ClientStringValue( oid.toLowerCase() ) ) );
}
-
+
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
try
{
- ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(), AliasDerefMode.DEREF_ALWAYS,
- filter, searchControls ) );
-
- if ( ! ne.hasMore() )
+ ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+
+ if ( !ne.hasMore() )
{
return false;
}
-
+
ne.next();
if ( ne.hasMore() )
{
@@ -439,8 +441,8 @@
}
}
}
-
-
+
+
/**
* Given the non-normalized name (alias) or the OID for a schema entity. This
* method finds the schema under which that entity is located.
@@ -462,26 +464,26 @@
{
return null;
}
-
+
Rdn rdn = dn.getRdn( 1 );
- if ( ! rdn.getNormType().equalsIgnoreCase( CN_OID ) )
+ if ( !rdn.getNormType().equalsIgnoreCase( CN_OID ) )
{
- throw new NamingException( "Attribute of second rdn in dn '" + dn.toNormName()
+ throw new NamingException( "Attribute of second rdn in dn '" + dn.toNormName()
+ "' expected to be CN oid of " + CN_OID + " but was " + rdn.getNormType() );
}
-
+
return ( String ) rdn.getValue();
}
-
+
public LdapDN findDn( String entityName ) throws NamingException
{
- ServerSearchResult sr = find( entityName );
+ ServerSearchResult sr = find( entityName );
LdapDN dn = sr.getDn();
dn.normalize( attrRegistry.getNormalizerMapping() );
return dn;
}
-
+
/**
* Given the non-normalized name (alias) or the OID for a schema entity. This
@@ -500,24 +502,24 @@
public ServerSearchResult find( String entityName ) throws NamingException
{
BranchNode filter = new OrNode();
- SimpleNode nameAVA = new EqualityNode( M_NAME_OID, entityName.toLowerCase() );
- SimpleNode oidAVA = new EqualityNode( M_OID_OID, entityName.toLowerCase() );
+ SimpleNode nameAVA = new EqualityNode( M_NAME_OID, new ClientStringValue( entityName.toLowerCase() ) );
+ SimpleNode oidAVA = new EqualityNode( M_OID_OID, new ClientStringValue( entityName.toLowerCase() ) );
filter.addNode( nameAVA );
filter.addNode( oidAVA );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
-
+
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
- if ( ! ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+
+ if ( !ne.hasMore() )
{
return null;
}
-
+
ServerSearchResult sr = ne.next();
if ( ne.hasMore() )
{
@@ -573,43 +575,31 @@
ServerEntry entry = partition.lookup( new LookupOperationContext( registries, dn ) );
EntryAttribute disabledAttr = entry.get( disabledAttributeType );
List<Modification> mods = new ArrayList<Modification>( 3 );
-
+
if ( disabledAttr == null )
{
LOG.warn( "Does not make sense: you're trying to enable {} schema which is already enabled", schemaName );
return;
}
-
+
boolean isDisabled = disabledAttr.contains( "TRUE" );
- if ( ! isDisabled )
+ if ( !isDisabled )
{
LOG.warn( "Does not make sense: you're trying to enable {} schema which is already enabled", schemaName );
return;
}
-
- mods.add(
- new ServerModification(
- DirContext.REMOVE_ATTRIBUTE,
- new DefaultServerAttribute(
- MetaSchemaConstants.M_DISABLED_AT ,
- attrRegistry.lookup(MetaSchemaConstants.M_DISABLED_AT) ) ) );
-
- mods.add(
- new ServerModification(
- DirContext.ADD_ATTRIBUTE,
- new DefaultServerAttribute(
- SchemaConstants.MODIFIERS_NAME_AT,
- attrRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ),
- ServerDNConstants.ADMIN_SYSTEM_DN ) ) );
-
- mods.add(
- new ServerModification(
- DirContext.ADD_ATTRIBUTE,
- new DefaultServerAttribute(
- SchemaConstants.MODIFY_TIMESTAMP_AT,
- attrRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ),
- DateUtils.getGeneralizedTime() ) ) );
-
+
+ mods.add( new ServerModification( DirContext.REMOVE_ATTRIBUTE, new DefaultServerAttribute(
+ MetaSchemaConstants.M_DISABLED_AT, attrRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT ) ) ) );
+
+ mods.add( new ServerModification( DirContext.ADD_ATTRIBUTE, new DefaultServerAttribute(
+ SchemaConstants.MODIFIERS_NAME_AT, attrRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ),
+ ServerDNConstants.ADMIN_SYSTEM_DN ) ) );
+
+ mods.add( new ServerModification( DirContext.ADD_ATTRIBUTE, new DefaultServerAttribute(
+ SchemaConstants.MODIFY_TIMESTAMP_AT, attrRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ), DateUtils
+ .getGeneralizedTime() ) ) );
+
partition.modify( new ModifyOperationContext( registries, dn, mods ) );
}
@@ -624,28 +614,28 @@
*/
public Set<ServerSearchResult> listSyntaxDependents( String numericOid ) throws NamingException
{
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>( );
+ Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
BranchNode filter = new AndNode();
-
+
// subfilter for (| (objectClass=metaMatchingRule) (objectClass=metaAttributeType))
BranchNode or = new OrNode();
- or.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_MATCHING_RULE_OC.toLowerCase() ) );
- or.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) );
-
+ or.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_MATCHING_RULE_OC
+ .toLowerCase() ) ) );
+ or.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) ) );
+
filter.addNode( or );
- filter.addNode( new EqualityNode( M_SYNTAX_OID, numericOid.toLowerCase() ) );
+ filter.addNode( new EqualityNode( M_SYNTAX_OID, new ClientStringValue( numericOid.toLowerCase() ) ) );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
-
+
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while( ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+ while ( ne.hasMore() )
{
set.add( ne.next() );
}
@@ -657,44 +647,45 @@
ne.close();
}
}
-
+
return set;
}
public Set<ServerSearchResult> listMatchingRuleDependents( MatchingRule mr ) throws NamingException
{
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>( );
+ Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
BranchNode filter = new AndNode();
-
+
// ( objectClass = metaAttributeType )
- filter.addNode( new EqualityNode( OBJECTCLASS_OID, MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) );
-
+ filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) ) );
+
BranchNode or = new OrNode();
- or.addNode( new EqualityNode( M_ORDERING_OID, mr.getOid() ) );
- or.addNode( new EqualityNode( M_SUBSTRING_OID, mr.getOid() ) );
- or.addNode( new EqualityNode( M_EQUALITY_OID, mr.getOid() ) );
+ or.addNode( new EqualityNode( M_ORDERING_OID, new ClientStringValue( mr.getOid() ) ) );
+ or.addNode( new EqualityNode( M_SUBSTRING_OID, new ClientStringValue( mr.getOid() ) ) );
+ or.addNode( new EqualityNode( M_EQUALITY_OID, new ClientStringValue( mr.getOid() ) ) );
filter.addNode( or );
if ( mr.getNames() != null || mr.getNames().length > 0 )
{
for ( String name : mr.getNames() )
{
- or.addNode( new EqualityNode( M_ORDERING_OID, name.toLowerCase() ) );
- or.addNode( new EqualityNode( M_SUBSTRING_OID, name.toLowerCase() ) );
- or.addNode( new EqualityNode( M_EQUALITY_OID, name.toLowerCase() ) );
+ or.addNode( new EqualityNode( M_ORDERING_OID, new ClientStringValue( name.toLowerCase() ) ) );
+ or.addNode( new EqualityNode( M_SUBSTRING_OID, new ClientStringValue( name.toLowerCase() ) ) );
+ or.addNode( new EqualityNode( M_EQUALITY_OID, new ClientStringValue( name.toLowerCase() ) ) );
}
}
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
-
+
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while( ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+ while ( ne.hasMore() )
{
set.add( ne.next() );
}
@@ -706,7 +697,7 @@
ne.close();
}
}
-
+
return set;
}
@@ -716,12 +707,12 @@
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
BranchNode filter = new AndNode();
-
+
// (& (m-oid=*) (m-name=*) )
filter.addNode( new PresenceNode( M_OID_OID ) );
filter.addNode( new PresenceNode( M_NAME_OID ) );
return partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
}
@@ -744,34 +735,33 @@
* ( & ( objectClass = metaObjectClass ) ( | ( m-may = $oid ) ( m-must = $oid ) ) )
* )
*/
-
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>( );
+
+ Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
BranchNode filter = new AndNode();
-
+
// ( objectClass = metaAttributeType )
BranchNode or = new OrNode();
- or.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) );
- or.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_OBJECT_CLASS_OC.toLowerCase() ) );
+ or.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC.toLowerCase() ) ) );
+ or.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_OBJECT_CLASS_OC
+ .toLowerCase() ) ) );
filter.addNode( or );
-
or = new OrNode();
- or.addNode( new EqualityNode( M_MAY_OID, at.getOid() ) );
- or.addNode( new EqualityNode( M_MUST_OID, at.getOid() ) );
- or.addNode( new EqualityNode( M_SUP_ATTRIBUTE_TYPE_OID, at.getOid() ) );
+ or.addNode( new EqualityNode( M_MAY_OID, new ClientStringValue( at.getOid() ) ) );
+ or.addNode( new EqualityNode( M_MUST_OID, new ClientStringValue( at.getOid() ) ) );
+ or.addNode( new EqualityNode( M_SUP_ATTRIBUTE_TYPE_OID, new ClientStringValue( at.getOid() ) ) );
filter.addNode( or );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
-
+
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while( ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+ while ( ne.hasMore() )
{
set.add( ne.next() );
}
@@ -783,7 +773,7 @@
ne.close();
}
}
-
+
return set;
}
@@ -802,24 +792,23 @@
*
* ( & ( objectClass = metaSchema ) ( m-dependencies = $schemaName ) )
*/
-
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>( );
+
+ Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
BranchNode filter = new AndNode();
-
- filter.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_SCHEMA_OC.toLowerCase() ) );
- filter.addNode( new EqualityNode( M_DEPENDENCIES_OID,
- schemaName.toLowerCase() ) );
+
+ filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC
+ .toLowerCase() ) ) );
+ filter.addNode( new EqualityNode( M_DEPENDENCIES_OID, new ClientStringValue( schemaName.toLowerCase() ) ) );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
-
+
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while( ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+ while ( ne.hasMore() )
{
set.add( ne.next() );
}
@@ -831,7 +820,7 @@
ne.close();
}
}
-
+
return set;
}
@@ -845,28 +834,27 @@
*/
public Set<ServerSearchResult> listEnabledSchemaDependents( String schemaName ) throws NamingException
{
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>( );
+ Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
BranchNode filter = new AndNode();
-
- filter.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_SCHEMA_OC.toLowerCase() ) );
- filter.addNode( new EqualityNode( M_DEPENDENCIES_OID,
- schemaName.toLowerCase() ) );
-
+
+ filter.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC
+ .toLowerCase() ) ) );
+ filter.addNode( new EqualityNode( M_DEPENDENCIES_OID, new ClientStringValue( schemaName.toLowerCase() ) ) );
+
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
-
+
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
-
- while( ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+
+ while ( ne.hasMore() )
{
- ServerSearchResult sr = ne.next();
- EntryAttribute disabled = sr.getServerEntry().get( disabledAttributeType );
-
+ ServerSearchResult sr = ne.next();
+ EntryAttribute disabled = sr.getServerEntry().get( disabledAttributeType );
+
if ( disabled == null )
{
set.add( sr );
@@ -884,7 +872,7 @@
ne.close();
}
}
-
+
return set;
}
@@ -914,35 +902,34 @@
* ( & ( objectClass = metaDITContentRule ) ( m-aux = $oid ) )
* )
*/
-
- Set<ServerSearchResult> set = new HashSet<ServerSearchResult>( );
+
+ Set<ServerSearchResult> set = new HashSet<ServerSearchResult>();
BranchNode filter = new AndNode();
-
+
BranchNode or = new OrNode();
- or.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_NAME_FORM_OC.toLowerCase() ) );
- or.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_OBJECT_CLASS_OC.toLowerCase() ) );
- or.addNode( new EqualityNode( OBJECTCLASS_OID,
- MetaSchemaConstants.META_DIT_CONTENT_RULE_OC.toLowerCase() ) );
+ or.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_NAME_FORM_OC
+ .toLowerCase() ) ) );
+ or.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue( MetaSchemaConstants.META_OBJECT_CLASS_OC
+ .toLowerCase() ) ) );
+ or.addNode( new EqualityNode( OBJECTCLASS_OID, new ClientStringValue(
+ MetaSchemaConstants.META_DIT_CONTENT_RULE_OC.toLowerCase() ) ) );
filter.addNode( or );
-
or = new OrNode();
- or.addNode( new EqualityNode( M_AUX_OID, oc.getOid() ) );
- or.addNode( new EqualityNode( M_OC_OID, oc.getOid() ) );
- or.addNode( new EqualityNode( M_SUP_OBJECT_CLASS_OID, oc.getOid() ) );
+ or.addNode( new EqualityNode( M_AUX_OID, new ClientStringValue( oc.getOid() ) ) );
+ or.addNode( new EqualityNode( M_OC_OID, new ClientStringValue( oc.getOid() ) ) );
+ or.addNode( new EqualityNode( M_SUP_OBJECT_CLASS_OID, new ClientStringValue( oc.getOid() ) ) );
filter.addNode( or );
SearchControls searchControls = new SearchControls();
searchControls.setSearchScope( SearchControls.SUBTREE_SCOPE );
NamingEnumeration<ServerSearchResult> ne = null;
-
+
try
{
ne = partition.search( new SearchOperationContext( registries, partition.getSuffixDn(),
- AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
- while( ne.hasMore() )
+ AliasDerefMode.DEREF_ALWAYS, filter, searchControls ) );
+ while ( ne.hasMore() )
{
set.add( ne.next() );
}
@@ -954,7 +941,7 @@
ne.close();
}
}
-
+
return set;
}
}
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=652410&r1=652409&r2=652410&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 Apr 30 17:06:41 2008
@@ -148,8 +148,8 @@
PartitionNexusProxy proxy = InvocationStack.getInstance().peek().getProxy();
Schema schema = dao.getSchema( obj.getSchema() );
LdapDN dn = getDn( obj );
- Attributes attrs = factory.getAttributes( obj, schema );
- ServerEntry entry = ServerEntryUtils.toServerEntry( attrs, dn, registries );
+ ServerEntry entry = factory.getAttributes( obj, schema, registries );
+ entry.setDn( dn );
proxy.add( new AddOperationContext( registries, dn, entry, true ), BYPASS );
}
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java Wed Apr 30 17:06:41 2008
@@ -30,6 +30,7 @@
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.jndi.ServerLdapContext;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.filter.AndNode;
import org.apache.directory.shared.ldap.filter.BranchNode;
@@ -74,8 +75,8 @@
byte[] classBytes = null;
BranchNode filter = new AndNode( );
- filter.addNode( new EqualityNode( "fullyQualifiedJavaClassName", name ) );
- filter.addNode( new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.JAVA_CLASS_OC ) );
+ filter.addNode( new EqualityNode( "fullyQualifiedJavaClassName", new ClientStringValue( name ) ) );
+ filter.addNode( new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, new ClientStringValue( ApacheSchemaConstants.JAVA_CLASS_OC ) ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?rev=652410&r1=652409&r2=652410&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java Wed Apr 30 17:06:41 2008
@@ -24,6 +24,8 @@
import org.apache.directory.server.schema.registries.OidRegistry;
import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.entry.client.ClientBinaryValue;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.filter.EqualityNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import org.apache.directory.shared.ldap.util.StringTools;
@@ -95,27 +97,20 @@
}
// check if AVA value exists in attribute
- if ( node.getValue() instanceof String )
- {
- if ( objectClasses.contains( (String)node.getValue() ) )
- {
- return true;
- }
- }
- else if ( objectClasses.contains( (byte[])node.getValue() ) )
+ if ( objectClasses.contains( node.getValue() ) )
{
return true;
}
// If the filter value for the objectClass is an OID we need to resolve a name
String value = null;
- if ( node.getValue() instanceof String )
+ if ( node.getValue() instanceof ClientStringValue )
{
- value = ( String ) node.getValue();
+ value = ( String ) node.getValue().get();
}
- else if ( node.getValue() instanceof byte[] )
+ else if ( node.getValue() instanceof ClientBinaryValue )
{
- value = "#" + StringTools.toHexString( ( byte[] ) node.getValue() );
+ value = "#" + StringTools.toHexString( ( byte[] ) node.getValue().get() );
}
else
{
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=652410&r1=652409&r2=652410&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 Wed Apr 30 17:06:41 2008
@@ -19,8 +19,8 @@
*/
package org.apache.directory.server.core.subtree;
-import org.apache.directory.server.core.interceptor.BaseInterceptor;
+import org.apache.directory.server.core.interceptor.BaseInterceptor;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.DirectoryService;
@@ -53,6 +53,7 @@
import org.apache.directory.shared.ldap.entry.Modification;
import org.apache.directory.shared.ldap.entry.ModificationOperation;
import org.apache.directory.shared.ldap.entry.Value;
+import org.apache.directory.shared.ldap.entry.client.ClientStringValue;
import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
@@ -104,36 +105,32 @@
public static final String COLLECTIVE_AREA = "collectiveAttributeSpecificArea";
public static final String COLLECTIVE_INNERAREA = "collectiveAttributeInnerArea";
-
+
public static final String TRIGGER_AREA = "triggerExecutionSpecificArea";
public static final String TRIGGER_INNERAREA = "triggerExecutionInnerArea";
public static final String[] SUBENTRY_OPATTRS =
- {
- SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
- SchemaConstants.SUBSCHEMA_SUBENTRY_AT,
- SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
- SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT
- };
+ { SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT, SchemaConstants.SUBSCHEMA_SUBENTRY_AT,
+ SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT, SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT };
private static final Logger LOG = LoggerFactory.getLogger( SubentryInterceptor.class );
/** the hash mapping the DN of a subentry to its SubtreeSpecification/types */
private final SubentryCache subentryCache = new SubentryCache();
-
+
private SubtreeSpecificationParser ssParser;
private SubtreeEvaluator evaluator;
private PartitionNexus nexus;
/** The global registries */
private Registries registries;
-
+
/** The AttributeType registry */
private AttributeTypeRegistry atRegistry;
-
+
/** The OID registry */
private OidRegistry oidRegistry;
-
+
private AttributeType objectClassType;
@@ -144,10 +141,10 @@
registries = directoryService.getRegistries();
atRegistry = registries.getAttributeTypeRegistry();
oidRegistry = registries.getOidRegistry();
-
+
// setup various attribute type values
objectClassType = atRegistry.lookup( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
-
+
ssParser = new SubtreeSpecificationParser( new NormalizerMappingResolver()
{
public Map<String, OidNormalizer> getNormalizerMapping() throws NamingException
@@ -159,10 +156,12 @@
// prepare to find all subentries in all namingContexts
Iterator<String> suffixes = this.nexus.listSuffixes( null );
- ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC );
+ ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, new ClientStringValue(
+ SchemaConstants.SUBENTRY_OC ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- controls.setReturningAttributes( new String[] { SchemaConstants.SUBTREE_SPECIFICATION_AT, SchemaConstants.OBJECT_CLASS_AT } );
+ controls.setReturningAttributes( new String[]
+ { SchemaConstants.SUBTREE_SPECIFICATION_AT, SchemaConstants.OBJECT_CLASS_AT } );
// search each namingContext for subentries
while ( suffixes.hasNext() )
@@ -170,15 +169,15 @@
LdapDN suffix = new LdapDN( suffixes.next() );
//suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
suffix.normalize( atRegistry.getNormalizerMapping() );
-
- NamingEnumeration<ServerSearchResult> subentries = nexus.search(
- new SearchOperationContext( registries, suffix, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
-
+
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext( registries,
+ suffix, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dnName = new LdapDN( result.getDn() );
-
+
ServerEntry subentry = result.getServerEntry();
String subtree = subentry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).getString();
SubtreeSpecification ss;
@@ -198,40 +197,40 @@
}
}
}
-
-
+
+
private int getSubentryTypes( ServerEntry subentry ) throws NamingException
{
int types = 0;
-
+
EntryAttribute oc = subentry.get( SchemaConstants.OBJECT_CLASS_AT );
-
+
if ( oc == null )
{
- throw new LdapSchemaViolationException( "A subentry must have an objectClass attribute",
+ throw new LdapSchemaViolationException( "A subentry must have an objectClass attribute",
ResultCodeEnum.OBJECT_CLASS_VIOLATION );
}
-
+
if ( oc.contains( SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) )
{
types |= Subentry.ACCESS_CONTROL_SUBENTRY;
}
-
+
if ( oc.contains( "subschema" ) )
{
types |= Subentry.SCHEMA_SUBENTRY;
}
-
+
if ( oc.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) )
{
types |= Subentry.COLLECTIVE_SUBENTRY;
}
-
+
if ( oc.contains( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) )
{
types |= Subentry.TRIGGER_SUBENTRY;
}
-
+
return types;
}
@@ -240,7 +239,8 @@
// Methods/Code dealing with Subentry Visibility
// -----------------------------------------------------------------------
- public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> list( NextInterceptor nextInterceptor, ListOperationContext opContext )
+ throws NamingException
{
NamingEnumeration<ServerSearchResult> result = nextInterceptor.list( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
@@ -255,7 +255,8 @@
}
- public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor, SearchOperationContext opContext ) throws NamingException
+ public NamingEnumeration<ServerSearchResult> search( NextInterceptor nextInterceptor,
+ SearchOperationContext opContext ) throws NamingException
{
NamingEnumeration<ServerSearchResult> result = nextInterceptor.search( opContext );
Invocation invocation = InvocationStack.getInstance().peek();
@@ -270,11 +271,13 @@
// for subtree and one level scope we filter
if ( !isSubentryVisible( invocation ) )
{
- return new SearchResultFilteringEnumeration( result, searchCtls, invocation, new HideSubentriesFilter(), "Search Subentry filter hide subentries" );
+ return new SearchResultFilteringEnumeration( result, searchCtls, invocation, new HideSubentriesFilter(),
+ "Search Subentry filter hide subentries" );
}
else
{
- return new SearchResultFilteringEnumeration( result, searchCtls, invocation, new HideEntriesFilter(), "Search Subentry filter hide entries");
+ return new SearchResultFilteringEnumeration( result, searchCtls, invocation, new HideEntriesFilter(),
+ "Search Subentry filter hide entries" );
}
}
@@ -329,7 +332,7 @@
{
ServerEntry subentryAttrs = new DefaultServerEntry( registries, dn );
Iterator<String> list = subentryCache.nameIterator();
-
+
while ( list.hasNext() )
{
String subentryDnStr = list.next();
@@ -340,63 +343,59 @@
SubtreeSpecification ss = subentry.getSubtreeSpecification();
if ( evaluator.evaluate( ss, apDn, dn, entryAttrs ) )
- {
+ {
EntryAttribute operational;
-
+
if ( subentry.isAccessControlSubentry() )
{
operational = subentryAttrs.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
+ atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
-
+
operational.add( subentryDn.toString() );
}
if ( subentry.isSchemaSubentry() )
{
operational = subentryAttrs.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.SUBSCHEMA_SUBENTRY_AT,
- atRegistry.lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, atRegistry
+ .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
subentryAttrs.put( operational );
}
-
+
operational.add( subentryDn.toString() );
}
if ( subentry.isCollectiveSubentry() )
{
operational = subentryAttrs.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
+ atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
-
+
operational.add( subentryDn.toString() );
- }
+ }
if ( subentry.isTriggerSubentry() )
{
operational = subentryAttrs.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
+ atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
subentryAttrs.put( operational );
}
-
+
operational.add( subentryDn.toString() );
}
}
@@ -408,9 +407,9 @@
public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
{
- LdapDN name = addContext.getDn();
+ LdapDN name = addContext.getDn();
ServerEntry entry = addContext.getEntry();
-
+
EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
@@ -451,7 +450,7 @@
*/
String subtree = entry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT ).getString();
SubtreeSpecification ss;
-
+
try
{
ss = ssParser.parse( subtree );
@@ -462,9 +461,9 @@
LOG.warn( msg );
throw new LdapInvalidAttributeValueException( msg, ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX );
}
-
+
subentryCache.setSubentry( name.getNormName(), ss, getSubentryTypes( entry ) );
-
+
next.add( addContext );
/* ----------------------------------------------------------------
@@ -484,28 +483,29 @@
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<ServerSearchResult> subentries = nexus.search(
- new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext( registries,
+ baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
ServerEntry candidate = result.getServerEntry();
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational ) ));
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate,
+ operational ) ) );
}
}
- addContext.setEntry( entry );
+ addContext.setEntry( entry );
}
else
{
Iterator<String> list = subentryCache.nameIterator();
-
+
while ( list.hasNext() )
{
String subentryDnStr = list.next();
@@ -518,65 +518,65 @@
if ( evaluator.evaluate( ss, apDn, name, entry ) )
{
EntryAttribute operational;
-
+
if ( subentry.isAccessControlSubentry() )
{
operational = entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( atRegistry
+ .lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
entry.put( operational );
}
-
+
operational.add( subentryDn.toString() );
}
-
+
if ( subentry.isSchemaSubentry() )
{
operational = entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- atRegistry.lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( atRegistry
+ .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
entry.put( operational );
}
-
+
operational.add( subentryDn.toString() );
}
-
+
if ( subentry.isCollectiveSubentry() )
{
operational = entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( atRegistry
+ .lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
entry.put( operational );
}
-
+
operational.add( subentryDn.toString() );
}
-
+
if ( subentry.isTriggerSubentry() )
{
operational = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT );
-
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( atRegistry
+ .lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
entry.put( operational );
}
-
+
operational.add( subentryDn.toString() );
}
}
}
-
+
addContext.setEntry( entry );
next.add( addContext );
@@ -590,9 +590,9 @@
public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
{
- LdapDN name = opContext.getDn();
- ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
- EntryAttribute objectClasses = entry.get( objectClassType );
+ LdapDN name = opContext.getDn();
+ ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
+ EntryAttribute objectClasses = entry.get( objectClassType );
if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
{
@@ -618,19 +618,20 @@
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<ServerSearchResult> subentries = nexus.search(
- new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
-
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext( registries,
+ baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dn = new LdapDN( result.getDn() );
dn.normalize( atRegistry.getNormalizerMapping() );
ServerEntry candidate = result.getServerEntry();
-
+
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name,
+ candidate ) ) );
}
}
}
@@ -659,8 +660,8 @@
ExprNode filter = new PresenceNode( "administrativeRole" );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- NamingEnumeration<ServerSearchResult> aps = nexus.search(
- new SearchOperationContext( registries, name, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+ NamingEnumeration<ServerSearchResult> aps = nexus.search( new SearchOperationContext( registries, name,
+ AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
if ( aps.hasMore() )
{
@@ -691,7 +692,7 @@
* operational attribute values with the dn of this subentry.
*/
Iterator<String> subentries = subentryCache.nameIterator();
-
+
while ( subentries.hasNext() )
{
String subentryDn = subentries.next();
@@ -713,7 +714,7 @@
{
ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
EntryAttribute opAttr = entry.get( aSUBENTRY_OPATTRS );
-
+
if ( opAttr != null )
{
opAttr = ( ServerAttribute ) opAttr.clone();
@@ -734,9 +735,8 @@
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
- ServerAttribute opAttr = new DefaultServerAttribute(
- aSUBENTRY_OPATTRS,
- atRegistry.lookup( aSUBENTRY_OPATTRS ) );
+ ServerAttribute opAttr = new DefaultServerAttribute( aSUBENTRY_OPATTRS, atRegistry
+ .lookup( aSUBENTRY_OPATTRS ) );
opAttr.add( subentryDn );
modList.add( new ServerModification( op, opAttr ) );
}
@@ -752,7 +752,7 @@
LdapDN name = opContext.getDn();
ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
-
+
EntryAttribute objectClasses = entry.get( objectClassType );
if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
@@ -776,13 +776,14 @@
ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<ServerSearchResult> subentries = nexus.search(
- new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
-
+ controls.setReturningAttributes( new String[]
+ { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext( registries,
+ baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
@@ -790,7 +791,8 @@
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( name, newName, subentry, candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( name,
+ newName, subentry, candidate ) ) );
}
}
}
@@ -802,7 +804,7 @@
LOG.warn( msg );
throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
}
-
+
next.rename( opContext );
// calculate the new DN now for use below to modify subentry operational
@@ -821,14 +823,13 @@
}
- public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext )
- throws NamingException
+ public void moveAndRename( NextInterceptor next, MoveAndRenameOperationContext opContext ) throws NamingException
{
LdapDN oriChildName = opContext.getDn();
LdapDN parent = opContext.getParent();
ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) );
-
+
EntryAttribute objectClasses = entry.get( objectClassType );
if ( objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
@@ -853,21 +854,22 @@
ExprNode filter = new PresenceNode( oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT ) );
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
- controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<ServerSearchResult> subentries = nexus.search(
- new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
-
+ controls.setReturningAttributes( new String[]
+ { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext( registries,
+ baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
ServerEntry candidate = result.getServerEntry();
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
- candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace(
+ oriChildName, newName, subentry, candidate ) ) );
}
}
}
@@ -879,7 +881,7 @@
LOG.warn( msg );
throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
}
-
+
next.moveAndRename( opContext );
// calculate the new DN now for use below to modify subentry operational
@@ -901,7 +903,7 @@
{
LdapDN oriChildName = opContext.getDn();
LdapDN newParentName = opContext.getParent();
-
+
ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, oriChildName ) );
EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
@@ -929,20 +931,20 @@
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<ServerSearchResult> subentries = nexus.search(
- new SearchOperationContext( registries, baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
-
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext( registries,
+ baseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
ServerEntry candidate = result.getServerEntry();
if ( evaluator.evaluate( ss, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace( oriChildName, newName, subentry,
- candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForReplace(
+ oriChildName, newName, subentry, candidate ) ) );
}
}
}
@@ -954,7 +956,7 @@
LOG.warn( msg );
throw new LdapSchemaViolationException( msg, ResultCodeEnum.NOT_ALLOWED_ON_RDN );
}
-
+
next.move( opContext );
// calculate the new DN now for use below to modify subentry operational
@@ -975,53 +977,53 @@
// Methods dealing subentry modification
// -----------------------------------------------------------------------
-
private int getSubentryTypes( ServerEntry entry, List<Modification> mods ) throws NamingException
{
ServerAttribute ocFinalState = ( ServerAttribute ) entry.get( SchemaConstants.OBJECT_CLASS_AT ).clone();
-
+
for ( Modification mod : mods )
{
if ( mod.getAttribute().getId().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT ) )
{
switch ( mod.getOperation() )
{
- case ADD_ATTRIBUTE :
- for ( Value<?> value:(ServerAttribute)mod.getAttribute() )
+ case ADD_ATTRIBUTE:
+ for ( Value<?> value : ( ServerAttribute ) mod.getAttribute() )
{
- ocFinalState.add( (String)value.get() );
+ ocFinalState.add( ( String ) value.get() );
}
-
+
break;
-
- case REMOVE_ATTRIBUTE :
- for ( Value<?> value:(ServerAttribute)mod.getAttribute() )
+
+ case REMOVE_ATTRIBUTE:
+ for ( Value<?> value : ( ServerAttribute ) mod.getAttribute() )
{
- ocFinalState.remove( (String)value.get() );
+ ocFinalState.remove( ( String ) value.get() );
}
-
+
break;
-
- case REPLACE_ATTRIBUTE :
- ocFinalState = (ServerAttribute)mod.getAttribute();
+
+ case REPLACE_ATTRIBUTE:
+ ocFinalState = ( ServerAttribute ) mod.getAttribute();
break;
}
}
}
-
+
ServerEntry attrs = new DefaultServerEntry( registries, LdapDN.EMPTY_LDAPDN );
attrs.put( ocFinalState );
return getSubentryTypes( attrs );
}
+
public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
{
LdapDN name = opContext.getDn();
List<Modification> mods = opContext.getModItems();
-
+
ServerEntry entry = nexus.lookup( new LookupOperationContext( registries, name ) );
-
- ServerEntry oldEntry = (ServerEntry) entry.clone();
+
+ ServerEntry oldEntry = ( ServerEntry ) entry.clone();
EntryAttribute objectClasses = entry.get( objectClassType );
boolean isSubtreeSpecificationModification = false;
Modification subtreeMod = null;
@@ -1042,7 +1044,7 @@
try
{
- ssNew = ssParser.parse( ((ServerAttribute)subtreeMod.getAttribute()).getString() );
+ ssNew = ssParser.parse( ( ( ServerAttribute ) subtreeMod.getAttribute() ).getString() );
}
catch ( Exception e )
{
@@ -1064,19 +1066,20 @@
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setReturningAttributes( new String[]
{ SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES } );
- NamingEnumeration<ServerSearchResult> subentries = nexus.search(
- new SearchOperationContext( registries, oldBaseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
-
+ NamingEnumeration<ServerSearchResult> subentries = nexus.search( new SearchOperationContext( registries,
+ oldBaseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
- ServerEntry candidate = result.getServerEntry();
+ ServerEntry candidate = result.getServerEntry();
if ( evaluator.evaluate( ssOld, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name, candidate ) ) );
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForRemove( name,
+ candidate ) ) );
}
}
@@ -1085,35 +1088,36 @@
ServerEntry operational = getSubentryOperatationalAttributes( name, subentry );
LdapDN newBaseDn = ( LdapDN ) apName.clone();
newBaseDn.addAll( ssNew.getBase() );
- subentries = nexus.search(
- new SearchOperationContext( registries, newBaseDn, AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
+ subentries = nexus.search( new SearchOperationContext( registries, newBaseDn,
+ AliasDerefMode.NEVER_DEREF_ALIASES, filter, controls ) );
while ( subentries.hasMore() )
{
- ServerSearchResult result = subentries.next();
+ ServerSearchResult result = subentries.next();
LdapDN dn = result.getDn();
dn.normalize( atRegistry.getNormalizerMapping() );
ServerEntry candidate = result.getServerEntry();
if ( evaluator.evaluate( ssNew, apName, dn, candidate ) )
{
- nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate, operational ) )) ;
+ nexus.modify( new ModifyOperationContext( registries, dn, getOperationalModsForAdd( candidate,
+ operational ) ) );
}
}
}
else
{
next.modify( opContext );
-
+
if ( !objectClasses.contains( SchemaConstants.SUBENTRY_OC ) )
{
ServerEntry newEntry = nexus.lookup( new LookupOperationContext( registries, name ) );
- List<Modification> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
-
- if ( subentriesOpAttrMods.size() > 0)
- {
- nexus.modify( new ModifyOperationContext( registries, name, subentriesOpAttrMods ) );
- }
+ List<Modification> subentriesOpAttrMods = getModsOnEntryModification( name, oldEntry, newEntry );
+
+ if ( subentriesOpAttrMods.size() > 0 )
+ {
+ nexus.modify( new ModifyOperationContext( registries, name, subentriesOpAttrMods ) );
+ }
}
}
}
@@ -1127,18 +1131,17 @@
ServerEntry entry ) throws NamingException
{
List<Modification> modList = new ArrayList<Modification>();
-
+
ServerAttribute operational;
if ( subentry.isAccessControlSubentry() )
{
- operational = (ServerAttribute)entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ).clone();
-
+ operational = ( ServerAttribute ) entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ).clone();
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT, atRegistry
+ .lookup( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1146,19 +1149,18 @@
operational.remove( oldName.toString() );
operational.add( newName.toString() );
}
-
+
modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
}
-
+
if ( subentry.isSchemaSubentry() )
{
- operational = (ServerAttribute)entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).clone();
-
+ operational = ( ServerAttribute ) entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).clone();
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.SUBSCHEMA_SUBENTRY_AT,
- atRegistry.lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.SUBSCHEMA_SUBENTRY_AT, atRegistry
+ .lookup( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ) );
operational.add( newName.toString() );
}
else
@@ -1166,18 +1168,17 @@
operational.remove( oldName.toString() );
operational.add( newName.toString() );
}
-
+
modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
}
-
+
if ( subentry.isCollectiveSubentry() )
{
- operational = (ServerAttribute)entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ).clone();
-
+ operational = ( ServerAttribute ) entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ).clone();
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
+ operational = new DefaultServerAttribute( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT,
atRegistry.lookup( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
@@ -1186,19 +1187,18 @@
operational.remove( oldName.toString() );
operational.add( newName.toString() );
}
-
+
modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
}
-
+
if ( subentry.isTriggerSubentry() )
{
- operational = (ServerAttribute)entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ).clone();
-
+ operational = ( ServerAttribute ) entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ).clone();
+
if ( operational == null )
{
- operational = new DefaultServerAttribute(
- SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT,
- atRegistry.lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
+ operational = new DefaultServerAttribute( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT, atRegistry
+ .lookup( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT ) );
operational.add( newName.toString() );
}
else
@@ -1206,9 +1206,9 @@
operational.remove( oldName.toString() );
operational.add( newName.toString() );
}
-
+
modList.add( new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, operational ) );
- }
+ }
return modList;
}
@@ -1225,7 +1225,7 @@
private ServerEntry getSubentryOperatationalAttributes( LdapDN name, Subentry subentry ) throws NamingException
{
ServerEntry operational = new DefaultServerEntry( registries, name );
-
+
if ( subentry.isAccessControlSubentry() )
{
if ( operational.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT ) == null )
@@ -1288,7 +1288,8 @@
* @return the set of modifications required to remove an entry's reference to
* a subentry
*/
- private List<Modification> getOperationalModsForRemove( LdapDN subentryDn, ServerEntry candidate ) throws NamingException
+ private List<Modification> getOperationalModsForRemove( LdapDN subentryDn, ServerEntry candidate )
+ throws NamingException
{
List<Modification> modList = new ArrayList<Modification>();
String dn = subentryDn.toNormName();
@@ -1329,21 +1330,21 @@
{
List<Modification> modList = new ArrayList<Modification>();
- for ( AttributeType attributeType:operational.getAttributeTypes() )
+ for ( AttributeType attributeType : operational.getAttributeTypes() )
{
ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
EntryAttribute result = new DefaultServerAttribute( attributeType );
EntryAttribute opAttrAdditions = operational.get( attributeType );
EntryAttribute opAttrInEntry = entry.get( attributeType );
- for ( Value<?> value:opAttrAdditions )
+ for ( Value<?> value : opAttrAdditions )
{
result.add( value );
}
if ( opAttrInEntry != null && opAttrInEntry.size() > 0 )
{
- for ( Value<?> value:opAttrInEntry )
+ for ( Value<?> value : opAttrInEntry )
{
result.add( value );
}
@@ -1376,9 +1377,8 @@
}
// see if we can use objectclass if present
- EntryAttribute objectClasses =
- result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT );
-
+ EntryAttribute objectClasses = result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT );
+
if ( objectClasses != null )
{
return !objectClasses.contains( SchemaConstants.SUBENTRY_OC );
@@ -1420,9 +1420,8 @@
}
// see if we can use objectclass if present
- EntryAttribute objectClasses =
- result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT);
-
+ EntryAttribute objectClasses = result.getServerEntry().get( SchemaConstants.OBJECT_CLASS_AT );
+
if ( objectClasses != null )
{
return objectClasses.contains( SchemaConstants.SUBENTRY_OC );
@@ -1444,37 +1443,37 @@
return subentryCache.hasSubentry( name.toNormName() );
}
}
-
-
+
+
private List<Modification> getModsOnEntryModification( LdapDN name, ServerEntry oldEntry, ServerEntry newEntry )
- throws NamingException
- {
- List<Modification> modList = new ArrayList<Modification>();
-
- Iterator<String> subentries = subentryCache.nameIterator();
-
- while ( subentries.hasNext() )
- {
- String subentryDn = subentries.next();
- Name apDn = new LdapDN( subentryDn );
- apDn.remove( apDn.size() - 1 );
- SubtreeSpecification ss = subentryCache.getSubentry( subentryDn ).getSubtreeSpecification();
- boolean isOldEntrySelected = evaluator.evaluate( ss, apDn, name, oldEntry );
- boolean isNewEntrySelected = evaluator.evaluate( ss, apDn, name, newEntry );
-
- if ( isOldEntrySelected == isNewEntrySelected )
- {
- continue;
- }
-
- // need to remove references to the subentry
- if ( isOldEntrySelected && !isNewEntrySelected )
- {
+ throws NamingException
+ {
+ List<Modification> modList = new ArrayList<Modification>();
+
+ Iterator<String> subentries = subentryCache.nameIterator();
+
+ while ( subentries.hasNext() )
+ {
+ String subentryDn = subentries.next();
+ Name apDn = new LdapDN( subentryDn );
+ apDn.remove( apDn.size() - 1 );
+ SubtreeSpecification ss = subentryCache.getSubentry( subentryDn ).getSubtreeSpecification();
+ boolean isOldEntrySelected = evaluator.evaluate( ss, apDn, name, oldEntry );
+ boolean isNewEntrySelected = evaluator.evaluate( ss, apDn, name, newEntry );
+
+ if ( isOldEntrySelected == isNewEntrySelected )
+ {
+ continue;
+ }
+
+ // need to remove references to the subentry
+ if ( isOldEntrySelected && !isNewEntrySelected )
+ {
for ( String aSUBENTRY_OPATTRS : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.REPLACE_ATTRIBUTE;
EntryAttribute opAttr = oldEntry.get( aSUBENTRY_OPATTRS );
-
+
if ( opAttr != null )
{
opAttr = ( ServerAttribute ) opAttr.clone();
@@ -1488,10 +1487,10 @@
modList.add( new ServerModification( op, opAttr ) );
}
}
- }
- // need to add references to the subentry
- else if ( isNewEntrySelected && !isOldEntrySelected )
- {
+ }
+ // need to add references to the subentry
+ else if ( isNewEntrySelected && !isOldEntrySelected )
+ {
for ( String attribute : SUBENTRY_OPATTRS )
{
ModificationOperation op = ModificationOperation.ADD_ATTRIBUTE;
@@ -1500,10 +1499,10 @@
opAttr.add( subentryDn );
modList.add( new ServerModification( op, opAttr ) );
}
- }
- }
-
- return modList;
- }
+ }
+ }
+
+ return modList;
+ }
}