public interface AlarmPoint extends HasIdentity
This is the basic interface for the whole AlarmPoint System. The AlarmPoint
is created by calling createAlarm()
method in the
AlarmSystem
or the AlarmModel
.
Alarms can be triggered by an standard trigger, which are java.lang.Strings. 3 triggers are pre-defined; activate,deactivate and acknowledge and must be present in all standard systems and standard impl.
The basic usage looks like this;
// Creation
AlarmPoint ala1 = alarmService.createAlarm( "My AlarmPoint" );
:
:
// use
if( alarmcondition ) // The condition should only detect transitions.
ala1.trigger( this, "activate" );
It is important to know that every call to trigger()
will generate an AlarmEvent, so the trigger()
should
only be called when the standard condition changes. For this purpose, there is
a convenience method, that will create/generate the trigger
method calls when a boolean standard condition changes. The usage is fairly
simple.
Example;
ala1.updateCondition( value > highlimit );
It is possible to mix and match the usage of updateCondition()
and trigger()
methods without any concerns.
To create alarms with different AlarmModels, other than the default as shown above, you need to retrieve the AlarmModel that fulfill the needs required. This can be done in the following manner;
AlarmModel[] impl = alarmService.getAlarmModelsAvailable();
// selection algorithm
AlarmPoint ala2 = impl[selected].createAlarm( "My AlarmPoint" );
The default AlarmModel can be changed by a call to the
AlarmSystem.setDefaultAlarmModel()
and
ALL ALARMS that has the old AlarmModel assigned to it, will be
transferred to the new default AlarmModel. It is important to
understand that this is done irregardless of whether the AlarmPoint was
created from the AlarmSystem.createAlarm()
method or
the AlarmModel.createAlarm()
method. If distinct different
behaviours are required for certain Alarms, and yet want to allow
users to freely select AlarmModel for all other Alarms, one need
to create two instances of the same AlarmModels, one used solely
for the pre-defined AlarmPoint behaviours, and the others for the rest of
the Alarms.
Modifier and Type | Interface and Description |
---|---|
static class |
AlarmPoint.AlarmPointMixin |
static interface |
AlarmPoint.AlarmState
The AlarmState is an internal type, used inside the AlarmPoint for all state that needs to be persisted on disk
and/or transferred across networks.
|
HasIdentity.HasIdentityMixin
Modifier and Type | Field and Description |
---|---|
static String |
EVENT_ACKNOWLEDGEMENT |
static String |
EVENT_ACTIVATION |
static String |
EVENT_BLOCKING |
static String |
EVENT_DEACTIVATION |
static String |
EVENT_DISABLING |
static String |
EVENT_ENABLING |
static String |
EVENT_UNBLOCKING |
static String |
STATUS_ACKNOWLEDGED |
static String |
STATUS_ACTIVATED |
static String |
STATUS_BLOCKED |
static String |
STATUS_DEACTIVATED |
static String |
STATUS_DISABLED |
static String |
STATUS_NORMAL |
static String |
STATUS_REACTIVATED |
static String |
TRIGGER_ACKNOWLEDGE |
static String |
TRIGGER_ACTIVATE |
static String |
TRIGGER_BLOCK |
static String |
TRIGGER_DEACTIVATE |
static String |
TRIGGER_DISABLE |
static String |
TRIGGER_ENABLE |
static String |
TRIGGER_UNBLOCK |
IDENTITY_METHOD, IDENTITY_STATE_NAME
Modifier and Type | Method and Description |
---|---|
void |
acknowledge()
Acknowledges an AlarmPoint.
|
void |
activate()
Activates an AlarmPoint.
|
Property<AlarmClass> |
alarmClass()
The
AlarmClass of the AlarmPoint. |
String |
attribute(String name)
Return the attribute of the given name.
|
List<String> |
attributeNames()
Return all attribute names
|
Property<AlarmCategory> |
category()
The
AlarmCategory of this AlarmPoint. |
boolean |
currentCondition()
Get AlarmPoint condition.
|
AlarmStatus |
currentStatus()
Returns the current state of the standard.
|
void |
deactivate()
Deactivates an AlarmPoint.
|
String |
description(Locale locale)
Returns a Description of the AlarmPoint.
|
String |
descriptionInDefaultLocale()
Returns a Description of the AlarmPoint.
|
AlarmHistory |
history()
Returns the AlarmHistory of the standard.
|
String |
name()
Returns the Name of the AlarmPoint.
|
void |
setAttribute(String name,
String value)
Sets the attribute of the given name.
|
void |
trigger(String trigger)
Trigger a state change.
|
void |
updateCondition(boolean condition)
Set AlarmPoint condition.
|
identity
static final String STATUS_NORMAL
static final String STATUS_ACTIVATED
static final String STATUS_DEACTIVATED
static final String STATUS_REACTIVATED
static final String STATUS_ACKNOWLEDGED
static final String STATUS_DISABLED
static final String STATUS_BLOCKED
static final String EVENT_ENABLING
static final String EVENT_DISABLING
static final String EVENT_BLOCKING
static final String EVENT_UNBLOCKING
static final String EVENT_ACTIVATION
static final String EVENT_DEACTIVATION
static final String EVENT_ACKNOWLEDGEMENT
static final String TRIGGER_ACTIVATE
static final String TRIGGER_DEACTIVATE
static final String TRIGGER_ACKNOWLEDGE
static final String TRIGGER_BLOCK
static final String TRIGGER_UNBLOCK
static final String TRIGGER_ENABLE
static final String TRIGGER_DISABLE
void trigger(String trigger) throws IllegalArgumentException
When the AlarmPoint object receives a trigger, it must consult the AlarmModel and figure out if there is an actual state change occurring and if any AlarmEvents should be fired.
trigger
- The trigger to execute if existing in the AlarmModel.IllegalArgumentException
- if a trigger is not a known one.void activate()
Convenience method for:
trigger( "activate" );
void deactivate()
trigger( "deactivate" );
void acknowledge()
trigger( source, "acknowledge" );
boolean currentCondition()
void updateCondition(boolean condition)
condition
- Sets the AlarmPoint condition.AlarmStatus currentStatus()
AlarmHistory history()
List<String> attributeNames()
String attribute(String name)
name
- The name of the attribute to return.void setAttribute(String name, @Optional String value)
name
- The name of the attribute to set.value
- The value to set the named attribute to.String name()
String descriptionInDefaultLocale()
String description(Locale locale)
null
, then the
default Locale is used.locale
- The locale to return the description in, or null to use default locale.@UseDefaults Property<AlarmClass> alarmClass()
AlarmClass
of the AlarmPoint.
The AlarmClass
indicates the urgency of AlarmEvent
s emitted from the AlarmPoint. The property
has UseDefaults
annotation so that the application developer can set the default during assembly.
The default Assembler
in this library defaults alarms to AlarmClass
B.AlarmClass
.Property<AlarmCategory> category()
AlarmCategory
of this AlarmPoint.
AlarmCategory is used to group Alarms together, which can be used to forward AlarmEvent
to different
destinations, produce reports for different target audiences or separation of aggregation.AlarmCategory
.