org.objectweb.jorm.metainfo.lib
Class BasicSchema

java.lang.Object
  |
  +--org.objectweb.jorm.metainfo.lib.BasicSchema
All Implemented Interfaces:
Loggable, MetaObject, Schema, java.io.Serializable

public class BasicSchema
extends java.lang.Object
implements Schema, Loggable

BasicSchema is an implementation of the Schema interface. This object defines a set of classes and generic classes declared in a Schema tag. Its parent is the Manager.

Author:
X. Spengler
See Also:
Serialized Form

Field Summary
protected  java.util.Map classes
          This structure contains all declared classes for the current schema object.
protected  java.util.Map compositeNames
          This structure contains all declared compositename for the current schema object.
protected  java.util.Map genClasses
          This structure contains all declared generic classes for the current schema object.
protected  java.util.Map hiddenClasses
          This structure contains all undeclared classes for the current schema object.
protected  java.util.Map hiddenCompositeNames
          This structure contains all undeclared compositename for the current schema object.
 org.objectweb.util.monolog.api.Logger logger
          a simple logger to log
protected  java.lang.String name
          The name of the schema, this name could be null if the name is not defined by the user.
protected  MetaObject parent
          the parent object for the schema (Manager) which is a MetaObject.
 
Constructor Summary
BasicSchema(java.lang.String name, Manager parent)
          Builds a new Schema object.
 
Method Summary
 void addClass(Class aClass)
          Adds an existing Class to the current Schema
 void addCompositeName(CompositeName composite)
          Adds an existing CompositeName to the current Schema
 Class createClass(java.lang.String className, boolean isAbstract)
          Returns a new Class created with a class name.
 CompositeName createCompositeName(java.lang.String CN_Name)
          Returns a new compositename identified by its name.
 GenClass createGenClass(java.lang.String genClassName, boolean isAbstract)
          Returns a new GenClass created with a generic class name.
 Class createHiddenClass(java.lang.String className, boolean isAbstract)
          Returns a new Class created with a class name.
 CompositeName createHiddenCompositeName(java.lang.String cn_Name)
          Returns a new compositename created with its name.
 Class getClass(java.lang.String className)
          Returns a Class created with a class name.
 CompositeName getCompositeName(java.lang.String cn_Name)
          Returns a compositename identified with its name.
 GenClass getGenClass(java.lang.String genClassName)
          Returns a GenClass created with a generic class name.
 Class getHiddenClass(java.lang.String className)
          Returns an hidden class.
 CompositeName getHiddenCompositeName(java.lang.String cn_Name)
          Returns an hidden compositename.
 org.objectweb.util.monolog.api.Logger getLogger()
          Returns a logger to an component that wants to log things.
 org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 java.lang.String getName()
          Returns the name of the schema.
 MetaObject getParent()
          Allows to know the parent MetaObject of the current MetaObject.
 java.util.Iterator iterateClass()
          Allows to know all the registered classes into the current schema.
 java.util.Iterator iterateCompositeName()
          Allows to know all the registered compositename into the current schema.
 java.util.Iterator iterateGenClass()
          Allows to know all the registered generic classes into the current schema.
 java.util.Iterator iterateHiddenClass()
          Allows to know all the not yet completly registered classes into the current schema.
 java.util.Iterator iterateHiddenCompositeName()
          Allows to know all the not yet completly registered compositename into the current schema.
 void moveHiddenToClass(java.lang.String className)
          Moves an hidden class to a known class.
 void moveHiddenToCompositeName(java.lang.String cn_Name)
          Moves an hidden compositename to a known compositename.
 void setLogger(org.objectweb.util.monolog.api.Logger logger)
          Defines a logger object.
 void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
          Defines the logger factory to obtain new logger.
 void setParent(MetaObject itsParent)
          Set the parent of the current meta object if it is not yet done by the constructor of the meta object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classes

protected java.util.Map classes
This structure contains all declared classes for the current schema object. key: the name of the class value: the Class MetaObject object

hiddenClasses

protected java.util.Map hiddenClasses
This structure contains all undeclared classes for the current schema object. An Hidden class is not generated, and must be defined in a separated XML description file. key: the name of the class value: the Class MetaObject object

compositeNames

protected java.util.Map compositeNames
This structure contains all declared compositename for the current schema object. key: the name of the class value: the Class MetaObject object

hiddenCompositeNames

