Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions

alma.alarmsystem.dump.AlarmDumperBase Class Reference

Inheritance diagram for alma.alarmsystem.dump.AlarmDumperBase:
alma.acs.component.client.AdvancedComponentClient alma.acs.component.client.ComponentClient alma.alarmsystem.dump.AlarmCategoryDumper alma.alarmsystem.dump.AlarmSourceDumper

List of all members.

Classes

class  ShutdownHook

Public Member Functions

 AlarmDumperBase (Logger theLogger, String mangerLoc, String clientname) throws Exception
abstract void startReceivingAlarms () throws Exception
void receiveAlarms () throws Exception
void receiveAlarms (long timeout, TimeUnit timeUnit) throws Exception
abstract void close () throws Exception
synchronized void tearDown ()
String formatTimestamp (Timestamp timestamp)

Static Public Member Functions

static void clientRunner (String[] args, boolean isSourceClient, long timeout, TimeUnit timeUnit)

Protected Member Functions

void registerShutdownHook ()

Detailed Description

The base class of the alarm dumper. It groups common code for the dumpers that write XML alarms, from sources or categories, in the stdout.

The pattern for using a dumper is:

  1. Instantiate the dumper that extends this class
  2. call receiveAlarms()

call tearDown()

receiveAlarms() blocks until the user presses CTRL-C a signal is received or tearDown() is called.
receiveAlarms(long, TimeUnit) can be used instead of receiveAlarms() if the receiving has to terminate after the specified timeout.

tearDown() must be called before terminating to cleanly exit.

Author:
acaproni
Since:
ACS-10.1

Constructor & Destructor Documentation

alma.alarmsystem.dump.AlarmDumperBase.AlarmDumperBase ( Logger  theLogger,
String  mangerLoc,
String  clientname 
) throws Exception

Constructor

Parameters:
theLogger The logger
mangerLoc The CORBA loc of the manager
clientname The name of the client
Exceptions:
Exception if an error happens instantiating the AdvancedComponentClient

Member Function Documentation

static void alma.alarmsystem.dump.AlarmDumperBase.clientRunner ( String[]  args,
boolean  isSourceClient,
long  timeout,
TimeUnit  timeUnit 
) [static]

This block of code avoid code replication.

Parameters:
args Command line args
isSourceClient true if a source client must be instantiated, false for category client
timeout If greater then 0 the process waits until the timeout elapses
timeUnit The TimeUnit for the timeout (must be not null if the timeout is greater then 0)

References alma.alarmsystem.dump.AlarmDumperBase.receiveAlarms(), and alma.alarmsystem.dump.AlarmDumperBase.tearDown().

abstract void alma.alarmsystem.dump.AlarmDumperBase.close (  )  throws Exception [pure virtual]

Close the resources of the alarm client

Referenced by alma.alarmsystem.dump.AlarmDumperBase.tearDown().

String alma.alarmsystem.dump.AlarmDumperBase.formatTimestamp ( Timestamp  timestamp  ) 

Return the timestamp in ISO format.

Parameters:
timestamp 
Returns:

Referenced by alma.alarmsystem.dump.AlarmSourceDumper.faultStateReceived(), and alma.alarmsystem.dump.AlarmCategoryDumper.onAlarm().

void alma.alarmsystem.dump.AlarmDumperBase.receiveAlarms (  )  throws Exception

Connect the client

This method never stops.

Exceptions:
Exception In case of error connecting the SourceClient

References alma.acs.component.client.ComponentClient.m_logger, and alma.alarmsystem.dump.AlarmDumperBase.startReceivingAlarms().

Referenced by alma.alarmsystem.dump.AlarmDumperBase.clientRunner().

void alma.alarmsystem.dump.AlarmDumperBase.receiveAlarms ( long  timeout,
TimeUnit  timeUnit 
) throws Exception

Connect the client until the timeout elapses or the user presses CTRL-C

This method never when the timeout elapse or the user presses CTRL-C

Exceptions:
Exception In case of error connecting the SourceClient

References alma.acs.component.client.ComponentClient.m_logger, and alma.alarmsystem.dump.AlarmDumperBase.startReceivingAlarms().

void alma.alarmsystem.dump.AlarmDumperBase.registerShutdownHook (  )  [protected]

AlarmDumperBase registers its own shutdown hook in fact what is provided by ComponentClient logs a few warnings if the process is interrupted but in this case the situation is absolutely normal.

Reimplemented from alma.acs.component.client.ComponentClient.

References alma.acs.component.client.ComponentClient.m_shutdownHook.

abstract void alma.alarmsystem.dump.AlarmDumperBase.startReceivingAlarms (  )  throws Exception [pure virtual]

Connects to the NC and start receiving alarms.

This must be implemented to connect to the right NC. If the connection failed, startReceivingAlarms() must thrown an exception

Referenced by alma.alarmsystem.dump.AlarmDumperBase.receiveAlarms().

synchronized void alma.alarmsystem.dump.AlarmDumperBase.tearDown (  ) 

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties