com.waveset.object
Class SimulatedLighthouseContext

java.lang.Object
  extended bycom.waveset.object.AbstractLighthouseContext
      extended bycom.waveset.object.SimulatedLighthouseContext
All Implemented Interfaces:
CacheConsistencyNumberLoader, LighthouseContext, ObjectLoader, ObjectSource

public class SimulatedLighthouseContext
extends AbstractLighthouseContext

A base implementation of LighthouseContext that throws exceptions for unimplemented methods, and stubs out others. Custom contexts may wish to subclass this rather than implement LighthouseContext to reduce the number of methods that need to be implemented.


Field Summary
static java.lang.String code_id
           
 
Fields inherited from interface com.waveset.object.LighthouseContext
COMP_ACCESS_POLICY, COMP_AUTH_CACHE, COMP_LOGIN_CONFIG_INFO, COMP_PROVISIONER, COMP_RECONCILER, COMP_REPOSITORY, COMP_SUBJECT_AUTH_CACHE, COMP_TASK_MANAGER, COMP_WORKFLOW, OP_CACHE, OP_CACHE_TIMEOUT, OP_CLEAR_CACHE, OP_NO_RESULT
 
Fields inherited from interface com.waveset.object.ObjectSource
HIGH_VALUES, OP_ALLOW_NOT_FOUND, OP_ATTRIBUTES, OP_BLOCK_SIZE, OP_BUFFERED, OP_CONDITIONS, OP_END_BEFORE, OP_FAST, OP_FILTER, OP_FORCE, OP_KEEP_LOCK, OP_MAX_ROWS, OP_NO_CACHE, OP_NO_RULE_DRIVEN_MEMBERS, OP_ONLY_NAMES, OP_ORDER_BY, OP_START_AFTER, OP_SUBJECT, OP_SUBTYPES, OP_USER
 
Constructor Summary
SimulatedLighthouseContext()
          Build a new empty context.
SimulatedLighthouseContext(java.lang.String filename)
          Build a context persisting data in the given file.
 
Method Summary
 WavesetResult checkinObject(PersistentObject obj, java.util.Map options)
          Create a new object.
 WavesetResult checkinView(GenericObject view, java.util.Map options)
          Checkin a view.
 GenericObject checkoutView(java.lang.String id, java.util.Map options)
          Checkout a view.
 WavesetResult commitView(GenericObject view, java.util.Map options)
          Commit a view.
 GenericObject createView(java.lang.String id, java.util.Map options)
          Create a view.
 QueryResult getObjects(java.lang.Object type, java.util.Map options)
          Get a list of objects of a given type.
 GenericObject getSystemConfiguration()
          Return the system configuration object.
 GenericObject getView(java.lang.String id, java.util.Map options)
          Get a view.
 QueryResult listObjects(java.lang.Object type, java.util.Map options)
          Get a list of summary attributes for objects of a given type.
 void load()
          Load the context from the persistence file.
 void load(java.lang.String filename)
          Load the context from the given persistence file.
 void renameObject(java.lang.Object type, java.lang.String id, java.lang.String newName, java.util.Map options)
          Rename an object.
 TaskInstance runTask(TaskTemplate tt)
          Launch a task defined by a task template.
 void save()
          Save the current state of the context into the persistence file.
 void save(java.lang.String filename)
          Save the current state of the context to the given persistence file.
 void setFilename(java.lang.String filename)
          Set the file to be used for persistent storage.
 void unlockView(GenericObject view, java.util.Map options)
          Unlock a view.
 
Methods inherited from class com.waveset.object.AbstractLighthouseContext
breakLock, callResourceMethod, checkoutObject, checkPermission, checkPermission, checkPermissionToAnyAuthTypeSubType, checkReferencePermissions, clearResourceObjectGetCache, clearResourceObjectGetCache, clearResourceObjectListCache, clearResourceObjectListCache, countObjects, countObjects, deleteObject, deleteObjects, deleteView, extendedOperation, getAuthenticatedContext, getAuthenticatedContext, getAuthenticatedContext, getAuthenticatedContext, getCache, getCacheConsistencyNumber, getComponent, getForm, getLock, getObject, getObject, getObjectIfExists, getObjectIfExists, getResourceObject, getResourceObjects, getSubject, getTopControlledObjectGroups, getUser, listResourceObjects, listResourceObjects, loadObject, loadObjects, lockObject, log, logFailure, logFailure, logResultErrors, logSuccess, logSuccess, nextBlock, previousBlock, refreshView, setSubject, setUser, subjectControlsObjectGroup, subjectHasRight, subjectHasRightToAnyAuthTypeSubType, subjectIsAssignedAdminGroups, testPermission, testPermission, unlockObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

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

SimulatedLighthouseContext

public SimulatedLighthouseContext()
Build a new empty context.


SimulatedLighthouseContext

public SimulatedLighthouseContext(java.lang.String filename)
Build a context persisting data in the given file.

