org.apache.directory.server.core.schema.registries.synchronizers
Class AbstractRegistrySynchronizer

java.lang.Object
  extended by org.apache.directory.server.core.schema.registries.synchronizers.AbstractRegistrySynchronizer
All Implemented Interfaces:
RegistrySynchronizer
Direct Known Subclasses:
AttributeTypeSynchronizer, ComparatorSynchronizer, DitContentRuleSynchronizer, DitStructureRuleSynchronizer, MatchingRuleSynchronizer, MatchingRuleUseSynchronizer, NameFormSynchronizer, NormalizerSynchronizer, ObjectClassSynchronizer, SyntaxCheckerSynchronizer, SyntaxSynchronizer

public abstract class AbstractRegistrySynchronizer
extends java.lang.Object
implements RegistrySynchronizer

An abstract registry synchronizer with some reused functionality.

Version:
$Rev$
Author:
Apache Directory Project

Field Summary
protected  org.apache.directory.shared.ldap.schema.loader.ldif.SchemaEntityFactory factory
          The Schema objetc factory
protected  org.apache.directory.shared.ldap.schema.AttributeType m_oidAT
          The m-oid AttributeType
protected  org.apache.directory.shared.ldap.schema.SchemaManager schemaManager
          The global SchemaManager
 
Fields inherited from interface org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizer
SCHEMA_MODIFIED, SCHEMA_UNCHANGED
 
