FileDocCategorySizeDatePackage
JBossClientParsingDeployer.javaAPI DocJBoss 4.2.13795Fri Jul 13 20:53:48 BST 2007org.jboss.ejb3.deployers

JBossClientParsingDeployer

public class JBossClientParsingDeployer extends org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer
Comment
author
Carlo de Wolf
version
$Revision: $

Fields Summary
private String
jbossClientXmlPath
Constructors Summary
public JBossClientParsingDeployer()
Set the relative order to PARSER_DEPLOYER+1 by default

   
                  
    
   
      super(ApplicationClientDD.class);
      setRelativeOrder(PARSER_DEPLOYER + 1);
   
Methods Summary
private booleanaccepts(org.jboss.deployers.spi.deployer.DeploymentUnit unit)
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(jbossClientXmlPath);
      if (dd != null)
      {
         log.debug("Found application-client.xml file: " + unit.getName());
         try
         {
            Element root = DOMUtils.parse(dd.openStream());
            DocumentType doctype = root.getOwnerDocument().getDoctype();
            String publicId = (doctype != null ? doctype.getPublicId() : null);
            // Accept the JBoss5 publicId
            accepts = "-//JBoss//DTD Application Client 5.0//EN".equals(publicId);
            if (accepts == false)
               log.debug("Ignore jboss-client.xml with publicId: " + publicId);
         }
         catch (IOException ex)
         {
            DeploymentException.rethrowAsDeploymentException("Cannot parse " + jbossClientXmlPath, ex);
         }
      }

      return accepts;
   
protected booleanallowsReparse()

      return true;
   
public voiddeploy(org.jboss.deployers.spi.deployer.DeploymentUnit unit)

      if (accepts(unit))
         createMetaData(unit, jbossClientXmlPath, null);
   
protected org.jboss.xb.binding.ObjectModelFactorygetObjectModelFactory(org.jboss.ejb3.metamodel.ApplicationClientDD root)

      // if we haven't gotten an application-client.xml yet
      if(root == null)
         root = new ApplicationClientDD();
      
      return new JBossClientDDObjectFactory(root);