public interface ProcessInterface extends MessageSender, Runnable, AgentPrintInterface, CasaObservable
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.
Modifier and Type | Method and Description |
---|---|
void |
addObserver(Observer observer)
Part of the Observable interface from the observer pattern (Gamma et al.).
|
void |
addObserver(URLDescriptor observer)
Extension to the Observable interface from the observer pattern (Gamma et al.).
|
void |
closePort()
Method to close the module's open port and return it to the system.
|
void |
deleteObserver(Observer observer)
Part of the Observable interface from the observer pattern (Gamma et al.).
|
void |
deleteObserver(URLDescriptor observer)
Extension to the Observable interface from the observer pattern (Gamma et al.).
|
void |
exit()
Tells the process to exit.
|
String |
getAgentName()
Returns the name of the current process
|
String |
getName() |
MLMessage |
getNewMessage(String performative,
String act,
URLDescriptor reciever)
Creates a basic message with the given performative, act, and receiver.
|
ProcessOptions |
getOptions()
Returns a reference to this object's
ProcessOptions object. |
int |
getPort()
Returns the port that this agent is listening on.
|
String |
getStrategy()
Returns the strategy that this agent uses to interpret messages.
|
TraceInterface |
getTrace()
get the associated
Trace object. |
String |
getUniqueRequestID() |
URLDescriptor |
getURL()
Returns the URL of the current process
|
boolean |
getUseAckProtocol()
Retrieves whether this agent will use the the Ack (acknowledge) protocol.
|
boolean |
hasOpenPort()
Tests if this process has any open ports.
|
boolean |
isA(String s1,
String s2) |
boolean |
isAPerformative(String p1,
String p2) |
boolean |
isExiting()
determines if this process is in the process of exiting.
|
boolean |
isLoggingTag(String tag) |
boolean |
isStoppable()
determines if this process can be stopped.
|
boolean |
isTracing()
is tracing on?
|
String |
println(String traceTag,
String txt)
Debugging or error method: Uses the
Trace object to log the
string if appropriate (ie: the traceTAg matches a tag that's turned on
in the Trace object. |
String |
println(String traceTag,
String txt,
Status tempStatus)
Same as
println(String, String) but appends tempStatus.getExplanation(). |
String |
println(String traceTag,
String txt,
Throwable ex)
Same as
println(String, String) but appends ex.toString() and prints
a stack trace after. |
void |
realizeAgentBehaviourFromOptions()
Refresh agent behaviour from the options object.
|
Status |
sendMessage(MLMessage message)
Sends the message to the the message.receiver or, if
message.receiver is missing or empty, to message.to.
|
void |
setOptions(ProcessOptions options)
Sets this object's ProcessOptions object.
|
void |
setTracing(boolean doTrace)
turn tracing on / off
|
boolean |
setUseAckProtocol(boolean b)
Sets whether this agent will use the the Ack (acknowledge) protocol.
|
void |
startTraceMonitor()
Display the trace monitor window.
|
void |
updateOptions()
Save the options to a persistent database.
|
addObserver, addObserver, countObservers, deleteObservers, hasChanged, notifyObservers, notifyObservers, notifyObserversWithNoArg, notifyObserversWithTop
URLDescriptor getURL()
String getAgentName()
int getPort()
String getStrategy()
boolean hasOpenPort()
true
if and only if the process has an open port;
false
otherwise.void closePort()
boolean isStoppable()
void exit()
isStoppable()
is true before
it can actually exit.boolean isExiting()
void addObserver(Observer observer)
observer
- the Observer object to add.void addObserver(URLDescriptor observer)
observer
- the Observer object to add.void deleteObserver(Observer observer)
deleteObserver
in interface CasaObservable
observer
- void deleteObserver(URLDescriptor observer)
deleteObserver
in interface CasaObservable
observer
- Status sendMessage(MLMessage message)
sendMessage
in interface MessageSender
message
- MLMessage of the message being sent, which
contains the info about the recipient in the receiver or
to fields.IPMessage
MLMessage getNewMessage(String performative, String act, URLDescriptor reciever)
performative
- The performative of the new message.act
- The act of the new message.reciever
- The receiver of the new message.ProcessOptions getOptions()
ProcessOptions
object.ProcessOptions
object.void setOptions(ProcessOptions options)
options
- void updateOptions()
void realizeAgentBehaviourFromOptions()
boolean getUseAckProtocol()
boolean setUseAckProtocol(boolean b)
b
- true to set the protocol, false to not use the protocol.boolean isTracing()
TraceInterface getTrace()
Trace
object. If isTracing() == true, then this is guaranteed non-null, otherwise, this may return null.void setTracing(boolean doTrace)
void startTraceMonitor()
String println(String traceTag, String txt)
Trace
object to log the
string if appropriate (ie: the traceTAg matches a tag that's turned on
in the Trace object.println
in interface AgentPrintInterface
traceTag
- The txt String will be logged if the traceTag maches a tag that's turned on in the Trace object.txt
- The String to be loggedString println(String traceTag, String txt, Throwable ex)
println(String, String)
but appends ex.toString() and prints
a stack trace after.println
in interface AgentPrintInterface
traceTag
- The txt String will be logged if the traceTag maches a tag that's turned on in the Trace object.txt
- The String to be loggedex
- An Exception objectString println(String traceTag, String txt, Status tempStatus)
println(String, String)
but appends tempStatus.getExplanation().println
in interface AgentPrintInterface
traceTag
- The txt String will be logged if the traceTag maches a tag that's turned on in the Trace object.txt
- The String to be loggedtempStatus
- A Status objectString getUniqueRequestID()
boolean isLoggingTag(String tag)
isLoggingTag
in interface AgentPrintInterface
String getName()