org.bsf.smartValueObject.mediator
Class HibernateMediator

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

public class HibernateMediator
extends java.lang.Object
implements Mediator

Mediator for Hibernate.


Field Summary
private  org.bsf.smartValueObject.mediator.MediatorConfig config
           
private static java.lang.Object DBNAME
           
private  java.lang.String indexField
           
private static org.apache.commons.logging.Log log
           
private static java.lang.String PASSWORD
           
private  net.sf.hibernate.SessionFactory sessions
           
private static java.lang.String USERNAME
           
 
Fields inherited from interface org.bsf.smartValueObject.mediator.Mediator
INDEXFIELD
 
Constructor Summary
HibernateMediator(org.bsf.smartValueObject.mediator.MediatorConfig config)
           
 
Method Summary
 void deleteGraph(java.lang.Object graph)
          Deletes a graph.
 java.lang.Object getGraph(java.lang.Object prototype)
          Retrieves a graph based on given prototype.
private  java.util.Properties getHsqlDbProperties()
          Gets configuration for HsqlDB.
private  java.util.Properties getMySqlProperties()
          Gets configuration for MySQL.
private  java.lang.Object getPK(java.lang.Object o)
          Gets primary key from object (from the field specied in indexField).
private  void initHibernate(java.util.Collection classes)
           
 org.bsf.smartValueObject.mediator.ChangeSummary updateGraph(java.lang.Object graph)
          Stores a graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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

sessions

private net.sf.hibernate.SessionFactory sessions

USERNAME

private static final java.lang.String USERNAME
See Also:
Constant Field Values

PASSWORD

private static final java.lang.String PASSWORD
See Also:
Constant Field Values

DBNAME

private static final java.lang.Object DBNAME

indexField

private java.lang.String indexField

config

private org.bsf.smartValueObject.mediator.MediatorConfig config
Constructor Detail

HibernateMediator

public HibernateMediator(org.bsf.smartValueObject.mediator.MediatorConfig config)
Method Detail

initHibernate

private void initHibernate(java.util.Collection classes)

getMySqlProperties

private java.util.Properties getMySqlProperties()
Gets configuration for MySQL.

Returns:

getHsqlDbProperties

private java.util.Properties getHsqlDbProperties()
Gets configuration for HsqlDB.

Returns:

getGraph

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

Specified by:
getGraph in interface Mediator
Parameters:
prototype - a prototype to obtain a initialized graph.
Returns:
Throws:
MediatorException

updateGraph

public org.bsf.smartValueObject.mediator.ChangeSummary updateGraph(java.lang.Object graph)
                                                            throws MediatorException
Stores a graph.

Specified by:
updateGraph in interface Mediator
Parameters:
graph - the root element of the 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

getPK

private java.lang.Object getPK(java.lang.Object o)
                        throws MediatorException
Gets primary key from object (from the field specied in indexField).

Parameters:
o -
Returns:
Throws:
MediatorException