Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Listener Notifications | Listener Implementation | Specifying Configuration Metadata for Listener Notifications
 
Specifying Configuration Metadata for Listener Notifications
The next step for implementing a listener is to create the metadata constructs that the users of the adapter use for entering data when they create listener notification nodes. To do this, perform the following:
*Create metadata parameters appropriate for the function of the listener notification nodes. Each parameter has:
*A variable to hold the configured values.
*A String constant containing the name of the parameter.
*An accessor method.
*A set of resource bundle entries with a localizable parameter name and description as shown in Updating the Resource Bundle.
For more information on metadata parameters, see Metadata Model for Connection.
*Describe presentation for those metadata parameters.
*Set the data entry rules for those metadata parameters.
The example implementation includes one metadata parameter, that the users of the adapter use to create listener notification nodes. The following table describes the purpose of each of these parameters for data entry:
Parameter
Description
fileName
File to monitor.
Parameter
Accessor Method
Variable
Resource Bundle Entries
fileName
setFileName
FILE_NAME_PARM
None
Specifying the Display and Data Entry Attributes of the Data Entry Parameters
*After creating the parameters, specify the display and data entry attributes by calling various methods of the WmDescriptor interface from the service's fillWmDescriptor method.
*The example code places each data entry parameter into a single group (in display order) referenced by the constant NOTIFICATION_SETUP_GROUP. A constant instead of a string is used to name the group, because the same value is used in the resource bundle to specify a localizable group name.
Restricting Listeners to Register Specified Notification Templates
By default a listener supports all listener notification templates of the adapter. When the users of the adapter configure a new listener notification (either synchronous or asynchronous) using Designer, they may select from the complete list of all enabled listeners in the adapter. You may want to override this default behavior so that the listener implementation specifies exactly which notification templates it supports. To do this, implement the restrictNotificationTypes method in your listener implementation class. This method returns a String array containing the fully qualified path names of one or more notification template classes that the listener supports. When the users of the adapter attempt to configure a new listener notification in Designer, only those template classes in the returned array will appear in the Adapter Notification Editor. The following example shows how to use this method.
public class SimpleListener extends WmConnectedListener
{
...
public String[] restrictNotificationTypes()
{
return new String[]{"com.wm.myadapter.notifications.FooNotification",
"com.wm.myadapter.notifications.BarNotification"};
}
...
}
Note:
All names returned by this method should refer to classes that extend WmNotification.