Top Description Fields Constructors Methods
org.osgi.service.dal.functions.data

public Class AlarmData

extends FunctionData
Class Inheritance
Imports
java.util.Map, org.osgi.service.dal.FunctionData, org.osgi.service.dal.functions.Alarm

Function alarm data. It cares about the alarm type, severity, timestamp and additional metadata. It doesn't support unit. The alarm type is mapped to FunctionData value.
See Also
Alarm, FunctionData

Field Summary

Modifier and TypeField and Description
public static final String
FIELD_SEVERITY

Represents the severity field name.

public static final String
FIELD_TYPE

Represents the type field name.

private final int
public static final int
SEVERITY_CRITICAL

The severity rating indicates that there a critical alarm.

public static final int
SEVERITY_MAJOR

The severity rating indicates that there is a major alarm.

public static final int
SEVERITY_MINOR

The severity rating indicates that there is a minor alarm.

public static final int
SEVERITY_UNDEFINED

The severity constant indicates that there is no severity rating for this alarm.

private final int
public static final int
TYPE_ACCESS_CONTROL

The alarm type indicates that there is access control issue.

public static final int
TYPE_BURGLAR

The alarm type indicates that there is a burglar notification.

public static final int
TYPE_COLD

The alarm type indicates that temperature is too low.

public static final int
TYPE_GAS_CO

The alarm type indicates that carbon monoxide (CO) is detected.

public static final int
TYPE_GAS_CO2

The alarm type indicates that carbon dioxide (CO2) is detected.

public static final int
TYPE_HARDWARE_FAIL

The alarm type indicates that there is hardware failure.

public static final int
TYPE_HEAT

The alarm type indicates that temperature is too high.

public static final int
TYPE_POWER_FAIL

The alarm type indicates a power cut.

public static final int
TYPE_SMOKE

The alarm type indicates that smoke is detected.

public static final int
TYPE_SOFTWARE_FAIL

The alarm type indicates that there is software failure.

public static final int
TYPE_TAMPER

The alarm type for a tamper indication.

public static final int
TYPE_UNDEFINED

The alarm type indicates that the type is not specified.

public static final int
TYPE_WATER

The alarm type indicates that a water leak is detected.

Inherited from org.osgi.service.dal.FunctionData:
DESCRIPTIONFIELD_METADATAFIELD_TIMESTAMP

Constructor Summary

AccessConstructor and Description
public
AlarmData(Map<String, ?>
Contains the new AlarmData instance field values.
fields
)

Constructs new AlarmData instance with the specified field values.

public
AlarmData(long
The alarm data timestamp optional field.
timestamp
,
Map<String, ?>
The alarm data metadata optional field.
metadata
,
int
The alarm data severity optional field.
severity
,
int
The alarm data type optional field.
type
)

Constructs new AlarmData instance with the specified arguments.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

-1, 0 or 1 depending on the comparison rules.
compareTo
(Object
AlarmData to be compared.
o
)

Overrides org.osgi.service.dal.FunctionData.compareTo.

Implements java.lang.Comparable.compareTo.

Compares this AlarmData instance with the given argument.

public boolean

Returns:

true if this object is equivalent to the specified one.
equals
(Object
The object to compare this data.
o
)

Overrides org.osgi.service.dal.FunctionData.equals.

Two AlarmData instances are equal if they contain equal metadata, timestamp, type and severity.

public int

Returns:

The alarm severity.
getSeverity
()

Returns the alarm severity.

private String
public int

Returns:

The alarm type.
getType
()

Returns the alarm type.

public int

Returns:

The hash code of this AlarmData object.
hashCode
()

Overrides org.osgi.service.dal.FunctionData.hashCode.

Returns the hash code for this AlarmData object.

public String

Returns:

The string representation of this alarm data.
toString
()

Overrides java.lang.Object.toString.

Returns the string representation of this alarm data.

private void
Inherited from org.osgi.service.dal.FunctionData:
getMetadatagetTimestamp

Field Detail

FIELD_SEVERITYback to summary
public static final String FIELD_SEVERITY

Represents the severity field name. The field value is available with getSeverity(). The field type is int. The constant can be used as a key to AlarmData(Map) .

FIELD_TYPEback to summary
public static final String FIELD_TYPE

Represents the type field name. The field value is available with getType(). The field type is int. The constant can be used as a key to AlarmData(Map).

severityback to summary
private final int severity
SEVERITY_CRITICALback to summary
public static final int SEVERITY_CRITICAL

The severity rating indicates that there a critical alarm. The severity priority is higher than SEVERITY_MINOR and SEVERITY_MAJOR.

SEVERITY_MAJORback to summary
public static final int SEVERITY_MAJOR

The severity rating indicates that there is a major alarm. The severity priority is higher than SEVERITY_MINOR and lower than SEVERITY_CRITICAL.

SEVERITY_MINORback to summary
public static final int SEVERITY_MINOR

The severity rating indicates that there is a minor alarm. The severity priority is lower than SEVERITY_MAJOR and SEVERITY_CRITICAL.

SEVERITY_UNDEFINEDback to summary
public static final int SEVERITY_UNDEFINED

The severity constant indicates that there is no severity rating for this alarm.

