javax.infobus
Interface InfoBusBean

All Known Implementing Classes:
InfoBusBeanSupport

public abstract interface InfoBusBean
extends InfoBusMember

Those InfoBusMembers which will also be Java Beans must implement the InfoBusBean interface to insure proper operation when used in Bean builder tools. InfoBusBean extends InfoBusMember to add a String property called infoBusName, which allows InfoBus membership to be easily manipulated in a Bean builder via a property page and is also serializable (which InfoBus objects are not). InfoBusMembers which are not usable as Beans can optionally implement the InfoBusBean interface to support this property.

InfoBusBeans preserve their infoBusName property for future use: if an InfoBusBean is serializable, it will serialize its infoBusName property. When an InfoBusBean voluntarily leaves an InfoBus by calling InfoBus.leave(), it retains its infoBusName property even though the infoBus property is reset to null. In all cases, when an InfoBusBean needs to join an InfoBus, it first checks its infoBusName property and attempts to use the one specified there as its first choice.

The setInfoBus method impacts the infoBusName property in a symmetric fashion: a successful call to setInfoBus will update the infoBusName to the name of the new bus.

An implementation of this interface is provided in the InfoBusBeanSupport class.

See Also:
InfoBusMember

Field Summary
static java.lang.String USE_DEFAULT_INFOBUS
          a reserved String, "-default", which indicates that the InfoBusBean should attempt to get and join its default InfoBus (NOTE cannot be used directly in InfoBus.get(String) ).
 
Method Summary
 java.lang.String getInfoBusName()
          Returns the String which is currently assigned to the InfoBusBean's infoBusName property.
 void setInfoBusName(java.lang.String newBusName)
          The setInfoBusName method must be a second means of setting the infoBus property: when setInfoBusName( newBusName ) is called, the InfoBusBean obtains the InfoBus specified by newBusName and then calls its own setInfoBus with the result.
 
Methods inherited from interface javax.infobus.InfoBusMember
addInfoBusPropertyListener, addInfoBusVetoableListener, getInfoBus, removeInfoBusPropertyListener, removeInfoBusVetoableListener, setInfoBus
 

Field Detail

USE_DEFAULT_INFOBUS

public static final java.lang.String USE_DEFAULT_INFOBUS
a reserved String, "-default", which indicates that the InfoBusBean should attempt to get and join its default InfoBus (NOTE cannot be used directly in InfoBus.get(String) ).
See Also:
setInfoBusName(java.lang.String)
Method Detail

setInfoBusName

public void setInfoBusName(java.lang.String newBusName)
                    throws InfoBusMembershipException
The setInfoBusName method must be a second means of setting the infoBus property: when setInfoBusName( newBusName ) is called, the InfoBusBean obtains the InfoBus specified by newBusName and then calls its own setInfoBus with the result. Calling setInfoBusName with null or the empty String ("") must cause the InfoBusBean to call its setInfoBus with null. If the call to setInfoBus produces a PropertyVetoException, the setInfoBusName method will catch it and throw an InfoBusMembershipException in its place. Other exceptions propagate uncaught to the caller of setInfoBusName.

The infoBusName and infoBus setter and getter methods must be synchronized so that calling either setter unambiguously updates both properties.

When setInfoBusName is called with the String "-default" (the constant InfoBusBean.USE_DEFAULT_INFOBUS), it indicates that the InfoBusBean should get its default InfoBus (for example, by InfoBus.get(Component) ) and use this for an immediate setInfoBus. If successful, the infoBusName property is updated to "-default" and will therefore be different from getInfoBus().getName(). Note that "-default" is a reserved String and is illegal as the name of an InfoBus object (InfoBus.getInfoBus("-default") will throw an IllegalArgumentException).

Parameters:
newBusName - the name of an InfoBus which will be assigned to the infoBus property if the action is not vetoed
Throws:
InfoBusMembershipException - if one of the VetoableChangeListeners rejects the proposed change of InfoBus

getInfoBusName

public java.lang.String getInfoBusName()
Returns the String which is currently assigned to the InfoBusBean's infoBusName property. It is possible that the infoBusName may be a non-null String and the infoBus property may be null, for example in some Applet Beans which have had their stop() called. The reverse condition, a non-null infoBus with a null infoBusName, is an unpermitted combination.
Returns:
the current value of the infoBusName property