public abstract class AbstractSchemaLoader extends Object implements SchemaLoader
Modifier and Type | Field and Description |
---|---|
protected SchemaLoaderListener |
listener |
protected Map<String,Schema> |
schemaMap
A map of all available schema names to schema objects.
|
Constructor and Description |
---|
AbstractSchemaLoader() |
Modifier and Type | Method and Description |
---|---|
void |
addSchema(Schema schema)
Add a new schema to the schema's list
|
Collection<Schema> |
getAllEnabled() |
Collection<Schema> |
getAllSchemas() |
Object |
getDao()
public List
|
protected Schema |
getSchema(Entry entry) |
Schema |
getSchema(String schemaName)
Gets a schema object based on it's name.
|
List<Entry> |
loadAttributeTypes(String... schemaNames)
Build a list of AttributeTypes read from the underlying storage for
a list of specific schema, using their name
|
List<Entry> |
loadComparators(String... schemaNames)
Build a list of Comparators read from the underlying storage for
a list of specific schema, using their name
|
List<Entry> |
loadDitContentRules(String... schemaNames)
Build a list of DitContentRules read from the underlying storage for
a list of specified schema names
|
List<Entry> |
loadDitStructureRules(String... schemaNames)
Build a list of DitStructureRules read from the underlying storage for
a list of specified schema names
|
List<Entry> |
loadMatchingRules(String... schemaNames)
Build a list of MatchingRules read from the underlying storage for
a list of specific schema, using their name
|
List<Entry> |
loadMatchingRuleUses(String... schemaNames)
Build a list of MatchingRuleUses read from the underlying storage for
a list of specified schema names
|
List<Entry> |
loadNameForms(String... schemaNames)
Build a list of NameForms read from the underlying storage for
a list of specified schema names
|
List<Entry> |
loadNormalizers(String... schemaNames)
Build a list of Normalizers read from the underlying storage for
a list of specified schema names
|
List<Entry> |
loadObjectClasses(String... schemaNames)
Build a list of ObjectClasses read from the underlying storage for
a list of specified schema names
|
List<Entry> |
loadSyntaxCheckers(String... schemaNames)
Build a list of SyntaxCheckers read from the underlying storage for
a list of specified schema names
|
List<Entry> |
loadSyntaxes(String... schemaNames)
Build a list of Syntaxes read from the underlying storage for
a list of specified schema names
|
protected void |
notifyListenerOrRegistries(Schema schema,
Registries registries) |
void |
removeSchema(Schema schema)
Remove a schema from the schema's list
|
void |
setListener(SchemaLoaderListener listener)
Sets listener used to notify of newly loaded schemas.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
loadAttributeTypes, loadComparators, loadDitContentRules, loadDitStructureRules, loadMatchingRules, loadMatchingRuleUses, loadNameForms, loadNormalizers, loadObjectClasses, loadSyntaxCheckers, loadSyntaxes
protected SchemaLoaderListener listener
public void setListener(SchemaLoaderListener listener)
SchemaLoader
setListener
in interface SchemaLoader
listener
- the listener to notify (only one is enough for us)protected final void notifyListenerOrRegistries(Schema schema, Registries registries)
public final Collection<Schema> getAllEnabled() throws Exception
getAllEnabled
in interface SchemaLoader
Exception
- TODOpublic final Collection<Schema> getAllSchemas() throws Exception
getAllSchemas
in interface SchemaLoader
Exception
- TODOpublic Schema getSchema(String schemaName)
getSchema
in interface SchemaLoader
schemaName
- the name of the schema to loadpublic void addSchema(Schema schema)
addSchema
in interface SchemaLoader
public void removeSchema(Schema schema)
removeSchema
in interface SchemaLoader
public Object getDao()
registries
- The Registriesentry
- The LdifEntry containing the comparator descriptionschema
- The associated schemaregistries
- The Registriesentry
- The Entry containing the comparator descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the SyntaxChecker descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the Normalizer descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the MatchingRule descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the Syntax descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the AttributeType descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the MatchingRuleUse descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the NameForm descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the DitContentRule descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the DitStructureRule descriptionschema
- The associated schemaregistries
- The Registriesentry
- The LdifEntry containing the ObjectClass descriptionschema
- The associated schemaregistries
- The Registriesentry
- The Entry containing the ObjectClass descriptionschema
- The associated schemaException
- If the registering failed
protected LdapComparator> registerComparator( Registries registries, LdifEntry entry, Schema schema )
throws Exception
{
return registerComparator( registries, entry.getEntry(), schema );
}
/**
Register the comparator contained in the given Entry into the registries.Exception
- If the registering failed
protected LdapComparator> registerComparator( Registries registries, Entry entry, Schema schema )
throws Exception
{
LdapComparator> comparator =
factory.getLdapComparator( entry, registries, schema.getSchemaName() );
comparator.setOid( entry.get( MetaSchemaConstants.M_OID_AT ).getString() );
if ( registries.isRelaxed() )
{
if ( registries.acceptDisabled() )
{
registries.register( comparator );
}
else if ( schema.isEnabled() && comparator.isEnabled() )
{
registries.register( comparator );
}
}
else
{
if ( schema.isEnabled() && comparator.isEnabled() )
{
registries.register( comparator );
}
}
return comparator;
}
/**
Register the SyntaxChecker contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected SyntaxChecker registerSyntaxChecker( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
SyntaxChecker syntaxChecker =
factory.getSyntaxChecker( entry.getEntry(), registries, schema.getSchemaName() );
syntaxChecker.setOid( entry.get( MetaSchemaConstants.M_OID_AT ).getString() );
if ( registries.isRelaxed() )
{
if ( registries.acceptDisabled() )
{
registries.register( syntaxChecker );
}
else if ( schema.isEnabled() && syntaxChecker.isEnabled() )
{
registries.register( syntaxChecker );
}
}
else
{
if ( schema.isEnabled() && syntaxChecker.isEnabled() )
{
registries.register( syntaxChecker );
}
}
return syntaxChecker;
}
/**
Register the Normalizer contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected Normalizer registerNormalizer( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
Normalizer normalizer =
factory.getNormalizer( entry.getEntry(), registries, schema.getSchemaName() );
if ( registries.isRelaxed() )
{
if ( registries.acceptDisabled() )
{
registries.register( normalizer );
}
else if ( schema.isEnabled() && normalizer.isEnabled() )
{
registries.register( normalizer );
}
}
else
{
if ( schema.isEnabled() && normalizer.isEnabled() )
{
registries.register( normalizer );
}
}
return normalizer;
}
/**
Register the MatchingRule contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected MatchingRule registerMatchingRule( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
MatchingRule matchingRule = factory.getMatchingRule(
entry.getEntry(), registries, schema.getSchemaName() );
if ( registries.isRelaxed() )
{
if ( registries.acceptDisabled() )
{
registries.register( matchingRule );
}
else if ( schema.isEnabled() && matchingRule.isEnabled() )
{
registries.register( matchingRule );
}
}
else
{
if ( schema.isEnabled() && matchingRule.isEnabled() )
{
registries.register( matchingRule );
}
}
return matchingRule;
}
/**
Register the Syntax contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected LdapSyntax registerSyntax( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
LdapSyntax syntax = factory.getSyntax(
entry.getEntry(), registries, schema.getSchemaName() );
if ( registries.isRelaxed() )
{
if ( registries.acceptDisabled() )
{
registries.register( syntax );
}
else if ( schema.isEnabled() && syntax.isEnabled() )
{
registries.register( syntax );
}
}
else
{
if ( schema.isEnabled() && syntax.isEnabled() )
{
registries.register( syntax );
}
}
return syntax;
}
/**
Register the AttributeType contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected AttributeType registerAttributeType( Registries registries, LdifEntry entry, Schema schema )
throws Exception
{
AttributeType attributeType = factory.getAttributeType( entry.getEntry(), registries, schema.getSchemaName() );
if ( registries.isRelaxed() )
{
if ( registries.acceptDisabled() )
{
registries.register( attributeType );
}
else if ( schema.isEnabled() && attributeType.isEnabled() )
{
registries.register( attributeType );
}
}
else
{
if ( schema.isEnabled() && attributeType.isEnabled() )
{
registries.register( attributeType );
}
}
return attributeType;
}
/**
Register the MatchingRuleUse contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected MatchingRuleUse registerMatchingRuleUse( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
throw new NotImplementedException( "Need to implement factory " +
"method for creating a MatchingRuleUse" );
}
/**
Register the NameForm contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected NameForm registerNameForm( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
throw new NotImplementedException( "Need to implement factory " +
"method for creating a NameForm" );
}
/**
Register the DitContentRule contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected DITContentRule registerDitContentRule( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
throw new NotImplementedException( "Need to implement factory " +
"method for creating a DitContentRule" );
}
/**
Register the DitStructureRule contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected DITStructureRule registerDitStructureRule( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
throw new NotImplementedException( "Need to implement factory " +
"method for creating a DitStructureRule" );
}
/**
Register the ObjectClass contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected ObjectClass registerObjectClass( Registries registries, LdifEntry entry, Schema schema)
throws Exception
{
return registerObjectClass( registries, entry.getEntry(), schema );
}
/**
Register the ObjectClass contained in the given LdifEntry into the registries.Exception
- If the registering failed
protected ObjectClass registerObjectClass( Registries registries, Entry entry, Schema schema)
throws Exception
{
ObjectClass objectClass = factory.getObjectClass( entry, registries, schema.getSchemaName() );
if ( registries.isRelaxed() )
{
if ( registries.acceptDisabled() )
{
registries.register( objectClass );
}
else if ( schema.isEnabled() && objectClass.isEnabled() )
{
registries.register( objectClass );
}
}
else
{
if ( schema.isEnabled() && objectClass.isEnabled() )
{
registries.register( objectClass );
}
}
return objectClass;
}
public EntityFactory getFactory()
{
return factory;
}public List<Entry> loadAttributeTypes(String... schemaNames) throws Exception
loadAttributeTypes
in interface SchemaLoader
schemaNames
- the schema names from which AttributeTypes are loadedException
- if there are failures accessing AttributeType informationpublic List<Entry> loadComparators(String... schemaNames) throws Exception
loadComparators
in interface SchemaLoader
schemaNames
- the schema names from which Comparators are loadedException
- if there are failures accessing Comparator informationpublic List<Entry> loadDitContentRules(String... schemaNames) throws Exception
loadDitContentRules
in interface SchemaLoader
Exception
- if there are failures accessing DitContentRule informationpublic List<Entry> loadDitStructureRules(String... schemaNames) throws Exception
loadDitStructureRules
in interface SchemaLoader
Exception
- if there are failures accessing DitStructureRule informationpublic List<Entry> loadMatchingRules(String... schemaNames) throws Exception
loadMatchingRules
in interface SchemaLoader
schemaNames
- the schema names from which MatchingRules are loadedException
- if there are failures accessing MatchingRule informationpublic List<Entry> loadMatchingRuleUses(String... schemaNames) throws Exception
loadMatchingRuleUses
in interface SchemaLoader
Exception
- if there are failures accessing MatchingRuleUses informationpublic List<Entry> loadNameForms(String... schemaNames) throws Exception
loadNameForms
in interface SchemaLoader
Exception
- if there are failures accessing NameForms informationpublic List<Entry> loadNormalizers(String... schemaNames) throws Exception
loadNormalizers
in interface SchemaLoader
schemaNames
- the schema names from which Normalizers are loadedException
- if there are failures accessing Normalizer informationpublic List<Entry> loadObjectClasses(String... schemaNames) throws Exception
loadObjectClasses
in interface SchemaLoader
schemaNames
- the schema names from which ObjectClasses are loadedException
- if there are failures accessing ObjectClasses informationpublic List<Entry> loadSyntaxes(String... schemaNames) throws Exception
loadSyntaxes
in interface SchemaLoader
schemaNames
- the schema names from which Syntaxes are loadedException
- if there are failures accessing Syntax informationpublic List<Entry> loadSyntaxCheckers(String... schemaNames) throws Exception
loadSyntaxCheckers
in interface SchemaLoader
Exception
- if there are failures accessing SyntaxChecker informationCopyright © 2003–2015 The Apache Software Foundation. All rights reserved.