protected java.util.Map hiddenCompositeNames
This structure contains all undeclared compositename for the current schema object. An Hidden compositename is not generated, and must be defined in a separated XML description file. key: the name of the compositename value: the compositename MetaObject object

genClasses

protected java.util.Map genClasses
This structure contains all declared generic classes for the current schema object. key: the name of the generic class value: a GenClass object

name

protected java.lang.String name
The name of the schema, this name could be null if the name is not defined by the user.

parent

protected MetaObject parent
the parent object for the schema (Manager) which is a MetaObject.

logger

public transient org.objectweb.util.monolog.api.Logger logger
a simple logger to log
Constructor Detail

BasicSchema

public BasicSchema(java.lang.String name,
                   Manager parent)
Builds a new Schema object. This object is defined by its name and its parent.
Parameters:
name - the name of the schema to create
parent - the parent meta-object
Method Detail

getName

public java.lang.String getName()
Returns the name of the schema.
Specified by:
getName in interface Schema
Returns:
the string representation of the name of the schema. Null is returned if there is no schema name else a not empty dotted string.

getClass

public Class getClass(java.lang.String className)
Returns a Class created with a class name.
Specified by:
getClass in interface Schema
Parameters:
className - the string representation of the class name
Returns:
a Class corresponding to its name. If the Class does not exist, null is returned.

getHiddenClass

public Class getHiddenClass(java.lang.String className)
Returns an hidden class. An Hidden class is a class which is not yet totally defined. If the class is not found into the current schema, null is returned.
Specified by:
getHiddenClass in interface Schema
Parameters:
className - the name of the class to search
Returns:
the Class object corresponding to its name or null if not present in the current structure

moveHiddenToClass

public void moveHiddenToClass(java.lang.String className)
Moves an hidden class to a known class. A known class is known when it is defined in an XML description file.
Specified by:
moveHiddenToClass in interface Schema
Parameters:
className - the name of the class to move

moveHiddenToCompositeName

public void moveHiddenToCompositeName(java.lang.String cn_Name)
Moves an hidden compositename to a known compositename. A known compositename is known when it is defined in an XML description file.
Specified by:
moveHiddenToCompositeName in interface Schema
Parameters:
cn_Name - the name of the compositename to move

getCompositeName

public CompositeName getCompositeName(java.lang.String cn_Name)
Returns a compositename identified with its name.
Specified by:
getCompositeName in interface Schema
Parameters:
cn_Name - the string representation of the name of the composite name.
Returns:
a compositename corresponding to its name. If the compositename does not exist, null is returned.

getHiddenCompositeName

public CompositeName getHiddenCompositeName(java.lang.String cn_Name)
Returns an hidden compositename. An Hidden compositename is a compositename which is not yet totally defined. If the compositename is not found into the current schema, null is returned.
Specified by:
getHiddenCompositeName in interface Schema
Parameters:
cn_Name - the name of the compositename to search
Returns:
the compositename object corresponding to its name or null if not present in the current structure

createCompositeName

public CompositeName createCompositeName(java.lang.String CN_Name)
Returns a new compositename identified by its name. The MetaObject is added to the list of compositename classes managed by the current schema. If the compositename already exists, it is returned.
Specified by:
createCompositeName in interface Schema
Parameters:
cn_Name - the string representation of the name of the compositename
Returns:
a compositename corresponding to the created compositename and registered, or an existing one if already defined

createHiddenCompositeName

public CompositeName createHiddenCompositeName(java.lang.String cn_Name)
Returns a new compositename created with its name. The MetaObject is added to the list of unknown compositename managed by the current schema.
Specified by:
createHiddenCompositeName in interface Schema
Parameters:
cn_Name - the string representation of the name of the compositename
Returns:
a Class corresponding to the created class and registered, or an existing one if already defined

iterateCompositeName

public java.util.Iterator iterateCompositeName()
Allows to know all the registered compositename into the current schema. This method returns an iterator on compositename object.
Specified by:
iterateCompositeName in interface Schema
Returns:
an iterator for compositename object. If there is no class, an empty iterator is returned.

iterateHiddenCompositeName

public java.util.Iterator iterateHiddenCompositeName()
Allows to know all the not yet completly registered compositename into the current schema. This method returns an iterator on compositename object.
Specified by:
iterateHiddenCompositeName in interface Schema
Returns:
an iterator for compositename object. If there is no compositename, an empty iterator is returned.

