|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.server.context.Mod
public abstract class Mod
Abstract base class to facilitate implementation of application-specific
mods that can be attached to basic objects (contexts, users, and items).
This class implements basic services needed by or useful to all mods,
regardless of application.
Subclasses need to implement application-specific mod logic as well as the
encode() method called for by the Encodable interface.
| Constructor Summary | |
|---|---|
protected |
Mod()
Base constructor. |
| Method Summary | |
|---|---|
void |
attachTo(BasicObject object)
Attach this mod to an object. |
Object |
clone()
Clone this object. |
Context |
context()
Obtain the context in which the object this mod is attached to is located, regardless of how deeply nested in containers the object might be. |
protected void |
ensureHolding(User who)
Guard function to guarantee that an operation being attempted by a user is being applied to an object that that user is holding. |
protected void |
ensureInContext(User who)
Guard function to guarantee that an operation being attempted by a user on an object that is contained by the user's context. |
protected void |
ensureReachable(User who)
Guard function to guarantee that an operation being attempted by a user is being applied to an object that that user is allowed to reach (either because it is in the context or because the user is holding it). |
protected void |
ensureSameContext(User who)
Guard function to guarantee that an operation being attempted by a user on an object is taking place in the same context as the object. |
protected void |
ensureSameUser(User who)
Guard function to guarantee that an operation being attempted by a user is being applied to that same user. |
protected BasicObject |
holder()
Obtain the user or context holding the object to which this mod is attached, regardless of how deeply nested in containers it might be. |
boolean |
isEphemeral()
Test if this mod is ephemeral. |
void |
markAsChanged()
Mark the object to which this mod is attached as having been changed and thus in need of checkpointing. |
void |
markAsEphemeral()
Mark this mod as being ephemeral. |
BasicObject |
object()
Obtain the object to which this mod is attached. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.elkoserver.json.Encodable |
|---|
encode |
| Constructor Detail |
|---|
protected Mod()
| Method Detail |
|---|
public void attachTo(BasicObject object)
Only one mod of any given class may be attached to any given object.
Application code will not normally need to call this method, since it is called automatically when an object is loaded from persistent storage. However, certain specialized applications that synthesize objects directly will need to use this to attach the mods they have constructed to the objects they have constructed.
object - The object to which this mod is to be attached.
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException
protected void ensureReachable(User who)
throws MessageHandlerException
MessageHandlerException exception.
who - The user who is attempting the operation.
MessageHandlerException - if the test fails.
protected void ensureHolding(User who)
throws MessageHandlerException
MessageHandlerException exception.
who - The user who is attempting the operation.
MessageHandlerException - if the test fails.
protected void ensureSameUser(User who)
throws MessageHandlerException
MessageHandlerException.
who - The user who is attempting the operation.
MessageHandlerException - if the test fails.
protected void ensureSameContext(User who)
throws MessageHandlerException
MessageHandlerException.
who - The user who is attempting the operation.
MessageHandlerException - if the test fails.
protected void ensureInContext(User who)
throws MessageHandlerException
MessageHandlerException.
who - The user who is attempting the operation.
MessageHandlerException - if the test fails.protected BasicObject holder()
public boolean isEphemeral()
markAsEphemeral() method.
public void markAsChanged()
public void markAsEphemeral()
public BasicObject object()
public Context context()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||