org.objectweb.jorm.mapper.rdb.lib
Class RdbPMappingStructuresManager

java.lang.Object
  extended byorg.objectweb.jorm.mapper.rdb.lib.RdbPMappingStructuresManager
All Implemented Interfaces:
PMappingStructuresManager

public class RdbPMappingStructuresManager
extends java.lang.Object
implements PMappingStructuresManager

Defines the way to manage relational schema for the RDB mappers.

Author:
P. Dechamboux

Field Summary
protected  Logger logger
           
 
Constructor Summary
RdbPMappingStructuresManager()
           
 
Method Summary
 void addDependency(java.lang.String jcname1, java.lang.String jcname2)
          Adds a dependency between a defined class and another class.
 void addTableColumn(java.lang.String jcname, java.lang.String tname, java.lang.String cname, java.lang.String type, boolean notnull, boolean ispkcol, boolean isMaster)
          Adds a table column into these RDB mapping structures.
 void addViewStatement(java.lang.String jcName, java.lang.String viewName, java.lang.String stmtName, java.lang.String stmtValue, boolean hasWhereClause, RdbPPolymorphicClass clazz)
          Add a statement to a view.
 void classDefined(java.lang.String jcname)
          Indicates that a jorm class is defined.
 void declareClass(java.lang.String jcname)
          Declares a persistent class.
 PMapCluster getPMapCluster(java.lang.String jcname)
          Asks for the map cluster associated with a JORM class.
 java.util.Collection getPMapClusters()
          Asks for all the map clusters defined within this mapper.
 PMapper getPMapper()
           
 void setLogger(Logger l)
          Assigns a logger to this schema manager.
 void setPMapper(PMapper pm)
          Assigns a mapper to this schema manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Logger logger
Constructor Detail

RdbPMappingStructuresManager

public RdbPMappingStructuresManager()
Method Detail

addTableColumn

public void addTableColumn(java.lang.String jcname,
                           java.lang.String tname,
                           java.lang.String cname,
                           java.lang.String type,
                           boolean notnull,
                           boolean ispkcol,
                           boolean isMaster)
                    throws PException
Adds a table column into these RDB mapping structures.

Parameters:
jcname - The JORM class name.
tname - The table name.
cname - The column name.
notnull - true if column value should never be null.
Throws:
PException

addViewStatement

public void addViewStatement(java.lang.String jcName,
                             java.lang.String viewName,
                             java.lang.String stmtName,
                             java.lang.String stmtValue,
                             boolean hasWhereClause,
                             RdbPPolymorphicClass clazz)
                      throws PException
Add a statement to a view. The view will be the union of all added statements. Create the view if it does not already exist. The statement is of the form select ... from ... [where ...]. Statements are named so one can register filters to them. The last parameter indicates whether the statement has a where clause so as to know if filters must be precceded by a AND (if there is already a where clause) or a WHERE (if there no where clause yet)

Parameters:
jcName - the name of the class
viewName - the name of the view
stmtName - the name of the statement
stmtValue - tht select/from/where to be added
hasWhereClause - if true the statement has a where clause
clazz - the class of which we are calculating the extent on which the appendExtentFilter method will be called
Throws:
PException

declareClass

public void declareClass(java.lang.String jcname)
Description copied from interface: PMappingStructuresManager
Declares a persistent class. This call crerates the PMapCluster.

Specified by:
declareClass in interface PMappingStructuresManager
Parameters:
jcname -

getPMapper

public PMapper getPMapper()

getPMapCluster

public PMapCluster getPMapCluster(java.lang.String jcname)
                           throws PException
Asks for the map cluster associated with a JORM class.

Specified by:
getPMapCluster in interface PMappingStructuresManager
Parameters:
jcname - The JORM class name.
Returns:
The relevant map cluster.
Throws:
PException - This class has not been mapped.

getPMapClusters

public java.util.Collection getPMapClusters()
Asks for all the map clusters defined within this mapper. The returned Collection is not thread safe.

Specified by:
getPMapClusters in interface PMappingStructuresManager
Returns:
The Iterator over the collection of map clusters.

addDependency

public void addDependency(java.lang.String jcname1,
                          java.lang.String jcname2)
                   throws PException
Description copied from interface: PMappingStructuresManager
Adds a dependency between a defined class and another class.

Specified by:
addDependency in interface PMappingStructuresManager
Parameters:
jcname1 - is the class name of a defined class
jcname2 - is the name of the class which the first depends on it.
Throws:
PException - if the first jorm class name is not defined (no cluster found)

classDefined

public void classDefined(java.lang.String jcname)
                  throws PException
Description copied from interface: PMappingStructuresManager
Indicates that a jorm class is defined.

Specified by:
classDefined in interface PMappingStructuresManager
Parameters:
jcname - which is defined.
Throws:
PException

setPMapper

public void setPMapper(PMapper pm)
Assigns a mapper to this schema manager.

Specified by:
setPMapper in interface PMappingStructuresManager
Parameters:
pm - The concerned mapper.

setLogger

public void setLogger(Logger l)
Assigns a logger to this schema manager.

Specified by:
setLogger in interface PMappingStructuresManager
Parameters:
l - The concerned logger.