|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.infobus.InfoBus
An InfoBus object maintains a list of InfoBusMembers that have attached to it and enables communication among those members. Using methods on the InfoBus object, members create InfoBusEvents which are distributed to other members to request, announce, and revoke data items.
The InfoBus supports a flexible security module called the InfoBusPolicyHelper that determines which, if any, methods called on the InfoBus perform permission checking. If the policy helper in use determines that a caller does not have the proper security clearance to perform the requested action, it will throw a RuntimeException. Note that all methods on the InfoBus are potentially subject to the policy helper's inspection. Static methods that are documented here as "Internally Synchronized" contain internal synchronized blocks which lock on a common static variable. Likewise, instance methods documented as "Internally Synchronized" contain internal synchronized blocks that lock on a common instance variable.InfoBusMembers should not new
an InfoBus, but should
call InfoBus.get to find the InfoBus they need.
InfoBusMember
,
InfoBusDataProducer
,
InfoBusDataConsumer
,
InfoBusBean
,
get(java.awt.Component)
Field Summary | |
static int |
HIGH_PRIORITY
A priority for a data controller. |
static int |
LOW_PRIORITY
A priority for a data controller. |
static int |
MEDIUM_PRIORITY
A priority for a data controller. |
static java.lang.String |
MIME_TYPE_ANY_ACCESS
MIME string used to indicate that any access interface is acceptable for this request. |
static java.lang.String |
MIME_TYPE_ARRAY_ACCESS
MIME string used for a DataFlavor indicating the presence or requirement of the ArrayAccess interface for an available or requested data item. |
static java.lang.String |
MIME_TYPE_COLLECTION
MIME string used for a DataFlavor indicating the presence or requirement of the Collection interface (see JDK Collections) for an available or requested data item. |
static java.lang.String |
MIME_TYPE_DB_ACCESS
MIME string used for a DataFlavor indicating the presence or requirement of the DbAccess interface for an available or requested data item. |
static java.lang.String |
MIME_TYPE_IMMEDIATE_ACCESS
MIME string used for a DataFlavor indicating the presence or requirement of the ImmediateAccess interface for an available or requested data item. |
static java.lang.String |
MIME_TYPE_LIST
MIME string used for a DataFlavor indicating the presence or requirement of the List interface (see JDK Collections) for an available or requested data item. |
static java.lang.String |
MIME_TYPE_MAP
MIME string used for a DataFlavor indicating the presence or requirement of the Map interface (see JDK Collections) for an available or requested data item. |
static java.lang.String |
MIME_TYPE_RESHAPEABLEARRAY_ACCESS
MIME string used for a DataFlavor indicating the presence or requirement of the ReshapeableArrayAccess interface for an available or requested data item. |
static java.lang.String |
MIME_TYPE_ROWSET_ACCESS
MIME string used for a DataFlavor indicating the presence or requirement of the RowsetAccess interface for an available or requested data item. |
static java.lang.String |
MIME_TYPE_SCROLLABLEROWSET_ACCESS
MIME string used for a DataFlavor indicating the presence or requirement of the ScrollableRowsetAccess interface for an available or requested data item. |
static java.lang.String |
MIME_TYPE_SET
MIME string used for a DataFlavor indicating the presence or requirement of the Set interface (see JDK Collections) for an available or requested data item. |
static int |
MONITOR_PRIORITY
A priority for a data controller. |
static int |
VERY_HIGH_PRIORITY
A priority for a data controller. |
static int |
VERY_LOW_PRIORITY
A priority for a data controller. |
Method Summary | |
void |
addDataConsumer(InfoBusDataConsumer consumer)
Registers an InfoBusDataConsumer on the InfoBus, so that the consumer can receive announcements of data availability via InfoBusItemAvailableEvents and InfoBusItemRevokedEvents. |
void |
addDataController(InfoBusDataController controller,
int priority)
Registers the InfoBusDataController on the InfoBus, adding it to a list of controllers sorted by priority. |
void |
addDataProducer(InfoBusDataProducer producer)
Registers an InfoBusDataProducer on the InfoBus, so that the producer can receive request notifications from consumers in the form of InfoBusItemRequestedEvents. |
java.lang.Object |
findDataItem(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataConsumer consumer)
Seeks a DataItem for a given data item name, by creating an InfoBusItemRequestedEvent and distributing it to producers on the bus. |
java.lang.Object |
findDataItem(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataConsumer consumer,
InfoBusDataProducer target)
Seeks a named DataItem only from a named target producer. |
java.lang.Object |
findDataItem(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataConsumer consumer,
java.util.Vector targets)
Requests data from a Vector of producers. |
java.lang.Object[] |
findMultipleDataItems(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataConsumer consumer)
Seeks all available data items for a specified data item name. |
void |
fireItemAvailable(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataProducer source)
Announces the availability of a DataItem, by creating an InfoBusItemAvailableEvent and sending it to all registered InfoBusDataConsumers. |
void |
fireItemAvailable(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataProducer source,
InfoBusDataConsumer target)
Creates an InfoBusItemAvailableEvent and sends it to the specified InfoBusDataConsumer. |
void |
fireItemAvailable(java.lang.String dataItemName,
java.awt.datatransfer.DataFlavor[] flavors,
InfoBusDataProducer source,
java.util.Vector targets)
Creates an InfoBusItemAvailableEvent and sends it to all InfoBusDataConsumers in the targets Vector. |
void |
fireItemRevoked(java.lang.String dataItemName,
InfoBusDataProducer source)
Notifies consumers that a DataItem is being revoked and will no longer be available from the given source. |
void |
fireItemRevoked(java.lang.String dataItemName,
InfoBusDataProducer source,
InfoBusDataConsumer target)
Creates an InfoBusItemRevokedEvent and sends it to the specified InfoBusDataConsumer. |
void |
fireItemRevoked(java.lang.String dataItemName,
InfoBusDataProducer source,
java.util.Vector targets)
Creates an InfoBusItemRevokedEvent and sends it to all InfoBusDataConsumers in the targets Vector. |
static InfoBus |
get(java.awt.Component component)
Returns the default InfoBus for a component. |
static InfoBus |
get(java.lang.String busName)
Returns a named InfoBus. |
java.lang.String |
getName()
Returns the String used as the unique identifier for this InfoBus. |
void |
join(InfoBusMember member)
Attaches an InfoBusMember to the InfoBus on which the method was called. |
void |
leave(InfoBusMember member)
Removes an InfoBusMember from the InfoBus. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Accepts notifications of an InfoBus change via a PropertyChangeEvent. |
void |
register(InfoBusMember member)
Registers an InfoBusMember on the InfoBus's list of active members, and also causes the InfoBus to register itself as a PropertyChangeListener on the InfoBusMember's InfoBus property. |
void |
release()
Releases the artificial reference to an InfoBus instance set by calling get(). |
void |
removeDataConsumer(InfoBusDataConsumer consumer)
Removes an InfoBusDataConsumer from the distribution list for InfoBusItemAvailableEvents and InfoBusItemRevokedEvents. |
void |
removeDataController(InfoBusDataController controller)
Removes a controller from the list of registered InfoBusDataControllers on this InfoBus. |
void |
removeDataProducer(InfoBusDataProducer producer)
Removes an InfoBusDataProducer from the distribution list for InfoBusItemRequestedEvents. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String MIME_TYPE_IMMEDIATE_ACCESS
public static final java.lang.String MIME_TYPE_ARRAY_ACCESS
public static final java.lang.String MIME_TYPE_RESHAPEABLEARRAY_ACCESS
public static final java.lang.String MIME_TYPE_ROWSET_ACCESS
public static final java.lang.String MIME_TYPE_SCROLLABLEROWSET_ACCESS
public static final java.lang.String MIME_TYPE_DB_ACCESS
public static final java.lang.String MIME_TYPE_COLLECTION
public static final java.lang.String MIME_TYPE_MAP
public static final java.lang.String MIME_TYPE_SET
public static final java.lang.String MIME_TYPE_LIST
public static final java.lang.String MIME_TYPE_ANY_ACCESS
public static final int MONITOR_PRIORITY
public static final int VERY_HIGH_PRIORITY
public static final int HIGH_PRIORITY
public static final int MEDIUM_PRIORITY
public static final int LOW_PRIORITY
public static final int VERY_LOW_PRIORITY
Method Detail |
public java.lang.String getName()
public static InfoBus get(java.awt.Component component)
The get() method introduces an artificial reference to the InfoBus to ensure that it is kept alive until a member joins it. This artificial reference must be released by calling the release() method on this class after the InfoBus has been used for a join or setInfoBus.
This is a low-level method which will not be used directly by most applications. We recommend the use of InfoBusMemberSupport or InfoBusBeanSupport methods for joining and leaving a bus.
component
- The java.awt.Component on which to base
the default namepublic static InfoBus get(java.lang.String busName)
Named infobuses are useful for builder environments, for classes that are not Components, and for applications that wish to specify security constraints on particular buses by name.
The get() method introduces an artificial reference to the InfoBus to ensure that it is kept alive until a member joins it. This artificial reference must be released by calling the release() method on this class after the InfoBus has been used for a join or setInfoBus.
This is a low-level method which will not be used directly by most applications. We recommend the use of InfoBusMemberSupport or InfoBusBeanSupport methods for joining and leaving a bus. NOTE: The string "-default" can be used with InfoBusBeanSupport.setInfoBusName() to request an Applet default InfoBus, but it cannot be used here with the get() method.
Internally Synchronized.
busName
- the unique identifier for the InfoBus being requestedpublic void release()
This is a low-level method which will not be used directly by most applications. We recommend the use of InfoBusMemberSupport or InfoBusBeanSupport methods for joining and leaving a bus.
Internally Synchronized.
public void join(InfoBusMember member) throws java.beans.PropertyVetoException
The join method is typically called by the InfoBusMember wishing to join an InfoBus, after it has obtained an InfoBus instance by calling the get() method.
This is a low-level method which will not be used directly by most applications. We recommend the use of InfoBusMemberSupport or InfoBusBeanSupport methods for joining and leaving a bus.
Internally Synchronized.
member
- the InfoBusMember to attach to the InfoBuspublic void register(InfoBusMember member)
The register method must be called by an InfoBusMember's setInfoBus method (unless the setInfoBus was vetoed).
This is a low-level method which will not be used directly by most applications. We recommend the use of InfoBusMemberSupport or InfoBusBeanSupport methods for joining and leaving a bus.
Internally Synchronized.
member
- the member to add to the active member listpublic void propertyChange(java.beans.PropertyChangeEvent event)
This is a low-level method which will not be used directly by most applications. We recommend the use of InfoBusMemberSupport or InfoBusBeanSupport methods for joining and leaving a bus.
event
- encapsulates the InfoBusMember having its InfoBus property
changed, and the property's old and new valuespublic void leave(InfoBusMember member) throws java.beans.PropertyVetoException
This is a low-level method which will not be used directly by most applications. We recommend the use of InfoBusMemberSupport or InfoBusBeanSupport methods for joining and leaving a bus.
Internally Synchronized.
member
- the InfoBusMember which is disconnecting from the InfoBuspublic void addDataController(InfoBusDataController controller, int priority) throws InfoBusMembershipException
controller
- the controller to be added to the buspriority
- the priority of the controller for sorting
purposes; should be one of the following:
Internally Synchronized.
InfoBusDataController
public void removeDataController(InfoBusDataController controller)
Internally Synchronized.
controller
- the controller to be removedpublic void addDataProducer(InfoBusDataProducer producer)
Internally Synchronized.
producer
- the producer to add to the InfoBusItemRequestedEvent
distribution listpublic void removeDataProducer(InfoBusDataProducer producer)
Internally Synchronized.
producer
- the producer that no longer wishes to receive
InfoBus request notificationspublic void addDataConsumer(InfoBusDataConsumer consumer)
Internally Synchronized.
consumer
- the consumer to add to the distribution list
for the above Eventspublic void removeDataConsumer(InfoBusDataConsumer consumer)
Internally Synchronized.
consumer
- the consumer that no longer wishes to receive
InfoBus notificationspublic void fireItemAvailable(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataProducer source)
Each consumer that wants the DataItem uses one of the findDataItem methods, resulting in the source's requestDataItem method being called to retrieve the data.
dataItemName
- the name of the DataItem being offeredflavors
- the flavors of data the producer wishes to supply.
Producers can use null if they don’t care to describe the data.source
- the producer that can provide the DataItempublic void fireItemRevoked(java.lang.String dataItemName, InfoBusDataProducer source)
The InfoBus requires that when an available event for a particular data item name and producer is fired, it must be received by all listeners before the corresponding revoked event (i.e., a revoked event from the same producer with the same data item name) is fired. In order to guarantee that this requirement is met, before firing the available event, the producer must temporarily disable its ability to send the corresponding revoked event by using synchronization techniques appropriate for multithreaded operation.
This can be accomplished using a synchronization block around code that fires available and revoked events. In implementing this, a component must not specify its InfoBus as the parameter to the Java synchronized keyword, as this can cause a deadlock to occur.
dataItemName
- the name of the DataItem being revokedsource
- the producer that will no longer provide the datapublic java.lang.Object findDataItem(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataConsumer consumer)
A producer that has the requested data will put a data item for it in the event's dataItem field, and the InfoBus returns it to the caller. The InfoBus stops distributing the event as soon as a non-null response is received.
dataItemName
- the name of the data item to request on the InfoBusflavors
- the consumer's preferred transfer flavors (optional, may be null)consumer
- the InfoBusMember making the requestfindMultipleDataItems(java.lang.String, java.awt.datatransfer.DataFlavor[], javax.infobus.InfoBusDataConsumer)
public java.lang.Object[] findMultipleDataItems(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataConsumer consumer)
dataItemName
- the name of the data item to request on the InfoBusflavors
- the consumer's preferred transfer flavors (optional, may be null)consumer
- the InfoBusDataConsumer making the requestfindDataItem(java.lang.String, java.awt.datatransfer.DataFlavor[], javax.infobus.InfoBusDataConsumer)
public java.lang.Object findDataItem(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataConsumer consumer, InfoBusDataProducer target)
dataItemName
- the name of the data item being requestedflavors
- the consumer's preferred transfer flavors (optional, may be null)consumer
- the consumer making the requesttarget
- the target producer to be queried for the datapublic java.lang.Object findDataItem(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataConsumer consumer, java.util.Vector targets)
This method is primarily for use by data controllers.
dataItemName
- the name of the data item being requestedflavors
- the consumer's preferred transfer flavors (optional, may be null)consumer
- the consumer making the requesttargets
- a list of target producers to be queried for the dataInfoBusDataController
public void fireItemAvailable(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataProducer source, InfoBusDataConsumer target)
dataItemName
- the name of the DataItem being offeredflavors
- the flavors of data the producer wishes to
supply. Producers can use null if they don’t care to describe the data.source
- the producer that can provide the DataItemtarget
- the consumer that receives the notification eventInfoBusDataController
public void fireItemAvailable(java.lang.String dataItemName, java.awt.datatransfer.DataFlavor[] flavors, InfoBusDataProducer source, java.util.Vector targets)
dataItemName
- the name of the DataItem being offeredflavors
- the flavors of data the producer wishes to
supply. Producers can use null if they don’t care to describe the data.source
- the producer that can provide the DataItemtargets
- the list of target consumers to receive the eventInfoBusDataController
public void fireItemRevoked(java.lang.String dataItemName, InfoBusDataProducer source, InfoBusDataConsumer target)
dataItemName
- the name of the DataItem being offeredsource
- the producer that is revoking the DataItemtarget
- the consumer that will receive the notification eventInfoBusDataController
public void fireItemRevoked(java.lang.String dataItemName, InfoBusDataProducer source, java.util.Vector targets)
dataItemName
- the name of the DataItem being offeredsource
- the producer that is revoking the DataItemtargets
- the list of target consumers to receive the eventInfoBusDataController
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |