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" |
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:
com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.ACSAlarmCacheImpl | ( | AlarmDAO | alarmDAO, | |
ACSCategoryDAOImpl | categoryDAO, | |||
AlarmCacheListener | alarmCacheListener, | |||
Logger | logger | |||
) |
The constructor
alarmDAO | The object to access the database | |
alarmCacheListener | The listener |
References com.cosylab.acs.laser.dao.ACSAlarmDAOImpl.setAlarmCache().
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.
identifier | the active list private identifier |
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.
identifier | the alarm private identifier |
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.
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.
identifier | the alarm private identifier |
Exception | if the operation can not be performed |
Implements cern.laser.business.cache.AlarmCache.
void com.cosylab.acs.laser.dao.ACSAlarmCacheImpl.put | ( | Alarm | alarm | ) | throws AlarmCacheException |
Puts an object in the cache. If that object was already in the cache it is replaced. This method combines the methods replace, and release alarm the new alarm object Exception if the operation can not be performed
Implements cern.laser.business.cache.AlarmCache.
References cern.laser.business.dao.AlarmDAO.updateAlarm().
Referenced by cern.laser.business.pojo.AlarmMessageProcessorImpl.processChange(), cern.laser.business.pojo.AlarmMessageProcessorImpl.updateMultiplicityNode(), and cern.laser.business.pojo.AlarmMessageProcessorImpl.updateReductionStatus().
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.
identifier | the id of the active list to destroy (=category id) |
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.
identifier | the id for the alarm |
AlarmCacheException | if the operation cannot be performed Releases the lock held on an alarm. |
identifier | the id for the alarm |
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
alarm |
References cern.laser.business.data.Alarm.getAlarmId(), and cern.laser.business.dao.AlarmDAO.updateAlarm().
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