jpa.p1.sub
Class Subscriber

java.lang.Object
  |
  +--jpa.p1.sub.Subscriber

public class Subscriber
extends java.lang.Object

This is the main class in the JPA PlatformOne Subscription package, which is used for subscribing to PlatformOne data. All the other classes are accessed through this one.

The JPA PlatformOne Subscription package, jpa.p1.sub, is implemented as a hierarchical set of pairs of classes and interfaces.

There are five fundamental levels of class in this package:

For each of these levels, there is one class that is implemented by the package (Subxxx) itself and an interface that can be implemented by the application (SubxxxEvent). The latter interface us used to receive asynchronous events from the package. An application always starts by instantiating a Subscriber object, passing it in a reference to an application object that implements the SubscriberEvent interface. From this point on, the order of instantiation is dependent on the nature of the application.

There are also a number of classes that are used to access other aspects of the incoming data. These are as follows:


Constructor Summary
Subscriber(SubscriberEvent event)
          This is the sole constructor for Subscriber.
 
Method Summary
 void addHost(java.lang.String address, int port)
          This method adds a PlatformOne server to the list of alternatives for making a connection to.
 void clearHosts()
          This method clears the list of alternative PlatformOne server hosts.
 boolean connect()
          This method attempts to establish a connection to the first available server host.
 boolean connectToHost(java.lang.String address, int port)
          This method attempts to establish a connection to the specified PlatformOne server host.
 SubDataset createDataset(java.lang.String name)
          This method creates a new dataset object.
 SubDatasetList createDatasetList()
          This method creates a new dataset list object.
 void deleteDataset(SubDataset dataset)
          This method deletes a dataset object.
 void deleteDatasetList(SubDatasetList list)
          This method deletes a dataset list object.
 void disconnect()
          This method disconnects from the current PlatformOne server host, or abandons connection attempts if there is currently no connection.
protected  void finalize()
           
 java.lang.String getUser()
          This method gets the current user name.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Subscriber

public Subscriber(SubscriberEvent event)
This is the sole constructor for Subscriber. The single argument is a reference to an object in the application that implements the SubscriberEvent interface. This is used to catch events related to the state of the connection to PlatformOne.
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object

addHost

public void addHost(java.lang.String address,
                    int port)
This method adds a PlatformOne server to the list of alternatives for making a connection to.

connect

public boolean connect()
This method attempts to establish a connection to the first available server host. If the attempt fails, the client application will try the other hosts in turn, until the alternatives are exhausted. It will then wait a timeout period before trying again. This interval is initially 15 seconds, and then whatever centralised value is returned by the first successful connection.

disconnect

public void disconnect()
This method disconnects from the current PlatformOne server host, or abandons connection attempts if there is currently no connection.

connectToHost

public boolean connectToHost(java.lang.String address,
                             int port)
This method attempts to establish a connection to the specified PlatformOne server host. This is equivalent to invoking clearHosts, followed by addHost and then connect.

clearHosts

public void clearHosts()
This method clears the list of alternative PlatformOne server hosts.

createDatasetList

public SubDatasetList createDatasetList()
This method creates a new dataset list object. This object is unpopulated until it is watched.

createDataset

public SubDataset createDataset(java.lang.String name)
This method creates a new dataset object. This object is unpopulated until it is watched.

deleteDataset

public void deleteDataset(SubDataset dataset)
This method deletes a dataset object.

deleteDatasetList

public void deleteDatasetList(SubDatasetList list)
This method deletes a dataset list object.

getUser

public java.lang.String getUser()
This method gets the current user name.