JMSResourcepublic class JMSResource extends GenericResource
Constructors Summary |
---|
public JMSResource()Creates a new instance of Element
|
Methods Summary |
---|
public void | transform(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)element - jms-resource
parentSource - resources element of source
parentResult - resources element of result
Element resultResource = null;
logger.log(Level.FINE, stringManager.getString("upgrade.transform.transformingMSG", this.getClass().getName(), element.getTagName()));
String resourceType = element.getAttribute("res-type");
logger.log(Level.FINE, stringManager.getString(this.getClass().getName() + ":: resourceType ", resourceType));
/*
* JMS resource type. This can be one of: javax.jms.Topic, javax.jms.Queue, javax.jms.TopicConnectionFactory, javax.jms.QueueConnectionFactory
*/
if(resourceType.equals("javax.jms.Topic") || resourceType.equals("javax.jms.Queue")){
// javax.jms.Topic, javax.jms.Queue must use admin-object-resource in 8.0
resultResource = this.transformToAdminObjectResource(element, parentSource, parentResult);
}else{
// javax.jms.TopicConnectionFactory, javax.jms.QueueConnectionFactory must use connector-resouce in appserver 8.0
resultResource = this.transformToConnectorResource(element, parentSource, parentResult);
}
super.updateResourceRef(resultResource, parentResult);
super.transform(element, parentSource, resultResource);
| private void | transformConnectorPool(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
NodeList connectorPools = parentResult.getElementsByTagName("connector-connection-pool");
Element connectorPool = null;
for(int lh =0; lh < connectorPools.getLength(); lh++){
// Compare one key attribute
if((element.getAttribute("jndi-name")).equals(((Element)connectorPools.item(lh)).getAttribute("name"))){
connectorPool = (Element)connectorPools.item(lh);
connectorPool.setAttribute("connection-definition-name", element.getAttribute("res-type"));
connectorPool.setAttribute("resource-adapter-name", "jmsra");
break;
}
}
if(connectorPool == null){
// Add element - http-listener to result http-service.
connectorPool = parentResult.getOwnerDocument().createElement("connector-connection-pool");
connectorPool.setAttribute("name", element.getAttribute("jndi-name"));
connectorPool.setAttribute("connection-definition-name", element.getAttribute("res-type"));
connectorPool.setAttribute("resource-adapter-name", "jmsra");
this.appendElementToParent(parentResult,connectorPool);
}
| private org.w3c.dom.Element | transformToAdminObjectResource(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
NodeList resultResources = parentResult.getElementsByTagName("admin-object-resource");
Element resultResource = null;
for(int lh =0; lh < resultResources.getLength(); lh++){
// Compare one key attribute
if((element.getAttribute("jndi-name")).equals(((Element)resultResources.item(lh)).getAttribute("jndi-name"))){
resultResource = (Element)resultResources.item(lh);
resultResource.setAttribute("res-type", element.getAttribute("res-type"));
resultResource.setAttribute("enabled", element.getAttribute("enabled"));
resultResource.setAttribute("res-adapter", "jmsra");
break;
}
}
if(resultResource == null){
// Add element - http-listener to result http-service.
resultResource = parentResult.getOwnerDocument().createElement("admin-object-resource");
resultResource.setAttribute("jndi-name", element.getAttribute("jndi-name"));
resultResource.setAttribute("res-type", element.getAttribute("res-type"));
resultResource.setAttribute("enabled", element.getAttribute("enabled"));
resultResource.setAttribute("res-adapter", "jmsra");
this.appendElementToParent(parentResult,resultResource);
}
return resultResource;
| private org.w3c.dom.Element | transformToConnectorResource(org.w3c.dom.Element element, org.w3c.dom.Element parentSource, org.w3c.dom.Element parentResult)
NodeList resultResources = parentResult.getElementsByTagName("connector-resource");
Element resultResource = null;
for(int lh =0; lh < resultResources.getLength(); lh++){
// Compare one key attribute
if((element.getAttribute("jndi-name")).equals(((Element)resultResources.item(lh)).getAttribute("jndi-name"))){
resultResource = (Element)resultResources.item(lh);
resultResource.setAttribute("enabled", element.getAttribute("enabled"));
break;
}
}
if(resultResource == null){
// Add element - http-listener to result http-service.
resultResource = parentResult.getOwnerDocument().createElement("connector-resource");
resultResource.setAttribute("jndi-name", element.getAttribute("jndi-name"));
resultResource.setAttribute("enabled", element.getAttribute("enabled"));
resultResource.setAttribute("pool-name", element.getAttribute("jndi-name"));
this.appendElementToParent(parentResult,resultResource);
// Now search for connectionpool resource.
this.transformConnectorPool(element, parentSource, parentResult);
}
return resultResource;
|
|