public class SchemaSynchronizer extends java.lang.Object implements RegistrySynchronizer
| Modifier and Type | Field and Description |
|---|---|
private org.apache.directory.api.ldap.model.schema.AttributeType |
cnAT
The CN attributeType
|
private org.apache.directory.api.ldap.model.schema.AttributeType |
dependenciesAT
The m-dependencies AttributeType
|
private org.apache.directory.api.ldap.model.schema.AttributeType |
disabledAT
The m-disable AttributeType
|
private org.apache.directory.api.ldap.schema.loader.SchemaEntityFactory |
factory |
private static org.slf4j.Logger |
LOG
A logger for this class
|
private org.apache.directory.api.ldap.model.name.Dn |
ouSchemaDn
A static Dn referencing ou=schema
|
private org.apache.directory.api.ldap.model.schema.SchemaManager |
schemaManager |
SCHEMA_MODIFIED, SCHEMA_UNCHANGED| Constructor and Description |
|---|
SchemaSynchronizer(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
Creates and initializes a new instance of Schema synchronizer
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(org.apache.directory.api.ldap.model.entry.Entry entry)
Handles the addition of a metaSchema object to the schema partition.
|
private void |
checkForDependencies(boolean isEnabled,
org.apache.directory.api.ldap.model.entry.Entry entry)
Checks to make sure the dependencies either exist for disabled metaSchemas,
or exist and are loaded (enabled) for enabled metaSchemas.
|
void |
delete(org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascade)
Called to react to the deletion of a metaSchema object.
|
private boolean |
disableSchema(java.lang.String schemaName) |
private boolean |
enableSchema(java.lang.String schemaName)
Enabling a schema consist on switching all of its schema element to enable.
|
private java.lang.String |
getSchemaName(org.apache.directory.api.ldap.model.name.Dn schema) |
boolean |
modify(ModifyOperationContext modifyContext,
org.apache.directory.api.ldap.model.entry.Entry targetEntry,
boolean cascade)
The only modification done on a schema element is on the m-disabled
attributeType
Depending in the existence of this attribute in the previous entry, we will
have to update the entry or not.
|
private boolean |
modifyDisable(ModifyOperationContext modifyContext,
org.apache.directory.api.ldap.model.entry.ModificationOperation modOp,
org.apache.directory.api.ldap.model.entry.Attribute disabledInMods,
org.apache.directory.api.ldap.model.entry.Attribute disabledInEntry)
Modify the Disable flag (the flag can be set to true or false).
|
void |
move(org.apache.directory.api.ldap.model.name.Dn oriChildName,
org.apache.directory.api.ldap.model.name.Dn newParentName,
org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascade)
Moves are not allowed for metaSchema objects so this always throws an
UNWILLING_TO_PERFORM LdapException.
|
void |
moveAndRename(org.apache.directory.api.ldap.model.name.Dn oriChildName,
org.apache.directory.api.ldap.model.name.Dn newParentName,
org.apache.directory.api.ldap.model.name.Rdn newRn,
boolean deleteOldRn,
org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascaded) |
void |
moveAndRename(org.apache.directory.api.ldap.model.name.Dn oriChildName,
org.apache.directory.api.ldap.model.name.Dn newParentName,
java.lang.String newRn,
boolean deleteOldRn,
org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascade)
Moves are not allowed for metaSchema objects so this always throws an
UNWILLING_TO_PERFORM LdapException.
|
void |
rename(org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean cascade)
Responds to the rdn (commonName) of the metaSchema object being
changed.
|
private static final org.slf4j.Logger LOG
private final org.apache.directory.api.ldap.schema.loader.SchemaEntityFactory factory
private final org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager
private final org.apache.directory.api.ldap.model.schema.AttributeType disabledAT
private final org.apache.directory.api.ldap.model.schema.AttributeType cnAT
private final org.apache.directory.api.ldap.model.schema.AttributeType dependenciesAT
private final org.apache.directory.api.ldap.model.name.Dn ouSchemaDn
public SchemaSynchronizer(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
throws java.lang.Exception
schemaManager - The server schemaManagerjava.lang.Exception - If something went wrongpublic boolean modify(ModifyOperationContext modifyContext, org.apache.directory.api.ldap.model.entry.Entry targetEntry, boolean cascade) throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface RegistrySynchronizermodifyContext - The OperationContext, which contains the entry and the modifications to applytargetEntry - The modified entrycascade - Unusedorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void moveAndRename(org.apache.directory.api.ldap.model.name.Dn oriChildName,
org.apache.directory.api.ldap.model.name.Dn newParentName,
org.apache.directory.api.ldap.model.name.Rdn newRn,
boolean deleteOldRn,
org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascaded)
throws org.apache.directory.api.ldap.model.exception.LdapException
moveAndRename in interface RegistrySynchronizerorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void add(org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
add in interface RegistrySynchronizername - the dn of the new metaSchema objectentry - the attributes of the new metaSchema objectorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void delete(org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascade)
throws org.apache.directory.api.ldap.model.exception.LdapException
delete in interface RegistrySynchronizername - the dn of the metaSchema object being deletedentry - the attributes of the metaSchema objectorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void rename(org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean cascade)
throws org.apache.directory.api.ldap.model.exception.LdapException
rename in interface RegistrySynchronizername - the dn of the metaSchema object renamedentry - the entry of the metaSchema object before the renamenewRdn - the new commonName of the metaSchema objectorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic void moveAndRename(org.apache.directory.api.ldap.model.name.Dn oriChildName,
org.apache.directory.api.ldap.model.name.Dn newParentName,
java.lang.String newRn,
boolean deleteOldRn,
org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascade)
throws org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException
org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformExceptionpublic void move(org.apache.directory.api.ldap.model.name.Dn oriChildName,
org.apache.directory.api.ldap.model.name.Dn newParentName,
org.apache.directory.api.ldap.model.entry.Entry entry,
boolean cascade)
throws org.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformException
move in interface RegistrySynchronizerorg.apache.directory.api.ldap.model.exception.LdapUnwillingToPerformExceptionprivate boolean modifyDisable(ModifyOperationContext modifyContext, org.apache.directory.api.ldap.model.entry.ModificationOperation modOp, org.apache.directory.api.ldap.model.entry.Attribute disabledInMods, org.apache.directory.api.ldap.model.entry.Attribute disabledInEntry) throws org.apache.directory.api.ldap.model.exception.LdapException
+-------------------+--------------------+--------------------+
op/state | TRUE | FALSE | ABSENT |
+-------+-------+----------------------------------------+--------------------+
| ADD | TRUE | do nothing | do nothing | disable the schema |
| +-------+-------------------+--------------------+--------------------+
| | FALSE | do nothing | do nothing | do nothing |
+-------+-------+-------------------+--------------------+--------------------+
|REMOVE | N/A | enable the schema | do nothing | do nothing |
+-------+-------+-------------------+--------------------+--------------------+
|MODIFY | TRUE | do nothing | disable the schema | disable the schema |
| +-------+-------------------+--------------------+--------------------+
| | FALSE | enable the schema | do nothing | do nothing |
+-------+-------+-------------------+--------------------+--------------------+
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate java.lang.String getSchemaName(org.apache.directory.api.ldap.model.name.Dn schema)
private boolean disableSchema(java.lang.String schemaName)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate boolean enableSchema(java.lang.String schemaName)
throws org.apache.directory.api.ldap.model.exception.LdapException
org.apache.directory.api.ldap.model.exception.LdapExceptionprivate void checkForDependencies(boolean isEnabled,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws org.apache.directory.api.ldap.model.exception.LdapException
isEnabled - whether or not the new metaSchema is enabledentry - the Attributes for the new metaSchema objectNamingException - if the dependencies do not resolve or are not
loaded (enabled)org.apache.directory.api.ldap.model.exception.LdapException