Resource Domain Lookups
A dynamic resource domain uses resource domain lookups. The method addResourceDomainLookup is used to enable the adapter to look up parameter values in the adapter resource.
When the users of the adapter create an adapter service node, they select a connection in which the adapter service executes. That connection also provides data from the resource domain that you registered with the connection.
When a node is created, the adapter service editor initiates a resource domain lookup to the connection class for each of the adapter's metadata parameters that are associated with dynamic resource domains. Additional lookups are made as the users of the adapter modify the values of parameters upon which other parameters depend.
All resource domain lookups invoke the method adapterResourceDomainLookup in the WmManagedConnection implementation class:
ResourceDomainValues[] adapterResourceDomainLookup(String serviceName,
String resourceDomainName,
String[][] values)
Parameter Name | Description |
serviceName | Class name of the adapter service. |
resourceDomainName | Registered name of the resource domain. |
values | A multi-dimensional array that is populated with the current value of the parameters upon which the current lookup depends, as specified in the WmTemplateDescriptor.setResourceDomain call. |
For example:
d.setResourceDomain( "columnsArg", "columnsLookup", new String[] {"tablesArg"});
This call creates a dependency on tablesArg. When the lookup for the columnsLookup resource domain is made, the values argument contains the current settings for the tablesArg parameter. Data in the values argument is organized such that:
The first dimension of the array determines the dependent parameter.
The second dimension iterates the data in the parameter.
Thus, values[0][0] contains the value of the first dependent parameter. If it is a sequence parameter, then values[0][1] would contain the next value in the sequence, values[0][2] the next, and so on. If there were more than one dependency, the contents of the second parameter on which the lookup depends would be contained in values[1][].
Note:
Placing a sequence parameter in a field map has several effects on the resource domain lookup process (see
Tuples).
The signature of adapterResourceDomainLookup indicates that an array of ResourceDomainValues objects must be returned. Unless your implementation includes tuples, there must be exactly one object in the response array, and the name attribute of that ResourceDomainValues object must always be the same as the resourceDomainName argument passed into the method.
When the adapter service editor receives the lookup response data, it is evaluated against any data in the "current" parameter (the parameter for which the lookup was performed). An entry in the current parameter is considered valid if any one of the following is true:
The parameter value matches a value in the
ResourceDomainValues list.
ResourceDomainValues.setComplete(false) and
ResourceDomainValues.setCanValidate(false).
ResourceDomainValues.setComplete(false) and
ResourceDomainValues.setCanValidate(true) and the value was successfully validated through the
adapter check values facility.
If the current parameter settings are considered valid, then the parameter values remain unchanged. However, any current parameter values are merged with the values in the lookup response when the parameter's dropdown list is opened. (This effectively extends the resource domain to include values that were entered by the user.) If the current parameter settings are not considered valid, then the invalid value is deleted and replaced by a value in the resource domain.