org.elkoserver.server.context.caps
Class ContextKeyCap

java.lang.Object
  extended by org.elkoserver.server.context.Mod
      extended by org.elkoserver.server.context.caps.Cap
          extended by org.elkoserver.server.context.caps.ContextKeyCap
All Implemented Interfaces:
Cloneable, DispatchTarget, Encodable, ContextKey, ItemMod, ObjectCompletionWatcher, UserMod

public class ContextKeyCap
extends Cap
implements ItemMod, UserMod, ContextKey

Capability to enable entry to one or more entry controlled contexts.


Constructor Summary
ContextKeyCap(JSONObject raw, String[] contexts)
          JSON-driven constructor.
 
Method Summary
 boolean enablesEntry(String contextRef)
          Test if this capability enables entry to a particular context.
 JSONLiteral encode(EncodeControl control)
          Encode this mod for transmission or persistence.
 
Methods inherited from class org.elkoserver.server.context.caps.Cap
delete, encodeDefaultParameters, ensureValid, isExpired, objectIsComplete, setlabel, spawn, transfer
 
Methods inherited from class org.elkoserver.server.context.Mod
attachTo, clone, context, ensureHolding, ensureInContext, ensureReachable, ensureSameContext, ensureSameUser, holder, isEphemeral, markAsChanged, markAsEphemeral, object
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextKeyCap

@JSONMethod(value="contexts")
public ContextKeyCap(JSONObject raw,
                                     String[] contexts)
              throws JSONDecodingException
JSON-driven constructor.

Parameters:
contexts - Array of refs for the contexts to which this key grants entry permission.
Throws:
JSONDecodingException
Method Detail

enablesEntry

public boolean enablesEntry(String contextRef)
Test if this capability enables entry to a particular context.

Specified by:
enablesEntry in interface ContextKey
Parameters:
contextRef - Reference string of the context of interest.
Returns:
true if this capability enables entry to the context designated by 'contextRef', false if not.

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.