org.jboss.deployment
Class J2eeDeployer

java.lang.Object
  |
  +--javax.management.NotificationBroadcasterSupport
        |
        +--org.jboss.util.ServiceMBeanSupport
              |
              +--org.jboss.deployment.J2eeDeployer
All Implemented Interfaces:
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.11 $
Author:
Daniel Schulze

Field Summary
 java.lang.String CONFIG
           
 java.io.File DEPLOYMENT_DIR
           
 
Fields inherited from class org.jboss.util.ServiceMBeanSupport
log
 
Fields inherited from interface org.jboss.deployment.J2eeDeployerMBean
OBJECT_NAME
 
Constructor Summary
J2eeDeployer(java.lang.String _deployDir, java.lang.String jarDeployerName, java.lang.String warDeployerName)
           
J2eeDeployer(java.lang.String _name, java.lang.String _deployDir, java.lang.String jarDeployerName, java.lang.String warDeployerName)
           
 
Method Summary
 void deploy(java.lang.String _url)
          Deploys the given URL independent if it is a EJB.jar, Web.war or Application.ear.
 java.lang.String getAppName(java.net.URL _url)
          returns the filename this url points to
 java.lang.String getName()
           
protected  javax.management.ObjectName getObjectName(javax.management.MBeanServer server, javax.management.ObjectName name)
           
 java.lang.String getWebContext(java.net.URL _downloadUrl)
          composes a webContext name of the file this url points to
protected  void initService()
           
 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 startService()
           
protected  void stopService()
          undeploys all deployments
 void undeploy(java.lang.String _app)
          Undeploys the given URL (if it is deployed).
 
Methods inherited from class org.jboss.util.ServiceMBeanSupport
destroy, destroyService, getState, getStateString, init, 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 java.lang.String CONFIG
Constructor Detail

J2eeDeployer

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

J2eeDeployer

public J2eeDeployer(java.lang.String _name,
                    java.lang.String _deployDir,
                    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...

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 J2eeDeployerMBean
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

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 J2eeDeployerMBean
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 J2eeDeployerMBean
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

getAppName

public java.lang.String getAppName(java.net.URL _url)
returns the filename this url points to

getWebContext

public java.lang.String getWebContext(java.net.URL _downloadUrl)
composes a webContext name of the file this url points to


Copyright © 2000 The jBoss Organization. All Rights Reserved.