public class AgentProxy extends TransientAgent implements TransientAgentInterface
AgentProxy
is a simple subclass of TransientAgent
with the sole purpose of acting as a proxy between an agent and all other agents. All messages that it recieves are first filtered to determine if the message is to the proxy (based on the ML.RECEIVER
parameter). If so, the message is processed by the super class as a regular agent. Otherwise, the message is passed along to the proxied agent by forwardMessage()
. Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
TransientAgent
TransientAgent.Conversations, TransientAgent.NewAgentLispCommand
AbstractProcess.Subthread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private int |
agentPort
The port of the agent this proxy is protecting.
|
cacheKB, CDInvitedTo, CDinvitee, conversationData, defaultOntologyClassName, DEFER_ACTION, DROP_ACTION, kBase, lisp, lispEnvironment, ListOfArgs, methodMap, ontologyEngine, ontologyEngineCreateMethod, ontologyEngineLoadMethod, policies, policiesAlwaysApply, policiesLastResort, primaryUI, proxy, UIs, usingProxy
eventQueue, exitWaitCounter, heartbeat, huntForPort, initParams, ontology, ontologyShared, options, securityFilter, trace, TRACE_MONITOR, TRACE_OFF, TRACE_ON, TRACE_TO_FILE, TRACE_UNDEFINED, transformations, uniqueThreadName, waitingForAgentToStart, waitingForEvent, waitingForSocketServerToStart
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
AgentProxy(ParamsMap params,
AgentUI ui)
Creates a new
AgentProxy that forwards messages to the given
agent and uses the given port. |
Modifier and Type | Method and Description |
---|---|
private static ParamsMap |
adjustAgentName(ParamsMap params) |
protected void |
forwardMessage(MLMessage message)
Sends the given message to the protected agent at the port given by
agentPort . |
void |
handleEvent(Event event)
Handles the processing and dispatching of all incoming messages.
|
protected Status |
handleForwardMessage(MLMessage message)
Handles all messages that should be forwarded to the proxied agent.
|
protected void |
pendingFinishRun_withdrawFromAllCDs()
Unsubscribes from an any watched CDs (
TransientAgent.watchedCooperationDomains )
by calling doCDSubscribeMembership(URLDescriptor, false) and withdraws from any
joined CDs (TransientAgent.joinedCooperationDomains ) by calling
doWithdrawCD(URLDescriptor,
false) . |
void |
setLACPort(int port)
Sets the LAC port that this agent should use when it needs to resolve local
hosts.
|
abclEval, abclEval, abclEval, accept_deleteCD, accept_exit, accept_forward_message, accept_LAC_closing, accept_new_MenuItem, accept_update, acceptDefault, addConversation, addJoinedCooperationDomain, addMembers, addSubscribeEvents, assembleDefault, assert_, assert_, authorizedByProxy, authorizeMessage, chooseSC, concludeDefault, consider_execute, consider_invite_to_cd, consider_new_MenuItem, consider_ping, consider_query_if, consider_query_ref, considerDefault, createCasaLispOperators, dispatchMsgHandlerMethod, doAddObserver, doAdvertise, doCDGetHistory_sync, doCDGetMembers, doCDPutData, doCDSubscribeMembership, doFindInstances_sync, doGetCooperationDomains, doGetOnology, doInviteToCD, doJoinCD, doPing_sync, doPing, doRegisterAgentInstance, doRegisterAgentInstance, doResolveURL, doSearchYP, doUnadvertise, doUnregisterAgentInstance, doUnregisterAgentType, doWithdrawCD, evaluateDefault, evesdrop, executeCommand, findFileResourcePath, findFileResourcePath, getAgentForThread, getAlwaysApplyPolicies, getBanner, getCachedKnowledgeBase, getChosenCommitment, getCommitmentProcessor, getConversation, getConversations, getConversationsReport, getDefaultBanner, getDefFileSystemLocations, getEventForThread, getField, getInstancesFound, getJoinedCooperationDomain, getJoinedCooperationDomains, getKnowledgeBase, getLACURL, getLastResortPolicies, getMembers, getMsgForThread, getObjectsForThread, getOntology, getOntologyEngine, getOntologyFileSuffix, getPolicies, getPrimaryUI, getProxy, getSCStore, getSerializedOntology, getStrategy, getStrategyGUI, getSubscribeEvents, getSubscribeEvents, getTermsFromContent, getUI, getUIForThread, getUIs, getUnfulfilledSocialCommitments, getUnfulfilledSocialCommitments, handleErrorReplies, handleLACClosing, hasActiveCommitments, hasConversation, hasStrategyGUI, initializeAfterRegistered, initializePolicies, initializeThread, initJADE, initUI, isEventQueueReady, isRegistered, isRegisteredWithLAC, isStoppable, isTrusted, isTrusted, isUsingProxy, kb_get_value, makeDefaultGUI, makeDefaultInterface, makeDefaultInternalFrame, makeDefaultTextInterface, monitorDefault, notifySendingMessage, optionsToString, parseJADENode, pendingFinishRun_unregisterAgentInstance, pendingFinishRun, perform_execute, perform_FIPAStyle, perform_get_name, perform_get_ontology, perform_invite_to_cd, perform_method_call, perform_query_if, perform_query_if, perform_query_ref, perform_query_ref, performDefault, processCommitment, processCommitments, processObserverNotification, putExtendedOntology, putPolicy, putPolicyAlwaysApply, putPolicyLastResort, putReplacementOntology, putUI, query_ref, query_toString, query, queryIf, queryRef_toIntegerList, queryRef_toString, queryRef_toStringList, queryRef_toTermList, queryRef, queryRef, queryRefAIDs, queryRefURLs, querywithFilter, realizeAgentBehaviourFromOptions, recursiveParent, recursivePermutations, release_execute, release_FIPAStyle, release_get_agents_registered, release_get_agents_running, release_get_members, release_get_ontology, release_join_cd, release_ping, release_query_if, release_query_ref, release_resolve_url, release_unregister_agentType, release_unregister_instance, release_withdraw_cd, releaseDefault, removeConversation, removeCooperationDomains, removeJoinedCooperationDomain, removeSubscribeEvents, requestInstances, resolveConnectException, retrieveReturnedData, saveReturnedData, searchOntology, searchOntology1, setBanner, setCommitmentProcessor, setField, setInstancesFound, setOntology, shouldDoExecuteRequest, template_handleNewOntologyInfo, update, updateConversationProtocolType, verifyCD, verifyDefault, verifyMessage
addObserver, addObserver, addObserver, addObserver, addTraceTags, addTransformation, bump, clearAllTraceTags, closePort, compareTo, countObservers, defer, defer, deleteObserver, deleteObserver, deleteObservers, dequeueEvent, equals, eventBufferLoopBody, eventBufferLoopPeriodic, eventQueuePeek, existed, exit, finalize, finishRun, fixupMessage, getAgent, getAgentName, getEventQueue, getInitParams, getNewMessage, getNewMessage, getOptions, getPort, getSocketServer, getTrace, getTraceTags, getTransformationFor, getUniqueRequestID, getURL, getUseAckProtocol, getUsePriority, hasChanged, hasOpenPort, in, initializeConstructor, initializeURL, isA, isA, isA, isA, isAAct, isAAct, isAgentThread, isAPerformative, isAPerformative, isExiting, isInitialized, isLoggingTag, isObserveMessages, isPaused, isThisMyAddress, isTracing, loadClass, makeOptions, makeSubthread, makeSubthread, makeTraceParam, notifyObservers, notifyObservers, notifyObserversWithNoArg, notifyObserversWithTop, out, println, println, println, println, println, queueEvent, queueEventIf, removeTraceTags, resetRuntimeOptionsFromCommandLine, resetSecurityPackage, resetTraceOptions, revTransform, revTransform, run, sendMessage_primitive, sendMessage, sendMessage, sendMessageAndWait, sendQueryAndWait, sendRequestAndWait, sendRequestAndWait, setAllTraceTags, setObserveMessages, setOptions, setPause, setTraceTags, setTracing, setURL, setUseAckProtocol, setUsePriority, startSocketServer, startTraceMonitor, step, transform, transform, unhandledMessage, updateOptions
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
getClass, hashCode, notify, notifyAll, wait, wait, wait
doAdvertise, doCDGetHistory_sync, doCDGetMembers, doCDPutData, doFindInstances_sync, doGetCooperationDomains, doGetOnology, doInviteToCD, doJoinCD, doPing_sync, doPing, doRegisterAgentInstance, doRegisterAgentInstance, doSearchYP, doUnadvertise, doUnregisterAgentInstance, doUnregisterAgentType, doWithdrawCD, executeCommand, getInstancesFound, getJoinedCooperationDomains, getLACURL, getMembers, getOntology, getOptions, getSerializedOntology, getStrategyGUI, hasStrategyGUI, isAAct, isInitialized, isRegistered, makeDefaultInterface, putExtendedOntology, putReplacementOntology, putUI, release_get_ontology, removeCooperationDomains, requestInstances, setOptions, updateOptions
addObserver, addObserver, closePort, deleteObserver, deleteObserver, exit, getAgentName, getName, getNewMessage, getPort, getStrategy, getTrace, getUniqueRequestID, getURL, getUseAckProtocol, hasOpenPort, isA, isAPerformative, isExiting, isLoggingTag, isStoppable, isTracing, println, println, println, realizeAgentBehaviourFromOptions, sendMessage, setTracing, setUseAckProtocol, startTraceMonitor
addObserver, addObserver, countObservers, deleteObservers, hasChanged, notifyObservers, notifyObservers, notifyObserversWithNoArg, notifyObserversWithTop
abclEval, abclEval, abclEval, addTransformation, bump, chooseSC, defer, dequeueEvent, dispatchMsgHandlerMethod, evesdrop, getKnowledgeBase, getName, getSCStore, getSubscribeEvents, getTransformationFor, getUniqueRequestID, getURL, getUseAckProtocol, isA, isA, isA, isA, isAPerformative, isAPerformative, isLoggingTag, notifyObservers, println, println, println, queueEvent, queueEventIf, revTransform, revTransform, sendMessage, transform, transform
public AgentProxy(ParamsMap params, AgentUI ui) throws Exception
AgentProxy
that forwards messages to the given
agent and uses the given port.agentName
- The name of the agent the new proxy is protecting.proxyPort
- The port that the new proxy should use for communications.agentPort
- The port that the agent uses for communications.IPSocketException
- If an Agent attempts to bind to an IPSocket
(port) that doesn't exist or is in use.Exception
private static ParamsMap adjustAgentName(ParamsMap params) throws Exception
Exception
protected void pendingFinishRun_withdrawFromAllCDs()
TransientAgent
TransientAgent.watchedCooperationDomains
)
by calling doCDSubscribeMembership(URLDescriptor, false)
and withdraws from any
joined CDs (TransientAgent.joinedCooperationDomains
) by calling
doWithdrawCD(URLDescriptor,
false)
.pendingFinishRun_withdrawFromAllCDs
in class TransientAgent
public void handleEvent(Event event)
super.handleMessage()
is returned.
If the message was not sent to the proxy directly, the message is passed to
handleForwardMessage()
, which is responsible for forwarding
the message to the proxied agent, and its return value is returned.handleEvent
in class TransientAgent
event
- The incoming message to be handled.AbstractProcess.handleEvent(Event)
,
TransientAgent.processPolicies(AbstractProcess, Event,
AbstractCollection, Conversation, String, Map)
protected Status handleForwardMessage(MLMessage message)
message
- The incoming message to be forwarded to the proxied agent.Status
describing if the message was forwarded:
protected void forwardMessage(MLMessage message) throws Exception
agentPort
. The protected agent is always assumed to be on
the same host as the proxy.message
- The message to forward to the protected agent.IOException
- If there was an error in the process of sending the
message to the protected agent.Exception
public void setLACPort(int port)
port
- The LAC port that this agent should use when it needs to
resolve local hosts.