FileDocCategorySizeDatePackage
DeploymentFactoryImpl.javaAPI DocJBoss 4.2.16782Fri Jul 13 20:52:32 BST 2007org.jboss.deployment.spi.factories

DeploymentFactoryImpl

public class DeploymentFactoryImpl extends Object implements javax.enterprise.deploy.spi.factories.DeploymentFactory
The DeploymentFactory interface is a deployment driver for a J2EE plaform product. It returns a DeploymentManager object which represents a connection to a specific J2EE platform product. Each application server vendor must provide an implementation of this class in order for the J2EE Deployment API to work with their product. The class implementing this interface should have a public no-argument constructor, and it should be stateless (two instances of the class should always behave the same). It is suggested but not required that the class have a static initializer that registers an instance of the class with the DeploymentFactoryManager class. A connected or disconnected DeploymentManager can be requested. A DeploymentManager that runs connected to the platform can provide access to J2EE resources. A DeploymentManager that runs disconnected only provides module deployment configuration support.
author
Thomas.Diesler@jboss.org
author
Scott.Stark@jboss.com
version
$Revision: 57190 $

Fields Summary
private static final Logger
log
private static String
DISPLAY_NAME
private static String
PRODUCT_VERSION
Constructors Summary
Methods Summary
public javax.enterprise.deploy.spi.DeploymentManagergetDeploymentManager(java.lang.String uri, java.lang.String userName, java.lang.String password)
Get a connected deployment manager

param
uri the uri of the deployment manager
param
userName the user name
param
password the password
return
the deployment manager
throws
javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException

      log.debug("getDeploymentManager (uri=" + uri + ")");
      DeploymentManager mgr = null;

      try
      {
         URI deployURI = parseURI(uri);
         mgr = new DeploymentManagerImpl(deployURI, true, userName, password);
      }
      catch (URISyntaxException e)
      {
         DeploymentManagerCreationException ex = new DeploymentManagerCreationException("Failed to create DeploymentManagerImpl");
         ex.initCause(e);
         throw ex;
      }
      return mgr;
   
public javax.enterprise.deploy.spi.DeploymentManagergetDisconnectedDeploymentManager(java.lang.String uri)
Get a disconnected version of the deployment manager

param
uri the uri to connect to
return
the disconnected deployment manager
throws
javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException

      log.debug("getDisconnectedDeploymentManager (uri=" + uri + ")");
      DeploymentManager mgr = null;

      try
      {
         URI deployURI = parseURI(uri);
         mgr = new DeploymentManagerImpl(deployURI, false);
      }
      catch (URISyntaxException e)
      {
         DeploymentManagerCreationException ex = new DeploymentManagerCreationException("Failed to create DeploymentManagerImpl");
         ex.initCause(e);
         throw ex;
      }
      return mgr;
   
public java.lang.StringgetDisplayName()
The name of the JBoss DeploymentFactory.

return
the vendor name

      return DISPLAY_NAME;
   
public java.lang.StringgetProductVersion()
The version of the deployment manager

return
the version

      return PRODUCT_VERSION;
   
public booleanhandlesURI(java.lang.String uri)
Look for jboss-deployer:.... URIs. Returns true if uri is has a scheme of jboss-deployer, false otherwise.

param
uri the uri
return
true for jboss-deployer schemes, false otherwise.


   /* Obtain the display name and version from the Package object for
    org.jboss.deploy.spi.factories
    */
   
   
      Package pkg = Package.getPackage("org.jboss.deploy.spi.factories");
      if (pkg != null)
      {
         DISPLAY_NAME = pkg.getImplementationVendor();
         PRODUCT_VERSION = pkg.getImplementationVersion();
      }
      if (DISPLAY_NAME == null || PRODUCT_VERSION == null)
      {
         DISPLAY_NAME = "DeploymentFactoryImpl";
         PRODUCT_VERSION = "1.1-DEV";
      }

      // Register this deployment factory with the manager 
      DeploymentFactoryManager manager = DeploymentFactoryManager.getInstance();
      manager.registerDeploymentFactory(new DeploymentFactoryImpl());
   
      boolean handlesURI = DeploymentManagerImpl.DEPLOYER_URI.equals(uri);
      if (handlesURI == false)
      {
         try
         {
            URI deployURI = parseURI(uri);
            handlesURI = "jnp".equals(deployURI.getScheme());
         }
         catch (URISyntaxException e)
         {
            log.warn("Failed to parse uri: " + uri, e);
         }
      }

      log.debug("handlesURI [" + uri + "]: " + handlesURI);
      return handlesURI;
   
private java.net.URIparseURI(java.lang.String uri)

      URI deployURI = new URI(uri);
      return deployURI;