All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.beans.samples.dips.context.AuthorContextDip

java.lang.Object
   |
   +----com.ibm.beans.dip.SimpleDip
           |
           +----com.ibm.beans.samples.dips.context.AuthorContextDip

public final class AuthorContextDip
extends SimpleDip
implements Dip, ContextElement, Serializable, DipPropertyChangeListener
The AuthorContext allows a user or application assembly expert to put an author name on an instance of a bean. The update policy provides the assembly specialist with a way to identify when the authorship of an instance changes.


Constructor Index

 o AuthorContextDip()
Constructs an AuthorContextDip.

Method Index

 o addAuthor(String)
Adds an author's name to the list of authors.
 o createImplementation(Object)
Creates the dip implementation, and provides the dip access to the dippable bean.
 o createPropertyChangeListener(Object, String[])
Returns an array of PropertyChangeListeners describing the method to call after the dipped bean's property change method is called.
 o getAuthors()
Get the names of the author, a convenience method, equivalent to getContextElement.
 o getContextElement()
Gets the names of the authors as the context element.
 o getContextElementName()
Gets the name of the Context element.
 o getUpdatePolicy()
Gets the update policy for the context element.
 o propertyChange(PropertyChangeEvent)
Checks to see if the property changed is in the context update policy.
 o retrieveDip()
Provides the framework with access to the dip.
 o setAuthors(Vector)
Sets the names of the authors, a convenience method, equivalent to setContextElement.
 o setContextElement(Object)
Sets the names of the authors as the context element.
 o setUpdatePolicy(ContextUpdatePolicy)
Sets the update policy for the context element.
 o typeName()
Returns the dip type name as a String.

Constructors

 o AuthorContextDip
 public AuthorContextDip()
Constructs an AuthorContextDip.

Methods

 o getAuthors
 public Vector getAuthors()
Get the names of the author, a convenience method, equivalent to getContextElement.

Returns:
A vector of strings representing the names of the authors.
 o addAuthor
 public void addAuthor(String name)
Adds an author's name to the list of authors.

Parameters:
name - A String representing the name of the author to be added.
 o setAuthors
 public void setAuthors(Vector names)
Sets the names of the authors, a convenience method, equivalent to setContextElement.

Parameters:
names - A Vector of Strings representing the names of the authors.
 o getContextElement
 public Object getContextElement()
Gets the names of the authors as the context element.

Returns:
An object representing the names of the author.
 o setContextElement
 public void setContextElement(Object o)
Sets the names of the authors as the context element.

Parameters:
o - An object which is a String representing the names of the authors.
 o getContextElementName
 public String getContextElementName()
Gets the name of the Context element.

Returns:
A String that identifies the kind of context.
 o getUpdatePolicy
 public ContextUpdatePolicy getUpdatePolicy()
Gets the update policy for the context element.

Returns:
A context policy update object
 o setUpdatePolicy
 public void setUpdatePolicy(ContextUpdatePolicy up)
Sets the update policy for the context element.

Parameters:
up - The context policy update object for this element.
 o typeName
 public final String typeName()
Returns the dip type name as a String.

Returns:
The type name of the dip.
Overrides:
typeName in class SimpleDip
 o createImplementation
 public Object createImplementation(Object obj) throws DipRejectAdditionException
Creates the dip implementation, and provides the dip access to the dippable bean.

Parameters:
obj - The bean being dipped.
Throws: DipRejectAdditionException
This exception is thrown if the dip rejects being added to the bean. Author context does not throw this exception.
Overrides:
createImplementation in class SimpleDip
 o createPropertyChangeListener
 public DipPropertyChangeListener[] createPropertyChangeListener(Object imp,
                                                                 String methods[]) throws DipRejectAdditionException
Returns an array of PropertyChangeListeners describing the method to call after the dipped bean's property change method is called.

For context dips this returns the list of PropertyChangeListeners that correspond to the update policy.

Parameters:
imp - This is the implementation returned from createImplementation
methods[] - This is the array of event methods in the dippable bean.
Returns:
The array of PropertyChangeListeners is a one-to-one mapping with the methods[] input parameter. This means PropertyChangeListener[i] will be used with methods[i], and the length of the two arrays are equal.
Throws: DipRejectAdditionException
This exception is thrown if the dip rejects being added to the bean. Author context does not throw this exception.
Overrides:
createPropertyChangeListener in class SimpleDip
 o retrieveDip
 public Dip retrieveDip()
Provides the framework with access to the dip.

Returns:
A reference to this instance.
Overrides:
retrieveDip in class SimpleDip
 o propertyChange
 public synchronized void propertyChange(PropertyChangeEvent evt)
Checks to see if the property changed is in the context update policy. If it is, it invokes an author dialog. The author dialog allows the user to attach a new author to an instance of a bean.

Parameters:
evt - The PropertyChangeEvent that the dip heard. This is checked against the properties registered in the context update policy.

All Packages  Class Hierarchy  This Package  Previous  Next  Index