Method Detail

setFilename

public void setFilename(java.lang.String filename)
Set the file to be used for persistent storage.


load

public void load()
          throws WavesetException
Load the context from the persistence file. The current contents of the cache will be lost.

Throws:
WavesetException

load

public void load(java.lang.String filename)
          throws WavesetException
Load the context from the given persistence file. The current contents of the cache will be lost.

Throws:
WavesetException

save

public void save()
          throws WavesetException
Save the current state of the context into the persistence file. Note that this does not maintain a "write through" cache, modified objects continue to live in memory until the context is explicitly flushed.

Throws:
WavesetException

save

public void save(java.lang.String filename)
          throws WavesetException
Save the current state of the context to the given persistence file.

Throws:
WavesetException

getSystemConfiguration

public GenericObject getSystemConfiguration()
                                     throws WavesetException
Description copied from class: AbstractLighthouseContext
Return the system configuration object.

Specified by:
getSystemConfiguration in interface ObjectSource
Overrides:
getSystemConfiguration in class AbstractLighthouseContext
Throws:
WavesetException

checkinObject

public WavesetResult checkinObject(PersistentObject obj,
                                   java.util.Map options)
                            throws ItemNotFound,
                                   ItemNotLocked,
                                   LockedByAnother,
                                   WavesetException
Create a new object. One of the more significant differences between this and the real server is that we don't have the CheckinVisitor or automatic resolution of references.

Specified by:
checkinObject in interface ObjectSource
Overrides:
checkinObject in class AbstractLighthouseContext
Throws:
ItemNotFound
ItemNotLocked
LockedByAnother
WavesetException

renameObject

public void renameObject(java.lang.Object type,
                         java.lang.String id,
                         java.lang.String newName,
                         java.util.Map options)
                  throws ItemNotFound,
                         LockedByAnother,
                         AlreadyExists,
                         WavesetException
Rename an object.

The object must unlocked, or locked by the current user. It will be implicitly locked to perform the rename.

Specified by:
renameObject in interface ObjectSource
Overrides:
renameObject in class AbstractLighthouseContext
Throws:
ItemNotFound
LockedByAnother
AlreadyExists
WavesetException

listObjects

public QueryResult listObjects(java.lang.Object type,
                               java.util.Map options)
                        throws WavesetException
Get a list of summary attributes for objects of a given type. We're ignoring the orderBy option in this simulation.

Specified by:
listObjects in interface ObjectSource
Overrides:
listObjects in class AbstractLighthouseContext
Throws:
WavesetException

getObjects

public QueryResult getObjects(java.lang.Object type,
                              java.util.Map options)
                       throws WavesetException
Get a list of objects of a given type.

Specified by:
getObjects in interface ObjectSource
Overrides:
getObjects in class AbstractLighthouseContext
Throws:
WavesetException

getView

public GenericObject getView(java.lang.String id,
                             java.util.Map options)
                      throws WavesetException
Description copied from interface: ObjectSource
Get a view.

Specified by:
getView in interface ObjectSource
Overrides:
getView in class AbstractLighthouseContext
Throws:
WavesetException

createView

public GenericObject createView(java.lang.String id,
                                java.util.Map options)
                         throws WavesetException
Description copied from interface: ObjectSource
Create a view.

Specified by:
createView in interface ObjectSource
Overrides:
createView in class AbstractLighthouseContext
Throws:
WavesetException

checkoutView

public GenericObject checkoutView(java.lang.String id,
                                  java.util.Map options)
                           throws WavesetException
Description copied from interface: ObjectSource
Checkout a view.

Specified by:
checkoutView in interface ObjectSource
Overrides:
checkoutView in class AbstractLighthouseContext
Throws:
WavesetException

checkinView

public WavesetResult checkinView(GenericObject view,
                                 java.util.Map options)
                          throws WavesetException
Description copied from interface: ObjectSource
Checkin a view.

Specified by:
checkinView in interface ObjectSource
Overrides:
checkinView in class AbstractLighthouseContext
Throws:
WavesetException

commitView

public WavesetResult commitView(GenericObject view,
                                java.util.Map options)
                         throws WavesetException
Description copied from interface: ObjectSource
Commit a view.

Specified by:
commitView in interface ObjectSource
Overrides:
commitView in class AbstractLighthouseContext
Throws:
WavesetException

unlockView

public void unlockView(GenericObject view,
                       java.util.Map options)
                throws WavesetException
Description copied from interface: ObjectSource
Unlock a view.

Specified by:
unlockView in interface ObjectSource
Overrides:
unlockView in class AbstractLighthouseContext
Throws:
WavesetException

runTask

public TaskInstance runTask(TaskTemplate tt)
                     throws WavesetException
Launch a task defined by a task template.

Specified by:
runTask in interface LighthouseContext
Overrides:
runTask in class AbstractLighthouseContext
Throws:
WavesetException