Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.deployment
Class J2eeDeployer

    java.lang.Object
      |
      +--javax.management.NotificationBroadcasterSupport
            |
            +--org.jboss.util.ServiceMBeanSupport
                  |
                  +--org.jboss.deployment.J2eeDeployer

All Implemented Interfaces:
  DeployerMBean, J2eeDeployerMBean, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, Service, ServiceMBean

public class J2eeDeployer
extends ServiceMBeanSupport
implements J2eeDeployerMBean

J2eeDeployer allows to deploy single EJB.jars as well as Web.wars (if a Servlet Container is present) or even Application.ears.
The deployment is done by determining the file type of the given url. The file must be a valid zip file or a directory and must contain either a META-INF/ejb-jar.xml or META-INF/application.xml or a WEB-INF/web.xml file. Depending on the file type, the whole file (EJBs, WARs) or only the relevant packages (EAR) becoming downloaded.
replacing alternative DDs and validation is not yet implementet! The uploaded files are getting passed through to the responsible deployer (ContainerFactory for JBoss and EmbededTomcatService for Tomcat).

Version:
  $Revision: 1.31.2.5 $
Author:
  Daniel Schulze, Toby Allsopp (toby.allsopp@peace.com), Scott_Stark@displayscape.com

Field Summary
`static java.lang.String` | `CONFIG`
`java.io.File` | `DEPLOYMENT_DIR`
`static int` | `EASY`
`protected InstallerFactory` | `installer` The InstallerFactory which installs J2EE module deployments
`protected javax.management.ObjectName` | `jarDeployer` The name of the EJB jar deployer
`protected java.lang.String` | `name`
`static int` | `RESTRICTIVE`
`protected javax.management.MBeanServer` | `server`
`protected javax.management.ObjectName` | `warDeployer` The name of the Web war deployer

Fields inherited from class org.jboss.util.ServiceMBeanSupport
`log`

Fields inherited from interface org.jboss.deployment.J2eeDeployerMBean
`OBJECT_NAME`

Fields inherited from interface org.jboss.util.ServiceMBean
`STARTED, STARTING, states, STOPPED, STOPPING`

Constructor Summary
`J2eeDeployer()`
`J2eeDeployer(java.lang.String _name, java.lang.String jarDeployerName, java.lang.String warDeployerName)`

Method Summary
`protected javax.management.ObjectName` | `createCollectorName()` creation of collector name factored out.
`protected void` | `createContextClassLoader(Deployment deployment)` creates an application class loader for this deployment this class loader will be shared between jboss and tomcat via the contextclassloader.
`void` | `deploy(java.lang.String _url)` Deploys the given URL independent if it is a EJB.jar, Web.war or Application.ear.
`java.io.FilenameFilter` | `getDeployableFilter()` Provides a filter that decides whether a file can be deployed by this deployer based on the filename.
`java.lang.String` | `getDeployerName()`
`java.lang.String` | `getJarDeployerName()`
`java.lang.String` | `getName()`
`protected javax.management.ObjectName` | `getObjectName(javax.management.MBeanServer server, javax.management.ObjectName name)`
`java.lang.String` | `getWarDeployerName()`
`protected void` | `initService()`
`protected Deployment` | `installApplication(java.net.URL _downloadUrl)` determines deployment type and installs (downloads) all packages needed by the given deployment of the given deployment.
`boolean` | `isDeployed(java.lang.String _url)` Checks if the given URL is currently deployed or not.
`static void` | `main(java.lang.String[] _args)` only for testing...
`protected void` | `removeFromCollector(java.lang.String _url, javax.management.ObjectName lCollector)` report of removal to data collector factored out for subclass access a try/catch for dealing with an uninstalled collector has been added.
`void` | `setDeployerName(java.lang.String name)`
`void` | `setJarDeployerName(java.lang.String jarDeployerName)`
`void` | `setWarDeployerName(java.lang.String warDeployerName)`
`protected void` | `startApplication(Deployment _d)` Starts the successful downloaded deployment.
`protected void` | `startModules(Deployment _d, java.lang.ClassLoader appCl, java.lang.ClassLoader oldCl)` factored out method to start individual modules and reinstall context classloader afterwards
`protected void` | `startService()`
`protected void` | `stopApplication(Deployment _d)` Stops a running deployment.
`protected void` | `stopService()` undeploys all deployments
`void` | `undeploy(java.lang.String _app)` Undeploys the given URL (if it is deployed).
`protected void` | `uninstallApplication(Deployment _d)`
`protected void` | `uninstallApplication(java.lang.String _pattern)` Deletes the file tree of the specified application.
`protected boolean` | `warDeployerAvailable()` tests if the web container deployer is available better be protected for subclassing

