Use WebSphere bindings to define resource environment reference JNDI names

JBoss-specific deployment descriptors, jboss-web.xml and jboss.xml, might contain resource environment reference elements. These elements map resource environment references to a JNDI name. This rule detects the JBoss resource environment reference JNDI names. In the source scanner, the quick fix migrates the JNDI name to the WebSphere Application Server bindings file.

Example of jboss-web.xml constructs detected:

<jboss-web>
...
<resource-env-ref>
<resource-env-ref-name>jms/myQueue</resource-env-ref-name>
<jndi-name>jndi/myQueue</jndi-name>
</resource-env-ref>
...
</jboss-web>

The corresponding resource environment reference must be available in the corresponding web.xml file. For this example, the web.xml file must contain a resource-env-ref named jms/myQueue.

<web-app>
...
<resource-env-ref>
<resource-env-ref-name>jms/myQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
...
</web-app>

The quick fix saves the JNDI name in the bindings file, and the reference is correlated to a <resource-env-ref> element in the web.xml file.

Similarly for jboss.xml EJB constructs, when <resource-env-ref> elements correspond to an <resource-env-ref> element in the ejb-jar.xml for a specific EJB, the JNDI name will be saved in WebSphere traditional and Liberty bindings.

<jboss>
<enterprise-beans>
</session>
<ejb-name>MyBean</ejb-name>
...
<resource-env-ref>
<resource-env-ref-name>jms/myQueue</resource-env-ref-name>
<jndi-name>jndi/myQueue</jndi-name>
</resource-env-ref
...
</session>
</enterprise-beans>
</jboss>