org.objectweb.jorm.interp.genclass.rdb.lib
Class RdbGenClassMapping

java.lang.Object
  |
  +--org.objectweb.jorm.interp.genclass.lib.GenClassMapping
        |
        +--org.objectweb.jorm.interp.genclass.rdb.lib.RdbGenClassMapping
All Implemented Interfaces:
GenClassProp, Loggable, PClassMapping, RdbGenClassProp

public class RdbGenClassMapping
extends GenClassMapping
implements RdbGenClassProp

This class provides the implementation of PClassMapping for RDBMS.

Author:
P. D?chamboux

Inner classes inherited from class org.objectweb.jorm.api.PClassMapping
PClassMapping.ReferenceConfigurator
 
Field Summary
protected  java.lang.String tableName
          The name of the table into which to store generic class object elements.
protected  RdbAdpater typeConverter
          This is the type converter defined for a particular kind of RDB.
 
Fields inherited from class org.objectweb.jorm.interp.genclass.lib.GenClassMapping
binder, elemClassMapping, elemCodingOnly, elemFields, elemNamingContext, genClassMetaInfo, genClassPType, identifierFields, indexFields, logger, loggerFactory, mapper
 
Fields inherited from interface org.objectweb.jorm.api.PClassMapping
CLEANUP_DONOTHING, CLEANUP_REMOVEALL, CLEANUP_REMOVEDATA, CREATE_STRUCTURE_IF_NEEDED
 
Constructor Summary
RdbGenClassMapping()
           
 
Method Summary
 PBinding createPBinding()
          It creates a new PBinding.
 PName decodeSingle(FieldDesc fd, java.sql.ResultSet resultSet, int idx)
           
 java.util.Iterator getPNameIterator(java.lang.Object conn)
          It returns an iterator over all pname of persitent objects availlable in this class.
 void initMappingStructures(java.lang.Object conn, byte cleanup)
          It initializes the persistent structures required to map a JORM class within a particular Data Store.
 boolean isConform(java.lang.String mappername)
          It specifies if the given kind of PMapper is supported by this PClassMapping.
 void removeMappingStructures(java.lang.Object conn, boolean contentonly)
          It removes the persistent structures required to map a JORM class within a particular Data Store.
 void setTableName(java.lang.String tn)
          Defines the table name property of a generic class instance mapped to a RDB.
 void setTypeConverter(RdbAdpater tc)
          Defines the type converter property of a generic class instance mapped to a RDB.
 
Methods inherited from class org.objectweb.jorm.interp.genclass.lib.GenClassMapping
configureRefFields, getClassName, getElemFields, getGenClassMapping, getGenClassMapping, getIdentifierFields, getIndexFields, getLogger, getLoggerFactory, getMetaInfo, getPBinder, getPMapper, getPNameManager, getPNameManager, getPType, init, setElemDesc, setGcType, setGenClassMapping, setGenClassMapping, setIdentifierDesc, setIndexDesc, setLogger, setLoggerFactory, setPBinder, setPNamingContext, setPNamingContext, setPType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jorm.interp.genclass.api.GenClassProp
setElemDesc, setGcType, setIdentifierDesc, setIndexDesc
 

Field Detail

tableName

protected java.lang.String tableName
The name of the table into which to store generic class object elements. It should be null in case of "legacy" mapping.

typeConverter

protected RdbAdpater typeConverter
This is the type converter defined for a particular kind of RDB.
Constructor Detail

RdbGenClassMapping

public RdbGenClassMapping()
Method Detail

createPBinding

public PBinding createPBinding()
                        throws PException
It creates a new PBinding.
Returns:
The new PBinding with lifecycle state set to LIFECYCLE_NOTBOUND.

getPNameIterator

public java.util.Iterator getPNameIterator(java.lang.Object conn)
                                    throws PExceptionProtocol,
                                           PExceptionIO
It returns an iterator over all pname of persitent objects availlable in this class. When you use the returned iterator you must leave the connection opened.
Parameters:
conn - is the connection which permits to access to the support
Returns:
the iterator over PName objects
Throws:
PExceptionProtocol - A problem occured during the request that is not related to I/O.
PExceptionIO - A problem occured during the request.

initMappingStructures

public void initMappingStructures(java.lang.Object conn,
                                  byte cleanup)
                           throws PExceptionProtocol,
                                  PExceptionIO
It initializes the persistent structures required to map a JORM class within a particular Data Store. This method has no effect when the structures already exist, or when the structure must not be manipulated via JORM (e.g., case of a legacy DS). The deletion of these structures may be requested before initializing them.
Parameters:
conn - The connection that can be used to access the DS.
cleanup - Tells if structures and/or data should be removed at initialization time.
Throws:
PExceptionIO - A problem occured during the initialization of the DS.

isConform

public boolean isConform(java.lang.String mappername)
It specifies if the given kind of PMapper is supported by this PClassMapping. In this case, all kinds of RDB mappers are supported.
Parameters:
mappername - The name defining the PMapper kind.
Returns:
true if this kind of mapper is supported.

removeMappingStructures

public void removeMappingStructures(java.lang.Object conn,
                                    boolean contentonly)
                             throws PExceptionIO
It removes the persistent structures required to map a JORM class within a particular Data Store. This method has no effect when the structures do not exist, or when the structure must not be manipulated via JORM (e.g., case of a legacy DS).
Parameters:
conn - The connection that can be used to access the DS.
contentonly - It specifies if only the content of the persistent structures should be removed (it only removes data).

setTableName

public void setTableName(java.lang.String tn)
Defines the table name property of a generic class instance mapped to a RDB.
Specified by:
setTableName in interface RdbGenClassProp
Parameters:
pt - The associated type.

setTypeConverter

public void setTypeConverter(RdbAdpater tc)
Defines the type converter property of a generic class instance mapped to a RDB.
Specified by:
setTypeConverter in interface RdbGenClassProp
Parameters:
pt - The associated type.

decodeSingle

public PName decodeSingle(FieldDesc fd,
                          java.sql.ResultSet resultSet,
                          int idx)
                   throws PExceptionProtocol,
                          PExceptionNaming,
                          java.sql.SQLException