public class SchemaManager extends Object implements DmcNameResolverWithClashSupportIF, DmcNameClashResolverIF, DmcUniqueNameResolverIF
| Constructor and Description |
|---|
SchemaManager()
Creates a new SchemaManager.
|
SchemaManager(SchemaDefinition sd)
A convenience constructor that lets you create the schema manager and manage
a single schema in one easy operation.
|
| Modifier and Type | Method and Description |
|---|---|
ActionDefinition |
actdef(String n)
This function will return the class definition associated with the
given name.
|
void |
addDefinition(DmsDefinition def,
DmcNameClashResolverIF clashResolver)
Attempts to add the specified definition.
|
void |
addDefinitionListener(SchemaDefinitionListenerIF listener) |
void |
addRuleData(RuleData rule)
Attempts to add the specified rule data.
|
AttributeDefinition |
adef(ClassDefinition cd,
String n)
This function will return the attribute definition associated with the given name.
|
AttributeDefinition |
adef(DotName dn) |
AttributeDefinition |
adef(String n)
This function will return the attribute definition associated with the
given name.
|
ClassDefinition |
cdef(String n)
This function will return the class definition associated with the
given name.
|
void |
definitionPreAdd(DmcUncheckedObject def)
Calls the schema extensions with this definition so that they can add
auxiliary information if required.
|
void |
diff(SchemaManager predecessor,
StringBuffer sb)
Performs a diff between this schema and the one passed as argument.
|
TypeDefinition |
findInternalType(DefinitionName name)
Finds the internally generated type definition with the specified name.
|
DmcObject |
findNamedDMO(DmcObjectName name)
Finds a DMO based on its name.
|
DmcNamedObjectIF |
findNamedObject(DmcObjectName name)
Finds a named object based on its name.
|
DmcNamedObjectIF |
findNamedObject(DmcObjectName name,
int attributeID)
Finds a named object based on its name and indicates the attribute via which
the reference is being made.
|
DmcNamedObjectIF |
findNamedObject(String name)
Returns the definition with the specified name if it exists.
|
DmcNamedObjectIF |
findNamedObjectMayClash(DmcObject object,
DmcObjectName name,
DmcNameClashResolverIF resolver,
DmcAttributeInfo ai)
Finds a named object based on its name and indicates the attribute via which
the reference is being made.
|
DmcObject |
findUniqueObject(DmcObjectName name)
Implementing classes should overload this interface to return the
object based on the specified name if they have such an object.
|
DmcAttribute<?> |
getAttributeInstance(Integer id)
Create an instance of the attribute with the specified identifier.
|
ClassDefinition |
getClassByJavaClassName(String cn)
Gets the class definition based on the full java class name.
|
Iterator<ComplexTypeDefinition> |
getComplexTypes() |
Iterator<DSDefinitionModule> |
getDSDefinitionModules() |
int |
getDSDefinitionModulesCount() |
Iterator<ExtendedReferenceTypeDefinition> |
getExtendedReferenceTypes() |
TreeMap<DefinitionName,ClassDefinition> |
getHierarchicObjects() |
DmcAttribute<DmcObjectNameIF> |
getNameAttributeInstance(DmcObjectName oni) |
DmcObjectName |
getNameValueInstance(Integer id) |
Iterator<RuleCategory> |
getRuleCategories() |
Iterator<RuleDefinition> |
getRuleDefinitions() |
Iterator<SchemaDefinition> |
getSchemas()
Returns an iterator over the schemas sorted by their name.
|
Iterator<SliceDefinition> |
getSlices() |
ActionDefinition |
isAction(String name)
This function indicates if the specified string the name of an ActionDefinition.
|
AttributeDefinition |
isAttribute(Integer id)
Returns the attribute definition associated with the specified identifier.
|
AttributeDefinition |
isAttribute(String name)
This function indicates if the specified string the name of an AttributeDefinition.
|
ClassDefinition |
isClass(Integer id)
Returns the class definition associated with the specified identifier.
|
ClassDefinition |
isClass(String name)
This function indicates if the specified string the name of a ClassDefinition.
|
EnumDefinition |
isEnum(String name) |
SchemaDefinition |
isSchema(String name)
This function indicates if the specified string the name of a SchemaDefinition.
|
TypeDefinition |
isType(String name)
This function indicates if the specified string the name of a TypeDefinition.
|
void |
manageSchema(SchemaDefinition sd)
This function integrates a new set of definitions into the schema manager.
|
void |
manageSchemaInternal(SchemaDefinition sd)
This function integrates a new set of definitions into the schema manager.
|
void |
manageSchemaInternal(SchemaDefinition sd,
boolean checkIDs) |
DmcNamedObjectIF |
resolveClash(DmcObject obj,
DmcAttributeInfo ai,
DmcNameClashObjectSet<?> ncos)
We implement this because we need to pass in a clash resolver when we resolve
schema references on auto-generated schemas.
|
void |
resolveNameTypes(Iterator<AttributeDefinition> adl) |
void |
resolveReferences(SchemaDefinition sd,
DmcNameClashResolverIF clashResolver)
This method will ensure that all references in the specified schema can
be resolved.
|
void |
schemaBeingLoaded(SchemaDefinition sd)
This method is called from the DmsSchemaParser to alert us that a new schema
is about to be read.
|
void |
schemaPreAdd(DmcUncheckedObject sd)
This method is called from the DmsSchemaParser to alert us that a new schema
is about to be read.
|
TypeDefinition |
tdef(String n)
This function will return the type definition associated with the
given name.
|
String |
toString()
Dumps the contents of the manager to a string.
|
DmwWrapper |
wrapIt(DmcObject dmo) |
public HashMap<DotName,DmsDefinition> globallyUniqueMAP
public HashMap<DotName,ArrayList<DmsDefinition>> clashMAP
public int longestEnumName
public HashMap<DefinitionName,TypeDefinition> typeDefs
public int longestTypeName
public HashMap<DefinitionName,TypeDefinition> internalTypeDefs
public DmcDefinitionSet<AttributeDefinition> attributeDefinitions
public TreeMap<Integer,ClassDefinition> classesByID
public TreeMap<String,ClassDefinition> classesByJavaClass
public TreeMap<Integer,AttributeDefinition> attrByID
public HashMap<DefinitionName,ActionDefinition> actionDefs
public int longestActionName
public int longestClassName
public HashMap<DefinitionName,ComplexTypeDefinition> complexTypeDefs
public int longestComplexTypeName
public HashMap<DefinitionName,ExtendedReferenceTypeDefinition> extendedReferenceTypeDefs
public int longestExtendedReferenceTypeName
public HashMap<DefinitionName,SliceDefinition> sliceDefs
public int longestSliceName
public HashMap<DefinitionName,RuleCategory> ruleCategoryDefs
public int longestRuleCategoryName
public TreeMap<Integer,RuleCategory> ruleCategoriesByID
public HashMap<DefinitionName,RuleDefinition> ruleDefs
public HashMap<DotName,RuleDefinition> ruleDefsByDot
public int longestRuleName
public HashMap<DefinitionName,ClassDefinition> classAbbrevs
public HashMap<DefinitionName,AttributeDefinition> attrAbbrevs
public int longestSchemaName
public SchemaManager()
throws ResultException,
DmcValueException,
DmcNameClashException
public SchemaManager(SchemaDefinition sd) throws ResultException, DmcValueException, DmcNameClashException
sd - The schema to be managed.ResultExceptionDmcValueExceptionDmcNameClashExceptionpublic void addDefinitionListener(SchemaDefinitionListenerIF listener)
public TreeMap<DefinitionName,ClassDefinition> getHierarchicObjects()
public DmwWrapper wrapIt(DmcObject dmo) throws DmcNameClashException, DmcValueException
dmo - the object to be wrapped.DmcNameClashExceptionDmcValueExceptionpublic DmcObjectName getNameValueInstance(Integer id) throws Exception
Exceptionpublic DmcAttribute<?> getAttributeInstance(Integer id) throws InstantiationException, IllegalAccessException, ClassNotFoundException
id - The dmdID.InstantiationExceptionIllegalAccessExceptionClassNotFoundExceptionpublic TypeDefinition findInternalType(DefinitionName name)
name - the name of the typepublic DmcAttribute<DmcObjectNameIF> getNameAttributeInstance(DmcObjectName oni)
oni - The object name.InstantiationExceptionIllegalAccessExceptionClassNotFoundExceptionpublic void schemaBeingLoaded(SchemaDefinition sd) throws ResultException
sd - The schema about to be loaded.ResultExceptionpublic void definitionPreAdd(DmcUncheckedObject def) throws DmcValueException
def - the definition about to be added.DmcValueExceptionpublic void schemaPreAdd(DmcUncheckedObject sd) throws ResultException, DmcValueException, DmcNameClashException
sd - The schema about to be loaded.ResultExceptionDmcValueExceptionDmcNameClashExceptionpublic void manageSchema(SchemaDefinition sd) throws ResultException, DmcValueException, DmcNameClashException
sd - The schema definition to be managed.DmcValueExceptionDmcNameClashExceptionDmcValueExceptionSetResultExceptionpublic void manageSchemaInternal(SchemaDefinition sd, boolean checkIDs) throws ResultException, DmcValueException, DmcNameClashException
public void manageSchemaInternal(SchemaDefinition sd) throws ResultException, DmcValueException, DmcNameClashException
sd - The schema definition to be managed.DmcValueExceptionDmcNameClashExceptionDmcValueExceptionSetResultExceptionpublic Iterator<SchemaDefinition> getSchemas()
public TypeDefinition isType(String name)
name - the name of a suspected type definition.public AttributeDefinition isAttribute(String name)
name - the name of a suspected attribute definition.public EnumDefinition isEnum(String name)
public AttributeDefinition isAttribute(Integer id)
id - The identifier of the attribute.public ClassDefinition isClass(Integer id)
id - The identifier of the class.public ClassDefinition getClassByJavaClassName(String cn)
cn - the construction class namepublic ActionDefinition isAction(String name)
name - the name of a suspected action definition.public ClassDefinition isClass(String name) throws DmcNameClashException, DmcValueException
name - the name of a suspected class definition.DmcNameClashExceptionDmcValueExceptionpublic SchemaDefinition isSchema(String name)
name - the name of a suspected class definition.public void addDefinition(DmsDefinition def, DmcNameClashResolverIF clashResolver) throws ResultException, DmcValueException, DmcNameClashException
public void addRuleData(RuleData rule) throws ResultException
rule - ResultExceptionpublic String toString()
public DmcNamedObjectIF findNamedObject(DmcObjectName name)
DmcNameResolverIFfindNamedObject in interface DmcNameResolverIFpublic DmcNamedObjectIF findNamedObject(DmcObjectName name, int attributeID)
DmcNameResolverIFfindNamedObject in interface DmcNameResolverIFname - the name of an objectattributeID - the attribute by which it is namedpublic DmcObject findNamedDMO(DmcObjectName name)
DmcNameResolverIFfindNamedDMO in interface DmcNameResolverIFname - the name of the objectpublic DmcNamedObjectIF findNamedObject(String name)
public void diff(SchemaManager predecessor, StringBuffer sb)
public AttributeDefinition adef(String n)
public AttributeDefinition adef(ClassDefinition cd, String n) throws DmcValueException
DmcValueExceptionpublic AttributeDefinition adef(DotName dn)
public ClassDefinition cdef(String n) throws DmcNameClashException, DmcValueException
public TypeDefinition tdef(String n)
public ActionDefinition actdef(String n)
public void resolveReferences(SchemaDefinition sd, DmcNameClashResolverIF clashResolver) throws ResultException, DmcNameClashException, DmcValueException
sd - The schema to be resolved.ResultExceptionDmcNameClashExceptionDmcValueExceptionDmcValueExceptionSetpublic void resolveNameTypes(Iterator<AttributeDefinition> adl) throws ResultException
ResultExceptionpublic Iterator<SliceDefinition> getSlices()
public Iterator<RuleCategory> getRuleCategories()
public Iterator<RuleDefinition> getRuleDefinitions()
public Iterator<ComplexTypeDefinition> getComplexTypes()
public Iterator<DSDefinitionModule> getDSDefinitionModules()
public int getDSDefinitionModulesCount()
public Iterator<ExtendedReferenceTypeDefinition> getExtendedReferenceTypes()
public DmcNamedObjectIF findNamedObjectMayClash(DmcObject object, DmcObjectName name, DmcNameClashResolverIF resolver, DmcAttributeInfo ai) throws DmcValueException
DmcNameResolverWithClashSupportIFfindNamedObjectMayClash in interface DmcNameResolverWithClashSupportIFobject - the object that we're resolvingname - the name of the object being referred toresolver - the entity that may resolve clashes if they occurai - the attribute being resolvedDmcValueException - if values are incorrectpublic DmcNamedObjectIF resolveClash(DmcObject obj, DmcAttributeInfo ai, DmcNameClashObjectSet<?> ncos) throws DmcValueException
resolveClash in interface DmcNameClashResolverIFobj - attr - ex - DmcValueExceptionpublic DmcObject findUniqueObject(DmcObjectName name)
DmcUniqueNameResolverIFfindUniqueObject in interface DmcUniqueNameResolverIFname - the fully qualified nameCopyright © 2023. All rights reserved.