m_writer.closeElement();
for (int i = 0, n = ref.getPropertyCount(); i < n; ++i)
{
J2EEProperty property = ref.getProperty(i);
if (property.getValue() != null)
{
m_writer.openElement("config-property");
m_writer.writeAttribute("name", property.getName());
m_writer.writeAttribute("value", property.getValue());
m_writer.closeEmptyElement();
}
}
m_writer.endElement("factory");
break;
case J2EEUtil.JBOSS:
m_writer.startElement((ref.getTxMode() == J2EEResourceRef.TX_NONE) ?
"no-tx-connection-factory" : "tx-connection-factory");
m_writer.writeElement("jndi-name", ref.getJNDIName());
switch (ref.getTxMode())
{
case J2EEResourceRef.TX_LOCAL:
m_writer.openElement("local-transaction");
m_writer.closeEmptyElement();
break;
case J2EEResourceRef.TX_XA:
m_writer.openElement("xa-transaction");
m_writer.closeEmptyElement();
break;
}
/*
* Force same connection to get reused throughout an XA transaction
* for SHAREABLE resources.
*/
if (ref.getTxMode() == J2EEResourceRef.TX_XA && ref.isShareable())
{
m_writer.openElement("track-connection-by-tx");
m_writer.closeEmptyElement();
}
m_writer.writeElement("rar-name", SysUtil.NAMESPACE, ".ear#", ref.getResourceAdapterName());
m_writer.writeElement("connection-definition", ref.getClassName());
for (int i = 0, n = ref.getPropertyCount(); i < n; ++i)
{
J2EEProperty property = ref.getProperty(i);
if (property.getValue() != null)
{
m_writer.openElement("config-property");
m_writer.writeAttribute("name", property.getName());
m_writer.writeAttribute("type", property.getTypeName());
m_writer.closeElement();
m_writer.writeValue(property.getValue());
m_writer.endElement("config-property");
}
}
if (ref.isConnectionPoolPartitioned())
{
m_writer.openElement("application-managed-security");
m_writer.closeEmptyElement();
}
if (ref.getAuthAlias() != null)
{
m_writer.writeElement("security-domain-and-application", ref.getAuthAlias());
}
m_writer.writeElement("max-pool-size", Integer.toString(ref.getMaxConnections()));
m_writer.endElement((ref.getTxMode() == J2EEResourceRef.TX_NONE) ?
"no-tx-connection-factory" : "tx-connection-factory");
break;
case J2EEUtil.WEBSPHERE:
m_writer.openElement("factories");
m_writer.writeAttribute("xmi:type", "resources.j2c:J2CConnectionFactory");
m_writer.writeAttribute("name", sId);
m_writer.writeAttribute("jndiName", ref.getJNDIName());
m_writer.writeAttribute("logMissingTransactionContext", "false");
m_writer.writeAttribute("connectionDefinition", "connectionDefinition-", sNamespace);
m_writer.closeElement();
m_writer.startElement("propertySet");
for (int i = 0, n = ref.getPropertyCount(); i < n; ++i)
{
J2EEProperty property = ref.getProperty(i);
m_writer.openElement("resourceProperties");
m_writer.writeAttribute("name", property.getName());
m_writer.writeAttribute("type", property.getTypeName());
m_writer.writeAttribute("value", property.getValue());
m_writer.closeEmptyElement();
}
m_writer.endElement("propertySet");
m_writer.openElement("connectionPool");
m_writer.writeAttribute("minConnections", 1);
m_writer.writeAttribute("maxConnections", ref.getMaxConnections());
m_writer.closeEmptyElement();
m_writer.endElement("factories");
break;
}
break;
case J2EE_PLATFORM_ADMIN_OBJECT:
switch (nContainer)
{
case J2EEUtil.TEEE:
m_writer.openElement("admin-object");
m_writer.writeAttribute("jndi-name", ref.getJNDIName());
m_writer.writeAttribute("interface-name", ref.getClassName());
m_writer.closeElement();
for (int i = 0, n = ref.getPropertyCount(); i < n; ++i)
{
J2EEProperty property = ref.getProperty(i);
if (property.getValue() != null)
{
m_writer.openElement("config-property");
m_writer.writeAttribute("name", property.getName());
m_writer.writeAttribute("value", property.getValue());
m_writer.closeEmptyElement();
}
}
m_writer.endElement("admin-object");
break;
case J2EEUtil.JBOSS:
m_writer.openElement("mbean");
m_writer.writeAttribute("code", "org.jboss.resource.deployment.AdminObject");
m_writer.writeAttribute("name", SysUtil.NAMESPACE + ".destination:name=" + ref.getJNDIName());
m_writer.closeElement();
m_writer.openElement("attribute");
m_writer.writeAttribute("name", "JNDIName");
m_writer.closeElement();
m_writer.writeValue(ref.getJNDIName());
m_writer.endElement("attribute");
m_writer.openElement("attribute");
m_writer.writeAttribute("name", "RARName");
m_writer.closeElement();
m_writer.writeValue("jboss.jca:service=RARDeployment,name='" + SysUtil.NAMESPACE + ".ear#" + ref.getResourceAdapterName() + "'");
m_writer.endElement("attribute");
m_writer.openElement("attribute");
m_writer.writeAttribute("name", "Type");
m_writer.closeElement();
m_writer.writeValue(ref.getClassName());
m_writer.endElement("attribute");
Properties adminObjProps = new Properties();
for (Iterator iter = ref.getPropertyIterator(); iter.hasNext();)
{
J2EEProperty j2eeProp = (J2EEProperty)iter.next();
adminObjProps.setProperty(j2eeProp.getName(), j2eeProp.getValue());
}
m_writer.openElement("attribute");
m_writer.writeAttribute("name", "Properties");
m_writer.closeElement();
m_writer.writeValue(PropertyUtil.toString(adminObjProps));
m_writer.endElement("attribute");
m_writer.endElement("mbean");
break;
case J2EEUtil.WEBSPHERE:
m_writer.openElement("j2cAdminObjects");
m_writer.writeAttribute("name", sId);
m_writer.writeAttribute("jndiName", ref.getJNDIName());
m_writer.writeAttribute("adminObject", "adminObject-", sNamespace);
m_writer.closeElement();
for (Iterator iter = ref.getPropertyIterator(); iter.hasNext();)
{
J2EEProperty j2eeProp = (J2EEProperty)iter.next();
m_writer.openElement("properties");
m_writer.writeAttribute("name", j2eeProp.getName());
m_writer.writeAttribute("type", j2eeProp.getTypeName());
m_writer.writeAttribute("value", j2eeProp.getValue());
m_writer.closeEmptyElement();
}
m_writer.endElement("j2cAdminObjects");