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.20.2.1 $
Author:
Daniel Schulze

Field Summary
static java.lang.String CONFIG
           
 java.io.File DEPLOYMENT_DIR
           
static int EASY
           
static int RESTRICTIVE
           
 
Fields inherited from class org.jboss.util.ServiceMBeanSupport
log, STARTED, STARTING, states, STOPPED, STOPPING
 
Fields inherited from interface org.jboss.deployment.J2eeDeployerMBean
OBJECT_NAME
 
Constructor Summary
J2eeDeployer()
           
J2eeDeployer(java.lang.String _name, 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 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()
           
 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...
 void setDeployerName(java.lang.String name)
           
 void setJarDeployerName(java.lang.String jarDeployerName)
           
 void setWarDeployerName(java.lang.String warDeployerName)
           
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 static java.lang.String CONFIG

EASY

public static final int EASY

RESTRICTIVE

public static final int RESTRICTIVE
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

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


Copyright © 2000 The JBoss Organization. All Rights Reserved.