javax.infobus
Class InfoBusBeanSupport

java.lang.Object
  |
  +--javax.infobus.InfoBusMemberSupport
        |
        +--javax.infobus.InfoBusBeanSupport

public class InfoBusBeanSupport
extends InfoBusMemberSupport
implements InfoBusBean, java.io.Serializable

Implements the methods of the InfoBusBean interface with the functionality specified by the InfoBus protocol. It is an extension of InfoBusMemberSupport which adds support for the setInfoBusName and getInfoBusName methods.

Methods documented here as "Internally Synchronized" contain internal synchronized blocks that lock on a common instance variable.

See Also:
InfoBusBean, Serialized Form

Constructor Summary
InfoBusBeanSupport()
          The no-argument constructor is provided for subclasses which want to be Serializable; it has the same effect as calling new InfoBusBeanSupport(null)
InfoBusBeanSupport(InfoBusMember parent)
          Creates a new InfoBusBeanSupport object, with both the infoBusName and InfoBus properties set to null. The parent parameter allows the parent of InfoBusBeanSupport to implement the InfoBusMember interface and have the parent -- instead of the InfoBusBeanSupport object -- specified in all PropertyChangeEvents and on the InfoBus itself.
InfoBusBeanSupport(InfoBusMember parent, java.lang.String initialBusName)
          Creates a new InfoBusBeanSupport object with the specified parent and sets the initial value of the infoBusName property to supplied string.
 
Method Summary
 InfoBus getInfoBus()
          Returns the InfoBus which is currently assigned to the InfoBusBeanSupport's InfoBus property.
 java.lang.String getInfoBusName()
          Returns the String which is currently assigned to the InfoBusBeanSupport's infoBusName property.
 void leaveInfoBus()
          Calls the leave method on the InfoBus to which this InfoBusBeanSupport is attached, effectively setting the InfoBus property to null.
 void rejoinInfoBus()
          In cases where the infoBusName property is non-null but the infoBus property is null (for example after deserialization), the rejoinInfoBus method is used to cause the infoBus property to update to the name stored in infoBusName.
 void setInfoBus(InfoBus newInfoBus)
          Attempts to set the InfoBus property and register with the InfoBus.
 void setInfoBusName(java.lang.String newBusName)
          Attempts to set the infoBus property by setting the corresponding infoBusName property -- the infoBusName will only be updated if the infoBus can be changed to the bus named by newBusName.
 
Methods inherited from class javax.infobus.InfoBusMemberSupport
addInfoBusPropertyListener, addInfoBusVetoableListener, joinInfoBus, joinInfoBus, removeInfoBusPropertyListener, removeInfoBusVetoableListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InfoBusBeanSupport

public InfoBusBeanSupport(InfoBusMember parent)
Creates a new InfoBusBeanSupport object, with both the infoBusName and InfoBus properties set to null.

The parent parameter allows the parent of InfoBusBeanSupport to implement the InfoBusMember interface and have the parent -- instead of the InfoBusBeanSupport object -- specified in all PropertyChangeEvents and on the InfoBus itself. If parent is null, the InfoBusBeanSupport object is specified in these cases.

NOTE: if parent is non-null, it must be Serializable if the the InfoBusBeanSupport might be serialized -- in other words, InfoBusBeanSupport can only serialize properly if parent is Serializable.

Parameters:
parent - used as the "source" of PropertyChangeEvents issued by the InfoBusBeanSupport. If null, the InfoBusBeanSupport object is used as the "source."

InfoBusBeanSupport

public InfoBusBeanSupport(InfoBusMember parent,
                          java.lang.String initialBusName)
Creates a new InfoBusBeanSupport object with the specified parent and sets the initial value of the infoBusName property to supplied string. Although the infoBusName is given an initial value, this constructor does not attempt to join that InfoBus: the InfoBus property remains null. A join can be initiated by calling rejoinInfoBus().

The parent parameter allows the parent of InfoBusBeanSupport to implement the InfoBusMember interface and have the parent -- instead of the InfoBusBeanSupport object -- specified in all PropertyChangeEvents and on the InfoBus itself. If parent is null, the InfoBusBeanSupport object is specified in these cases.

NOTE: if parent is non-null, it must be Serializable if the the InfoBusBeanSupport might be serialized -- in other words, InfoBusBeanSupport can only serialize properly if parent is Serializable.

