org.ow2.jonas.lib.ejb21.jorm
Class JormFactory

java.lang.Object
  extended by org.ow2.jonas.lib.ejb21.JFactory
      extended by org.ow2.jonas.lib.ejb21.JEntityFactory
          extended by org.ow2.jonas.lib.ejb21.jorm.JormFactory
All Implemented Interfaces:
TimerService, org.objectweb.jorm.api.PClassMapping, org.objectweb.jorm.api.PClassMappingCtrl, BeanFactory
Direct Known Subclasses:
MedorFactory

public abstract class JormFactory
extends JEntityFactory
implements org.objectweb.jorm.api.PClassMapping, org.objectweb.jorm.api.PClassMappingCtrl

This class is an extension of the JEntityFactory class. It initializes the persitant class (the bean) in the jorm mapper. This class is abstract in order to be extended by the PClassMapping generated for the Bean.

Author:
Sebastien Chassande-Barrioz

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.objectweb.jorm.api.PClassMapping
org.objectweb.jorm.api.PClassMapping.ReferenceConfigurator
 
Field Summary
protected  EntityCmp2Desc ecd
           
protected  boolean mapped
           
protected  org.objectweb.jorm.api.PMapper mapper
           
protected  int relNonInit
           
 
Fields inherited from class org.ow2.jonas.lib.ejb21.JEntityFactory
bctxlist, cmp2, datasource, hardLimit, home, instanceCount, localhome, lockPolicy, prefetch, readTimeout, reentrant, shared, txlist
 
Fields inherited from class org.ow2.jonas.lib.ejb21.JFactory
beanclass, cont, dd, dispatcher, ejb10Env, ejbname, ejbTimeoutSignature, isClusterReplicated, JNDICtx, maxCacheSize, minPoolSize, myTimerService, naming, passivationDir, stopped, timerTxAttr, tm, txbeanmanaged, wm
 
Fields inherited from interface org.objectweb.jorm.api.PClassMapping
CLEANUP_DONOTHING, CLEANUP_REMOVEALL, CLEANUP_REMOVEDATA, CREATE_STRUCTURE_IF_NEEDED
 
Constructor Summary
JormFactory()
          constructor
 
Method Summary
 void configurePnc(String n, org.objectweb.jorm.naming.api.PNamingContext pnc, JormFactory target, boolean isMultiple)
          It assignes the PNamingContext which manages a relation.
protected  JEntityContext createNewContext(EntityBean bean)
          This method is overrided in order to specify the JEntityContext class which must be instanciated.
 Serializable decodePK(Serializable strpk)
          Decode String to a PName
 Serializable encodePK(Serializable pk)
          Encode PK in case of CMP2
abstract  Object getConnection(Object hints)
           
 JEntitySwitch getJEntitySwitch()
          This method allocates a new JEntitySwitch.
 org.objectweb.jorm.api.PMapper getMapper()
           
 void init(EntityDesc ed, JContainer c, String mapperName)
          Initialization of the factory.
protected abstract  void initGenClassPrefetch(org.objectweb.jorm.api.PClassMapping gcm, org.objectweb.jorm.api.PClassMapping targetPCM)
          It initializes the prefetching of a genclassMapping with the PClassMapping of the target class of the multivalued CMR.
protected  org.objectweb.jorm.api.PClassMapping newGCMInstance(String mapperName)
          Create a GenClassMapping
abstract  void releaseConnection(Object conn)
           
protected abstract  void setMapper(String mapperName)
           
 void stop()
          stop this EJB.
 
Methods inherited from class org.ow2.jonas.lib.ejb21.JEntityFactory
bindEJB, calculateAutomaticPk, checkTransaction, createNewInstance, createTimer, createTimer, createTimer, createTimer, dirtyInstances, dummyFinderException, existEJB, getCacheSize, getCurrentWaiters, getDataSource, getDeadlockTimeout, getEJB, getEntityCounters, getHome, getInactivityTimeout, getJContext, getLocalHome, getLockPolicy, getMaxWaitTime, getPassivationTimeout, getPoolSize, getReadTimeout, getSelectForUpdate, getTimers, getTimerService, init, initInstancePool, isCMP2, isDeadLocked, isHardLimit, isPrefetch, isReentrant, isShared, rebindEJB, reduceCache, registerContext, registerEJB, releaseJContext, releaseJContext, removeEJB, removeTxListener, setDeadlockTimeout, setInactivityTimeout, setMaxWaitTime, setPassivationTimeout, storeInstances, syncDirty, syncForFind, syncForSelect, synchronizeEntities, tooManyInstances, unregisterContext
 
