*/
protected void parseXMLClasspath(DeploymentInfo di)
throws Exception
{
ArrayList classpath = new ArrayList();
URLListerFactory listerFactory = new URLListerFactory();
NodeList children = di.document.getDocumentElement().getChildNodes();
for (int i = 0; i < children.getLength(); i++)
{
if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
{
Element classpathElement = (Element)children.item(i);
if (classpathElement.getTagName().equals("classpath"))
{
log.debug("Found classpath element: " + classpathElement);
if (!classpathElement.hasAttribute("codebase"))
{
throw new DeploymentException
("Invalid classpath element missing codebase: " + classpathElement);
}
String codebase = classpathElement.getAttribute("codebase").trim();
// Replace any system property references like ${x}
codebase = StringPropertyReplacer.replaceProperties(codebase);
String archives = null;
if (classpathElement.hasAttribute("archives"))
{
archives = classpathElement.getAttribute("archives").trim();
// Replace any system property references like ${x}
archives = StringPropertyReplacer.replaceProperties(archives);
if ("".equals(archives))
{
archives = null;
}
}
// Convert codebase to a URL
// "." is resolved relative to the deployment
// other URLs are resolved relative to SERVER_HOME
URL codebaseUrl;
if (".".equals(codebase))
{
codebaseUrl = new URL(di.url, "./");
}
else
{
if (archives != null && codebase.endsWith("/") == false)
{
codebase += "/";
}
codebaseUrl = new URL(serverHomeURL, codebase);
}
log.debug("codebase URL is " + codebaseUrl);
if (archives == null)
{
// archives not supplied so add the codebase itself
classpath.add(codebaseUrl);
log.debug("added codebase to classpath");
}
else
{
// obtain a URLLister for the codebase and use it to obtain
// the list of URLs to add
log.debug("listing codebase for archives matching " + archives);
URLLister lister = listerFactory.createURLLister(codebaseUrl);
log.debug("URLLister class is " + lister.getClass().getName());
classpath.addAll(lister.listMembers(codebaseUrl, archives));
}
} // end of if ()