Parameters:
parent - used as the "source" of PropertyChangeEvents issued by the InfoBusBeanSupport. If null, the InfoBusBeanSupport object is used as the "source."
initialBusName - the initial value of the infoBusName property.

InfoBusBeanSupport

public InfoBusBeanSupport()
The no-argument constructor is provided for subclasses which want to be Serializable; it has the same effect as calling new InfoBusBeanSupport(null)
Method Detail

setInfoBus

public void setInfoBus(InfoBus newInfoBus)
                throws java.beans.PropertyVetoException
Attempts to set the InfoBus property and register with the InfoBus. First, it checks with any registered VetoableChangeListeners, and rethrows the PropertyVetoException if the attempt is denied. If successful, it updates the infoBusName to the name of the new InfoBus and then sends notification to all registered PropertyChangeListeners.

Internally Synchronized.

Parameters:
newInfoBus - the InfoBus that will be assigned to the InfoBus property if the action is not vetoed
Throws:
java.beans.PropertyVetoException - if one or more of the VetoableChangeListeners reject the proposed change of InfoBus
Overrides:
setInfoBus in class InfoBusMemberSupport

getInfoBus

public InfoBus getInfoBus()
Returns the InfoBus which is currently assigned to the InfoBusBeanSupport's InfoBus property.

Internally Synchronized.

Returns:
the current value of the InfoBus property
Overrides:
getInfoBus in class InfoBusMemberSupport

setInfoBusName

public void setInfoBusName(java.lang.String newBusName)
                    throws InfoBusMembershipException
Attempts to set the infoBus property by setting the corresponding infoBusName property -- the infoBusName will only be updated if the infoBus can be changed to the bus named by newBusName.

Setting the infoBusName to null or the empty String ("") has the same effect as attempting a setInfoBus(null). Using "-default" causes the InfoBusBeanSupport to attempt to join its default bus, as described in InfoBusBean.

Internally Synchronized.

Specified by:
setInfoBusName in interface InfoBusBean
Parameters:
newBusName - the name of the InfoBus which this InfoBusBean should get and join. If null or empty String (""), directs the InfoBusBean to leave its current bus (if any), making infoBus and infoBusName properties null
Throws:
InfoBusMembershipException - if one or more of the VetoableChangeListeners reject the proposed change of the infoBus property or if the parent is not of type Component
See Also:
InfoBusBean.setInfoBusName(java.lang.String)

getInfoBusName

public java.lang.String getInfoBusName()
Returns the String which is currently assigned to the InfoBusBeanSupport's infoBusName property. See InfoBusBean for details on when the infoBusName property and getInfoBus().getName() might differ.

Note that this method returns the empty String ("") when the infoBusName is null (to better support Bean builder property sheets).

Internally Synchronized.

Specified by:
getInfoBusName in interface InfoBusBean
Returns:
the current value of the infoBusName property
See Also:
InfoBusBean.getInfoBusName(), InfoBusBean.setInfoBusName(java.lang.String)

leaveInfoBus

public void leaveInfoBus()
                  throws InfoBusMembershipException,
                         java.beans.PropertyVetoException
Calls the leave method on the InfoBus to which this InfoBusBeanSupport is attached, effectively setting the InfoBus property to null. However, the InfoBusBeanSupport will retain the infoBusName property. This permits the infoBusName to be serialized, or a restarted applet to call rejoinInfoBus() to reattach to the last bus used. To force both the infoBus and infoBusName properties to null, use setInfoBus(null) or setInfoBusName(null)

Internally Synchronized.

Throws:
InfoBusMembershipException - if the InfoBus property is already set to null
java.beans.PropertyVetoException - if a VetoableChangeListener refuses to allow the InfoBus to be set to null
Overrides:
leaveInfoBus in class InfoBusMemberSupport

rejoinInfoBus

public void rejoinInfoBus()
                   throws InfoBusMembershipException
In cases where the infoBusName property is non-null but the infoBus property is null (for example after deserialization), the rejoinInfoBus method is used to cause the infoBus property to update to the name stored in infoBusName. The method does nothing if infoBus property is non-null, or if infoBusName is null.

This method is specific to InfoBusBeanSupport and not part of the InfoBusBean interface or the InfoBusMemberSupport.

Throws:
InfoBusMembershipException - if a VetoableChangeListener refuses to permit the infoBus property to be set to the bus named