MicroTAPAS
Class SubscribeRequestServer

java.lang.Object
  |
  +--MicroTAPAS.SubscribeRequestServer
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, java.io.Serializable

public class SubscribeRequestServer
extends java.lang.Object
implements java.awt.event.ActionListener, java.io.Serializable

Server for individual subscription requests from clients. The server receives event registrations, checks whether or not they shall be reported, and keep registrations to be reported until the report is sent. Reports are sent only when registrations exists, but it is the clien that specifies when or how often the reports shall be sent.

See Also:
Serialized Form

Field Summary
private  MicroBaseFrame bf
          Debug trace window (only temporarly)
private  ActorContext context
          The context that defines who shall be the sender of the reports
private  int next
          The number of registrations in the store
private  SubscribeRequest req
          The received subscribe request specification to be handled by this server
private  java.lang.String[] store
          The store to keep registrations until they are reported
private  javax.swing.Timer timer
          Timer used to measure time until next report
 
Constructor Summary
SubscribeRequestServer(SubscribeRequest sr, ActorContext ctx, MicroBaseFrame frame)
          Initiate the subscribe server instance.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Reported timeout from the initiated timer
private  void addEvent(int et, GAI sc, java.lang.String at)
          Store an event evaluated to be stored.
 boolean cancelSubscribe()
          Cancel this subscription.
private  void initiateTimer()
          Check if timer needs to be initiated and eventually initiate it
private  boolean inSetGAI(GAI[] set, GAI value)
          Check if specified value satisfies requirement to be stored.
private  boolean inSetInt(int[] set, int value)
          Check if specified value satisfies requirement to be stored.
private  boolean inSetString(java.lang.String[] set, java.lang.String value)
          Check if specified value satisfies requirement to be stored.
 void registerEvent(int et, GAI sc, java.lang.String at)
          Report of an event.
private  void reportEvents()
          Report to subscription client registered event
private  void terminateTimer()
          Terminate and discard eventually initiated timer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

req

private SubscribeRequest req
The received subscribe request specification to be handled by this server


store

private java.lang.String[] store
The store to keep registrations until they are reported


next

private int next
The number of registrations in the store


timer

private javax.swing.Timer timer
Timer used to measure time until next report


context

private ActorContext context
The context that defines who shall be the sender of the reports


bf

private MicroBaseFrame bf
Debug trace window (only temporarly)

Constructor Detail

SubscribeRequestServer

public SubscribeRequestServer(SubscribeRequest sr,
                              ActorContext ctx,
                              MicroBaseFrame frame)
Initiate the subscribe server instance.

Parameters:
sr - The specification of the subscribe request.
ctx - The context to be used to specify the sender of the subscribe reports.
frame - Debugging trace window (temporarly)
Method Detail

cancelSubscribe

public boolean cancelSubscribe()
Cancel this subscription. Deallocates and terminates the instance.


registerEvent

public void registerEvent(int et,
                          GAI sc,
                          java.lang.String at)
Report of an event. The event is checked and eventually stored.

Parameters:
et - Event type
sc - Address of the entity the event concerns
at - Application specific information

addEvent

private void addEvent(int et,
                      GAI sc,
                      java.lang.String at)
Store an event evaluated to be stored.

Parameters:
et - Event type
sc - Address of the entity the event concerns
at - Application specific information

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Reported timeout from the initiated timer

Specified by:
actionPerformed in interface java.awt.event.ActionListener

initiateTimer

private void initiateTimer()
Check if timer needs to be initiated and eventually initiate it


terminateTimer

private void terminateTimer()
Terminate and discard eventually initiated timer


reportEvents

private void reportEvents()
Report to subscription client registered event


inSetInt

private boolean inSetInt(int[] set,
                         int value)
Check if specified value satisfies requirement to be stored.

Parameters:
set - The set of values to search in, null means any
value - The value to search in 'set'.
Returns:
true means satisfied, false not satisfied.

inSetGAI

private boolean inSetGAI(GAI[] set,
                         GAI value)
Check if specified value satisfies requirement to be stored.

Parameters:
set - The set of values to search in, null means any
value - The value to search in 'set'.
Returns:
true means satisfied, false not satisfied.

inSetString

private boolean inSetString(java.lang.String[] set,
                            java.lang.String value)
Check if specified value satisfies requirement to be stored.

Parameters:
set - The set of values to search in, null means any
value - The value to search in 'set'.
Returns:
true means satisfied, false not satisfied.


The Telematics Architecture for Plug-and-Play Systems (TAPAS) is a research project undertaken by the Norwegian University of Science and Technology's Telematics department which aims at developing an architecture for network-based service systems with a) flexibility and adaptability, b) robustness and survivability, and c) QoS awareness and resource control.

More information can be found at the project's homepage at http://tapas.item.ntnu.no and the project manager, Professor Finn Arve Aagesen, can be reached at finn.arve.aagesen@item.ntnu.no.