Constructor Summary
protected AbstractRegistrySynchronizer(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
           
 
Method Summary
protected  void addToSchema(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject, java.lang.String schemaName)
          Add a new SchemaObject to the schema content, assuming that it has an associated schema and that this schema is loaded
protected  org.apache.directory.shared.ldap.schema.SchemaObject checkOidExists(org.apache.directory.shared.ldap.entry.ServerEntry entry)
          Check that a SchemaObject exists in the global OidRegsitry, and if so, return it.
protected  void checkOidIsUnique(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject)
           
protected  void checkOidIsUnique(org.apache.directory.shared.ldap.entry.ServerEntry entry)
           
protected  void checkOidIsUnique(java.lang.String oid)
           
protected  void checkParent(org.apache.directory.shared.ldap.name.DN newParent, org.apache.directory.shared.ldap.schema.SchemaManager schemaManager, java.lang.String objectType)
          Checks that the parent DN is a valid DN
protected  void deleteFromSchema(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject, java.lang.String schemaName)
          Delete a SchemaObject from the schema registry, assuming that it has an associated schema and that this schema is loaded
protected  java.lang.String getOid(org.apache.directory.shared.ldap.entry.ServerEntry entry)
           
protected  java.util.Set<java.lang.String> getOids(java.util.Set<org.apache.directory.shared.ldap.entry.ServerEntry> results)
           
protected  java.lang.String getReferenced(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject)
          Get a String containing the SchemaObjects referencing the given ShcemaObject
protected  java.lang.String getSchemaName(org.apache.directory.shared.ldap.name.DN dn)
          Exctract the schema name from the DN.
protected  boolean isSchemaEnabled(java.lang.String schemaName)
          Tells if a schema is loaded and enabled
protected  boolean isSchemaLoaded(org.apache.directory.shared.ldap.name.DN dn)
          Tells if the schema the DN references is loaded or not
protected  boolean isSchemaLoaded(java.lang.String schemaName)
          Tells if the schemaName is loaded or not
abstract  boolean modify(ModifyOperationContext opContext, org.apache.directory.shared.ldap.entry.ServerEntry targetEntry, boolean cascade)
          Applies a set of modification to an entry
protected  void registerOids(org.apache.directory.shared.ldap.schema.SchemaObject obj)
          Register a SchemaObject's OID in the associated oidRegistry
protected  void unregisterOids(org.apache.directory.shared.ldap.schema.SchemaObject obj)
          Unregister a SchemaObject's OID from the associated oidRegistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.directory.server.core.schema.registries.synchronizers.RegistrySynchronizer
add, delete, move, moveAndRename, rename
 

Field Detail

schemaManager

protected final org.apache.directory.shared.ldap.schema.SchemaManager schemaManager
The global SchemaManager


m_oidAT

protected final org.apache.directory.shared.ldap.schema.AttributeType m_oidAT
The m-oid AttributeType


factory

protected final org.apache.directory.shared.ldap.schema.loader.ldif.SchemaEntityFactory factory
The Schema objetc factory

Constructor Detail

AbstractRegistrySynchronizer

protected AbstractRegistrySynchronizer(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
                                throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

isSchemaLoaded

protected boolean isSchemaLoaded(org.apache.directory.shared.ldap.name.DN dn)
                          throws java.lang.Exception
Tells if the schema the DN references is loaded or not

Parameters:
dn - The SchemaObject's DN
Returns:
true if the schema is loaded
Throws:
java.lang.Exception - If The DN is not a SchemaObject DN

isSchemaLoaded

protected boolean isSchemaLoaded(java.lang.String schemaName)
Tells if the schemaName is loaded or not

Parameters:
schemaName - The schema we want to check
Returns:
true if the schema is loaded

isSchemaEnabled

protected boolean isSchemaEnabled(java.lang.String schemaName)
Tells if a schema is loaded and enabled

Parameters:
schemaName - The schema we want to check
Returns:
true if the schema is loaded and enabled, false otherwise

getSchemaName

protected java.lang.String getSchemaName(org.apache.directory.shared.ldap.name.DN dn)
                                  throws javax.naming.NamingException
Exctract the schema name from the DN. It is supposed to be the second RDN in the dn :
 ou=schema, cn=MySchema, ...
 
Here, the schemaName is MySchema

Parameters:
dn - The DN we want to get the schema name from
Returns:
The schema name
Throws:
javax.naming.NamingException - If we got an error

checkOidIsUnique

protected void checkOidIsUnique(org.apache.directory.shared.ldap.entry.ServerEntry entry)
                         throws java.lang.Exception
Throws:
java.lang.Exception

checkOidExists

protected org.apache.directory.shared.ldap.schema.SchemaObject checkOidExists(org.apache.directory.shared.ldap.entry.ServerEntry entry)
                                                                       throws java.lang.Exception
Check that a SchemaObject exists in the global OidRegsitry, and if so, return it.

Throws:
java.lang.Exception

checkParent

protected void checkParent(org.apache.directory.shared.ldap.name.DN newParent,
                           org.apache.directory.shared.ldap.schema.SchemaManager schemaManager,
                           java.lang.String objectType)
                    throws org.apache.directory.shared.ldap.exception.LdapException
Checks that the parent DN is a valid DN

Throws:
org.apache.directory.shared.ldap.exception.LdapException

checkOidIsUnique

protected void checkOidIsUnique(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject)
                         throws java.lang.Exception
Throws:
java.lang.Exception

checkOidIsUnique

protected void checkOidIsUnique(java.lang.String oid)
                         throws java.lang.Exception
Throws:
java.lang.Exception

addToSchema

protected void addToSchema(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject,
                           java.lang.String schemaName)
                    throws java.lang.Exception
Add a new SchemaObject to the schema content, assuming that it has an associated schema and that this schema is loaded

Throws:
java.lang.Exception

deleteFromSchema

protected void deleteFromSchema(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject,
                                java.lang.String schemaName)
                         throws java.lang.Exception
Delete a SchemaObject from the schema registry, assuming that it has an associated schema and that this schema is loaded

Throws:
java.lang.Exception

modify

public abstract boolean modify(ModifyOperationContext opContext,
                               org.apache.directory.shared.ldap.entry.ServerEntry targetEntry,
                               boolean cascade)
                        throws java.lang.Exception
Applies a set of modification to an entry

Specified by:
modify in interface RegistrySynchronizer
Parameters:
opContext - The OperationContext, which contains the entry and the modifications to apply
targetEntry - The modified entry
cascade - Unused
Returns:
True if the modification has been done
Throws:
java.lang.Exception - If the modification failed

getOids

protected java.util.Set<java.lang.String> getOids(java.util.Set<org.apache.directory.shared.ldap.entry.ServerEntry> results)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

getOid

protected java.lang.String getOid(org.apache.directory.shared.ldap.entry.ServerEntry entry)
                           throws java.lang.Exception
Throws:
java.lang.Exception

unregisterOids

protected void unregisterOids(org.apache.directory.shared.ldap.schema.SchemaObject obj)
                       throws java.lang.Exception
Unregister a SchemaObject's OID from the associated oidRegistry

Parameters:
obj - The SchemaObject to unregister
Throws:
java.lang.Exception - If the unregistering failed

registerOids

protected void registerOids(org.apache.directory.shared.ldap.schema.SchemaObject obj)
                     throws java.lang.Exception
Register a SchemaObject's OID in the associated oidRegistry

Parameters:
obj - The SchemaObject to register
Throws:
java.lang.Exception - If the registering failed

getReferenced

protected java.lang.String getReferenced(org.apache.directory.shared.ldap.schema.SchemaObject schemaObject)
Get a String containing the SchemaObjects referencing the given ShcemaObject

Parameters:
schemaObject - The SchemaObject we want the referencing SchemaObjects for
Returns:
A String containing all the SchemaObjects referencing the give SchemaObject


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.