org.objectweb.jorm.metainfo.lib
Class JormManager

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

public class JormManager
extends java.lang.Object
implements Manager, Loggable

Implementation object of the Manager interface. This interface defines methods to create or find objects which construct the meta information from the description files. This object is managed by the parser system.

Author:
X. Spengler
See Also:
Serialized Form

Field Summary
protected  Logger logger
          a simple logger to log
protected  LoggerFactory loggerFactory
          a logger factory to create other loggers if needed
protected  java.util.Map mappingFactories
          this structure defines all the mapping factories declared in the meta information manager.
protected  java.util.Map packages
          this structure defines all declared schema in the current manager.
protected  PTypeSpace ptypeSpace
          TBD
 
Constructor Summary
JormManager()
           
 
Method Summary
 void addMappingFactory(java.lang.String mapperName, MappingFactory factory)
          Adds a mapping factory to the current metainformation manager.
 Class createClass(java.lang.String fqclassName)
           
 CompositeName createCompositeName(java.lang.String fqcompositeNameName)
           
 Package createPackage(java.lang.String schemaName)
          Returns a new schema.
 Class getClass(java.lang.String className)
          searches a class into all the declared schemas and returns it.
 java.util.Collection getClasses()
          build an iterator to iterates all classes of the meta-info
 CompositeName getCompositeName(java.lang.String fqcompositeNameName)
           
 java.util.Collection getCompositeNames()
          build an iterator to iterates all classes of the meta-info
 java.util.Collection getJormObjects()
           
 Logger getLogger()
          Returns a logger to an component that wants to log things.
 LoggerFactory getLoggerFactory()
          Returns a logger factory that allows the creation of new loggers.
 java.util.Collection getMappingFactories()
           
 MappingFactory getMappingFactory(java.lang.String mapperName)
          Returns a mapping factory corresponding to a mapper name.
 Package getPackage(java.lang.String schemaName)
          Returns an existing schema.
 java.util.Collection getPackages()
          Allows to know all the declared schemas into the current metainformation manager.
 MetaObject getParent()
          Allows to know the parent MetaObject of the current MetaObject.
 PTypeSpace getPTypeSpace()
          TBD
 void init()
          Initializes the current Manager.
 void setLogger(Logger logger)
          Defines a logger object.
 void setLoggerFactory(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

packages

protected java.util.Map packages
this structure defines all declared schema in the current manager. key: the name of the schema value: a Package object


mappingFactories

protected java.util.Map mappingFactories
this structure defines all the mapping factories declared in the meta information manager. key: the name of the mapper value: a MappingFactory object


logger

protected transient Logger logger
a simple logger to log


loggerFactory

protected transient LoggerFactory loggerFactory
a logger factory to create other loggers if needed


ptypeSpace

protected PTypeSpace ptypeSpace
TBD

Constructor Detail

JormManager

public JormManager()
Method Detail

init

public void init()
Initializes the current Manager. This method replaces the constructor method.

Specified by:
init in interface Manager

getPackage

public Package getPackage(java.lang.String schemaName)
Returns an existing schema. If no Package corresponds to the given name, null is returned.

Specified by:
getPackage in interface Manager
Parameters:
schemaName - the name of the schema
Returns:
a Package object. If the schema does not exist, null is returned.

createPackage

public Package createPackage(java.lang.String schemaName)
Returns a new schema. This method is the factory method to create schema object. If the schemaName schema already exists, it is returned.

Specified by:
createPackage in interface Manager
Parameters:
schemaName - the name of the schema
Returns:
a new schema object, or the existing one if already defined

getPackages

public java.util.Collection getPackages()
Allows to know all the declared schemas into the current metainformation manager. This iterator contains Package object.

Specified by:
getPackages in interface Manager
Returns:
an iterator on registered Package object. If there is no schema, an empty iterator is returned.

addMappingFactory

public void addMappingFactory(java.lang.String mapperName,
                              MappingFactory factory)
Adds a mapping factory to the current metainformation manager. A mapping factory is a factory to map object (class, field, ...).

Specified by:
addMappingFactory in interface Manager
Parameters:
mapperName - the name of the mapper (i.e: OR for rdb)
factory - the mapping factory to add to the list of existing mapping factories

getMappingFactory

public MappingFactory getMappingFactory(java.lang.String mapperName)
Returns a mapping factory corresponding to a mapper name. If no MappingFactory corresponds to the mapper name, null is returned.

Specified by:
getMappingFactory in interface Manager
Parameters:
mapperName - the name of the mapper to obtain
Returns:
a mapping factory. If the mapping factory does not exist for the mapper, null is returned.

getMappingFactories

public java.util.Collection getMappingFactories()
Specified by:
getMappingFactories in interface Manager

getPTypeSpace

public PTypeSpace getPTypeSpace()
TBD

Specified by:
getPTypeSpace in interface Manager

getClasses

public java.util.Collection getClasses()
build an iterator to iterates all classes of the meta-info

Specified by:
getClasses in interface Manager
Returns:
a new iterator

getCompositeNames

public java.util.Collection getCompositeNames()
build an iterator to iterates all classes of the meta-info

Specified by:
getCompositeNames in interface Manager
Returns:
a new iterator

getJormObjects

public java.util.Collection getJormObjects()
Specified by:
getJormObjects in interface Manager

getClass

public Class getClass(java.lang.String className)
searches a class into all the declared schemas and returns it. If no class corresponds to this name, null is returned.

Specified by:
getClass in interface Manager
Parameters:
className - the name of the class to search
Returns:
the Class object found, null if not found.

createClass

public Class createClass(java.lang.String fqclassName)
Specified by:
createClass in interface Manager

getCompositeName

public CompositeName getCompositeName(java.lang.String fqcompositeNameName)
Specified by:
getCompositeName in interface Manager

createCompositeName

public CompositeName createCompositeName(java.lang.String fqcompositeNameName)
Specified by:
createCompositeName in interface Manager

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(Logger logger)
Defines a logger object.

Specified by:
setLogger in interface Loggable
Parameters:
logger - the logger object

setLoggerFactory

public void setLoggerFactory(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 Logger getLogger()
Description copied from interface: Loggable
Returns a logger to an component that wants to log things.

Specified by:
getLogger in interface Loggable

getLoggerFactory

public LoggerFactory getLoggerFactory()
Description copied from interface: Loggable
Returns a logger factory that allows the creation of new loggers.

Specified by:
getLoggerFactory in interface Loggable