public JDBCApplicationMetaData load() throws DeploymentException {
JDBCApplicationMetaData jamd = new JDBCApplicationMetaData(
container.getBeanMetaData().getApplicationMetaData(), container.getClassLoader()
);
// Load standardjbosscmp-jdbc.xml from the default classLoader
// we always load defaults first
URL stdJDBCUrl = container.getClassLoader().getResource("standardjbosscmp-jdbc.xml");
if(stdJDBCUrl == null) {
throw new DeploymentException("No standardjbosscmp-jdbc.xml found");
}
boolean debug = log.isDebugEnabled();
if (debug)
log.debug("Loading standardjbosscmp-jdbc.xml : " + stdJDBCUrl.toString());
Element stdJDBCElement = XmlFileLoader.getDocument(stdJDBCUrl, true).getDocumentElement();
// first create the metadata
jamd = new JDBCApplicationMetaData(stdJDBCElement, jamd);
// Load jbosscmp-jdbc.xml if provided
URL jdbcUrl = null;
VirtualFile dd = container.getDeploymentUnit().getMetaDataFile("jbosscmp-jdbc.xml");
if(dd != null)
{
try
{
jdbcUrl = dd.toURL();
}
catch(Exception e)
{
throw new IllegalStateException("Failed to create URL for " + dd.getPathName(), e);
}
}
if(jdbcUrl != null)
{
if (debug)
log.debug(jdbcUrl.toString() + " found. Overriding defaults");
Element jdbcElement = XmlFileLoader.getDocument(jdbcUrl, true).getDocumentElement();
jamd = new JDBCApplicationMetaData(jdbcElement, jamd);
}
return jamd;
}
Loads the application meta data from the jbosscmp-jdbc.xml file |