Adapter Development Kit 6.5 | webMethods Adapter Development Kit Documentation | webMethods Adapter Development Kit Installation and User’s Documentation | Adapter Services | The Metadata Model for Adapter Services | Resource Domains | Registering Resource Domains | Example of Registering Resource Domains
 
Example of Registering Resource Domains
The following example registers two resource domains:
101. public void registerResourceDomain(WmAdapterAccess access)
102. throws AdapterException
103. {
104. ResourceDomainValues tableRdvs = new ResourceDomainValues(
105. MockDbUpdate.TABLES_RD, mockTableNames);
106. tableRdvs.setComplete(true);
107. access.addResourceDomain(tableRdvs);
108.
109. access.addResourceDomainLookup(MockDbUpdate.COLUMN_NAMES_RD,this);
110. access.addResourceDomainLookup(MockDbUpdate.COLUMN_TYPES_RD,this);
111.
112. ResourceDomainValues rdvs = new ResourceDomainValues(
113. MockDbUpdate.OVERRIDE_TYPES_RD, new String[] {""});
114. rdvs.setComplete(false);
115. rdvs.setCanValidate(true);
116. access.addResourceDomain(rdvs);
117. access.addCheckValue(MockDbUpdate.OVERRIDE_TYPES_RD,this);
...
121. }
In this example, note that:
*Lines 104-105 create a ResourceDomainValues object (identified by the constant MockDbUpdate.TABLES_RD).
*Line 106 indicates that adapter users may not supply their own values to the resource domain.
*Line 107 adds a resource domain to this object.
*Lines 109-110 adds lookups for this object, indicating that the resource domain is dynamic. For these lookups, you must pass an instance of the connection that can satisfy the lookup. This is accomplished by using the "this" reference.
*Lines 112-113 create an empty ResourceDomainValues object.
*Line 114-115 indicates that adapter users may supply their own values, and the adapter will validate these values. setCanValidate(true) calls the adapterCheckValue method (line 117) for each value that is not already in the resource domain.
*Line 116 adds a resource domain to this object. This is a fixed resource domain because no lookups are performed.