PaP
Class SubscribeCollection

java.lang.Object
  |
  +--PaP.SubscribeCollection
All Implemented Interfaces:
java.io.Serializable

public class SubscribeCollection
extends java.lang.Object
implements java.io.Serializable

This is the main class that implements the PaP Subscribe functionality. There will be one instance of this class for each independent Subscribe service provider to be used (i.e. the instance of the class is a Subscribe Service Provider). Each Subscribe Service Provider is able to handle multiple clients of the service, and each client is the result of a 'SubscribeRequest' to the provider and is identified by its Subscribe Identifier until the client is cancelled by a 'SubscribeCancel' request to the provider. Different types of events are reported to, and registered by the provider, and these registrations are reported to clients ('SubscribeReport') according to what clients has specified. Registrations has a predefined set of event types to be used, and the format and content of the registrations depends on the event type. The class 'SubscribeRequest' defines the specification of a request for subscription, while the class 'SubscribeRequestServer' defines how each 'SubscribeRequest' shall be served.

See Also:
Serialized Form

Field Summary
private  BaseFrame bf
          Defines trace information window.
private  ActorContext context
          The defined context for the service.
private  java.util.Hashtable subscriptions
          Keeps existing client instances
private  int unique
          Allocate unique identifiers for client instances
 
Constructor Summary
SubscribeCollection(ActorContext ctx, BaseFrame frame)
          Initiation of the Subscribe Service Provider instance.
 
Method Summary
 java.lang.String addEntry(SubscribeRequest sr)
          Create and initiate a new subscribe client instance.
 void registerEvent(int et, GAI sc, java.lang.String at)
          Register an event at all existing subscription clients.
 boolean removeEntry(java.lang.String subsID)
          Terminate and remove an existing subscription client.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

context

private ActorContext context
The defined context for the service. Used to specify sender address when SubscribeReport

unique

private int unique
Allocate unique identifiers for client instances

subscriptions

private java.util.Hashtable subscriptions
Keeps existing client instances

bf

private BaseFrame bf
Defines trace information window. Only temporary, used for debugging
Constructor Detail

SubscribeCollection

public SubscribeCollection(ActorContext ctx,
                           BaseFrame frame)
Initiation of the Subscribe Service Provider instance.
Parameters:
ctx - Defined context for the service
frame - Debug trace window (temporary)
Method Detail

addEntry

public java.lang.String addEntry(SubscribeRequest sr)
Create and initiate a new subscribe client instance.
Parameters:
sr - The specification of the subscribe request
Returns:
The subscription identifier, or null if failed

removeEntry

public boolean removeEntry(java.lang.String subsID)
Terminate and remove an existing subscription client.
Parameters:
subsID - The unique identification of the client
Returns:
true if successfully removed, false if failed for some reason

registerEvent

public void registerEvent(int et,
                          GAI sc,
                          java.lang.String at)
Register an event at all existing subscription clients.
Parameters:
et - Event type
sc - Address identifier for the entity the event concerns
at - Application specific information