Interface RestContext


public interface RestContext
Allows a Rest Service to communicate with NetSwitch.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name used with ServletContext#getAttribute(String) to retrieve an instance of RestContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns an unmodifiable map with all the properties of this RestContext.
    getProperty(String name, String defval)
    Returns the value of the property indexed by specified name.
    void
    Sends an multicast message built using the supplied name and data.
    sendRequest(String destination, Serializable data, int timeout)
    Sends a request message to a destination and then blocks waiting for the reply message for at most timeout milliseconds.
  • Field Details

  • Method Details

    • getProperties

      Map<String,String> getProperties()
      Returns an unmodifiable map with all the properties of this RestContext.
      Returns:
      an unmodifiable map with all the properties of this RestContext.
    • getProperty

      String getProperty(String name, String defval)
      Returns the value of the property indexed by specified name. If the property is not defined, it returns the supplied default value.
      Parameters:
      name - the name of the required property.
      defval - value returned if property is not defined (can be null).
      Returns:
      the value of the property or default value defval.
      Throws:
      NullPointerException - if name is null.
    • sendRequest

      Message sendRequest(String destination, Serializable data, int timeout) throws Exception
      Sends a request message to a destination and then blocks waiting for the reply message for at most timeout milliseconds. The value of destination must have the following format:
      [SwitchName:]ServerName[.ServiceName]
      where optional items are shown within "[" and "]" brackets, and the characters ":" and "." stand for themselves. If the optional SwitchName is not specified, the message is sent to the connected switch. ServerName is the name of a server, a listener or a connector. The optional ServiceName is the name of a service provided by the server, or the name of a channel of a listener. The following are examples of valid destinations:
       POS_DEVICE
       NETSWITCH.LOG_ERROR
       HUB:IMSER.ADD_CONTACT
      Argument timeout specifies the amount of time to wait for the synchronous reply message. If timeout is zero (0), the call waits forever for the reply message.
      Parameters:
      destination - the request destination switch:server.service.
      data - the data to include in the request message (can be null).
      timeout - the maximum time to wait for a reply (in milliseconds).
      Returns:
      the reply message returned from the switch server.
      Throws:
      NullPointerException - if destination is null.
      IllegalArgumentException - if timeout is negative.
      IllegalStateException - if already waiting for a reply message.
      SocketTimeoutException - if timeout expired while waiting for reply.
      Exception - if another error occurs.
    • sendMulticast

      void sendMulticast(String name, Serializable data) throws Exception
      Sends an multicast message built using the supplied name and data. The message will be dispatched to all client and/or server applications that have enabled the reception of multicast messages with the specified name.
      Parameters:
      name - the name of the multicast message.
      data - data to include in the multicast message (can be null).
      Throws:
      NullPointerException - if name is null.
      Exception - if another error occurs.