equip.data.beans
Class PropertySubscriberBean

java.lang.Object
  extended byjava.beans.beancontext.BeanContextChildSupport
      extended byequip.data.beans.PropertySubscriberBean
All Implemented Interfaces:
java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextServiceRevokedListener, java.beans.beancontext.BeanContextServicesListener, DataspaceEventListener, java.util.EventListener, java.io.Serializable

public class PropertySubscriberBean
extends java.beans.beancontext.BeanContextChildSupport
implements DataspaceEventListener

take a tuple from a dataspace and present as a bean property. monitors data item(s) of the form generated by PropertyPublisherBean and maps to a regular bean property and optionally sets anther beans property to match. This bean monitor assumes that there will only be at most one data item with the given class and item name. If more exist then the most recently added will be used. PropertyPublisherBean publishes a data item of class equip.data.Tuple with two fields. The first is a equip.data.StringBox with the nominal class name of the tuple, and the second is the property value itself (if a subclass of equip.runtime.ValueBase) or an equip.data.SerializedObject (if the property value is serializable). The name of the item (field of equip.data.ItemData) is also set by configuration to identify individual data items. The GUID is arbitrary and allocated on creation. To be active we need: - a dataspace (reference to equip.data.beans.DataspaceBean) - a tuple nominal class name (String) - a data item name (String) For the optional property push mode, i.e. setting another bean's property we also need: - a reference to the bean (java.lang.Object) - the name of the property to be set on that bean. In any case, the value is made available as the bean property 'value', of type java.lang.Object which supports PropertyChangeListeners.

See Also:
Serialized Form

Field Summary
 boolean debug
          debug
protected  DataSession dsSession
          dataspace callback session
protected  GUID mCurrentItemId
          dataspace current item id
protected  DataspaceBean mDataspace
          dataspace
protected  boolean mIsConnected
          active/connected
protected  java.lang.String mItemClassName
          item class name
protected  java.util.Vector mItemIds
          dataspace time-order list of matching item ids
protected  java.lang.String mItemName
          item name
protected  boolean mPushActive
          push active
protected  java.lang.Class mPushPropertyClass
          push target property type/class
protected  java.lang.String mPushPropertyName
          push target property name
protected  java.lang.Object mPushTarget
          push target as object
protected  java.lang.Object mValue
          last value
 
Fields inherited from class java.beans.beancontext.BeanContextChildSupport
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
Constructor Summary
PropertySubscriberBean()
          no-arg constructor - required
 
Method Summary
protected  ItemData createItemTemplate()
          create item template
 void dataspaceEvent(DataspaceEvent event)
          notify of event (cf DataCallbackPost)
 void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          fire property changed
 DataspaceBean getDataspace()
          source getter
 boolean getDebug()
           
 java.lang.String getItemClassName()
          item name getter
 java.lang.String getItemName()
          item name getter
 java.lang.String getPushPropertyName()
          property name getter
 java.lang.Object getPushTarget()
          source getter
 java.lang.Object getValue()
          value proxy
 void setDataspace(DataspaceBean dataspace)
          dataspace setter - initialisation time only
 void setDebug(boolean d)
           
 void setItemClassName(java.lang.String itemClassName)
          item class name setter - initialisation time only
 void setItemName(java.lang.String itemName)
          item name setter - initialisation time only
 void setPushPropertyName(java.lang.String pushPropertyName)
          property name setter - initialisation time only
 void setPushTarget(java.lang.Object pushTarget)
          push target setter - initialisation time only
 
Methods inherited from class java.beans.beancontext.BeanContextChildSupport
addPropertyChangeListener, addVetoableChangeListener, fireVetoableChange, getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public boolean debug
debug


mValue

protected java.lang.Object mValue
last value


mPushTarget

protected java.lang.Object mPushTarget
push target as object


mPushPropertyName

protected java.lang.String mPushPropertyName
push target property name


mPushPropertyClass

protected java.lang.Class mPushPropertyClass
push target property type/class


mDataspace

protected DataspaceBean mDataspace
dataspace


mItemName

protected java.lang.String mItemName
item name


mItemClassName

protected java.lang.String mItemClassName
item class name


mIsConnected

protected boolean mIsConnected
active/connected


mPushActive

protected boolean mPushActive
push active


mCurrentItemId

protected GUID mCurrentItemId
dataspace current item id


mItemIds

protected java.util.Vector mItemIds
dataspace time-order list of matching item ids


dsSession

protected DataSession dsSession
dataspace callback session

Constructor Detail

PropertySubscriberBean

public PropertySubscriberBean()
no-arg constructor - required

Method Detail

setDebug

public void setDebug(boolean d)

getDebug

public boolean getDebug()

firePropertyChange

public void firePropertyChange(java.lang.String propertyName,
                               java.lang.Object oldValue,
                               java.lang.Object newValue)
fire property changed


setPushTarget

public void setPushTarget(java.lang.Object pushTarget)
push target setter - initialisation time only


getPushTarget

public java.lang.Object getPushTarget()
source getter


setPushPropertyName

public void setPushPropertyName(java.lang.String pushPropertyName)
property name setter - initialisation time only


getPushPropertyName

public java.lang.String getPushPropertyName()
property name getter


setItemName

public void setItemName(java.lang.String itemName)
item name setter - initialisation time only


getItemName

public java.lang.String getItemName()
item name getter


setItemClassName

public void setItemClassName(java.lang.String itemClassName)
item class name setter - initialisation time only


getItemClassName

public java.lang.String getItemClassName()
item name getter


setDataspace

public void setDataspace(DataspaceBean dataspace)
dataspace setter - initialisation time only


getDataspace

public DataspaceBean getDataspace()
source getter


createItemTemplate

protected ItemData createItemTemplate()
create item template


dataspaceEvent

public void dataspaceEvent(DataspaceEvent event)
notify of event (cf DataCallbackPost)

Specified by:
dataspaceEvent in interface DataspaceEventListener

getValue

public java.lang.Object getValue()
value proxy