au.gov.tas.dpiwe.mr.bean
Class NullBean

java.lang.Object
  extended by au.gov.tas.dpiwe.mr.bean.NullBean
All Implemented Interfaces:
SimpleValidator, WrappedBean, ContainerChangeListener, Serializable, EventListener, EnterpriseBean, EntityBean
Direct Known Subclasses:
Artist, Bean, Board, Card, CD, Credit, DebugBean, Deck, Deed, HistoricCommand, MonopolySet, MrSiameseBean, Song, Square, ThinSiameseBean, Token, Track

public abstract class NullBean
extends Object
implements Serializable, ContainerChangeListener, SimpleValidator, WrappedBean

All the methods herein (except containerChanged(), getBeanObject(), throwEJBException() and simpleValidate()) must be provided to implement an entity bean.

However, most container-managed local entity beans won't care about the events these callbacks represent, so null implementations will probably suffice and are provided in this class as a convenience.

Since:
Mr Architecture 1.0
Version:
1.0.0.4
Author:
Kade Hansson
See Also:
Serialized Form

Field Summary
protected  Container container
          The container associated with this bean.
protected  EntityContext context
          The entity context associated with this bean.
protected  BeanWrapper wrapper
          For a cloned bean, contains a reference to the bean wrapper.
 
Constructor Summary
NullBean()
          All entity beans must provide a public no-argument constructor.
 
Method Summary
 Object clone()
          Produces a shallow copy of this bean.
 void containerChanged(ContainerChangeEvent event)
          Event handler called when the ownership of this bean has changed from ClientContainer to ServerContainer or vice versa.
 void ejbActivate()
          Callback issued upon resurrecting a serialized bean.
 void ejbLoad()
          Callback issued prior to refreshing a bean with its persistent storage.
 void ejbPassivate()
          Callback issued prior to serializing a bean.
 void ejbRemove()
          Callback issued prior to removing a bean from persistent storage.
 void ejbStore()
          Callback issued prior to committing a bean to persistent storage.
 BeanWrapper getBeanObject()
          Internal method to determine the bean wrapper associated with this entity bean.
 void setEntityContext(EntityContext context)
          Callback issued when a bean is placed in a container.
 void simpleValidate()
          Makes simple data validity checks for this bean based on the MetaData associated with the home.
protected  Object throwEJBException(String message)
          Utility method to throw an EJB exception with the specified detail message.
 void unsetEntityContext()
          Callback issued when a bean is removed from a container.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected transient EntityContext context
The entity context associated with this bean. The entity context provides access to the bean's environment.


container

protected transient Container container
The container associated with this bean. Use of this field by beans may impair their operation with containers other than the Mr Architecture Container.


wrapper

protected transient BeanWrapper wrapper
For a cloned bean, contains a reference to the bean wrapper.

Constructor Detail

NullBean

public NullBean()
All entity beans must provide a public no-argument constructor.

Method Detail

ejbActivate

public void ejbActivate()
                 throws RemoteException
Callback issued upon resurrecting a serialized bean.

Specified by:
ejbActivate in interface EntityBean
Throws:
RemoteException - never.

ejbPassivate

public void ejbPassivate()
                  throws RemoteException
Callback issued prior to serializing a bean.

Specified by:
ejbPassivate in interface EntityBean
Throws:
RemoteException - never.

ejbLoad

public void ejbLoad()
Callback issued prior to refreshing a bean with its persistent storage.

Specified by:
ejbLoad in interface EntityBean

ejbStore

public void ejbStore()
Callback issued prior to committing a bean to persistent storage.

Specified by:
ejbStore in interface EntityBean

ejbRemove

public void ejbRemove()
Callback issued prior to removing a bean from persistent storage.

Specified by:
ejbRemove in interface EntityBean

throwEJBException

protected Object throwEJBException(String message)
                            throws EJBException
Utility method to throw an EJB exception with the specified detail message.

Parameters:
message - the detail of what caused the exception.
Returns:
never.
Throws:
EJBException - always.

setEntityContext

public void setEntityContext(EntityContext context)
Callback issued when a bean is placed in a container.

Specified by:
setEntityContext in interface EntityBean
Parameters:
context - provides access to the bean's environment.

unsetEntityContext

public void unsetEntityContext()
Callback issued when a bean is removed from a container.

Specified by:
unsetEntityContext in interface EntityBean

containerChanged

public void containerChanged(ContainerChangeEvent event)
Event handler called when the ownership of this bean has changed from ClientContainer to ServerContainer or vice versa.

Specified by:
containerChanged in interface ContainerChangeListener
Parameters:
event - the event which describes the new container.

getBeanObject

public BeanWrapper getBeanObject()
Internal method to determine the bean wrapper associated with this entity bean.

Specified by:
getBeanObject in interface WrappedBean
Returns:
the bean wrapper, if this bean was originally cloned and has such a wrapper, otherwise null.

simpleValidate

public void simpleValidate()
                    throws ValidateException
Makes simple data validity checks for this bean based on the MetaData associated with the home.

Specified by:
simpleValidate in interface SimpleValidator
Throws:
ValidateException - if the data in this bean is invalid under these checks.

clone

public Object clone()
             throws CloneNotSupportedException
Produces a shallow copy of this bean.

Overrides:
clone in class Object
Returns:
a shallow copy of this bean.
Throws:
CloneNotSupportedException - if this bean does not allow itself to be cloned.