

Public Member Functions | |
| ACSAlarmCacheImpl (AlarmDAO alarmDAO, AlarmCacheListener alarmCacheListener) | |
| void | initializeAlarmCache (Map alarms, Map activeLists) |
| Alarm | getCopy (String identifier) throws AlarmCacheException |
| Alarm | getReference (String identifier) throws AlarmCacheException |
| 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 |
Private Member Functions | |
| void | sendMsgToListener (Alarm actual, Alarm old) |
| void | dumpAlarmsCache (boolean verbose) |
| CategoryActiveList | getCategoryList (Integer categoryId) |
| void | updateCategoryActiveLists (Alarm alarm) |
Private Attributes | |
| HashMap< String, Alarm > | alarms = new HashMap<String,Alarm>() |
| AlarmDAO | dao |
| AlarmCacheListener | listener |
| HashMap< Integer, CategoryActiveList > | activeLists = new HashMap<Integer,CategoryActiveList>() |
| com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::ACSAlarmCacheImpl | ( | AlarmDAO | alarmDAO, | |
| AlarmCacheListener | alarmCacheListener | |||
| ) | [inline] |
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::close | ( | ) | [inline] |
Close and deallocate the resources.
Implements cern::laser::business::cache::AlarmCache.
References alarms.
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::dumpAlarmsCache | ( | boolean | verbose | ) | [inline, private] |
Print a copy of the alarms in the cache in the standard output. This method is added for debugging
| verbose | If true the details of each alarm found in the cache is also displayed |
References alarms.
| CategoryActiveList com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::getActiveListReference | ( | Integer | identifier | ) | throws AlarmCacheException [inline] |
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.
References activeLists.
Referenced by updateCategoryActiveLists().
| CategoryActiveList com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::getCategoryList | ( | Integer | categoryId | ) | [inline, private] |
Return the CategoryActiveList for the specified categoryId. If the CategoryActiveList does not exist than a new one is created and inserted in the activeList and then returned to the caller
| categoryId | The categoryId identifying the CategoryActiveList |
References activeLists.
| Alarm com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::getCopy | ( | String | identifier | ) | throws AlarmCacheException [inline] |
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 getReference().
| Alarm com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::getReference | ( | String | identifier | ) | throws AlarmCacheException [inline] |
Returns a reference to the cached alarm.
| identifier | the alarm private identifier |
| AlarmCacheException | if the operation cannot be performed |
Implements cern::laser::business::cache::AlarmCache.
References alarms, dao, and cern::laser::business::dao::AlarmDAO::findAlarm().
Referenced by getCopy().
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::initializeAlarmCache | ( | Map | alarms, | |
| Map | activeLists | |||
| ) | [inline] |
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 [inline] |
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.
References alarms.
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::put | ( | Alarm | alarm | ) | throws AlarmCacheException [inline] |
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 alarms, sendMsgToListener(), and updateCategoryActiveLists().
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::removeActiveList | ( | Integer | identifier | ) | throws AlarmCacheException [inline] |
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.
References activeLists.
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::replace | ( | Alarm | alarm | ) | throws AlarmCacheException [inline] |
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 alarms, sendMsgToListener(), and updateCategoryActiveLists().
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::sendMsgToListener | ( | Alarm | actual, | |
| Alarm | old | |||
| ) | [inline, private] |
Send the message to the listener
NOTE: If the previous alarm does not exist (for example if the alarm is new) then we send as old alarm the actual alarm If we send a null then cern.laser.business.pojo.AlarmPublisher:publish returns an exception while executing Status previous_alarm_status=previous.getStatus();
This policy seems reasonable but could have an impact somewhere
| actual | The actual alarm | |
| old | The previous alarm |
References listener, and cern::laser::business::cache::AlarmCacheListener::onAlarmChange().
| void com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::updateCategoryActiveLists | ( | Alarm | alarm | ) | [inline, private] |
Update the CategoryActiveList for the alarm: all the CategoryActiveLists of the categories of the alarm will be updated. The alarmId is inserted or removed in the CategoryActiveList depending of the status of the alarm
| alarm | The alarm whose id must be inserted or removed for the CategoryActiveLists of its categories |
References cern::laser::business::data::CategoryActiveList::addAlarm(), cern::laser::business::data::Status::getActive(), getActiveListReference(), cern::laser::business::data::Alarm::getAlarmId(), cern::laser::business::data::Alarm::getCategories(), cern::laser::business::data::Alarm::getStatus(), and cern::laser::business::data::CategoryActiveList::removeAlarm().
HashMap<Integer,CategoryActiveList> com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::activeLists = new HashMap<Integer,CategoryActiveList>() [private] |
The HashMap with the active alarms per each category The map contains a CategoryActiveList per each category (the key is the Integer identifying the category)
Policy: the CategoryActiveList for a category is created and inserted in the map when a new alarm arrives (remember that an alarm has a Set of Categories) So it basically happens in the put and replace methods (based on the status of the alarm itself)
Referenced by getActiveListReference(), getCategoryList(), and removeActiveList().
HashMap<String,Alarm> com::cosylab::acs::laser::dao::ACSAlarmCacheImpl::alarms = new HashMap<String,Alarm>() [private] |
Referenced by ACSAlarmCacheImpl(), close(), dumpAlarmsCache(), getReference(), invalidate(), put(), and replace().
Referenced by ACSAlarmCacheImpl(), and getReference().
Referenced by ACSAlarmCacheImpl(), and sendMsgToListener().
1.6.2