beautypg.com

IBM WebSphere Adapters User Manual

Page 145

background image

A propertyChange() method should be implemented if a property needs to listen
for changes on some other property. Check the TwineBall sample for
ServiceTypeSingleProperty

.

To enable the function of both vetoableChange and propertyChange, the instance of
the property should be added to the propertyChangeListener list. In the
TwineBallMetadataSelection

class in the TwineBall sample, the property

representing operations listens on the property for serviceType:

propertyGroup = new WBIPropertyGroupImpl(Constants.SELECTION_PROPERTIES);

propertyGroup.setDisplayName(WBIMetadataDiscoveryImpl.getPropertyName

(Constants.SELECTIONPROPERTIES));

propertyGroup.setDescription(WBIMetadataDiscoveryImpl.getPropertyDescription

(Constants.SELECTIONPROPERTIES));

WBISingleValuedPropertyImpl typeProp = createServiceTypeProperty(propertyGroup);
ServiceTypeSingleProperty operationProp = createNamespaceProperty(propertyGroup);
createMaxRecordProperty(propertyGroup);
createRelativePathProperty(propertyGroup);

// Copy the applied properties to the new instance
if (this.getAppliedSelectionProperties() != null)

EMDUtil.copyValues(this.getAppliedSelectionProperties(), propertyGroup);

typeProp.addPropertyChangeListener(operationProp);

Progress monitor sample:

For enterprise metadata discovery processes that are time-consuming–such as
retrieving information from an EIS and building MetadataObject instances–you can
use the progress monitor.

While you are running the discovery service, the progress monitor can capture
information on current processes and allow you to cancel operations. You can
locate a handle to ProgressMonitor using the
following:WBIMetadataDiscovery.getLogUtils().getProgressMonitor(). As a
process elapses, you can use the setProgress() method to set progress levels that
approach a specified maximum as shown below:

WBIMetadataConnectionImpl.getToolContext().getProgressMonitor().setMaximum(100);
WBIMetadataConnectionImpl.getToolContext().getProgressMonitor().setMinimum(0);
WBIMetadataConnectionImpl.getToolContext().getProgressMonitor().setProgress(50);
WBIMetadataConnectionImpl.getToolContext().getProgressMonitor().setNote

("Getting namespace from Peoplesoft");

WBIMetadataDiscoveryImpl sample:

WBIMetadataDiscoveryImpl

is the main entry class for invoking enterprise metadata

discovery.

Interaction between the enterprise metadata discovery service and an EIS
originates in an implementation of the WBIMetadataDiscoveryImpl class. You must
implement the methods described below.

Constructor

The constructor should call super(Bundle Name). The bundle name is the name of
the resource bundle for property-group properties of the enterprise metadata
discovery; for example: super("com.abc.j2c.testapp.emd"). When creating
resource bundles the EMD.properties and LogMessages.properties should share
the same package name.

WebSphere Adapter development overview

139