Class ShApplication


public class ShApplication extends ClientApplication
Sh client application. See 3GPP TS 29.328 v6.8.0 and 3GPP TS 29.329 v6.6.0 for Sh protocol details.
Author:
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  • Field Details

    • ID

      public static final ApplicationId ID
      Sh application identifier
  • Constructor Details

    • ShApplication

      public ShApplication()
  • Method Details

    • init

      public void init() throws DiameterException
      Initializes the ShApplication. The hss host and realm can be configured with the application init parameters "destination.host" and "destination.realm" respectively. The "timeout" parameter can also be optionally used to specific the maximum number of milliseconds to wait for an answer from the HSS. By default, this is 30 seconds.
      Overrides:
      init in class ClientApplication
      Throws:
      DiameterException - if the initialization failed
    • getId

      public ApplicationId getId()
      Returns the Sh application identifier.
      Specified by:
      getId in class Application
      Returns:
      the Sh ApplicationId
    • getRepositoryData

      public RepositoryData getRepositoryData(AccessKey key) throws DiameterException, IOException
      Returns the RepositoryData for the specified Sh AccessKey. If the repository data does not exist then an empty RepositoryData instance will be created with a sequence number of 0. See 3GPP TS 29.328 v6.8.0 table 7.6.1 for details on data access key format.
      Parameters:
      key - the AccessKey for the requested data
      Returns:
      the RepositoryData for the key
      Throws:
      IllegalArgumentException - if not a repository data AccessKey
      MessageException - if the answer from the HSS indicated an error
      IOException - if an I/O error occurred
      DiameterException
    • putRepositoryData

      public void putRepositoryData(AccessKey key, RepositoryData rd) throws DiameterException, IOException
      Updates repository data for specified AccessKey.
      Parameters:
      key - the AccessKey for the data
      rd - the new RepositoryData
      Throws:
      MessageException - if the answer from the HSS indicated an error
      IOException - if an I/O error occurred
      DiameterException
    • getDocument

      public Document getDocument(AccessKey key) throws DiameterException, IOException
      Retrieves the data associated with the specified AccessKey by sending a UDR request and waiting for the corresponding UDA.
      Parameters:
      key - the AccessKey for the data
      Returns:
      the data associated with the key, or null if not found
      Throws:
      MessageException - if the answer from the HSS indicated an error
      IOException - if an I/O error occurred
      DiameterException
    • putDocument

      public void putDocument(AccessKey key, Document doc) throws DiameterException, IOException
      Updates data for the specified AccessKey by sending a PDR request and waiting for the corresponding PDA.
      Parameters:
      key - the AccessKey for the data
      doc - the updated user data
      Throws:
      IllegalArgumentException - if the document format was invalid
      MessageException - if the answer from the HSS indicated an error
      IOException - if an I/O error occurred
      DiameterException
    • subscribe

      public void subscribe(AccessKey key) throws DiameterException, IOException
      Starts subscription for the data referred to by the specified AccessKey.
      Parameters:
      key - the AccessKey for the data
      Throws:
      MessageException - if the answer from the HSS indicated an error
      IOException - if an I/O error occurred
      DiameterException
    • unsubscribe

      public void unsubscribe(AccessKey key) throws DiameterException, IOException
      Unsubscribes from the data referred to by the specified AccessKey.
      Parameters:
      key - the AccessKey for the data
      Throws:
      MessageException - if the answer from the HSS indicated an error
      IOException - if an I/O error occurred
      DiameterException
    • createSession

      public ShSession createSession()
      Creates a new client ShSession.
      Overrides:
      createSession in class Application
      Returns:
      the ShSession for this application
    • createSession

      public ShSession createSession(String id, Object parent)
      Overrides:
      createSession in class Application
    • setTimeout

      public void setTimeout(long msec)
      Sets the maximum number of millisecons to wait for an answer from the HSS. The default timeout is the request timeout value from the general Diameter configuration (30 seconds).
      Parameters:
      msec - the request timeout in milliseconds
    • getTimeout

      public long getTimeout()
      Returns the current request timeout.
      Returns:
      the request timeout in milliseconds, or -1 if the default request timeout should be used
    • rcvRequest

      protected void rcvRequest(Request req) throws DiameterException, IOException
      Called by the container when a new Sh request has been received. This request must be PNR since we are Sh client only.
      Overrides:
      rcvRequest in class Application
      Parameters:
      req - the Sh PNR requests
      Throws:
      DiameterException - if an error occurred while processing
      IOException - if an I/O error occurred
    • rcvPush

      protected void rcvPush(AccessKey key, Document doc)
      Called whenever a new PNR message has been received. This method should be overridden to provide handling of Push-Notification-Requests from the HSS.
      Parameters:
      key - the AccessKey for the user data
      doc - the updated user data