typeback to summary
private final int type
TYPE_ACCESS_CONTROLback to summary
public static final int TYPE_ACCESS_CONTROL

The alarm type indicates that there is access control issue. For example, the alarm can indicate that the door is unlocked.

TYPE_BURGLARback to summary
public static final int TYPE_BURGLAR

The alarm type indicates that there is a burglar notification. For example, the alarm can indicate that the glass is broken.

TYPE_COLDback to summary
public static final int TYPE_COLD

The alarm type indicates that temperature is too low.

TYPE_GAS_COback to summary
public static final int TYPE_GAS_CO

The alarm type indicates that carbon monoxide (CO) is detected.

TYPE_GAS_CO2back to summary
public static final int TYPE_GAS_CO2

The alarm type indicates that carbon dioxide (CO2) is detected.

TYPE_HARDWARE_FAILback to summary
public static final int TYPE_HARDWARE_FAIL

The alarm type indicates that there is hardware failure.

TYPE_HEATback to summary
public static final int TYPE_HEAT

The alarm type indicates that temperature is too high.

TYPE_POWER_FAILback to summary
public static final int TYPE_POWER_FAIL

The alarm type indicates a power cut.

TYPE_SMOKEback to summary
public static final int TYPE_SMOKE

The alarm type indicates that smoke is detected.

TYPE_SOFTWARE_FAILback to summary
public static final int TYPE_SOFTWARE_FAIL

The alarm type indicates that there is software failure.

TYPE_TAMPERback to summary
public static final int TYPE_TAMPER

The alarm type for a tamper indication.

TYPE_UNDEFINEDback to summary
public static final int TYPE_UNDEFINED

The alarm type indicates that the type is not specified.

TYPE_WATERback to summary
public static final int TYPE_WATER

The alarm type indicates that a water leak is detected.

Constructor Detail

AlarmDataback to summary
public AlarmData(Map<String, ?> fields)

Constructs new AlarmData instance with the specified field values. The map keys must match to the field names. The map values will be assigned to the appropriate class fields. For example, the maps can be: {"severity"=Integer(1)...}. That map will initialize the FIELD_SEVERITY field with 1. If severity is missing, SEVERITY_UNDEFINED is used.

  • FIELD_SEVERITY - optional field. The value type must be Integer.
  • FIELD_TYPE - optional field. The value type must be Integer.
Parameters
fields:Map<String, ?>

Contains the new AlarmData instance field values.

Exceptions
ClassCastException:
If the field value types are not expected.
IllegalArgumentException:
If the alarm severity is invalid.
NullPointerException:
If the fields map is null.
AlarmDataback to summary
public AlarmData(long timestamp, Map<String, ?> metadata, int severity, int type)

Constructs new AlarmData instance with the specified arguments.

Parameters
timestamp:long

The alarm data timestamp optional field.

metadata:Map<String, ?>

The alarm data metadata optional field.

severity:int

The alarm data severity optional field.

type:int

The alarm data type optional field.

Exceptions
IllegalArgumentException:
If the alarm severity is invalid.

Method Detail

compareToback to summary
public int compareTo(Object o)

Overrides org.osgi.service.dal.FunctionData.compareTo.

Implements java.lang.Comparable.compareTo.

Compares this AlarmData instance with the given argument. If the argument is not AlarmData, it throws ClassCastException. Otherwise, this method returns:

  • -1 if this instance field is less than a field of the specified argument.
  • 0 if all fields are equivalent.
  • 1 if this instance field is greater than a field of the specified argument.
The fields are compared in this order: timestamp, metadata, type, severity.
Parameters
o:Object

AlarmData to be compared.

Returns:int

-1, 0 or 1 depending on the comparison rules.

Annotations
@Override
Exceptions
ClassCastException:
If the method argument is not of type AlarmData.
See Also
java.lang.Comparable#compareTo(java.lang.Object)
equalsback to summary
public boolean equals(Object o)

Overrides org.osgi.service.dal.FunctionData.equals.

Two AlarmData instances are equal if they contain equal metadata, timestamp, type and severity.

Parameters
o:Object

The object to compare this data.

Returns:boolean

true if this object is equivalent to the specified one.

Annotations
@Override
See Also
org.osgi.service.dal.FunctionData#equals(java.lang.Object)
getSeverityback to summary
public int getSeverity()

Returns the alarm severity. The severity can be one of:

Returns:int

The alarm severity.

getSeverityAsStringback to summary
private String getSeverityAsString()
getTypeback to summary
public int getType()

Returns the alarm type. The type can be one of the predefined:

Zero and positive values are reserved for this definition and further extensions of the alarm types. Custom types can be used only as negative values to prevent potential collisions.
Returns:int

The alarm type.

hashCodeback to summary
public int hashCode()

Overrides org.osgi.service.dal.FunctionData.hashCode.

Returns the hash code for this AlarmData object. The hash code is a sum of FunctionData#hashCode(), the alarm severity and the alarm type.

Returns:int

The hash code of this AlarmData object.

Annotations
@Override
See Also
org.osgi.service.dal.FunctionData#hashCode()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the string representation of this alarm data.

Returns:String

The string representation of this alarm data.

Annotations
@Override
validateback to summary
private void validate()