org.bsf.smartValueObject.mediator
Class EjbSvoMediator

java.lang.Object
  |
  +--org.bsf.smartValueObject.mediator.EjbSvoMediator
All Implemented Interfaces:
Mediator

public class EjbSvoMediator
extends java.lang.Object
implements Mediator

A mediator for EJBs. This class is to be used by a session facade to retrieve/update objects based on graph of VOs. Right now we use a dummy implementation to simulate real ejb lookups. Implementation is not yet finished !


Field Summary
private  java.lang.Class clazz
          The class of the VO.
private  java.util.Map config
          To config lookups etc.
private  javax.naming.Context context
           
static java.lang.String CONTEXT
           
private  java.lang.Class homeClass
           
static java.lang.String HOMECLASS
           
private  java.lang.String indexField
          The index field of the VO
private static org.apache.commons.logging.Log log
           
private  java.util.Map objects
           
 
Fields inherited from interface org.bsf.smartValueObject.mediator.Mediator
INDEXFIELD
 
Constructor Summary
EjbSvoMediator(java.lang.Class clazz, java.util.Map config)
          Creates a mediator for the given class.
 
Method Summary
private  java.lang.Object createNewVO()
          Gets an 'empty' VO.
 void deleteGraph(java.lang.Object graph)
          Deletes a graph.
private  javax.naming.Context getContext()
          Gets initial context.
 java.lang.Object getGraph(java.lang.Object prototype)
          Retrieves graph based on given prototype.
private  java.lang.Object lookFor(java.lang.Object o)
           
private  java.lang.Object lookForEJB(java.lang.Object index)
           
private  java.lang.Object lookForIndex(java.lang.Object index)
           
private  void readConfig(java.util.Map config)
           
private  void storeEJB(java.lang.Object graph)
           
 void updateGraph(java.lang.Object graph)
          Stores graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

clazz

private java.lang.Class clazz
The class of the VO.


config

private java.util.Map config
To config lookups etc.


indexField

private java.lang.String indexField
The index field of the VO


objects

private java.util.Map objects

context

private javax.naming.Context context

homeClass

private java.lang.Class homeClass

CONTEXT

public static final java.lang.String CONTEXT
See Also:
Constant Field Values

HOMECLASS

public static final java.lang.String HOMECLASS
See Also:
Constant Field Values
Constructor Detail

EjbSvoMediator

public EjbSvoMediator(java.lang.Class clazz,
                      java.util.Map config)
Creates a mediator for the given class.

Parameters:
clazz - the class of the VO.
config - configuration parameters.
Method Detail

getGraph

public java.lang.Object getGraph(java.lang.Object prototype)
                          throws MediatorException
Retrieves graph based on given prototype.

Specified by:
getGraph in interface Mediator
Parameters:
prototype -
Returns:
Throws:
MediatorException

updateGraph

public void updateGraph(java.lang.Object graph)
                 throws MediatorException
Stores graph.

Specified by:
updateGraph in interface Mediator
Parameters:
graph -
Throws:
MediatorException

deleteGraph

public void deleteGraph(java.lang.Object graph)
                 throws MediatorException
Deletes a graph.

Specified by:
deleteGraph in interface Mediator
Parameters:
graph - the root element of the graph.
Throws:
MediatorException

storeEJB

private void storeEJB(java.lang.Object graph)
               throws MediatorException
MediatorException

lookFor

private java.lang.Object lookFor(java.lang.Object o)
                          throws MediatorException
MediatorException

lookForEJB

private java.lang.Object lookForEJB(java.lang.Object index)
                             throws MediatorException
MediatorException

lookForIndex

private java.lang.Object lookForIndex(java.lang.Object index)

readConfig

private void readConfig(java.util.Map config)

createNewVO

private java.lang.Object createNewVO()
                              throws MediatorException
Gets an 'empty' VO.

Returns:
Throws:
MediatorException

getContext

private javax.naming.Context getContext()
Gets initial context.