createClass

public Class createClass(java.lang.String className,
                         boolean isAbstract)
Returns a new Class created with a class name. The MetaObject is added to the list of classes managed by the current schema. An isAbstract boolean is defined to know if the current class is an abstract class or not.
Specified by:
createClass in interface Schema
Parameters:
className - the string representation of the class name
isAbstract - true, if the current class is an abstract class, else false, if the current class is not an abstract class
Returns:
a Class corresponding to the created class and registered, or an existing one if already defined

addClass

public void addClass(Class aClass)
Adds an existing Class to the current Schema
Specified by:
addClass in interface Schema
Parameters:
aClass - the Class object to add

addCompositeName

public void addCompositeName(CompositeName composite)
Adds an existing CompositeName to the current Schema
Specified by:
addCompositeName in interface Schema
Parameters:
composite - the CompositeName object to add

createHiddenClass

public Class createHiddenClass(java.lang.String className,
                               boolean isAbstract)
Returns a new Class created with a class name. The MetaObject is added to the list of unknown classes managed by the current schema. An isAbstract boolean is defined to know if the current class is an abstract class or not.
Specified by:
createHiddenClass in interface Schema
Parameters:
className - the string representation of the class name
isAbstract - true, if the current class is an abstract class, else false, if the current class is not an abstract class
Returns:
a Class corresponding to the created class and registered, or an existing one if already defined

getGenClass

public GenClass getGenClass(java.lang.String genClassName)
Returns a GenClass created with a generic class name.
Specified by:
getGenClass in interface Schema
Parameters:
genClassName - the string representation of the generic class name
Returns:
a GenClass corresponding to its name. If the GenClass does not exist, null is returned.

createGenClass

public GenClass createGenClass(java.lang.String genClassName,
                               boolean isAbstract)
Returns a new GenClass created with a generic class name. The MetaObject is added to the list of generic classes managed by the current schema. If the generic class already exists, it is returned.
Specified by:
createGenClass in interface Schema
Parameters:
genClassName - the string representation of the generic class name
isAbstract - true, if the generic class is abstract, else false, if the generic class is not abstract
Returns:
a GenClass corresponding to the created generic class and registered, or an existing one if already defined

iterateClass

public java.util.Iterator iterateClass()
Allows to know all the registered classes into the current schema. This method returns an iterator on Class object.
Specified by:
iterateClass in interface Schema
Returns:
an iterator for Class object. If there is no class, an empty iterator is returned.

iterateGenClass

public java.util.Iterator iterateGenClass()
Allows to know all the registered generic classes into the current schema. This method returns an iterator on GenClass object.
Specified by:
iterateGenClass in interface Schema
Returns:
an iterator for GenClass object. If there is no generic class, an empty iterator is returned.

iterateHiddenClass

public java.util.Iterator iterateHiddenClass()
Allows to know all the not yet completly registered classes into the current schema. This method returns an iterator on Class object.
Specified by:
iterateHiddenClass in interface Schema
Returns:
an iterator for Class object. If there is no class, an empty iterator is returned.

getParent

public MetaObject getParent()
Allows to know the parent MetaObject of the current MetaObject.
Specified by:
getParent in interface MetaObject
Returns:
the MetaObject corresponding to the parent of the current object. If there is no parent, null is returned.

setParent

public void setParent(MetaObject itsParent)
Set the parent of the current meta object if it is not yet done by the constructor of the meta object
Specified by:
setParent in interface MetaObject
Parameters:
itsParent - the parent MetaObject of the current object

setLogger

public void setLogger(org.objectweb.util.monolog.api.Logger logger)
Defines a logger object.
Specified by:
setLogger in interface Loggable
Parameters:
logger - the logger object

setLoggerFactory

public void setLoggerFactory(org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
Defines the logger factory to obtain new logger.
Specified by:
setLoggerFactory in interface Loggable
Parameters:
loggerFactory - the LoggerFactory object to obtain a logger object

getLogger

public org.objectweb.util.monolog.api.Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.
Specified by:
getLogger in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
logger - the logger object

getLoggerFactory

public org.objectweb.util.monolog.api.LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.
Specified by:
getLoggerFactory in interface Loggable
Following copied from interface: org.objectweb.jorm.util.api.Loggable
Parameters:
loggerfactory - the LoggerFactory object to obtain new loggers