public void init(DeploymentInfo di) throws DeploymentException
{
if (warFilesDir == null)
{
final String errorMsg = String.format("No property named '%s' was configured in jbossesb.sar/META-INF/jboss-service.xml for %s", "warFilesDir", getClass().getName());
throw new DeploymentException(errorMsg);
}
final File tmpDir = new File(warFilesDir);
if (!tmpDir.exists())
{
final String errorMsg = String.format("The directory configured for %s='%s' does not exist.", "warFilesDir", tmpDir);
throw new DeploymentException(errorMsg);
}
esbWarFiles = JBossDeployerUtil.createDir(tmpDir, "esbwarfiles");
try
{
if (di.url.getProtocol().equalsIgnoreCase("file"))
{
File file = new File(di.url.getFile());
if (!file.isDirectory())
{
// If not directory we watch the package
di.watch = di.url;
}
else
{
// If directory we watch the xml files
di.watch = new URL(di.url, "META-INF/jboss-esb.xml");
}
}
else
{
// We watch the top only, no directory support
di.watch = di.url;
}
XmlFileLoader xfl = new XmlFileLoader();
InputStream in = di.localCl.getResourceAsStream("META-INF/deployment.xml");
if (in != null)
{
try
{
Element jboss = xfl.getDocument(in, "META-INF/deployment.xml").getDocumentElement();
// Check for a ejb level class loading config
Element loader = MetaData.getOptionalChild(jboss, "loader-repository");
if (loader != null)
{
LoaderRepositoryFactory.LoaderRepositoryConfig config =
LoaderRepositoryFactory.parseRepositoryConfig(loader);
di.setRepositoryInfo(config);
}
}
finally
{
in.close();
}
}
final URL document = getDocumentUrl(di);
if (document == null)
{
throw new DeploymentException("Unable to find document url of META-INF/jboss-esb.xml in: "
+ di.url);
}
JBoss4ESBDeployment deployment = new JBoss4ESBDeployment(document, di, esbWarFiles);
final Set<ObjectName> deps = new HashSet<ObjectName>();
addActionDependencies(di.shortName, deployment.getModel(), deps) ;
initialiseDeploymentName(deployment) ;
final String deploymentName = deployment.getDeploymentName() ;
di.context.put(JBoss4ESBDeploymentMetaData.class, new JBoss4ESBDeploymentMetaData(deployment, deploymentName, deps)) ;
// invoke super-class initialization
super.init(di);
}
catch (Exception e)
{
if (e instanceof DeploymentException)
{
throw(DeploymentException) e;
}
throw new DeploymentException("failed to initialize", e);
}
}