java.lang.Object
org.cybergarage.upnp.Action
Represents a UPnP action with its associated service, arguments, and control functionality.
Field Summary
Modifier and TypeFieldDescriptionprivate final NodeThe action node containing action definitionstatic final StringThe element name for action nodes in XMLprivate MutexMutex for thread synchronizationprivate static final StringThe name attribute for action nodesprivate NodeThe service node this action belongs toprivate UPnPStatusThe UPnP status for this actionprivate ObjectUser-defined data associated with this actionConstructor Summary
Method Summary
Modifier and TypeMethodDescriptionprivate voidClears all output argument values by setting them to empty strings.private ActionDataGets the action data associated with this action.Gets the action listener for this action.Gets the action node.getArgument(String name) Gets an argument by name.intGets the integer value of an argument by name.Gets list of all arguments for this action.getArgumentValue(String name) Gets the value of an argument by name.private ControlResponseGets the control response for this action.Gets the control status for this action.Gets the list of input arguments for this action.getName()Gets name of this action.Gets the list of output arguments for this action.Gets the service this action belongs to.private NodeGets the service node this action belongs to.Gets the UPnP status for this action.Gets the user-defined data associated with this action.static booleanisActionNode(Node node) Checks if the given node is an action node.voidlock()Locks the mutex for this action.booleanperformActionListener(ActionRequest actionReq) Performs the action listener for this action.booleanPosts this control action without binding to a specific local address.booleanpostControlAction(String fromHost) Posts this control action, optionally binding to a specific local host address.voidprint()Prints debug information about this action and its arguments.voidsetActionListener(ActionListener listener) Sets the action listener for this action.voidSets the argument list for this action.voidsetArgumentValue(String name, int value) Sets the value of an argument by name using an integer value.voidsetArgumentValue(String name, String value) Sets the value of an argument by name.private voidSets the control response for this action.voidsetInArgumentValues(ArgumentList argList) /** Sets the values of input arguments.voidSets name of this action.voidsetOutArgumentValues(ArgumentList argList) Sets the values of output arguments.(package private) voidSets the service this action belongs to.voidsetStatus(int code) Sets the status code for this action using the default description.voidSets the status code and description for this action.voidsetUserData(Object data) Sets user-defined data for this action.voidunlock()Unlocks the mutex for this action.
Field Details
ELEM_NAME
The element name for action nodes in XML- See Also:
serviceNode
The service node this action belongs toactionNode
The action node containing action definitionmutex
Mutex for thread synchronizationNAME
upnpStatus
The UPnP status for this actionuserData
User-defined data associated with this action
Constructor Details
Action
Creates a new Action with a given service node.- Parameters:
serviceNode- service node this action belongs to
Action
Action
Method Details
getServiceNode
getService
setService
getActionNode
lock
public void lock()Locks the mutex for this action.unlock
public void unlock()Unlocks the mutex for this action.isActionNode
Checks if the given node is an action node.- Parameters:
node- node to check- Returns:
- true if the node is an action node, false otherwise
setName
getName
getArgumentList
Gets list of all arguments for this action.- Returns:
- argument list
setArgumentList
Sets the argument list for this action.- Parameters:
al- the argument list to set
getInputArgumentList
Gets the list of input arguments for this action.- Returns:
- the input argument list
getOutputArgumentList
Gets the list of output arguments for this action.- Returns:
- the output argument list
getArgument
setInArgumentValues
/** Sets the values of input arguments.- Parameters:
argList- the argument list containing input values
setOutArgumentValues
Sets the values of output arguments.- Parameters:
argList- the argument list containing output values
setArgumentValue
setArgumentValue
Sets the value of an argument by name using an integer value.- Parameters:
name- the name of the argumentvalue- the integer value to set
clearOutputAgumentValues
private void clearOutputAgumentValues()Clears all output argument values by setting them to empty strings.getArgumentValue
getArgumentIntegerValue
Gets the integer value of an argument by name.- Parameters:
name- the name of the argument- Returns:
- the argument integer value, or 0 if argument not found
getActionData
Gets the action data associated with this action.- Returns:
- the action data object
getActionListener
Gets the action listener for this action.- Returns:
- the action listener
setActionListener
Sets the action listener for this action.- Parameters:
listener- the action listener to set
performActionListener
Performs the action listener for this action.- Parameters:
actionReq- the action request- Returns:
- true if the listener was called, false if no listener is set
getControlResponse
Gets the control response for this action.- Returns:
- the control response
setControlResponse
Sets the control response for this action.- Parameters:
res- the control response to set
getControlStatus
postControlAction
public boolean postControlAction()Posts this control action without binding to a specific local address.- Returns:
- true if successful, false otherwise
postControlAction
Posts this control action, optionally binding to a specific local host address. I2P - bind HTTP socket to specified local host address- Parameters:
fromHost- null to not bind to a particular local address- Returns:
- true if successful, false otherwise
print
public void print()Prints debug information about this action and its arguments.setStatus
Sets the status code and description for this action.- Parameters:
code- the status codedescr- the status description
setStatus
public void setStatus(int code) Sets the status code for this action using the default description.- Parameters:
code- the status code
getStatus
setUserData
Sets user-defined data for this action.- Parameters:
data- the user data to set
getUserData
Gets the user-defined data associated with this action.- Returns:
- the user data