public class ACSAlarmCacheImpl extends java.lang.Object implements AlarmCache
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:
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
alarmServerPropkey
The key of the property for undocumented alarms
|
static java.lang.String |
undocumentedAlarmProp
The value of the property for undocumented alarms
|
| Constructor and Description |
|---|
ACSAlarmCacheImpl(AlarmDAO alarmDAO,
ACSCategoryDAOImpl categoryDAO,
AlarmCacheListener alarmCacheListener,
java.util.logging.Logger logger)
The constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
acquire()
Acquire the lock for using the cache.
|
void |
close()
Close and deallocate the resources.
|
CategoryActiveList |
getActiveListReference(java.lang.Integer identifier)
Returns a reference to the active list for a category.
|
Alarm |
getCopy(java.lang.String identifier)
Returns a clone of the cached alarm.
|
Alarm |
getReference(java.lang.String identifier)
Get a reference to the alarm with the passed identifier.
|
void |
initializeAlarmCache(java.util.Map alarms,
java.util.Map activeLists)
Initializes the alarm cache.
|
void |
invalidate(java.lang.String identifier)
Invalidate the cached object.
|
void |
put(Alarm alarm)
Puts an object in the cache.
|
void |
release()
Acquire the lock for using the cache.
|
void |
removeActiveList(java.lang.Integer identifier)
Remove the active list associated with the given category id.
|
void |
replace(Alarm alarm)
Puts alarm in the cache.
|
void |
update(Alarm alarm)
Update an alarm in the cache without notifying the listener.
|
public static final java.lang.String alarmServerPropkey
public static final java.lang.String undocumentedAlarmProp
public ACSAlarmCacheImpl(AlarmDAO alarmDAO, ACSCategoryDAOImpl categoryDAO, AlarmCacheListener alarmCacheListener, java.util.logging.Logger logger)
alarmDAO - The object to access the databasealarmCacheListener - The listenerpublic void initializeAlarmCache(java.util.Map alarms,
java.util.Map activeLists)
AlarmCacheinitializeAlarmCache in interface AlarmCachepublic Alarm getCopy(java.lang.String identifier) throws AlarmCacheException
AlarmCachegetCopy in interface AlarmCacheidentifier - the alarm private identifierAlarmCacheExceptionpublic Alarm getReference(java.lang.String identifier) throws AlarmCacheException
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.
getReference in interface AlarmCacheidentifier - The ID of the alarm to get from the cacheAlarmCacheException - if the operation cannot be performedpublic void update(Alarm alarm)
alarm - public void replace(Alarm alarm) throws AlarmCacheException
AlarmCachereplace in interface AlarmCachealarm - object to put in cacheAlarmCacheException - if the operation cannot be performed. However, the lock is released.public void put(Alarm alarm) throws AlarmCacheException
AlarmCacheput in interface AlarmCachealarm - the new alarm objectAlarmCacheExceptionpublic void invalidate(java.lang.String identifier)
throws AlarmCacheException
AlarmCacheinvalidate in interface AlarmCacheidentifier - the alarm private identifierAlarmCacheExceptionpublic CategoryActiveList getActiveListReference(java.lang.Integer identifier) throws AlarmCacheException
AlarmCachegetActiveListReference in interface AlarmCacheidentifier - the active list private identifierAlarmCacheExceptionpublic void close()
AlarmCacheclose in interface AlarmCachepublic void removeActiveList(java.lang.Integer identifier)
throws AlarmCacheException
AlarmCacheremoveActiveList in interface AlarmCacheidentifier - the id of the active list to destroy (=category id)AlarmCacheExceptionpublic void acquire()
public void release()