This method looks to the deployment for a META-INF/application-client.xml
descriptor to identify a j2ee client jar.
boolean accepts = false;
// The jar must contain an META-INF/application-client.xml
VirtualFile dd = unit.getMetaDataFile(appClientXmlPath);
if (dd != null)
{
log.debug("Found application-client.xml file: " + unit.getName());
try
{
Element root = DOMUtils.parse(dd.openStream());
String namespaceURI = root.getNamespaceURI();
// Accept the J2EE5 namespace
accepts = "http://java.sun.com/xml/ns/javaee".equals(namespaceURI);
if (accepts == false)
log.debug("Ignore application-client.xml with namespace: " + namespaceURI);
}
catch (IOException ex)
{
DeploymentException.rethrowAsDeploymentException("Cannot parse " + appClientXmlPath, ex);
}
}
if(accepts)
{
// in the cts there are apps with application-client with version 5
// and jboss-client with version 4
dd = unit.getMetaDataFile("jboss-client.xml");
if (dd != null)
{
log.debug("Found jboss-client.xml file: " + unit.getName());
try
{
Element root = DOMUtils.parse(dd.openStream());
DocumentType doctype = root.getOwnerDocument().getDoctype();
String publicId = (doctype != null ? doctype.getPublicId() : null);
accepts = !"-//JBoss//DTD Application Client 4.0//EN".equals(publicId);
}
catch (IOException ex)
{
DeploymentException.rethrowAsDeploymentException("Cannot parse " + appClientXmlPath, ex);
}
}
}
return accepts;