com.livis.livingtalks.ejb
Class EntityHandler
java.lang.Object
|
+--com.livis.livingtalks.ejb.EntityHandler
- Direct Known Subclasses:
- CachingEntityHandler
- public class EntityHandler
- extends java.lang.Object
EntityHandler is a generic class capable of acting as a fassade to any of our entity beans.
In an ideal world, our entity beans would have been derived from a common base class.
General algorithms acting on them would then have used the base class interface.
We have at least one such algorithm in our system: the cache. Therefore, we need a solution.
EJBs are components, not objects, and cannot be derived from each other.
The first idea is that their implementations can, but wait: Imagine we would have definded a base method
setModel (AbstractModel m)
in our entity bean base class. Then, because of RMI-IIOP
we would have got a Corba-Exception when calling setModel
with, e.g., an AuthorModel m
as argument. The solution presented here encapsulates all breaches of object-oriented design in this single file.
This is also a nice example where the difference between RMI-IIOP and RMI affects the entire system design.
Constructor Summary |
protected |
EntityHandler(java.lang.String homeName,
java.lang.Class homeClass)
|
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
getterModel
protected java.lang.reflect.Method getterModel
setterModel
protected java.lang.reflect.Method setterModel
creatorModel
protected java.lang.reflect.Method creatorModel
finderByPrimaryKey
protected java.lang.reflect.Method finderByPrimaryKey
finderAll
protected java.lang.reflect.Method finderAll
finder1
protected java.lang.reflect.Method finder1
finder1a
protected java.lang.reflect.Method finder1a
finder2
protected java.lang.reflect.Method finder2
EntityHandler
protected EntityHandler(java.lang.String homeName,
java.lang.Class homeClass)
getModel
public AbstractModel getModel(java.lang.String key)
getShortmodel
public AbstractModel getShortmodel(java.lang.String key)
setModel
public void setModel(AbstractModel model)
throws javax.ejb.CreateException
remove
public void remove(java.lang.String key)
throws com.livis.livingtalks.ejb.RemoveException
create
public java.lang.String create(AbstractModel model)
throws javax.ejb.CreateException
getShortmodelsAll
public java.util.Collection getShortmodelsAll()
getKeysAll
public java.util.Collection getKeysAll()
getKeys1
public java.util.Collection getKeys1(java.lang.Object a)
getKeys1a
public java.util.Collection getKeys1a(java.lang.Object a)
getKeys2
public java.util.Collection getKeys2(java.lang.Object a,
java.lang.Object b)