assert moduleFile != null: "moduleFile is null";
assert targetPath != null: "targetPath is null";
assert !targetPath.endsWith("/"): "targetPath must not end with a '/'";
String specDD;
XmlObject connector;
try {
if (specDDUrl == null) {
specDDUrl = DeploymentUtil.createJarURL(moduleFile, "META-INF/ra.xml");
}
// read in the entire specDD as a string, we need this for getDeploymentDescriptor
// on the J2ee management object
specDD = DeploymentUtil.readAll(specDDUrl);
} catch (Exception e) {
//no ra.xml, not for us.
return null;
}
//we found ra.xml, if it won't parse it's an error.
try {
// parse it
XmlObject xmlObject = XmlBeansUtil.parse(specDD);
ConnectorDocument connectorDoc = SchemaConversionUtils.convertToConnectorSchema(xmlObject);
connector = connectorDoc.getConnector();
} catch (XmlException e) {
throw new DeploymentException("Could not parse ra.xml descriptor", e);
}