Top Description Fields Constructors Methods
org.osgi.service.dmt.notification

public Class AlertItem

extends Object
Class Inheritance
Imports
org.osgi.service.dmt.DmtData, .Uri

Immutable data structure carried in an alert (client initiated notification). The AlertItem describes details of various notifications that can be sent by the client, for example as alerts in the OMA DM protocol. The use cases include the client sending a session request to the server (alert 1201), the client notifying the server of completion of a software update operation (alert 1226) or sending back results in response to an asynchronous EXEC command.

The data syntax and semantics varies widely between various alerts, so does the optionality of particular parameters of an alert item. If an item, such as source or type, is not defined, the corresponding getter method returns null. For example, for alert 1201 (client-initiated session) all elements will be null.

The syntax used in AlertItem class corresponds to the OMA DM alert format. NotificationService implementations on other management protocols should map these constructs to the underlying protocol.

Author
$Id: 2b73aa3f4b13b747c587366dc2e983c33e2bc611 $

Field Summary

Modifier and TypeField and Description
private final DmtData
private final String
private final String
private final String

Constructor Summary

AccessConstructor and Description
public
AlertItem(String
the URI of the node which is the source of the alert item
source
,
String
a MIME type or a URN that identifies the type of the data in the alert item
type
,
String
the mark parameter of the alert item
mark
,
DmtData
a DmtData object that contains the format and value of the data in the alert item
data
)

Create an instance of the alert item.

public
AlertItem(String[]
the path of the node which is the source of the alert item
source
,
String
a MIME type or a URN that identifies the type of the data in the alert item
type
,
String
the mark parameter of the alert item
mark
,
DmtData
a DmtData object that contains the format and value of the data in the alert item
data
)

Create an instance of the alert item, specifying the source node URI as an array of path segments.

Method Summary

Modifier and TypeMethod and Description
public DmtData

Returns:

the data associated with the alert item, or null if there is no data
getData
()

Get the data associated with the alert item.

public String

Returns:

the mark associated with the alert item, or null if there is no mark
getMark
()

Get the mark parameter associated with the alert item.

public String

Returns:

the URI of the node which is the source of this alert, or null if there is no source
getSource
()

Get the node which is the source of the alert.

public String

Returns:

the type associated with the alert item, or null if there is no type
getType
()

Get the type associated with the alert item.

public String

Returns:

the string representation of this alert item
toString
()

Overrides java.lang.Object.toString.

Returns the string representation of this alert item.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

databack to summary
private final DmtData data
markback to summary
private final String mark
sourceback to summary
private final String source
typeback to summary
private final String type

Constructor Detail

AlertItemback to summary
public AlertItem(String source, String type, String mark, DmtData data)

Create an instance of the alert item. The constructor takes all possible data entries as parameters. Any of these parameters can be null. The semantics of the parameters may be refined by the definition of a specific alert, identified by its alert code (see NotificationService#sendNotification(String, int, String, AlertItem[]) ). In case of Generic Alerts for example (code 1226), the mark parameter contains a severity string.

Parameters
source:String

the URI of the node which is the source of the alert item

type:String

a MIME type or a URN that identifies the type of the data in the alert item

mark:String

the mark parameter of the alert item

data:DmtData

a DmtData object that contains the format and value of the data in the alert item

AlertItemback to summary
public AlertItem(String[] source, String type, String mark, DmtData data)

Create an instance of the alert item, specifying the source node URI as an array of path segments. The constructor takes all possible data entries as parameters. Any of these parameters can be null. The semantics of the parameters may be refined by the definition of a specific alert, identified by its alert code (see NotificationService#sendNotification(String, int, String, AlertItem[]) ). In case of Generic Alerts for example (code 1226), the mark parameter contains a severity string.

Parameters
source:String[]

the path of the node which is the source of the alert item

type:String

a MIME type or a URN that identifies the type of the data in the alert item

mark:String

the mark parameter of the alert item

data:DmtData

a DmtData object that contains the format and value of the data in the alert item

Method Detail

getDataback to summary
public DmtData getData()

Get the data associated with the alert item. The returned DmtData object contains the format and the value of the data in the alert item. There might be no data associated with the alert item.

Returns:DmtData

the data associated with the alert item, or null if there is no data

getMarkback to summary
public String getMark()

Get the mark parameter associated with the alert item. The interpretation of the mark parameter depends on the alert being sent, as identified by the alert code in NotificationService#sendNotification(String, int, String, AlertItem[]) . There might be no mark associated with the alert item.

Returns:String

the mark associated with the alert item, or null if there is no mark

getSourceback to summary
public String getSource()

Get the node which is the source of the alert. There might be no source associated with the alert item.

Returns:String

the URI of the node which is the source of this alert, or null if there is no source

getTypeback to summary
public String getType()

Get the type associated with the alert item. The type string is a MIME type or a URN that identifies the type of the data in the alert item (returned by getData()). There might be no type associated with the alert item.

Returns:String

the type associated with the alert item, or null if there is no type

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the string representation of this alert item. The returned string includes all parameters of the alert item, and has the following format:

  AlertItem(<source>, <type>, <mark>, <data>)
The last parameter is the string representation of the data value. The format of the data is not explicitly included.
Returns:String

the string representation of this alert item

Annotations
@Override