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

java.lang.Object
  extended byorg.objectweb.jorm.lib.Mapper
      extended byorg.objectweb.jorm.mapper.rdb.lib.MapperJDBC
All Implemented Interfaces:
Loggable, PMapper, PMapperRdb, PMappingCallback, PMappingStructuresManager

public class MapperJDBC
extends Mapper
implements PMapperRdb

This mapper supports JDBC connection management.

Author:
P. Dechamboux

Field Summary
 
Fields inherited from class org.objectweb.jorm.lib.Mapper
logger, loggerFactory
 
Fields inherited from interface org.objectweb.jorm.api.PMapper
JORMPROPFILE, PBINDINGAPPENDER, PCLASSMAPPINGAPPENDER
 
Constructor Summary
MapperJDBC()
           
MapperJDBC(JormConfigurator jc)
           
 
Method Summary
 void closeConnection(java.lang.Object conn)
          Closes the given connection which has been allocated previously using getConnection.
 java.lang.Object getConnection()
          Allocates a connection for accessing the underlying relational DB.
 java.lang.Object getConnection(java.lang.Object ctxt)
          Allocates a connection for accessing the underlying relational DB.
 java.lang.Object getConnection(java.lang.Object connectionContext, java.lang.Object user)
          Allocates a connection for accessing the underlying DS knowing additional context information.
 java.lang.Object getConnectionFactory()
          Returns the connection factory associated to this mapper.
 RdbAdapter getRdbAdapter()
           
 void setConnectionFactory(java.lang.Object cf)
          Assigns the information about the JDBC connection to be allocated through this mapper.
 void start()
          Starts this mapper.
 
Methods inherited from class org.objectweb.jorm.lib.Mapper
addDependency, addMapperEventListener, classDefined, clean, clear, cn2mn, createGenClassMapping, declareClass, equals, getJormConfigurator, getLogger, getLoggerFactory, getMappedClasses, getMapperName, getMetaInfoManager, getPMapCluster, getPMapClusters, getPMappingStructuresManager, getPrefetchCache, getPTypeSpace, hashCode, lookup, map, map, map, removeMapperEventListener, scheduleEvent, setDTDLocations, setJormConfigurator, setLogger, setLoggerFactory, setMapperName, setPathsToPdFiles, setPMapper, setPrefetchCache, stop, unmap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jorm.api.PMapper
addMapperEventListener, clean, cn2mn, createGenClassMapping, getMappedClasses, getMapperName, getMetaInfoManager, getPMappingStructuresManager, getPrefetchCache, getPTypeSpace, lookup, map, map, map, removeMapperEventListener, setDTDLocations, setMapperName, setPathsToPdFiles, setPrefetchCache, stop, unmap
 
Methods inherited from interface org.objectweb.jorm.api.PMappingStructuresManager
addDependency, classDefined, clear, declareClass, getPMapCluster, getPMapClusters, setLogger, setPMapper
 

Constructor Detail

MapperJDBC

public MapperJDBC()
           throws PException

MapperJDBC

public MapperJDBC(JormConfigurator jc)
Method Detail

closeConnection

public void closeConnection(java.lang.Object conn)
                     throws PException
Closes the given connection which has been allocated previously using getConnection.

Specified by:
closeConnection in interface PMapper
Parameters:
conn - The concerned JDBC connection.
Throws:
PException

getConnection

public java.lang.Object getConnection()
                               throws PException
Allocates a connection for accessing the underlying relational DB.

Specified by:
getConnection in interface PMapper
Throws:
PException

getConnection

public java.lang.Object getConnection(java.lang.Object ctxt)
                               throws PException
Allocates a connection for accessing the underlying relational DB.

Specified by:
getConnection in interface PMapper
Parameters:
ctxt - The connection specification for the connection to be allocated.
Throws:
PException

getConnection

public java.lang.Object getConnection(java.lang.Object connectionContext,
                                      java.lang.Object user)
                               throws PException
Description copied from interface: PMapper
Allocates a connection for accessing the underlying DS knowing additional context information.

Specified by:
getConnection in interface PMapper
Parameters:
connectionContext - Context information used to allocate the connection.
user - is the identifier of the connection user (working set or transaction id).
Throws:
PException

setConnectionFactory

public void setConnectionFactory(java.lang.Object cf)
                          throws PException
Assigns the information about the JDBC connection to be allocated through this mapper.

Specified by:
setConnectionFactory in interface PMapper
Throws:
PExceptionProtocol - It is raised if a connection factory has already been assigned.
PException

getConnectionFactory

public java.lang.Object getConnectionFactory()
Returns the connection factory associated to this mapper.

Specified by:
getConnectionFactory in interface PMapper

start

public void start()
           throws PException
Description copied from interface: PMapper
Starts this mapper.

Specified by:
start in interface PMapper
Overrides:
start in class Mapper
Throws:
PException

getRdbAdapter

public RdbAdapter getRdbAdapter()
Specified by:
getRdbAdapter in interface PMapperRdb
Returns:
the RdbAdapter instance associated to this mapper.