Methods inherited from class org.jboss.util.ServiceMBeanSupport
`destroy, destroyService, getServer, getState, getStateString, init, nextSequenceNumber, postDeregister, postRegister, preDeregister, preRegister, start, stop`

Methods inherited from class javax.management.NotificationBroadcasterSupport
`addNotificationListener, getNotificationInfo, removeNotificationListener, sendNotification`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jboss.util.ServiceMBean
`getState, getStateString`

Methods inherited from interface org.jboss.util.Service
`destroy, init, start, stop`

Field Detail

### DEPLOYMENT_DIR

    public java.io.File DEPLOYMENT_DIR

### CONFIG

    public static java.lang.String CONFIG

### EASY

    public static final int EASY

### RESTRICTIVE

    public static final int RESTRICTIVE

### server

    protected javax.management.MBeanServer server

### name

    protected java.lang.String name

### jarDeployer

    protected javax.management.ObjectName jarDeployer

  The name of the EJB jar deployer

### warDeployer

    protected javax.management.ObjectName warDeployer

  The name of the Web war deployer

### installer

    protected InstallerFactory installer

  The InstallerFactory which installs J2EE module deployments

Constructor Detail

### J2eeDeployer

    public J2eeDeployer()

### J2eeDeployer

    public J2eeDeployer(java.lang.String _name,
                        java.lang.String jarDeployerName,
                        java.lang.String warDeployerName)

Method Detail

### main

    public static void main(java.lang.String[] _args)
                     throws java.lang.Exception

  only for testing...

### setDeployerName

    public void setDeployerName(java.lang.String name)

  Specified by:
    `setDeployerName` in interface `J2eeDeployerMBean`

### getDeployerName

    public java.lang.String getDeployerName()

  Specified by:
    `getDeployerName` in interface `J2eeDeployerMBean`

### setJarDeployerName

    public void setJarDeployerName(java.lang.String jarDeployerName)

  Specified by:
    `setJarDeployerName` in interface `J2eeDeployerMBean`

### getJarDeployerName

    public java.lang.String getJarDeployerName()

  Specified by:
    `getJarDeployerName` in interface `J2eeDeployerMBean`

### setWarDeployerName

    public void setWarDeployerName(java.lang.String warDeployerName)

  Specified by:
    `setWarDeployerName` in interface `J2eeDeployerMBean`

### getWarDeployerName

    public java.lang.String getWarDeployerName()

  Specified by:
    `getWarDeployerName` in interface `J2eeDeployerMBean`

### getDeployableFilter

    public java.io.FilenameFilter getDeployableFilter()

  Description copied from interface: `DeployerMBean`
  Provides a filter that decides whether a file can be deployed by this deployer based on the filename. This is for the benefit of the `AutoDeployer` service.
  Specified by:
    `getDeployableFilter` in interface `DeployerMBean`
  Following copied from interface: `org.jboss.deployment.DeployerMBean`
  Returns:
    a `FilenameFilter` that only `accept`s files with names that can be deployed by this deployer

### deploy

    public void deploy(java.lang.String _url)
                throws java.net.MalformedURLException,
                       java.io.IOException,
                       J2eeDeploymentException

  Deploys the given URL independent if it is a EJB.jar, Web.war or Application.ear. In case of already deployed, it performes a redeploy.
  Specified by:
    `deploy` in interface `DeployerMBean`
  Parameters:
    `_url` - the url (file or http) to the archiv to deploy
  Throws:
    `java.net.MalformedURLException` - in case of a malformed url
    `J2eeDeploymentException` - if something went wrong...
    `java.io.IOException` - if trouble while file download occurs

### createCollectorName

    protected javax.management.ObjectName createCollectorName()

  creation of collector name factored out.

### removeFromCollector

    protected void removeFromCollector(java.lang.String _url,
                                       javax.management.ObjectName lCollector)

  report of removal to data collector factored out for subclass access a try/catch for dealing with an uninstalled collector has been added.

