org.elkoserver.server.context.caps
Class Definer
java.lang.Object
org.elkoserver.server.context.Mod
org.elkoserver.server.context.caps.Cap
org.elkoserver.server.context.caps.Definer
- All Implemented Interfaces:
- Cloneable, DispatchTarget, Encodable, ItemMod, ObjectCompletionWatcher, UserMod
public class Definer
- extends Cap
- implements ItemMod, UserMod
Capability to enable external definition of persistent C-U-I objects.
| Methods inherited from class org.elkoserver.server.context.Mod |
attachTo, clone, context, ensureHolding, ensureInContext, ensureReachable, ensureSameContext, ensureSameUser, holder, isEphemeral, markAsChanged, markAsEphemeral, object |
Definer
@JSONMethod
public Definer(JSONObject raw)
throws JSONDecodingException
- JSON-driven constructor.
- Throws:
JSONDecodingException
define
@JSONMethod(value={"into","ref","obj"})
public void define(User from,
OptString into,
OptString ref,
BasicObject obj)
throws MessageHandlerException
- Message handler for a 'define' message. This is a request to define a
new context, item, or user.
recv: { to:REF, op:"define", into:optREF,
ref:optREF, obj:OBJDESC }
send: { to:REF, op:"define", ref:REF }
- Parameters:
into - Container into which the new object should be placed
(optional, defaults to no container).ref - Reference string for the new object (optional, defaults to
an automatically generated ref).obj - JSON descriptor for the object itself
- Throws:
MessageHandlerException - if 'from' is not the holder of this
definer capability, or if an explicit ID is given but an object of
that ID is loaded, or if a container is given and that container
object is loaded, or if the object descriptor is not a valid context,
item or user descriptor.
encode
public JSONLiteral encode(EncodeControl control)
- Encode this mod for transmission or persistence.
- Specified by:
encode in interface Encodable
- Parameters:
control - Encode control determining what flavor of encoding
should be done.
- Returns:
- a JSON literal representing this object.