Methods inherited from class org.ow2.jonas.lib.ejb21.JFactory
checkJonasVersion, checkSecurity, checkTransactionContainer, getContainer, getDeploymentDescriptor, getDispatcher, getEjb10Environment, getEJBName, getEjbTimeoutSignature, getEnv, getFileList, getInitialContext, getMaxCacheSize, getMinPoolSize, getPassivationDir, getResourceCheckerManager, getTimerTxAttribute, getTransactionManager, getWorkManager, init, isClassAvailable, isStopped, isTxBeanManaged, myClassLoader, postInvoke, postInvokeRemote, preInvoke, preInvokeRemote, resetComponentContext, restartTimers, setComponentContext, setDispatcher, setResourceCheckerManager, stopContainer
 
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.api.PClassMapping
addAssociation, classDefined, configureRefFields, createPBinding, exist, getAssociationTable, getClassName, getClassPNameCoder, getDecodedPName, getGenClassMapping, getGenClassMapping, getIndexesTable, getMetaInfo, getPBinder, getPMapper, getPNameCoder, getPNameCoder, getPNameIterator, getPNameIterator, getProjectName, getPType, getSubPCMs, init, init, isConform, match, read, read, read, resolve, setPBinder, write
 
Methods inherited from interface org.objectweb.jorm.api.PClassMappingCtrl
setClassPNameCoder, setGenClassMapping, setGenClassMapping, setPNameCoder, setPNameCoder, setProjectName
 

Field Detail

relNonInit

protected int relNonInit

mapped

protected boolean mapped

mapper

protected org.objectweb.jorm.api.PMapper mapper

ecd

protected EntityCmp2Desc ecd
Constructor Detail

JormFactory

public JormFactory()
constructor

Method Detail

setMapper

protected abstract void setMapper(String mapperName)
                           throws org.objectweb.jorm.api.PException
Throws:
org.objectweb.jorm.api.PException

getConnection

public abstract Object getConnection(Object hints)
                              throws org.objectweb.jorm.api.PException
Throws:
org.objectweb.jorm.api.PException

releaseConnection

public abstract void releaseConnection(Object conn)
                                throws org.objectweb.jorm.api.PException
Throws:
org.objectweb.jorm.api.PException

init

public void init(EntityDesc ed,
                 JContainer c,
                 String mapperName)
Initialization of the factory. This is called just after the newInstance() from the JContainer (addBean method)


getMapper

public org.objectweb.jorm.api.PMapper getMapper()
Returns:
mapper

configurePnc

public void configurePnc(String n,
                         org.objectweb.jorm.naming.api.PNamingContext pnc,
                         JormFactory target,
                         boolean isMultiple)
                  throws org.objectweb.jorm.api.PException
It assignes the PNamingContext which manages a relation.

Parameters:
n -
pnc -
isMultiple -
Throws:
org.objectweb.jorm.api.PException

stop

public void stop()
Description copied from class: JEntityFactory
stop this EJB. Mainly unregister it in JNDI.

Specified by:
stop in interface BeanFactory
Overrides:
stop in class JEntityFactory

createNewContext

protected JEntityContext createNewContext(EntityBean bean)
This method is overrided in order to specify the JEntityContext class which must be instanciated. Create a new instance of the bean and its EntityContext In case of CMP, the bean class is derived to manage entity persistence.

Overrides:
createNewContext in class JEntityFactory

getJEntitySwitch

public JEntitySwitch getJEntitySwitch()
Description copied from class: JEntityFactory
This method allocates a new JEntitySwitch. But no association has been done between the primary key and the new JEntitySwitch. Therefore the initialisation is not done.

Overrides:
getJEntitySwitch in class JEntityFactory
Returns:
The JEntitySwitch.

newGCMInstance

protected org.objectweb.jorm.api.PClassMapping newGCMInstance(String mapperName)
                                                       throws Exception
Create a GenClassMapping

Parameters:
mapperName - name of the mapper
Throws:
Exception

encodePK

public Serializable encodePK(Serializable pk)
Encode PK in case of CMP2

Overrides:
encodePK in class JEntityFactory
Returns:
String representation of the PName

decodePK

public Serializable decodePK(Serializable strpk)
Decode String to a PName

Overrides:
decodePK in class JEntityFactory
Returns:
PName matching the String

initGenClassPrefetch

protected abstract void initGenClassPrefetch(org.objectweb.jorm.api.PClassMapping gcm,
                                             org.objectweb.jorm.api.PClassMapping targetPCM)
It initializes the prefetching of a genclassMapping with the PClassMapping of the target class of the multivalued CMR.

Parameters:
gcm - is the GenClassMapping to initialized
targetPCM - is the PClassMapping of the target class


Copyright © 2010 OW2 Consortium. All Rights Reserved.