|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectau.gov.tas.dpiwe.mr.util.Messenger
au.gov.tas.dpiwe.mr.BeanCache
au.gov.tas.dpiwe.mr.PresentationUtilities
au.gov.tas.dpiwe.mr.BeanBundler
au.gov.tas.dpiwe.mr.server.database.QueryBuilder
au.gov.tas.dpiwe.mr.Container
public abstract class Container
The Mr Architecture Container is a variant of an EJB container which makes assumptions which allow it to manipulate business objects (or entity beans in EJB nomenclature) without deployment descriptors. Business objects suitable for deployment in this container are referred to as Mr Beans.
The Mr Architecture Container can be thought of as containing business objects (EntityBean implementations), their home interface client implementations (EJBLocalHome implementations), and their local component interface client implementations (EJBLocalObject implementations). Collectively, a business object implementation and its associated component and home interface implementations are called a bean type.
The Container provides an internal interface to allow bean life-cycle events to be initiated and to obtain beans matching particular selection criteria, and also provides an external interface for obtaining beans by querying the relational database storage. It also manages transactions involving beans belonging to it, providing an external interface to allow transactions to be demarcated. While parts of the internal interface are exposed to clients, clients must not use them or rely on their functionality, as their specifications are subject to change without notice. Such methods will be flagged with a comment such as "this method is not intended to be used by external clients."
In keeping with the names of the EJB superinterfaces, and because this container, and therefore the beans it supports, only provides local component views, the convention is to name the component interface for an abstract entity bean classes named <entity-bean-class-name> with the suffix "Object" (even though that class will paradoxically define an interface) viz <entity-bean-class-name>Object, and to name the home interface with the suffix "Home" viz <entity-bean-class-name>Home.
The assumptions made about bean types (beyond the fact that these should comply, except where noted below, with the EJB 2.0 specification's restrictions on beans with container-managed persistence and local home and component interfaces) from the perspective of the bean developer are as follows:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class au.gov.tas.dpiwe.mr.BeanCache |
|---|
BeanCache.ReferenceReaper, BeanCache.TypeRecord |
| Field Summary | |
|---|---|
protected String |
appName
The name of the application to which this container belongs. |
protected int |
batchFindTimeout
The number of seconds before a batch find is in danger of being terminated. |
protected Map |
batchThreadGroupBadCommandExceptionTable
Lists the exception thrown by the last bad command in a batch find. |
protected Map |
batchThreadGroupBadCommandIndexWaveCountTable
Lists the index and wave of the last bad command in a batch find. |
protected Map |
batchThreadGroupCommandTable
Lists the commands for each thread group participating in a batch find. |
protected Map |
batchThreadGroupResponseTable
Lists the responses in the most recent wave for each thread group whose batch find has succeeded. |
protected Map |
batchThreadGroupWaveCountTable
Lists the current wave of commands which have been sent (0 if the first wave has not yet been sent.) |
protected Map |
batchThreadGroupWaveResponseTable
Lists the responses for each wave in each thread group participating in a batch find. |
protected Class[] |
dateSignature
The signature of the setLastUpdateDateTime() methods in entity beans. |
protected Method |
executeBatchFind
The method which executes a batch find. |
protected Map |
handleCommandTable
Lists the commands for each registered non-thread transaction. |
protected Method |
initiateBatchFind
The method which initiates a batch find. |
protected Class[] |
integerSignature
The signature of the getter methods in the ResultSet that we use. |
protected static Container |
localContainer
A reference to the local container if an unnamed application has instatiated a container in this VM. |
protected static Map |
localContainers
A table listing the local containers on a per application basis. |
protected Class |
setClass
The ResultSet class which returns the result of SQL queries. |
protected Method |
setWasNull
The ResultSet.wasNull() method. |
protected Class[] |
stringSignature
The signature of the setLastUpdateUsername() methods in entity beans. |
protected PerThread |
threadBadCommandIndex
The index to the command that failed in the most recent doCommands() call. |
protected PerThread |
threadBatchFind
The batch find corresponding to this thread. |
protected PerThread |
threadCommands
The non-committed commands corresponding to this thread. |
protected Map |
threadGroupBatchFindTable
Lists the thread groups participating in batch finds. |
protected Map |
transactionThreadNameCommandTable
Lists the commands for each registered transaction thread. |
protected Set |
transactionThreadRollbackOnlyList
Lists the transaction threads or handles which are marked as rollback only. |
protected int |
transactionTimeout
The number of seconds before a transaction is in danger of being terminated. |
protected Class |
userEntityBeanClass
The class involved in user authentication. |
| Fields inherited from class au.gov.tas.dpiwe.mr.server.database.QueryBuilder |
|---|
database |
| Fields inherited from class au.gov.tas.dpiwe.mr.util.Messenger |
|---|
console, error, exceptionMessageTable, exceptionsToConsole, exceptionsToError, Level_Debug, Level_Exception, Level_None, Level_Normal, messageLevel |
| Constructor Summary | |
|---|---|
protected |
Container(int beanClassCount,
int initialPerBeanClassCacheSize,
String appName)
This class is abstract and cannot be instantiated. |
protected |
Container(String appName)
This class is abstract and cannot be instantiated. |
| Method Summary | |
|---|---|
EntityBean |
activateEntityBean(EntityBean bean)
The immediate action of this method is to reactivate a bean after transmission across a communication link or storage in a file. |
EntityBean |
activateEntityBean(EntityBean bean,
boolean recurse)
The immediate action of this method is to reactivate a bean after transmission across a communication link or storage in a file. |
EntityBean |
activateEntityBean(MrEntityBean bean,
boolean recurse,
boolean cache)
The immediate action of this method is to reactivate a bean after transmission across a communication link or storage in a file. |
protected void |
activateEntityBeanRelatives(EntityBean bean,
boolean cache)
Internal utility method to activate entity beans related to this entity bean. |
void |
addType(Class beanClass,
Method keyGetterMethod,
Method keySetterMethod,
Class homeClass,
Class objectClass)
Adds a recognised bean type to this container. |
void |
addTypeLater(String abstractBeanClassQualifiedName,
String keyTypeQualifiedName,
String keyFieldName)
Queues a recognised bean type to be added to this container at its first use. |
AlertResponse |
alertServer(int oldAlertStatus,
int newAlertStatus)
|
boolean |
areBeanObjectRelativesPersistent(BeanWrapper beanObject,
boolean relativesPersistent)
Internal utility method to determine if the direct and indirect relationships of a bean object are persistent. |
protected Batch |
batchRetrieveMethodCallsForBeanObject(Batch batch,
BeanWrapper beanObject)
Internal utility method to batch calls to the methods starting with the word "retrieve" in a particular bean object. |
protected Batch |
batchRetrieveMethodCallsForBeanObjects(Batch batch,
Collection beanObjects)
Internal utility method to batch calls to the methods starting with the word "retrieve" in a collection of bean objects. |
void |
begin()
Creates a new transaction and associates it with the current thread. |
void |
begin(int size)
Creates a new transaction and associates it with the current thread. |
protected Collection |
begin(Object handle,
int size)
Creates a new transaction and associates it with the given object. |
void |
bind(Object handle)
Bind a thread to the given transaction (assuming it exists.) |
void |
commit()
Complete the transaction being managed for the calling thread. |
protected void |
commit(Object handle)
Complete the given transaction. |
EJBLocalObject |
convertPrototypeFromDefaultDatabaseWildcards(EJBLocalObject beanObject)
Takes a prototype bean, and transforms String fields containing the default database wildcards into Strings containing the wildcards appropriate for the MrDatabase instance associated with this Container. |
EJBLocalObject |
convertPrototypeToDefaultDatabaseWildcards(EJBLocalObject beanObject)
Takes a prototype bean, and transforms String fields containing the database wildcards appropriate for the MrDatabase instance associated with this Container into Strings containing the default wildcards. |
void |
copyUpdateStampFromEntityBeanToBean(EntityBean sourceBean,
EntityBean objectBean)
Internal utility method sets the last update date/time and username field values for one entity bean to those of another. |
EntityBean |
createEntityBean(EntityBean bean,
Object primaryKey)
The immediate action of this method is to create a single entity bean with the specified primary key. |
EntityBean |
createEntityBeanImmediately(EntityBean bean,
Object primaryKey)
The immediate action of this method is to create a single entity bean with the specified primary key. |
void |
debugTransaction()
Prints (if debugging is enabled) the contents of the current transaction for this thread. |
Response |
doCommand(Command command)
Internal method to perform a single command immediately. |
abstract Response |
doCommand(Command command,
boolean oneOff)
Internal method to perform a single command immediately. |
protected Response |
doCommandInTransactionContext(Command command)
Internal method which executes a command (a) immediately if the calling thread has no defined transaction context or (b) at commit time if the calling thread is presently in the context of a transaction. |
abstract Collection |
doCommands(Collection commands)
Internal method to perform a batch of commands. |
boolean |
equals(Object another)
Does a crude test to check if two Containers contain the same types. |
void |
executeBatchFind()
Executes a batch find operation. |
void |
executeRetrieveMethodCallsForBeanObject(BeanWrapper beanObject)
Internal utility method to invoke methods starting with the word "retrieve" in a particular bean object. |
Collection |
executeRetrieveMethodCallsForBeanObjects(Collection beanObjects)
Internal utility method to invoke methods starting with the word "retrieve" in a collection of bean objects. |
Map |
executeRetrieveMethodCallsForBeanObjects(Map beanObjects)
Internal utility method to invoke methods starting with the word "retrieve" in a map of bean objects. |
EntityBean |
findAllOfEntityBean(EntityBean bean,
Object primaryKey)
The immediate action of this method is to load a single entity bean from persistent storage. |
EntityBean |
findEntityBean(EntityBean bean,
Object primaryKey)
The immediate action of this method is to load a single entity bean from persistent storage. |
static Container |
findLocalContainer(String appName)
Returns the local container corresponding to the specified application name. |
FlushResponse |
flushBeans(EntityBean bean)
Ensures that beans of the specified type are removed from all caches. |
String |
getAppName()
Returns the application name for this container. |
int |
getBadCommandIndex(boolean remove)
Gives the index of the last command that failed during a doCommands() call for the current thread. |
String |
getIDForEntityBean(EntityBean bean)
This internal utility method returns an identifier for a bean based on its type and primary key. |
protected NullableDate |
getLastUpdateDateFromEntityBean(EntityBean bean)
This internal utility method returns the last update date/time field value for an entity bean. |
MrDatabase |
getMrDatabase()
Get the database object associated with this container, if any. |
String |
getName()
Returns a dummy principal name for this container. |
String |
getObjectIDForEntityBean(EntityBean bean)
This internal utility method returns an identifier for a bean based on its type and primary key. |
UserEntityBean |
getPooledUserEntityBean()
Requests a pooled user entity bean. |
boolean |
getRollbackOnly()
Returns true if the current transaction being managed for the calling thread will never be committed. |
boolean |
getRollbackOnly(Object handle)
Returns true if the specified transaction will never be committed. |
Date |
getServerDate()
The immediate action of this method is to access the server's real-time clock. |
Date |
getServerDate(TimeZone suggestedTimeZone)
The immediate action of this method is to access the server's real-time clock. |
int |
getStatus()
Obtain the status of the transaction associated with the calling thread. |
protected int |
getStatus(Object handle)
Obtain the status of the specified transaction. |
Class |
getUserEntityBeanClass()
Returns a bean type which implements the UserEntityBean interface. |
UserTransaction |
getUserTransaction(Object handle)
Obtain a transaction context which can be shared or automatically suspended/resumed by multiple threads. |
int |
hashCode()
Returns a hashcode for this container. |
HeimlichedObstruction |
heimlichServer(String serverDumpFilename)
Kills all running threads on the server, leaving it in an undefined state. |
void |
initiateBatchFind(Batch batch)
Initiates a batch find operation and associates it with the current thread. |
InvokeResponse |
invokeMethodOfBeanObject(Method method,
EntityBean bean,
Object[] parameters)
The immediate action of this method is to execute a method of an entity bean on the server. |
InvokeResponse |
invokeMethodOfHome(Method method,
EntityBean bean,
Object[] parameters)
The immediate action of this method is to execute a method of a home interface on the server. |
protected boolean |
isCommandWhichExpectsNonPooledBean(Command command)
Internal utility method to determine if this command takes a non-pooled bean (i.e. a bean with identity) as an argument. |
EntityBean |
loadEntityBean(EntityBean bean)
The immediate action of this method is to refresh an entity bean from persistent storage. |
LockResponse |
lockHome(EntityBean bean)
The eventual action of this method is to lock the table associated with a particular home until the transaction has completed. |
LogResponse |
logOnServer(String logMessage)
The eventual action of this method is to place a log message in the server log file. |
EntityBean |
nullifyRelationships(EntityBean bean)
This internal utility method sets the relationships of a "Thin" entity bean to null. |
EntityBean |
passivateEntityBean(EntityBean bean)
The immediate action of this method is to passivate a bean ready for transmission across a communication link or storage in a file. |
EntityBean |
passivateEntityBean(EntityBean bean,
boolean recurse)
The immediate action of this method is to passivate a bean ready for transmission across a communication link or storage in a file. |
protected void |
passivateEntityBeanRelatives(EntityBean bean)
Internal utility method to passivate entity beans related to this entity bean. |
protected void |
purgeTimedOutTransactions()
Internal method to discard records of aging transactions being managed by the container. |
EntityBean |
removeEntityBean(EntityBean bean,
boolean cloned)
The eventual action of this method is to delete an entity bean from persistent storage. |
void |
removeNonRelatives(Collection beanObjects)
Internal utility method to activate the removeUnrelated() and remove() methods of a list of bean objects which are to be unrelated from another bean object. |
void |
removeNonRelativesFromBeanObjectNonRelatives(Collection beanObjects)
Internal utility method to activate the removeUnrelatedFromRelated() and removeUnrelated() methods of a list of bean objects which are to be unrelated from another bean object. |
void |
removeNonRelativesFromBeanObjectRelatives(BeanWrapper beanObject)
Internal utility method to activate the removeUnrelated() methods of all bean objects related to this bean object. |
StatusResponse |
reportServerStatus()
|
Map |
restoreNonRelativesToBeanObjectRelatives(Collection beanObjects)
Internal utility method to activate the restoreUnrelated() and restoreUnrelatedToRelated() methods of a list of bean objects which are to be rerelated to another bean object. |
void |
rollback()
Roll back the transaction associated with the calling thread. |
protected void |
rollback(Object handle)
Roll back the given transaction. |
Collection |
selectAllOfEntityBeans(EntityBean bean,
Collection constrainedFields)
The immediate action of this method is to load many entity beans from persistent storage. |
Collection |
selectAllOfEntityBeansInOrder(EntityBean bean,
Collection constrainedFields,
String orderFieldName)
The immediate action of this method is to load many entity beans from persistent storage. |
Collection |
selectEntityBeans(EntityBean bean,
Collection constrainedFields)
The immediate action of this method is to load many entity beans from persistent storage. |
Collection |
selectEntityBeansInOrder(EntityBean bean,
Collection constrainedFields,
String orderFieldName)
The immediate action of this method is to load many entity beans from persistent storage. |
Collection |
selectSiameseBeanObjects(String sqlQuery)
The immediate action of this method is to load many entity beans from persistent storage. |
void |
setRollbackOnly()
Ensures that the current transaction being managed for the calling thread can never be committed. |
protected void |
setRollbackOnly(Object handle)
Ensures that the specified transaction can never be committed. |
void |
setTransactionTimeout(int seconds)
Determines the age (in seconds) which transactions must reach before they can be discarded. |
void |
setUserEntityBeanClass(Class beanClass)
Specify a bean type which implements the UserEntityBean interface. |
void |
storeBeanObjectRelatives(BeanWrapper beanObject)
Internal utility method to activate the store() methods of all bean objects related to this bean object. |
EntityBean |
storeEntityBean(EntityBean bean,
boolean cloned)
The eventual action of this method is to update an entity bean in persistent storage. |
String |
toString()
Returns a string representation of this container. |
void |
unbind()
Unbinds a thread from its transaction (assuming it is bound.) |
void |
unrelateGivenRelativesFromBeanObjectRelatives(Collection relatives,
Map keyEntryTable)
Internal utility method to activate the unrelateAllInFlatMap() and unrelateAllInNestedMapFromRelated() methods of a map of bean objects which are to be re-unrelated from the given relatives. |
WipeResponse |
wipeEntityBeans(EntityBean bean,
Collection constrainedFields)
The eventual action of this method is to delete many entity beans from persistent storage. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Map transactionThreadNameCommandTable
protected Set transactionThreadRollbackOnlyList
protected PerThread threadCommands
protected Map handleCommandTable
protected PerThread threadBatchFind
protected PerThread threadBadCommandIndex
protected Map batchThreadGroupWaveCountTable
protected Map batchThreadGroupCommandTable
protected Map batchThreadGroupWaveResponseTable
protected Map batchThreadGroupBadCommandIndexWaveCountTable
protected Map batchThreadGroupBadCommandExceptionTable
protected Map threadGroupBatchFindTable
protected Map batchThreadGroupResponseTable
protected Class userEntityBeanClass
protected int transactionTimeout
protected int batchFindTimeout
protected Class setClass
protected Class[] integerSignature
protected Method setWasNull
protected Method initiateBatchFind
protected Method executeBatchFind
protected Class[] dateSignature
protected Class[] stringSignature
protected static Container localContainer
protected static Map localContainers
protected String appName
| Constructor Detail |
|---|
protected Container(String appName)
This constructor is called by subclasses to initialize the hashtables and hash sets which are common to all implementations.
It chooses default hashtable sizes based on a medium-sized business application with a couple of hundred bean types.
appName - the name of the application which requires this container,
usually the qualified name of the main application package, with an
additional suffix if there are multiple containers per application.
protected Container(int beanClassCount,
int initialPerBeanClassCacheSize,
String appName)
This constructor is called by subclasses to initialize the hashtables and hash sets which are common to all implementations.
beanClassCount - an estimate of the number of bean types this container
will contain.initialPerBeanClassCacheSize - an estimate of the number of beans that
will exist in the cache for a particular bean type.appName - the name of the application which requires this container,
usually the qualified name of the main application package, with an
additional suffix if there are multiple containers per application.| Method Detail |
|---|
public static Container findLocalContainer(String appName)
appName - the name of the application whose container is required,
further qualified if there are multiple containers for that application,
or null if only one application is running in this VM.
public String getAppName()
public void addTypeLater(String abstractBeanClassQualifiedName,
String keyTypeQualifiedName,
String keyFieldName)
throws InvocationTargetException,
IllegalAccessException,
NoSuchMethodException,
InstantiationException
This method is called by external clients to inform the container of each bean type it needs to recognise.
abstractBeanClassQualifiedName - the fully qualified name of the abstract bean class.keyTypeQualifiedName - the fully qualified name of the primary key type.keyGetterMethodName - the name of the primary key getter method in the abstract bean.keySetterMethodName - the name of the primary key setter method in the abstract bean.
InvocationTargetException
IllegalAccessException
NoSuchMethodException
InstantiationException
public void addType(Class beanClass,
Method keyGetterMethod,
Method keySetterMethod,
Class homeClass,
Class objectClass)
throws InvocationTargetException,
IllegalAccessException,
NoSuchMethodException,
InstantiationException
This method is called by external clients to inform the container of each bean type it needs to recognise.
beanClass - the "Thin" entity bean implementation which identifies this type,
as generated by DeploymentContainer.keyGetterMethod - the primary key getter method in the "Thin" entity bean.keySetterMethod - the primary key setter method in the "Thin" entity bean.homeClass - the EJBLocalHome implementation for this entity bean type,
as generated by DeploymentContainer.objectClass - the EJBLocalObject implementation for this entity bean type,
as generated by DeploymentContainer.
NoSuchMethodException - if the home interface implementation doesn't have
a constructor of the appropriate form.
IllegalAccessException - if the home interface implementation doesn't
have a public constructor of the appropriate form.
InstantiationException - if the home interface implementation could not
be instantiated because it is an interface or abstract.
InvocationTargetException - if the home interface implementation
constructor throws an exception.public MrDatabase getMrDatabase()
If this container is only indirectly connected to a database, this call returns a generic database object which cannot be used to obtain connections to any database.
bean - a "Thin" entity bean prototype.
public void setUserEntityBeanClass(Class beanClass)
throws EJBException
beanClass - the "Thin" entity bean class which implements the UserEntityBean interface.
EJBExceptionUserEntityBean
public Class getUserEntityBeanClass()
throws EJBException
EJBExceptionUserEntityBean
public UserEntityBean getPooledUserEntityBean()
throws EJBException
bean - a user entity bean prototype.
EJBException - if the user entity bean doesn't have a
constructor of the appropriate form, if the user entity bean doesn't have a public
constructor of the appropriate form, if the user entity bean could not be
instantiated because it is an interface or abstract, or if the user entity bean
constructor throws an exception.protected NullableDate getLastUpdateDateFromEntityBean(EntityBean bean)
bean - the entity bean to return the update date/time for.
public Date getServerDate()
throws EJBException
EJBException - the action failed.
public Date getServerDate(TimeZone suggestedTimeZone)
throws EJBException
This method may only be called remotely if the user is logged in with administrator privileges. As with all security constraints, this is enforced by the servlet security tier.
suggestedTimeZone - the timezone which it is
suggested that the server should be operating in.
EJBException - the action failed.public UserTransaction getUserTransaction(Object handle)
handle - the object designated as the owner of the
context.
public void bind(Object handle)
This is a low-level call, and should be used with caution. Calling it for threads which are already bound to a transaction but weren't themselves bound using a call to bind() could produce unpredictable behaviour.
handle - the owner of the transaction to bind to.public void unbind()
This is a low-level call, and should be used with caution. Calling it for threads which weren't bound using a call to bind() could produce unpredictable behaviour.
public void setTransactionTimeout(int seconds)
May be called by bean providers and external clients. Be aware that this change will be system wide.
setTransactionTimeout in interface UserTransactionseconds - timeout in seconds.
public void begin()
throws NotSupportedException
May be called by bean providers in business methods and by external clients. Bean providers should call this method via the UserTransaction object provided in response to EntityContext.getUserTransaction() to ensure that the bean is not specific to this architecture.
begin in interface UserTransactionNotSupportedException - if an attempt is made to nest transactions.
public void begin(int size)
throws NotSupportedException
May be called by bean providers in business methods and by external clients. Bean providers should call this method via the UserTransaction object provided in response to EntityContext.getUserTransaction() to ensure that the bean is not specific to this architecture.
size - the expected number of commands in this transaction.
NotSupportedException - if an attempt is made to nest transactions.
protected Collection begin(Object handle,
int size)
throws NotSupportedException
handle - the object to manage a thread on behalf of.size - the expected number of commands in this transaction.
NotSupportedException - if an attempt is made to nest transactions.public void initiateBatchFind(Batch batch)
batch - the batch of jobs participating in this batch find.protected void purgeTimedOutTransactions()
public EntityBean findEntityBean(EntityBean bean,
Object primaryKey)
throws EJBException
Any relationships to other beans are populated with null values. The effect of this is that the bean objects created from the entity beans returned from this method will defer loading of any beans they are related to until these relationships are explored. This method therefore is faster and more space efficient than selectAllOfEntityBeans(), but for each subsequent traversal of a relationship in the resulting bean objects there will be a performance hit.
This method should not be called by external clients. Call findByPrimaryKey() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for the bean which will be
found in persistent storage.primaryKey - determines the entity bean found.
EJBException - the action failed.
public EntityBean findAllOfEntityBean(EntityBean bean,
Object primaryKey)
throws EJBException
The bean loaded will immediately load all the beans it is related to. This method therefore carries a higher time and space overhead than findEntityBean(), but may offer a performance benefit in the long run if all the relationships are likely to be used subsequently.
This method should not be called by external clients. Call findAllByPrimaryKey() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for the bean which will be
found in persistent storage.primaryKey - determines the entity bean found.
EJBException - the action failed.
public EntityBean createEntityBean(EntityBean bean,
Object primaryKey)
throws EJBException,
CreateException
This method should not be called by external clients. Call create() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for the bean which will be
created in persistent storage.primaryKey - determines the identity of the entity bean created.
EJBException - the action failed.
CreateException - the primary key is already in use.
public EntityBean createEntityBeanImmediately(EntityBean bean,
Object primaryKey)
throws EJBException,
CreateException
This method should not be called by external clients. Call createImmediately() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for the bean which will be
created in persistent storage.primaryKey - determines the identity of the entity bean created.
EJBException - the action failed.
CreateException - never.
public Collection selectEntityBeans(EntityBean bean,
Collection constrainedFields)
throws EJBException
Any relationships to other beans are populated with null values. The effect of this is that the bean objects created from the entity beans returned from this method will defer loading of any beans they are related to until these relationships are explored. This method therefore is faster and more space efficient than selectAllOfEntityBeans(), but for each subsequent traversal of a relationship in the resulting bean objects there will be a performance hit.
This method should not be called by external clients. Call findWhereFieldsEqual() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for those beans which will be
selected from persistent storage.constrainedFields - determines how the selection is made.
EJBException - the action failed unexpectedly.
public Collection selectAllOfEntityBeans(EntityBean bean,
Collection constrainedFields)
throws EJBException
The beans loaded will immediately load all the beans they are related to. This method therefore carries a higher time and space overhead than selectEntityBeans(), but may offer a performance benefit in the long run if all these relationships are likely to be used subsequently.
This method should not be called by external clients. Call findAllWhereFieldsEqual() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for those beans which will be
selected from persistent storage.constrainedFields - determines how the beans will be selected.
EJBException - the action failed unexpectedly.
public Collection selectEntityBeansInOrder(EntityBean bean,
Collection constrainedFields,
String orderFieldName)
throws EJBException
Any relationships to other beans are populated with null values. The effect of this is that the bean objects created from the entity beans returned from this method will defer loading of any beans they are related to until these relationships are explored. This method therefore is faster and more space efficient than selectAllOfEntityBeans(), but for each subsequent traversal of a relationship in the resulting bean objects there will be a performance hit.
The beans will be sorted in ascending of the field named for the orderFieldName parameter, unless that field is of a date type, in which case the order will be descending on that field.
This method should not be called by external clients. Call findIn<field-name>Order() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for those beans which will be
selected from persistent storage.constrainedFields - determines how the selection is made.orderFieldName - the field to order the results on.
EJBException - the action failed unexpectedly.
public Collection selectAllOfEntityBeansInOrder(EntityBean bean,
Collection constrainedFields,
String orderFieldName)
throws EJBException
The beans loaded will immediately load all the beans they are related to. This method therefore carries a higher time and space overhead than selectEntityBeans(), but may offer a performance benefit in the long run if all these relationships are likely to be used subsequently.
The beans will be sorted in ascending of the field named for the orderFieldName parameter, unless that field is of a date type, in which case the order will be descending on that field.
This method should not be called by external clients. Call findAllIn<field-name>Order() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for those beans which will be
selected from persistent storage.constrainedFields - determines how the beans will be selected.orderFieldName - the field to order the results on.
EJBException - the action failed unexpectedly.public Collection selectSiameseBeanObjects(String sqlQuery)
Any relationships to other beans are populated with null values. The effect of this is that the bean objects created from the entity beans returned from this method will defer loading of any beans they are related to until these relationships are explored.
This method is only called by external clients who wish to perform a join across multiple tables in the database. The result set is parsed by the container to form groups of joined BeanObjects and orphaned fields, each such row constituting a siamese bean which is added to the returned collection. This parsing can only work when:
Note: The meaning of DISTINCT may depend on the underlying MrDatabase implementation*. For queries using a set operator, both queries must return sets, so the keyword DISTINCT is implicit, and the keyword ALL must not be used in either query argument (except as part of the UNION ALL operator.) Similarly, the interaction between DISTINCT and CORRESPONDING BY may also depend on the underlying MrDatabase implementation.
* For example, the MrOracleDatabase implementation ensures uniqueness on the primary key fields of each bean type only. DISTINCT ON is not supported (by Oracle or by MrOracleDatabase) and neither is CORRESPONDING BY. Order of evaluation of queries connected by set operators is left-to-right. i.e. set operators have the same precedence as one another.
sqlQuery - the SQL statement specifying the tables to
join and how they should be joined.
EJBException - the action failed unexpectedly.
public EntityBean loadEntityBean(EntityBean bean)
throws EJBException
This method should not be called by external clients. Call load() on the object interface instead.
This method is called by the implementation of an entity bean's local interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - the entity bean to load from persistent storage.
EJBException - the action failed unexpectedly.
public EntityBean activateEntityBean(EntityBean bean)
throws EJBException
By default, all the related beans are also activated.
This method should not be called by external clients.
bean - the entity bean to activate.
EJBException - the action failed unexpectedly.
public EntityBean activateEntityBean(EntityBean bean,
boolean recurse)
throws EJBException
This method should not be called by external clients.
bean - the entity bean to activate.recurse - true if related beans should also be activated.
EJBException - the action failed unexpectedly.
public EntityBean activateEntityBean(MrEntityBean bean,
boolean recurse,
boolean cache)
throws EJBException
This method should not be called by external clients.
bean - the entity bean to activate.recurse - true if related beans should also be activated.cache - true if beans should be cached.
EJBException - the action failed unexpectedly.
protected void activateEntityBeanRelatives(EntityBean bean,
boolean cache)
bean - the entity bean whose relatives are to be activated.cache - true if beans should be cached.
public EntityBean passivateEntityBean(EntityBean bean)
throws EJBException
By default, all the related beans are also passivated.
This method should not be called by external clients.
bean - the entity bean to passivate.
EJBException - the action failed unexpectedly.
public EntityBean passivateEntityBean(EntityBean bean,
boolean recurse)
throws EJBException
This method should not be called by external clients.
bean - the entity bean to passivate.recurse - true if related beans should also be passivated.
EJBException - the action failed unexpectedly.protected void passivateEntityBeanRelatives(EntityBean bean)
bean - the entity bean whose relatives are to be passivated.
public EntityBean storeEntityBean(EntityBean bean,
boolean cloned)
throws EJBException
This method should not be called by external clients. Call store() on the object interface instead.
This method is called by the implementation of an entity bean's local interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - the entity bean to store to persistent storage.cloned - true if the bean being stored is a clone, false otherwise.
EJBException - the action failed unexpectedly.
public EntityBean removeEntityBean(EntityBean bean,
boolean cloned)
throws EJBException,
RemoveException
This method should not be called by external clients. Call remove() on the home or object interface instead.
This method is called by the implementation of an entity bean's local and home interfaces to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - the entity bean to remove from persistent storage.cloned - true if the bean being stored is a clone, false otherwise.
EJBException - the action failed unexpectedly.
RemoveException
public WipeResponse wipeEntityBeans(EntityBean bean,
Collection constrainedFields)
throws EJBException,
RemoveException
This method should not be called by external clients. Call findWhereFieldsEqual() on the home interface instead.
This method is called by the implementation of an entity bean's home interface to allow the communication with persistent storage to occur in a way appropriate for the prevailing Container subtype.
bean - an entity bean prototype for those beans which will be
deleted from persistent storage.constrainedFields - determines the beans to be deleted.
EJBException - the action failed unexpectedly.
RemoveException
public InvokeResponse invokeMethodOfBeanObject(Method method,
EntityBean bean,
Object[] parameters)
throws EJBException
This method should not be called by external clients. Call invokeOnServer() on the object interface instead.
method - the method to invoke.bean - the entity bean which is the invocation target.parameters - the parameters to the method call.
EJBException - the action failed unexpectedly.
public InvokeResponse invokeMethodOfHome(Method method,
EntityBean bean,
Object[] parameters)
throws EJBException
This method should not be called by external clients. Call invokeOnServer() on the home interface instead.
method - the method to invoke.bean - the entity bean which is the invocation target.parameters - the parameters to the method call.
EJBException - the action failed unexpectedly.
public LockResponse lockHome(EntityBean bean)
throws EJBException
This method should not be called by external clients. Call lock() on the home interface instead.
bean - the entity bean which is representing the home.
EJBException - the action failed unexpectedly.
public LogResponse logOnServer(String logMessage)
throws EJBException
logMessage - the message to log.
EJBException - the action failed unexpectedly.
public FlushResponse flushBeans(EntityBean bean)
throws EJBException
This method should be called by external clients only when manually instructed to do so by the user. This method should not be called during normal system operations.
bean - an entity bean prototype for the beans which will be
removed from caches.
EJBException - the action failed.
public HeimlichedObstruction heimlichServer(String serverDumpFilename)
throws EJBException
This method should be used for debugging purposes only to find where in the code thread deadlocks are occurring. This method is not the correct way to shutdown the server.
serverDumpFilename - a suggestion for the name of the file
that the server should open to write the thread dumps to.
EJBException - the action failed.
public AlertResponse alertServer(int oldAlertStatus,
int newAlertStatus)
throws EJBException
EJBException
public StatusResponse reportServerStatus()
throws EJBException
EJBExceptionpublic String getIDForEntityBean(EntityBean bean)
It is not intended to be used by external clients.
bean - the entity bean to express an identifier for.
public String getObjectIDForEntityBean(EntityBean bean)
It is not intended to be used by external clients.
bean - the entity bean to express an identifier for.
public void setRollbackOnly()
setRollbackOnly in interface UserTransactionIllegalStateException - if a transaction is not being managed
for the calling thread.protected void setRollbackOnly(Object handle)
handle - the object which owns the transaction.
IllegalStateException - if there is no such transaction.public boolean getRollbackOnly()
public boolean getRollbackOnly(Object handle)
handle - the object which owns the transaction.
public void commit()
throws RollbackException,
HeuristicMixedException
commit in interface UserTransactionRollbackException - the transaction has been rolled back rather than
committed, probably because one of the commands in the transaction failed.
HeuristicMixedException - unauthorized commands in the transaction have been
rolled back, but those that were authorized have been committed.
IllegalStateException - if a transaction is not being managed
for the calling thread.
protected void commit(Object handle)
throws RollbackException,
HeuristicMixedException
When this method completes, the thread becomes associated with no transaction.
handle - the object which owns the transaction.
RollbackException - the transaction has been rolled back rather than
committed, probably because one of the commands in the transaction failed.
HeuristicMixedException - unauthorized commands in the transaction have been
rolled back, but those that were authorized have been committed.
IllegalStateException - if a transaction is not being managed
for the calling thread.public void rollback()
rollback in interface UserTransactionIllegalStateException - if a transaction is not being managed
for the calling thread.protected void rollback(Object handle)
handle - the object which owns the transaction.
IllegalStateException - if a transaction is not being managed
for the calling thread.
public void executeBatchFind()
throws EJBException
IllegalStateException - if a batch find is not being managed
for the calling thread.
EJBException - if any of the commands in the batch fail.public int getStatus()
getStatus in interface UserTransactionprotected int getStatus(Object handle)
handle - the object which owns the transaction.
public void debugTransaction()
protected Response doCommandInTransactionContext(Command command)
throws EJBException
command - the command to execute.
EJBExceptionprotected boolean isCommandWhichExpectsNonPooledBean(Command command)
command - the command instance.
public void copyUpdateStampFromEntityBeanToBean(EntityBean sourceBean,
EntityBean objectBean)
sourceBean - the bean with the stamp fields to copy.objectBean - the bean with the stamp fields to replace.public EntityBean nullifyRelationships(EntityBean bean)
Useful before serializing a bean in some situations.
bean - the "Thin" entity bean to nullify
relationships for.
public void storeBeanObjectRelatives(BeanWrapper beanObject)
throws EJBException
External clients should not call this method. Instead they should call the storeWithRelated() method of the bean's component interface instead.
beanObject - the bean object whose relatives are to be stored.
EJBException
public void removeNonRelativesFromBeanObjectRelatives(BeanWrapper beanObject)
throws EJBException,
RemoveException
External clients should not call this method. Instead they should call the removeUnrelatedFromRelated() method of the bean's component interface instead.
beanObject - the bean object whose relatives are to be stored.
EJBException
RemoveException
public boolean areBeanObjectRelativesPersistent(BeanWrapper beanObject,
boolean relativesPersistent)
throws EJBException
External clients should not call this method. Instead they should call the areRelativesPersistent() method of the bean's component interface instead.
beanObject - the bean object whose relatives are to be examined.relativesPersistent - false if the direct relationships of this bean
object are not persistent, true otherwise.
EJBException
public void removeNonRelatives(Collection beanObjects)
throws EJBException,
RemoveException
External clients should not call this method. Instead they should call the removeUnrelated() method of an appropriate bean's component interface instead.
beanObjects - the bean objects which are to be unrelated from another
bean object.
EJBException
RemoveException
public void removeNonRelativesFromBeanObjectNonRelatives(Collection beanObjects)
throws EJBException,
RemoveException
External clients should not call this method. Instead they should call the removeUnrelatedFromRelated() method of an appropriate bean's component interface instead.
beanObjects - the bean objects which are to be unrelated from another
bean object.
EJBException
RemoveException
public Map restoreNonRelativesToBeanObjectRelatives(Collection beanObjects)
throws EJBException
External clients should not call this method.
beanObjects - the bean objects which are to be rerelated to
another bean object.
EJBException
public void unrelateGivenRelativesFromBeanObjectRelatives(Collection relatives,
Map keyEntryTable)
throws EJBException
External clients should not call this method.
relatives - the bean objects which will be selected from.keyEntryTable - describes the bean objects which are to be
re-unrelated fromthe given relatives.
EJBException
public void executeRetrieveMethodCallsForBeanObject(BeanWrapper beanObject)
throws EJBException
beanObject - the bean object whose retrieve methods are to be
invoked.
EJBException
public Collection executeRetrieveMethodCallsForBeanObjects(Collection beanObjects)
throws EJBException
beanObjects - the bean objects whose retrieve methods are to be
invoked.
EJBException
public Map executeRetrieveMethodCallsForBeanObjects(Map beanObjects)
throws EJBException
beanObjects - the bean objects whose retrieve methods are to be
invoked.
EJBException
protected Batch batchRetrieveMethodCallsForBeanObject(Batch batch,
BeanWrapper beanObject)
throws EJBException
beanObject - the bean object whose retrieve methods are to be
invoked.
EJBException
protected Batch batchRetrieveMethodCallsForBeanObjects(Batch batch,
Collection beanObjects)
throws EJBException
beanObjects - the bean objects whose retrieve methods are to be
invoked.
EJBExceptionpublic EJBLocalObject convertPrototypeFromDefaultDatabaseWildcards(EJBLocalObject beanObject)
beanObject - the prototype bean object to transform.
public EJBLocalObject convertPrototypeToDefaultDatabaseWildcards(EJBLocalObject beanObject)
beanObject - the prototype bean object to transform.
public abstract Collection doCommands(Collection commands)
throws EJBException
This method is not intended to be used by external clients.
commands - the batch of commands.
EJBExceptionpublic int getBadCommandIndex(boolean remove)
remove - true if the command index should be forgotten after the
call.
public Response doCommand(Command command)
throws EJBException
This method is not intended to be used by external clients.
command - the command to be executed.
EJBException
public abstract Response doCommand(Command command,
boolean oneOff)
throws EJBException
This method is not intended to be used by external clients.
command - the command to be executed.oneOff - true if this command is not associated with a
transaction, false otherwise.
EJBExceptionpublic boolean equals(Object another)
equals in interface Principalequals in class Objectanother - the object to compare with this container.
public String getName()
getName in interface Principalpublic String toString()
toString in interface PrincipaltoString in class Objectpublic int hashCode()
hashCode in interface PrincipalhashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||