### undeploy

    public void undeploy(java.lang.String _app)
                  throws java.io.IOException,
                         J2eeDeploymentException

  Undeploys the given URL (if it is deployed). Actually only the file name is of interest, so it dont has to be an URL to be undeployed, the file name is ok as well.
  Specified by:
    `undeploy` in interface `DeployerMBean`
  Parameters:
    `_url` - the url to to undeploy
  Throws:
    `java.net.MalformedURLException` - in case of a malformed url
    `J2eeDeploymentException` - if something went wrong (but should have removed all files)
    `java.io.IOException` - if file removement fails

### isDeployed

    public boolean isDeployed(java.lang.String _url)
                       throws java.net.MalformedURLException,
                              J2eeDeploymentException

  Checks if the given URL is currently deployed or not. Actually only the file name is of interest, so it dont has to be an URL to be undeployed, the file name is ok as well.
  Specified by:
    `isDeployed` in interface `DeployerMBean`
  Parameters:
    `_url` - the url to to check
  Returns:
    true if _url is deployed
  Throws:
    `java.net.MalformedURLException` - in case of a malformed url
    `J2eeDeploymentException` - if the app seems to be deployed, but some of its modules are not.

### getName

    public java.lang.String getName()

  Specified by:
    `getName` in interface `ServiceMBean`
  Overrides:
    `getName` in class `ServiceMBeanSupport`

### getObjectName

    protected javax.management.ObjectName getObjectName(javax.management.MBeanServer server,
                                                        javax.management.ObjectName name)
                                                 throws javax.management.MalformedObjectNameException

  Overrides:
    `getObjectName` in class `ServiceMBeanSupport`

### initService

    protected void initService()
                        throws java.lang.Exception

  Overrides:
    `initService` in class `ServiceMBeanSupport`

### startService

    protected void startService()
                         throws java.lang.Exception

  Overrides:
    `startService` in class `ServiceMBeanSupport`

### stopService

    protected void stopService()

  undeploys all deployments
  Overrides:
    `stopService` in class `ServiceMBeanSupport`

### installApplication

    protected Deployment installApplication(java.net.URL _downloadUrl)
                                     throws java.io.IOException,
                                            J2eeDeploymentException

  determines deployment type and installs (downloads) all packages needed by the given deployment of the given deployment.
  This means download the needed packages do some validation... Validation and do some other things is not yet implemented better be protected for subclassing
  Parameters:
    `_downloadUrl` - the url that points to the app to install
  Throws:
    `java.io.IOException` - if the download fails
    `J2eeDeploymentException` - if the given package is somehow inconsistent

### uninstallApplication

    protected void uninstallApplication(java.lang.String _pattern)
                                 throws java.io.IOException

  Deletes the file tree of the specified application.
  better be protected for subclassing
  Parameters:
    `_name` - the directory (DEPLOYMENT_DIR/<_name> to remove recursivly
  Throws:
    `java.io.IOException` - if something goes wrong

### uninstallApplication

    protected void uninstallApplication(Deployment _d)
                                 throws java.io.IOException

### startApplication

    protected void startApplication(Deployment _d)
                             throws J2eeDeploymentException

  Starts the successful downloaded deployment.
  Means the modules are deployed by the responsible container deployer better be protected for subclassing
  Parameters:
    `_d` - the deployment to start
  Throws:
    `J2eeDeploymentException` - if an error occures for one of these modules

### startModules

    protected void startModules(Deployment _d,
                                java.lang.ClassLoader appCl,
                                java.lang.ClassLoader oldCl)
                         throws J2eeDeploymentException

  factored out method to start individual modules and reinstall context classloader afterwards

### stopApplication

    protected void stopApplication(Deployment _d)
                            throws J2eeDeploymentException

  Stops a running deployment.
  Means the modules are undeployed by the responsible container deployer better protected for subclassing
  Parameters:
    `_d` - the deployment to stop
  Throws:
    `J2eeDeploymentException` - if an error occures for one of these modules

### warDeployerAvailable

    protected boolean warDeployerAvailable()

  tests if the web container deployer is available better be protected for subclassing

### createContextClassLoader

    protected void createContextClassLoader(Deployment deployment)
                                     throws J2eeDeploymentException

  creates an application class loader for this deployment this class loader will be shared between jboss and tomcat via the contextclassloader. May throw a J2eeDeploymentException to indicate problems stting up the classloader. should be protected in order to allow reasonable subclassing. Needs an exception in case that you do more sophisticated meta-data installations.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000 The JBoss Organization. All Rights Reserved.