org.objectweb.jorm.metainfo.lib
Class BasicManager

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

public class BasicManager
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  BasicClassLoader classLoader
          the unique classloader in jorm compilation part to dynamicaly load classes (for mapping factories).
protected  org.objectweb.util.monolog.api.Logger logger
          a simple logger to log
protected  org.objectweb.util.monolog.api.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  PTypeSpace ptypeSpace
          TBD
protected  java.util.Map schemas
          this structure defines all declared schema in the current manager.
 
Constructor Summary
BasicManager()
           
 
Method Summary
 void addMappingFactory(java.lang.String mapperName, java.lang.String mappingFactory)
          Adds a mapping factory to the current metainformation manager.
 Schema createSchema(java.lang.String schemaName)
          Returns a new schema.
 java.util.Iterator getAllClassIterator()
          build an iterator to iterates all classes of the meta-info
 Class getClass(java.lang.String className)
          searches a class into all the declared schemas and returns it.
 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.
 MappingFactory getMappingFactory(java.lang.String mapperName)
          Returns a mapping factory corresponding to a mapper name.
 MetaObject getParent()
          Allows to know the parent MetaObject of the current MetaObject.
 PTypeSpace getPTypeSpace()
          TBD
 Schema getSchema(java.lang.String schemaName)
          Returns an existing schema.
 void init()
          Initializes the current Manager with no specific classloader
 void init(BasicClassLoader classloader)
          Deprecated. Basic ClassLoader is not a classloader. Need refactoring (Christophe Ney)
 java.util.Iterator iterateSchema()
          Allows to know all the declared schemas into the current metainformation manager.
 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

schemas

protected java.util.Map schemas
this structure defines all declared schema in the current manager. key: the name of the schema value: a Schema 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

classLoader

protected transient BasicClassLoader classLoader
the unique classloader in jorm compilation part to dynamicaly load classes (for mapping factories).

logger

protected transient org.objectweb.util.monolog.api.Logger logger
a simple logger to log

loggerFactory

protected transient org.objectweb.util.monolog.api.LoggerFactory loggerFactory
a logger factory to create other loggers if needed

ptypeSpace

protected PTypeSpace ptypeSpace
TBD
Constructor Detail

BasicManager

public BasicManager()
Method Detail

init

public void init(BasicClassLoader classloader)
Deprecated. Basic ClassLoader is not a classloader. Need refactoring (Christophe Ney)

Initializes the current Manager. This method replaces the constructor method, with a single parameter, which is a class loader.
Specified by:
init in interface Manager
Parameters:
classloader - a single class loader to load class into the meta information

init

public void init()
Initializes the current Manager with no specific classloader
Specified by:
init in interface Manager

getSchema

public Schema getSchema(java.lang.String schemaName)
Returns an existing schema. If no Schema corresponds to the given name, null is returned.
Specified by:
getSchema in interface Manager
Parameters:
schemaName - the name of the schema
Returns:
a Schema object. If the schema does not exist, null is returned.

createSchema

public Schema createSchema(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:
createSchema in interface Manager
Parameters:
schemaName - the name of the schema
Returns:
a new schema object, or the existing one if already defined

iterateSchema

public java.util.Iterator iterateSchema()
Allows to know all the declared schemas into the current metainformation manager. This iterator contains Schema object.
Specified by:
iterateSchema in interface Manager
Returns:
an iterator on registered Schema object. If there is no schema, an empty iterator is returned.

addMappingFactory

public void addMappingFactory(java.lang.String mapperName,
                              java.lang.String mappingFactory)
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)
mappingFactory - 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.

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.

getPTypeSpace

public PTypeSpace getPTypeSpace()
TBD
Specified by:
getPTypeSpace 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(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

getAllClassIterator

public java.util.Iterator getAllClassIterator()
build an iterator to iterates all classes of the meta-info
Specified by:
getAllClassIterator in interface Manager
Returns:
a new iterator