|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.wabit.dao.WabitSessionPersister
public class WabitSessionPersister
This class represents a Data Access Object for WabitSessions.
Special Case: If this persister receives a new WabitWorkspace the workspace in the session this persister is attached to must be cleaned up or removed. A new workspace event signals that an entire new set of objects that make up the workspace as a whole is about to be sent to the session. If the objects still exist in the workspace when the persister tries to create new objects exceptions will be thrown as an object with the same UUID will exist in the workspace.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface ca.sqlpower.dao.SPPersister |
|---|
ca.sqlpower.dao.SPPersister.DataType, ca.sqlpower.dao.SPPersister.SPPersistMethod |
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
objectsToRemove
WabitObject removal buffer, mapping of WabitObject UUIDs
to their parents |
protected java.util.Comparator<PersistedWabitObject> |
persistedObjectComparator
|
protected java.util.List<PersistedWabitObject> |
persistedObjects
Persisted WabitObject buffer, contains all the data that was
passed into the persistedObject call in the order of insertion |
protected java.util.Comparator<java.lang.String> |
removedObjectComparator
This comparator sorts buffered removeObject calls by each SPObject UUID. |
| Constructor Summary | |
|---|---|
WabitSessionPersister(java.lang.String name,
WabitSession session)
Creates a session persister that can update any object at or a descendant of the given session's workspace object. |
|
WabitSessionPersister(java.lang.String name,
WabitSession session,
WabitObject root)
Creates a session persister that can update an object at or a descendant of the given root now. |
|
| Method Summary | |
|---|---|
void |
begin()
Begins a transaction |
void |
commit()
Commits the persisted WabitObjects, its properties and removals |
void |
enforeThreadSafety()
|
boolean |
isHeadingToWisconsin()
|
boolean |
isUpdatingWabitWorkspace()
This is part of the 'echo-cancellation' system to notify any WorkspacePersisterListener listening to the same session to
ignore modifications to that session. |
void |
persistObject(java.lang.String parentUUID,
java.lang.String type,
java.lang.String uuid,
int index)
Persists a WabitObject given by its UUID, class name, and parent
UUID |
void |
persistProperty(java.lang.String uuid,
java.lang.String propertyName,
ca.sqlpower.dao.SPPersister.DataType propertyType,
java.lang.Object newValue)
Persists a WabitObject property unconditionally given by its
object UUID, property name, property type, and new value |
void |
persistProperty(java.lang.String uuid,
java.lang.String propertyName,
ca.sqlpower.dao.SPPersister.DataType propertyType,
java.lang.Object oldValue,
java.lang.Object newValue)
Persists a WabitObject property conditionally given by its object
UUID, property name, property type, expected old value, and new value |
void |
removeObject(java.lang.String parentUUID,
java.lang.String uuid)
Removes WabitObjects from persistent storage. |
void |
rollback()
|
void |
rollback(boolean force)
Rollback all changes to persistent storage to the beginning of the transaction |
void |
setGodMode(boolean godMode)
Turns this persister as a preacher of the truth and always the truth. |
java.lang.String |
toString()
|
static void |
undoForSession(WabitSession session,
java.util.List<PersistedObjectEntry> creations,
java.util.List<PersistedPropertiesEntry> properties,
java.util.List<RemovedObjectEntry> removals)
This static accessible method allows |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.List<PersistedWabitObject> persistedObjects
WabitObject buffer, contains all the data that was
passed into the persistedObject call in the order of insertion
protected final java.util.Comparator<java.lang.String> removedObjectComparator
SPObject UUID. The UUIDs being compared must matchup with an
existing SPObject in the root. If it does not exist, it means
that the SPObject has just been removed and this comparator is
reshuffling the map.
TODO We need a generic way of comparing
SPObjects. Instead of using the WabitObjectOrder enums which
currently exist in WabitWorkspace, QueryCache,
WabitOlapDimension and Page, we need to somehow make use
of the WabitObjectComparator instead.
protected java.util.Map<java.lang.String,java.lang.String> objectsToRemove
WabitObject removal buffer, mapping of WabitObject UUIDs
to their parents
protected final java.util.Comparator<PersistedWabitObject> persistedObjectComparator
| Constructor Detail |
|---|
public WabitSessionPersister(java.lang.String name,
WabitSession session)
public WabitSessionPersister(java.lang.String name,
WabitSession session,
WabitObject root)
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic void begin()
begin in interface ca.sqlpower.dao.SPPersister
public void commit()
throws ca.sqlpower.dao.SPPersistenceException
WabitObjects, its properties and removals
commit in interface ca.sqlpower.dao.SPPersisterca.sqlpower.dao.SPPersistenceException
public void persistObject(java.lang.String parentUUID,
java.lang.String type,
java.lang.String uuid,
int index)
throws ca.sqlpower.dao.SPPersistenceException
WabitObject given by its UUID, class name, and parent
UUID
A new WabitWorkspace object signals that there is a new workspace
being persisted and the current one attached to this listener must either
go away or clean up. See the class level documentation for more on this special
case.
persistObject in interface ca.sqlpower.dao.SPPersisterparentUUID - The parent UUID of the WabitObject to persisttype - The class name of the WabitObject to persistuuid - The UUID of the WabitObject to persistindex - The index of the WabitObject within its parents' list
of children
ca.sqlpower.dao.SPPersistenceException - Thrown if the property name is not known in this method.
public void persistProperty(java.lang.String uuid,
java.lang.String propertyName,
ca.sqlpower.dao.SPPersister.DataType propertyType,
java.lang.Object oldValue,
java.lang.Object newValue)
throws ca.sqlpower.dao.SPPersistenceException
WabitObject property conditionally given by its object
UUID, property name, property type, expected old value, and new value
persistProperty in interface ca.sqlpower.dao.SPPersisteruuid - The UUID of the WabitObject to persist the property
uponpropertyName - The property namepropertyType - The property typeoldValue - The expected old property valuenewValue - The new property value to persist
ca.sqlpower.dao.SPPersistenceException - Thrown if the property name is not known in this method.
public void persistProperty(java.lang.String uuid,
java.lang.String propertyName,
ca.sqlpower.dao.SPPersister.DataType propertyType,
java.lang.Object newValue)
throws ca.sqlpower.dao.SPPersistenceException
WabitObject property unconditionally given by its
object UUID, property name, property type, and new value
persistProperty in interface ca.sqlpower.dao.SPPersisteruuid - The UUID of the WabitObject to persist the property
uponpropertyName - The property namepropertyType - The property typenewValue - The new property value to persist
ca.sqlpower.dao.SPPersistenceException - Thrown if the property name is not known in this method.
public void removeObject(java.lang.String parentUUID,
java.lang.String uuid)
throws ca.sqlpower.dao.SPPersistenceException
WabitObjects from persistent storage.
removeObject in interface ca.sqlpower.dao.SPPersisterparentUUID - The parent UUID of the WabitObject to removeuuid - The UUID of the WabitObject to remove
ca.sqlpower.dao.SPPersistenceExceptionpublic void rollback()
rollback in interface ca.sqlpower.dao.SPPersisterpublic void rollback(boolean force)
ca.sqlpower.dao.SPPersistenceExceptionpublic boolean isHeadingToWisconsin()
public boolean isUpdatingWabitWorkspace()
WorkspacePersisterListener listening to the same session to
ignore modifications to that session.
public void enforeThreadSafety()
public void setGodMode(boolean godMode)
godMode - True or False
public static void undoForSession(WabitSession session,
java.util.List<PersistedObjectEntry> creations,
java.util.List<PersistedPropertiesEntry> properties,
java.util.List<RemovedObjectEntry> removals)
throws ca.sqlpower.dao.SPPersistenceException
session - creations - properties - removals -
ca.sqlpower.dao.SPPersistenceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||