Class ActionMessage

java.lang.Object
net.sbbi.upnp.messages.ActionMessage

public class ActionMessage extends Object
Message object for an UPNP action, simply call setInputParameter() to add the required action message params and then service() to receive the ActionResponse built with the parsed UPNP device SOAP xml response.
  • Constructor Details

    • ActionMessage

      protected ActionMessage(Service service, Action serviceAction)
      Protected constuctor so that only messages factories can build it
      Parameters:
      service - the service for which the
      serviceAction -
  • Method Details

    • clearInputParameters

      public void clearInputParameters()
      Method to clear all set input parameters so that this object can be reused
    • service

      Executes the message and retuns the UPNP device response, according to the UPNP specs, this method could take up to 30 secs to process ( time allowed for a device to respond to a request )
      Returns:
      a response object containing the UPNP parsed response
      Throws:
      IOException - if some IOException occurs during message send and reception process
      UPNPResponseException - if an UPNP error message is returned from the server or if some parsing exception occurs ( detailErrorCode = 899, detailErrorDescription = SAXException message )
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, Object parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call. If the param name already exists, the param value will be overwritten with the new value provided.
      Parameters:
      parameterName - the parameter name
      parameterValue - the parameter value as an object, primitive object are handled, all other object will be assigned with a call to their toString() method call
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, String parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call. If the param name already exists, the param value will be overwritten with the new value provided
      Parameters:
      parameterName - the parameter name
      parameterValue - the string parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, Date parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the date parameter value, will be automatically translated to the correct ISO 8601 date format for the given action input param related state variable
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, boolean parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the boolean parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, byte parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the byte parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, short parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the short parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, int parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the integer parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, long parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the long parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, float parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the float parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message
    • setInputParameter

      public ActionMessage setInputParameter(String parameterName, double parameterValue) throws IllegalArgumentException
      Set the value of an input parameter before a message service call
      Parameters:
      parameterName - the parameter name
      parameterValue - the double parameter value
      Returns:
      the current ActionMessage object instance
      Throws:
      IllegalArgumentException - if the provided parameterName is not valid for this message or if no input parameters are required for this message