org.qi4j.library.alarm
Interface AlarmSystem

All Known Subinterfaces:
AlarmSystemService
All Known Implementing Classes:
AlarmSystem.AlarmSystemMixin

@Mixins(value=AlarmSystem.AlarmSystemMixin.class)
public interface AlarmSystem

Defines the AlarmSystem interface.

The AlarmSystem is a central registry/handler for all AlarmPoint objects. By registering AlarmListeners to the AlarmSystem, objects are able to 'ignore' the fact that there are many AlarmPoint objects in the system.

Also, new attributes registered with the AlarmSystem will propagate into all existing and future AlarmPoints, whereas attributes at AlarmPoint level is individual to an AlarmPoint.

Many different AlarmModels can co-exist in the same application. In fact, every AlarmPoint can have its own AlarmModel, and the AlarmModel can be changed in runtime, for unrivaled flexibility. However, typically the AlarmModel is set in the AlarmSystem only, and all Alarms will use the default model.

The default alarm model is a service set by during assembly;


   public void assemble( ModuleAssembly module )
       throws AssemblyException
   {
       module.addServices( AlarmSystemService.class );
       module.addServices( StandardAlarmModelService.class );
   }
 


Nested Class Summary
static class AlarmSystem.AlarmSystemMixin
          AlarmSystem implementation.
 
Method Summary
 void addAlarmListener(AlarmListener listener)
          Register AlarmListener to recieve AlarmEvents from all Alarms managed by this AlarmSystem.
 Query<AlarmPoint> alarmList()
          Returns a list of all Alarms registered to the service.
 java.util.List<AlarmListener> alarmListeners()
          Returns an immmutable list of all AlarmListeners registered to the service.
 java.util.List<AlarmModelDescriptor> alarmModels()
          Returns all the AlarmModels that has been installed.
 AlarmPoint createAlarm(java.lang.String name, AlarmCategory category)
          Creates an AlarmPoint with the default AlarmModel.
 AlarmModel defaultAlarmModel()
          Returns the default AlarmModel.
 void removeAlarmListener(AlarmListener listener)
          Remove the AlarmListener from the AlarmSystem.
 

Method Detail

alarmModels

java.util.List<AlarmModelDescriptor> alarmModels()
Returns all the AlarmModels that has been installed.

Returns:
all the AlarmModels that has been installed.

defaultAlarmModel

AlarmModel defaultAlarmModel()
Returns the default AlarmModel.

Returns:
the default AlarmModel in this AlarmSystem.

alarmList

Query<AlarmPoint> alarmList()
Returns a list of all Alarms registered to the service.

The returned Collection may not be modified in any way. The implementation is free to return a clone, but not required to do so, and may decide to terminate if the collection is modified.

Returns:
a list of all Alarms registered to the service.

createAlarm

AlarmPoint createAlarm(java.lang.String name,
                       AlarmCategory category)
Creates an AlarmPoint with the default AlarmModel.

Parameters:
name - the name of the AlarmPoint to be created.
category - The category the created AlarmPoint should belong to.
Returns:
the created AlarmPoint with the given name using the default AlarmModel.

addAlarmListener

void addAlarmListener(AlarmListener listener)
Register AlarmListener to recieve AlarmEvents from all Alarms managed by this AlarmSystem.

Parameters:
listener - the global listener to be added.

removeAlarmListener

void removeAlarmListener(AlarmListener listener)
Remove the AlarmListener from the AlarmSystem.

Parameters:
listener - the global listener to be removed.

alarmListeners

java.util.List<AlarmListener> alarmListeners()
Returns an immmutable list of all AlarmListeners registered to the service.

Returns:
a list of all AlarmListeners registered to the service.