javax.infobus
Interface DataItem


public abstract interface DataItem

The DataItem interface provides identifying and descriptive information about a data item. Well-behaved InfoBus data producers always implement this interface on the top-level data item being exchanged. For multi-level data items, such as a Collection of data items, we recommend the implementation of DataItem for items at every level. This may not always be possible, so consumers should be prepared to use it if it is there, and degrade gracefully otherwise.

The data described by a data item is accessed through one of the Infobus access interfaces, which are implemented on the data item in addition to the DataItem interface:

In addition, the data may be accessed using the Java Collection API.

Complex data typically should not be contained in the DataItem object, but in a location convenient for its producer.


Method Summary
 java.lang.Object getProperty(java.lang.String propertyName)
          Returns a property or metadata information about the item.
 InfoBusEventListener getSource()
          Returns the source of the DataItem.
 void release()
          Allows a producer to know when a consumer has finished using a data item.
 

Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String propertyName)
Returns a property or metadata information about the item. It is recommended that the "Name" property be supported for announced data items, and that it return the String representing the data item name used for announcement or request. Support for other properties and the "Name" property for sub-items is optional.
Parameters:
propertyName - the name of the property requested. Property names must not contain the ‘*’ character.
Returns:
the requested property, or null if the requested property is not supported.

getSource

public InfoBusEventListener getSource()
Returns the source of the DataItem. The source returned by this method should be the same as the one that calls InfoBus.fireItemAvailable for this DataItem, so that consumers can associate the DataItem with the InfoBusEvent that announced it (especially important if different DataItems share one name).
Returns:
the source that provides this DataItem

release

public void release()
Allows a producer to know when a consumer has finished using a data item. Consumers are required to call this method when they are about to drop their last reference to an item or anything obtained directly or indirectly from the item, including subitems and transfer data (from Transferable.getTransferData()). Producers may optionally manage resources for data items in their implementation of this method.