Public Member Functions | Static Public Attributes

com.cosylab.acs.laser.dao.ACSAlarmCacheImpl Class Reference

Inheritance diagram for com.cosylab.acs.laser.dao.ACSAlarmCacheImpl:
cern.laser.business.cache.AlarmCache

List of all members.

Public Member Functions

 ACSAlarmCacheImpl (AlarmDAO alarmDAO, ACSCategoryDAOImpl categoryDAO, AlarmCacheListener alarmCacheListener, Logger logger)
void initializeAlarmCache (Map alarms, Map activeLists)
Alarm getCopy (String identifier) throws AlarmCacheException
Alarm getReference (String identifier) throws AlarmCacheException
void update (Alarm alarm)
void replace (Alarm alarm) throws AlarmCacheException
void put (Alarm alarm) throws AlarmCacheException
void invalidate (String identifier) throws AlarmCacheException
CategoryActiveList getActiveListReference (Integer identifier) throws AlarmCacheException
void close ()
void removeActiveList (Integer identifier) throws AlarmCacheException
void acquire ()
void release ()

Static Public Attributes

static final String alarmServerPropkey = "AlarmServerProp"
static final String undocumentedAlarmProp = "UnconfiguredAlarm"

Detailed Description

Implementation of the AlarmCache to use within ACS.

Note on the locking mechanism.
Each method that changes or reads the cache is surrounded by lock/unlock to ensure the mutual exclusion and therefore the integrity of the cache. If a sequence of operations have to be performed in mutual exclusion then the code must initially call acquire() and finally release(). The locking mechanism of each method works as follows:

Author:
acaproni

Constructor & Destructor Documentation

com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.ACSAlarmCacheImpl ( AlarmDAO  alarmDAO,
ACSCategoryDAOImpl  categoryDAO,
AlarmCacheListener  alarmCacheListener,
Logger  logger 
)

The constructor

Parameters:
alarmDAO The object to access the database
alarmCacheListener The listener

References com.cosylab.acs.laser.dao.ACSAlarmDAOImpl.setAlarmCache().


Member Function Documentation

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.acquire (  ) 

Acquire the lock for using the cache.

Referenced by cern.laser.business.pojo.AlarmMessageProcessorImpl.processChange().

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.close (  ) 

Close and deallocate the resources.

Implements cern.laser.business.cache.AlarmCache.

CategoryActiveList com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.getActiveListReference ( Integer  identifier  )  throws AlarmCacheException

Returns a reference to the active list for a category.

Parameters:
identifier the active list private identifier
Returns:
the reference to the active list object.
Exceptions:
Exception if the operation can not be performed

Implements cern.laser.business.cache.AlarmCache.

Alarm com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.getCopy ( String  identifier  )  throws AlarmCacheException

Returns a clone of the cached alarm.

Parameters:
identifier the alarm private identifier
Returns:
the cloned alarm object.
Exceptions:
Exception if the operation can not be performed

Implements cern.laser.business.cache.AlarmCache.

References com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.getReference().

Referenced by cern.laser.business.pojo.AlarmMessageProcessorImpl.processChange().

Alarm com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.getReference ( String  identifier  )  throws AlarmCacheException

Get a reference to the alarm with the passed identifier. The alarm is searched in the configuration database delegating to the ACSAlarmDAOImpl.

If the alarm is not found then an alarm is built to be sent to the client but it is marked with a special property to identify it as a misconfigured alarm. In the case of the alarm panel, such alarms will be displayed in a dedicated tab.

Parameters:
identifier The ID of the alarm to get from the cache

Implements cern.laser.business.cache.AlarmCache.

References cern.laser.business.dao.AlarmDAO.findAlarm().

Referenced by com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.getCopy().

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.initializeAlarmCache ( Map  alarms,
Map  activeLists 
)

Initializes the alarm cache. Can only be called once.

Implements cern.laser.business.cache.AlarmCache.

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.invalidate ( String  identifier  )  throws AlarmCacheException

Invalidate the cached object. Subsequent accesses to that object will cause the object to be loaded again from the ejb.

Parameters:
identifier the alarm private identifier
Exceptions:
Exception if the operation can not be performed

Implements cern.laser.business.cache.AlarmCache.

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.release (  ) 

Acquire the lock for using the cache.

Referenced by cern.laser.business.pojo.AlarmMessageProcessorImpl.processChange().

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.removeActiveList ( Integer  identifier  )  throws AlarmCacheException

Remove the active list associated with the given category id.

Parameters:
identifier the id of the active list to destroy (=category id)
Exceptions:
Exception if the operation cannot be performed

Implements cern.laser.business.cache.AlarmCache.

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.replace ( Alarm  alarm  )  throws AlarmCacheException

Returns a reference to the alarm specified. The object is locked from modification by other cache users.

Parameters:
identifier the id for the alarm
Returns:
a reference to the alarm
Exceptions:
AlarmCacheException if the operation cannot be performed Releases the lock held on an alarm.
Parameters:
identifier the id for the alarm
Exceptions:
AlarmCacheException if the operation cannot be performed. Puts alarm in the cache. This method must be called after as the alarm need to be locked. alarm object to put in cache AlarmCacheException if the operation cannot be performed. However, the lock is released.

Implements cern.laser.business.cache.AlarmCache.

References cern.laser.business.dao.AlarmDAO.updateAlarm().

void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.update ( Alarm  alarm  ) 

Update an alarm in the cache without notifying the listener.

NOTE: this is used when alarms are generated on the fly (defaultFM) because in that case there i sno need to notify the listener

Parameters:
alarm 

References cern.laser.business.data.Alarm.getAlarmId(), and cern.laser.business.dao.AlarmDAO.updateAlarm().


Member Data Documentation

final String com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.alarmServerPropkey = "AlarmServerProp" [static]

The key of the property for undocumented alarms

final String com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.undocumentedAlarmProp = "UnconfiguredAlarm" [static]

The value of the property for undocumented alarms


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