Class AgentContext

java.lang.Object
i5.las2peer.security.AgentContext
All Implemented Interfaces:
AgentStorage

public class AgentContext
extends java.lang.Object
implements AgentStorage
A context that can be created for an agent to perform operations in the network. Cached in the node for remembering unlocked agents. Used for messaging and service calls.
  • Constructor Summary

    Constructors 
    Constructor Description
    AgentContext​(Node localNode, AgentImpl mainAgent)
    Creates a new (local) context.
  • Method Summary

    Modifier and Type Method Description
    AgentImpl getAgent​(java.lang.String id)
    Uses this context as AgentStorage.
    static AgentContext getCurrent()
    Gets the current las2peer context.
    long getLastUsageTimestamp()
    Returns the time of the last usage of this context.
    Node getLocalNode()
    Gives access to the local node.
    AgentImpl getMainAgent()
    Gets the main agent of this context.
    boolean hasAccess​(java.lang.String agentId)
    Checks if the agent can be accessed (e.g. unlocked) from this context.
    boolean hasAgent​(java.lang.String id)
    does this storage know the requested agent?
    boolean isMemberRecursive​(GroupAgentImpl groupAgent, java.lang.String agentId)
    Checks if the given agent is transitive member of the given group.
    Agent requestAgent​(java.lang.String agentId)
    returns an unlocked instance of the requested Agent
    GroupAgentImpl requestGroupAgent​(java.lang.String groupId)
    Tries to open the given id for this context.
    void touch()
    Mark the current time as the last usage.
    void unlockMainAgent​(java.lang.String passphrase)
    unlocks the main agent of this context

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait