Adapter Development Kit 9.12 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Adapter Services | Adapter Service Implementation | Implementing Configuration Resource Domains for Adapter Service
 
Implementing Configuration Resource Domains for Adapter Service
The next step for implementing an adapter service is to:
*Define and implement the resource domains required for the metadata parameters that you created.
*Identify the values upon which those resource domains depend.
For each parameter that requires either a resource domain to supply a value or that requires a validity check for values supplied by the users of the adapter, you must:
1. In the service's fillWmTemplateDescriptor method, call WmTemplateDescriptor.setResourceDomain method, passing the name of the parameter, the name of the resource domain, and an array of the names of any parameters on which the resource domain depends.
2. In the associated connection class's WmManagedConnection.registerResourceDomain method, call WmAdapterAccess.addResourceDomain(ResourceDomainValues) to register the resource domain support.
3. Implement the code to populate the resource domain values and/or the "check values".
4. In the associated connection class's WmManagedConnection.registerResourceDomain method, call WmAdapterAccess.addResourceDomainLookup(Resource_Domain_Name, WmManagedConnection) method to add the resource domains that have to be looked up.
*The first parameter, tableName, is associated with a new resource domain called tableNameRD.
*The list of available tables in this example does not depend on any other parameters, so the dependency list is left null.
*Furthermore, since the list does not change once it is retrieved from the resource, it can be implemented as a complete resource domain during registration.
*When a ResourceDomainValues object is provided in registerResourceDomain, there is no need to add support for the resource domain in the lookup method.
*The resource domains columnNamesRD and columnTypesRD are created to support the columnNames and columnTypes parameters, respectively. The columNamesRD resource domain depends on the value of the tableName parameter. Since columnNames and columnTypes were placed in a tuple, columnTypesRD must also depend on the value of tableName.
*The lookup implementation for these resource domains checks for the name of the resource domain and returns the values for both resource domains in a single response array. The columnNamesRD resource domain is always passed as the resource domain name in this lookup. Adding the '||' check decouples the lookup implementation from the order in which the parameters were placed in the tuple.
*The final resource domain, overrideTypesRD associated with the overrideTypes parameter, is used to validate data entered by the users of the adapter into a Java class that contains the data at run time. The specifics of the check implementation are probably unrealistic for a real-world environment, but all the mechanics of doing a check are demonstrated. Remember to set the setCanValidate method to true in the WmManagedConnection.registerResourceDomain method.