org.openpermis.policy.bean.basic
Class BasicPropertyForwarder

java.lang.Object
  extended by org.openpermis.policy.bean.basic.BasicPropertyForwarder
All Implemented Interfaces:
PropertyChangeListener, EventListener

public class BasicPropertyForwarder
extends Object
implements PropertyChangeListener

Forwarder for bean part property changes.

Once registered at a bean part it will observe changes and register itself as listener for any bean part value changes. Any changes in contained bean parts will then be forwarded.

Since:
0.1.0

Field Summary
private static org.slf4j.Logger LOGGER
          The logger object of this class.
private  PartBean partBean
          The part bean for which to forward changes in contained part beans.
private  PropertyChangeSupport propertyChangeSupport
          The property change support to use for forwarding.
private  IdentityHashMap<PartBean,String> propertyMap
          Maps the contained part beans this forwarder is attached to their property names.
private static boolean TRACE
          Enable to see verbose log output message forwarding.
 
Constructor Summary
BasicPropertyForwarder(PartBean partBean, PropertyChangeSupport propertyChangeSupport)
          Creates and registers new basic property forwarder for the specified part bean.
 
Method Summary
protected  void attach(String propertyName, Object obj)
          Attaches this forwarder as a change listener to the specified object.
protected  void detach(String propertyName, Object obj)
          Detaches this forwarder as a change listener from the specified object.
protected  void forward(PropertyChangeEvent event)
          Forwards this event to listeners of the owner part bean.
 void propertyChange(PropertyChangeEvent event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
The logger object of this class.

Since:
0.1.0

TRACE

private static final boolean TRACE
Enable to see verbose log output message forwarding.

Constant Field Value:
false
Since:
0.1.0

partBean

private final PartBean partBean
The part bean for which to forward changes in contained part beans.

Since:
0.1.0

propertyChangeSupport

private final PropertyChangeSupport propertyChangeSupport
The property change support to use for forwarding.

Since:
0.1.0

propertyMap

private final IdentityHashMap<PartBean,String> propertyMap
Maps the contained part beans this forwarder is attached to their property names.

Notes:
We have to use an identity hash map here since the beans are mutable and will thus change their hash code. Using the identity will allow us to track them anyway. We could also have used the serial number of the part bean, but then we would have to make sure that the serial number lies in the same context and we could not support undefined serial numbers.
Since:
0.1.0
Constructor Detail

BasicPropertyForwarder

public BasicPropertyForwarder(PartBean partBean,
                              PropertyChangeSupport propertyChangeSupport)
Creates and registers new basic property forwarder for the specified part bean.

Parameters:
partBean - the part bean for which to forward contained part bean property changes.
propertyChangeSupport - the property change support to use for forwarding.
Since:
0.1.0
Method Detail

detach

protected void detach(String propertyName,
                      Object obj)
Detaches this forwarder as a change listener from the specified object.

If the object is a PartBean it simply detaches itself.

If the object is a Collection it will detach itself deeply.

Parameters:
propertyName - the name of the property that caused the detach.
obj - the object to detach from, may be null.
Since:
0.1.0

attach

protected void attach(String propertyName,
                      Object obj)
Attaches this forwarder as a change listener to the specified object.

If the object is a PartBean it simply attaches itself.

If the object is a Collection it will attach itself deeply.

Parameters:
propertyName - the name of the property that caused the attach.
obj - the object to attach to, may be null.
Since:
0.1.0

forward

protected void forward(PropertyChangeEvent event)
Forwards this event to listeners of the owner part bean.

The event forwarded will have the same propagation ID as the event passed in.

Parameters:
event - the event to forward, source must not be null.
Since:
0.1.0

propertyChange

public void propertyChange(PropertyChangeEvent event)
Specified by:
propertyChange in interface PropertyChangeListener
Since:
0.1.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:22
Copyright (c) 2002-2007 Ergon Informatik AG