Resource environment references

 

+

Search Tips   |   Advanced Search

 

WAS supports the <resource-env-ref> mechanism by providing resource environment provider administrative objects that are configured using the administration tools. Each <resource-env-ref> requires the creation of the following administered objects in the order shown:

Resource environment provider Defines an administrative object that groups together the referenceable, resource environment entry administrative objects and any required custom properties.

The scope you choose determines which resources.xml configuration file is updated to contain the provider's configuration stanza:

<resources.env:ResourceEnvironmentProvider 
    xmi:id="ResourceEnvironmentProvider_1" 
    name="ResProviderName"/>

Referenceable This object defines the classname of the factory class that returns object instances implementing a Java interface.

<resources.env:ResourceEnvironmentProvider 
   xmi:id="ResourceEnvironmentProvider_1" 
   name="ResProviderName">

    <referenceables xmi:id="Referenceable_1" 
                    factoryClassname="com.ibm.itso.test.LogWriterFactory" 
                    classname="com.ibm.itso.test.LogWriter"/>

  </resources.env:ResourceEnvironmentProvider>

Resource environment entry Defines the binding target (JNDI name), factory class, and return object type (via link to the Referenceable) of the resource environment entry.

The referenceable's configuration is added to the provider's stanza in the resources.xml file appropriate to the scope, as in Example 6-8.

<resources.env:ResourceEnvironmentProvider 
    xmi:id="ResourceEnvironmentProvider_1" 
    name="ResProviderName">

  <factories xmi:type="resources.env:ResourceEnvEntry" 
             xmi:id="ResourceEnvEntry_1" 
             name="MyLogWriter" 
             jndiName="myapp/MyLogWriter" 
             referenceable="Referenceable_1"/>

  <referenceables xmi:id="Referenceable_1" 
                  factoryClassname="com.ibm.itso.test.LogWriterFactory" 
                  classname="com.ibm.itso.test.LogWriter"/>

  </resources.env:ResourceEnvironmentProvider>

Next