org.persvr.datasource
Class RootDataSource

java.lang.Object
  extended by org.persvr.datasource.RootDataSource
All Implemented Interfaces:
DataSource, WritableDataSource

public class RootDataSource
extends java.lang.Object
implements WritableDataSource


Constructor Summary
RootDataSource()
           
 
Method Summary
 void abortTransaction()
           
 void addSourceConfigObject(java.lang.String sourceName, ObjectId configObject)
           
 void commitTransaction()
           
 java.lang.Object getFieldValue(LazyPropertyId valueId)
          This is called when a field value contains an unfulfilled value (ValueId)
 java.lang.String getId()
          Gets a string identification of the data source
 boolean hiddenId(java.lang.String id)
           
 void initParameters(java.util.Map parameters)
          This is called on initialization and provides access to the data source configuration parameters
 void mapObject(PersistableInitializer initializer, java.lang.String objectId)
          This is called when an object is being activated to retrieve the persisted data for a given object
 java.util.Iterator mapQuery(Query query)
          This is called when an object is being activated to retrieve the persisted data for a given object with a filter
 void recordDelete(java.lang.String objectId)
          This is called when an object should be deleted
 void recordListAdd(java.lang.String objectId, java.lang.Object value)
           
 void recordListRemoval(java.lang.String objectId, java.lang.Object value)
           
 NewObjectPersister recordNewObject(Persistable object)
          This is called when a new object is persisted
 void recordPropertyAddition(java.lang.String objectId, java.lang.String name, java.lang.Object value, int attributes)
          This is called when a new property is added to an object
 void recordPropertyChange(java.lang.String objectId, java.lang.String name, java.lang.Object value, int attributes)
          This is called when a property value is changed
 void recordPropertyRemoval(java.lang.String objectId, java.lang.String name)
          This is called when a property value is removed
 void setId(java.lang.String id)
          Sets a string identification of the data source
 void startTransaction()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RootDataSource

public RootDataSource()
Method Detail

abortTransaction

public void abortTransaction()
                      throws java.lang.Exception
Specified by:
abortTransaction in interface WritableDataSource
Throws:
java.lang.Exception

commitTransaction

public void commitTransaction()
                       throws java.lang.Exception
Specified by:
commitTransaction in interface WritableDataSource
Throws:
java.lang.Exception

startTransaction

public void startTransaction()
                      throws java.lang.Exception
Specified by:
startTransaction in interface WritableDataSource
Throws:
java.lang.Exception

hiddenId

public boolean hiddenId(java.lang.String id)
Specified by:
hiddenId in interface DataSource

recordNewObject

public NewObjectPersister recordNewObject(Persistable object)
                                   throws java.lang.Exception
Description copied from interface: WritableDataSource
This is called when a new object is persisted

Specified by:
recordNewObject in interface WritableDataSource
Returns:
persister
Throws:
java.lang.Exception

recordDelete

public void recordDelete(java.lang.String objectId)
                  throws java.lang.Exception
Description copied from interface: WritableDataSource
This is called when an object should be deleted

Specified by:
recordDelete in interface WritableDataSource
Throws:
java.lang.Exception

recordListAdd

public void recordListAdd(java.lang.String objectId,
                          java.lang.Object value)
                   throws java.lang.Exception
Throws:
java.lang.Exception

recordListRemoval

public void recordListRemoval(java.lang.String objectId,
                              java.lang.Object value)
                       throws java.lang.Exception
Throws:
java.lang.Exception

recordPropertyAddition

public void recordPropertyAddition(java.lang.String objectId,
                                   java.lang.String name,
                                   java.lang.Object value,
                                   int attributes)
                            throws java.lang.Exception
Description copied from interface: WritableDataSource
This is called when a new property is added to an object

Specified by:
recordPropertyAddition in interface WritableDataSource
value - - The value should generally be an object one of the following classes: String, Boolean, Integer, Double, Date, ObjectId, or a null If the value is an ObjectId than it indicates that it is a reference to another object. The data source can check isPersisted to see if the object has been persisted yet. If it is true than it means it means it has already been persisted. If it is false, the object has not been persisted yet. If the data source can handle a new object at this point, it should call ObjectId.persist to persist the object
attributes - TODO
Throws:
java.lang.Exception

recordPropertyChange

public void recordPropertyChange(java.lang.String objectId,
                                 java.lang.String name,
                                 java.lang.Object value,
                                 int attributes)
                          throws java.lang.Exception
Description copied from interface: WritableDataSource
This is called when a property value is changed

Specified by:
recordPropertyChange in interface WritableDataSource
attributes - TODO
Throws:
java.lang.Exception

recordPropertyRemoval

public void recordPropertyRemoval(java.lang.String objectId,
                                  java.lang.String name)
                           throws java.lang.Exception
Description copied from interface: WritableDataSource
This is called when a property value is removed

Specified by:
recordPropertyRemoval in interface WritableDataSource
Throws:
java.lang.Exception

getFieldValue

public java.lang.Object getFieldValue(LazyPropertyId valueId)
                               throws java.lang.Exception
Description copied from interface: DataSource
This is called when a field value contains an unfulfilled value (ValueId)

Specified by:
getFieldValue in interface DataSource
Returns:
the real value referred to by valueId
Throws:
java.lang.Exception

getId

public java.lang.String getId()
Description copied from interface: DataSource
Gets a string identification of the data source

Specified by:
getId in interface DataSource
Returns:

addSourceConfigObject

public void addSourceConfigObject(java.lang.String sourceName,
                                  ObjectId configObject)

initParameters

public void initParameters(java.util.Map parameters)
                    throws java.lang.Exception
Description copied from interface: DataSource
This is called on initialization and provides access to the data source configuration parameters

Specified by:
initParameters in interface DataSource
Throws:
java.lang.Exception

mapObject

public void mapObject(PersistableInitializer initializer,
                      java.lang.String objectId)
               throws java.lang.Exception
Description copied from interface: DataSource
This is called when an object is being activated to retrieve the persisted data for a given object

Specified by:
mapObject in interface DataSource
Throws:
java.lang.Exception

setId

public void setId(java.lang.String id)
Description copied from interface: DataSource
Sets a string identification of the data source

Specified by:
setId in interface DataSource

mapQuery

public java.util.Iterator mapQuery(Query query)
                            throws java.lang.Exception
Description copied from interface: DataSource
This is called when an object is being activated to retrieve the persisted data for a given object with a filter

Specified by:
mapQuery in interface DataSource
Returns:
Throws:
java.lang.Exception