com.waveset.workflow
Class LighthouseSimulator

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

public class LighthouseSimulator
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
LighthouseSimulator()
          Build a new empty context.
LighthouseSimulator(java.lang.String path)
          Build a context including data from the given file or directory.
 
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.
 void clear()
          Clear the contents of the simulator's "memory".
 WavesetResult commitView(GenericObject view, java.util.Map options)
          Commit a view.
 GenericObject createView(java.lang.String id, java.util.Map options)
          Create a view.
 void deleteObject(java.lang.Object type, java.lang.String id, java.util.Map options)
          Delete an object.
 void dump(java.lang.String file)
          Dump the current state of the context into a file.
 LighthouseContext getAuthenticatedContext(java.lang.String user)
          Derive a context for a particular user.
 Form getForm(GenericObject view, java.util.Map options)
          Get the form to be used with a view.
 java.lang.String getUser()
          Returns the effective user name for an authenticated context.
 GenericObject getView(java.lang.String id, java.util.Map options)
          Get a view.
 void load()
          Load the context from the current working directory.
 void load(java.lang.String path)
          Load objects from a file or directory.
static void println(java.lang.Object msg)
           
 GenericObject refreshView(GenericObject view, java.util.Map options)
          Refresh a view.
 void renameObject(java.lang.Object type, java.lang.String id, java.lang.String newName, java.util.Map options)
          Rename an object.
 void setNewDirectory(java.lang.String path)
          Set the directory used for the creation of new objects.
 void setReadOnly(boolean b)
           
 void setTrace(boolean b)
           
 void setUser(java.lang.String s)
          Change the effective user for logical locking.
 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, deleteObjects, deleteView, extendedOperation, getAuthenticatedContext, getAuthenticatedContext, getAuthenticatedContext, getCache, getCacheConsistencyNumber, getComponent, getLock, getObject, getObject, getObjectIfExists, getObjectIfExists, getObjects, getResourceObject, getResourceObjects, getSubject, getSystemConfiguration, getTopControlledObjectGroups, listObjects, listResourceObjects, listResourceObjects, loadObject, loadObjects, lockObject, log, logFailure, logFailure, logResultErrors, logSuccess, logSuccess, nextBlock, previousBlock, runTask, setSubject, 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

LighthouseSimulator

public LighthouseSimulator()
Build a new empty context.


LighthouseSimulator

public LighthouseSimulator(java.lang.String path)
Build a context including data from the given file or directory. If the path is to a directory, we will auto-load all files in that directory, and enable write-through storage to those files.

If the path is to a file, we will load the objects in that file, but write-through storage will not be available, the objects will persist only in memory.

Method Detail

setReadOnly

public void setReadOnly(boolean b)

setTrace

public void setTrace(boolean b)

setUser

public void setUser(java.lang.String s)
Description copied from interface: LighthouseContext
Change the effective user for logical locking. This should only be called if you know this is a private context that won't be shared by another thread. Here the user is specified by name.

Specified by:
setUser in interface LighthouseContext
Overrides:
setUser in class AbstractLighthouseContext

println

public static void println(java.lang.Object msg)

setNewDirectory

public void setNewDirectory(java.lang.String path)
Set the directory used for the creation of new objects. If a directory had previously been loaded into the simulator, this will be the default directory for new objects.


clear

public void clear()
Clear the contents of the simulator's "memory".


load

public void load()
          throws WavesetException
Load the context from the current working directory.

Throws:
WavesetException

load

public void load(java.lang.String path)
Load objects from a file or directory.

If the given path is to a directory, we will automatically load all files in that directory that contain a single object and enable write-through persistence. If you don't want write-through persistence, use setReadOnly().

The first directory you load will become the default directory for the storage of new objects. If you want new objects to be stored in a different directory, use setNewDirectory().

If the given path is to a file, and the file contains a single object, the object is loaded and write-through persistence is enabled. If the file contains multiple objects, all objects in the file are loaded, but the write-through persistence will not be enabled for those objects.


dump

public void dump(java.lang.String file)
          throws WavesetException
Dump the current state of the context into a file.

Throws:
WavesetException

getUser

public java.lang.String getUser()
Description copied from interface: LighthouseContext
Returns the effective user name for an authenticated context. Returns null for an anonymous context.

Specified by:
getUser in interface LighthouseContext
Overrides:
getUser in class AbstractLighthouseContext

getAuthenticatedContext

public LighthouseContext getAuthenticatedContext(java.lang.String user)
Derive a context for a particular user. Called by the ViewMaster constructor.

Specified by:
getAuthenticatedContext in interface LighthouseContext
Overrides:
getAuthenticatedContext in class AbstractLighthouseContext

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

deleteObject

public void deleteObject(java.lang.Object type,
                         java.lang.String id,
                         java.util.Map options)
                  throws ItemNotFound,
                         LockedByAnother,
                         WavesetException
Delete an object.

The force flag may be set to bypass any constraint checking that the context implementation may perform.

Specified by:
deleteObject in interface ObjectSource
Overrides:
deleteObject in class AbstractLighthouseContext
Throws:
ItemNotFound
LockedByAnother
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

getForm

public Form getForm(GenericObject view,
                    java.util.Map options)
             throws WavesetException
Description copied from interface: ObjectSource
Get the form to be used with a view.

Specified by:
getForm in interface ObjectSource
Overrides:
getForm 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

refreshView

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

Specified by:
refreshView in interface ObjectSource
Overrides:
refreshView 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