org.cybergarage.upnp

## Class Action

- java.lang.Object
- - org.cybergarage.upnp.Action

-     public class Action
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `ELEM_NAME` The element name for action nodes in XML

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Action(Action action)` Creates a copy of an existing Action.
    `Action(Node serviceNode)` Creates a new Action with a given service node.
    `Action(Node serviceNode, Node actionNode)` Creates a new Action with given service and action nodes.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ActionListener` | `getActionListener()` Gets the action listener for this action.
    `Node` | `getActionNode()` Gets the action node.
    `Argument` | `getArgument(String name)` Gets an argument by name.
    `int` | `getArgumentIntegerValue(String name)` Gets the integer value of an argument by name.
    `ArgumentList` | `getArgumentList()` Gets list of all arguments for this action.
    `String` | `getArgumentValue(String name)` Gets the value of an argument by name.
    `UPnPStatus` | `getControlStatus()` Gets the control status for this action.
    `ArgumentList` | `getInputArgumentList()` Gets the list of input arguments for this action.
    `String` | `getName()` Gets name of this action.
    `ArgumentList` | `getOutputArgumentList()` Gets the list of output arguments for this action.
    `Service` | `getService()` Gets the service this action belongs to.
    `UPnPStatus` | `getStatus()` Gets the UPnP status for this action.
    `Object` | `getUserData()` Gets the user-defined data associated with this action.
    `static boolean` | `isActionNode(Node node)` Checks if the given node is an action node.
    `void` | `lock()` Locks the mutex for this action.
    `boolean` | `performActionListener(ActionRequest actionReq)` Performs the action listener for this action.
    `boolean` | `postControlAction()` Posts this control action without binding to a specific local address.
    `boolean` | `postControlAction(String fromHost)` Posts this control action, optionally binding to a specific local host address.
    `void` | `print()` Prints debug information about this action and its arguments.
    `void` | `setActionListener(ActionListener listener)` Sets the action listener for this action.
    `void` | `setArgumentList(ArgumentList al)` Sets the argument list for this action.
    `void` | `setArgumentValue(String name, int value)` Sets the value of an argument by name using an integer value.
    `void` | `setArgumentValue(String name, String value)` Sets the value of an argument by name.
    `void` | `setInArgumentValues(ArgumentList argList)` Sets the values of input arguments.
    `void` | `setName(String value)` Sets name of this action.
    `void` | `setOutArgumentValues(ArgumentList argList)` Sets the values of output arguments.
    `(package private) void` | `setService(Service s)` Sets the service this action belongs to.
    `void` | `setStatus(int code)` Sets the status code for this action using the default description.
    `void` | `setStatus(int code, String descr)` Sets the status code and description for this action.
    `void` | `setUserData(Object data)` Sets user-defined data for this action.
    `void` | `unlock()` Unlocks the mutex for this action.

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### ELEM_NAME

          public static final String ELEM_NAME

      The element name for action nodes in XML
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Action

          public Action(Action action)

      Creates a copy of an existing Action.
      Parameters:
        `action` - Action to copy

    - #### Action

          public Action(Node serviceNode)

      Creates a new Action with a given service node.
      Parameters:
        `serviceNode` - service node this action belongs to

    - #### Action

          public Action(Node serviceNode,
                        Node actionNode)

      Creates a new Action with given service and action nodes.
      Parameters:
        `serviceNode` - service node this action belongs to
        `actionNode` - action node containing action definition

  - ### Method Detail

    - #### getActionListener

          public ActionListener getActionListener()

      Gets the action listener for this action.
      Returns:
        the action listener

    - #### getActionNode

          public Node getActionNode()

      Gets the action node.
      Returns:
        the action node

    - #### getArgument

          public Argument getArgument(String name)

      Gets an argument by name.
      Parameters:
        `name` - the name of the argument to find
      Returns:
        the argument if found, null otherwise

    - #### getArgumentIntegerValue

          public int getArgumentIntegerValue(String name)

      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

    - #### getArgumentList

          public ArgumentList getArgumentList()

      Gets list of all arguments for this action.
      Returns:
        argument list

    - #### getArgumentValue

          public String getArgumentValue(String name)

      Gets the value of an argument by name.
      Parameters:
        `name` - the name of the argument
      Returns:
        the argument value, or empty string if argument not found

    - #### getControlStatus

          public UPnPStatus getControlStatus()

      Gets the control status for this action.
      Returns:
        the UPnP status

    - #### getInputArgumentList

          public ArgumentList getInputArgumentList()

      Gets the list of input arguments for this action.
      Returns:
        the input argument list

    - #### getName

          public String getName()

      Gets name of this action.
      Returns:
        action name

    - #### getOutputArgumentList

          public ArgumentList getOutputArgumentList()

      Gets the list of output arguments for this action.
      Returns:
        the output argument list

    - #### getService

          public Service getService()

      Gets the service this action belongs to.
      Returns:
        the service object

    - #### getStatus

          public UPnPStatus getStatus()

      Gets the UPnP status for this action.
      Returns:
        the UPnP status

    - #### getUserData

          public Object getUserData()

      Gets the user-defined data associated with this action.
      Returns:
        the user data

    - #### isActionNode

          public static boolean isActionNode(Node node)

      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

    - #### lock

          public void lock()

      Locks the mutex for this action.

    - #### performActionListener

          public boolean performActionListener(ActionRequest actionReq)

      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

    - #### postControlAction

          public boolean postControlAction()

      Posts this control action without binding to a specific local address.
      Returns:
        true if successful, false otherwise

    - #### postControlAction

          public boolean postControlAction(String fromHost)

      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.

    - #### setActionListener

          public void setActionListener(ActionListener listener)

      Sets the action listener for this action.
      Parameters:
        `listener` - the action listener to set

    - #### setArgumentList

          public void setArgumentList(ArgumentList al)

      Sets the argument list for this action.
      Parameters:
        `al` - the argument list to set

    - #### setArgumentValue

          public void setArgumentValue(String name,
                                       int value)

      Sets the value of an argument by name using an integer value.
      Parameters:
        `name` - the name of the argument
        `value` - the integer value to set

    - #### setArgumentValue

          public void setArgumentValue(String name,
                                       String value)

      Sets the value of an argument by name.
      Parameters:
        `name` - the name of the argument
        `value` - the value to set

    - #### setInArgumentValues

          public void setInArgumentValues(ArgumentList argList)

      Sets the values of input arguments.
      Parameters:
        `argList` - the argument list containing input values

    - #### setName

          public void setName(String value)

      Sets name of this action.
      Parameters:
        `value` - name to set

    - #### setOutArgumentValues

          public void setOutArgumentValues(ArgumentList argList)

      Sets the values of output arguments.
      Parameters:
        `argList` - the argument list containing output values

    - #### setService

          void setService(Service s)

      Sets the service this action belongs to.
      Parameters:
        `s` - the service to set

    - #### setStatus

          public void setStatus(int code)

      Sets the status code for this action using the default description.
      Parameters:
        `code` - the status code

    - #### setStatus

          public void setStatus(int code,
                                String descr)

      Sets the status code and description for this action.
      Parameters:
        `code` - the status code
        `descr` - the status description

    - #### setUserData

          public void setUserData(Object data)

      Sets user-defined data for this action.
      Parameters:
        `data` - the user data to set

    - #### unlock

          public void unlock()

      Unlocks the mutex for this action.