org.objectweb.easybeans.deployer
Class JettyDeployer

java.lang.Object
  extended by org.objectweb.easybeans.deployer.AbsDeployer
      extended by org.objectweb.easybeans.deployer.AbsWebContainerDeployer
          extended by org.objectweb.easybeans.deployer.JettyDeployer
All Implemented Interfaces:
EZBDeployer

public class JettyDeployer
extends AbsWebContainerDeployer
implements EZBDeployer

Implementation of the Deployer for EasyBeans in Jetty.
It will deploy EJB3 and EAR. EJB3 will be deployed in EasyBeans while WAR file will go in Jetty.

Author:
Florent Benoit

Field Summary
private static java.lang.String ADD_HANDLER_METHOD_NAME
          Name of the method used to add an handler.
private  java.lang.reflect.Method addHandlerMethod
          Method object used to add an handler.
private  java.lang.Object contexts
          List of the contexts deployed on the current jetty server.
private static java.lang.String GET_ALL_HANDLER_METHOD_NAME
          Name of the method used to get all handlers.
private static java.lang.String GET_CHILD_HANDLER_METHOD_NAME
          Name of the method used to get the child handler on the server object.
private static java.lang.String GET_CONTEXT_METHOD_NAME
          Name of the method used to get the name of the context on the web app context.
private  java.lang.reflect.Method getContextPathMethod
          Method object used to get the name of the context on the web app context.
private  java.lang.reflect.Method getHandlersMethod
          Method object used to get all handlers.
private static java.lang.String HANDLER_CLASS_NAME
          Name of the class that is an handler.
private static java.lang.String HANDLER_COLLECTION_CLASS_NAME
          Name of the class that represent an handler collection.
private  java.lang.reflect.Method javaDelegationModelMethod
          Method object used for changing the Java Delegation model.
private static java.lang.Object jettyServer
          Link to the Jetty Server used to deploy the web applications.
private static JLog logger
          Logger.
private static java.lang.String REMOVE_HANDLER_METHOD_NAME
          Name of the method used to remove an handler.
private  java.lang.reflect.Method removeHandlerMethod
          Method object used to remove an handler.
private static java.lang.String SET_CONTEXT_METHOD_NAME
          Name of the method used to set the name of the context on the web app context.
private static java.lang.String SET_JAVA_DELEGATION_MODEL_METHOD_NAME
          Name of the method for changing the Java Delegation model.
private static java.lang.String SET_WAR_METHOD_NAME
          Name of the method used to set the URL of the war file on the web app context.
private  java.lang.reflect.Method setContextPathMethod
          Method object used to set the name of the context on the web app context.
private  java.lang.reflect.Method setWarMethod
          Method object used to set the URL of the war file on the web app context.
private static java.lang.String START_CONTEXT_METHOD_NAME
          Name of the method used to start the web app context.
private  java.lang.reflect.Method startContextMethod
          Method object used to start the web app context.
private static java.lang.String STOP_CONTEXT_METHOD_NAME
          Name of the method used to stop the web app context.
private  java.lang.reflect.Method stopContextMethod
          Method object used to stop the web app context.
private static java.lang.String WEB_APP_CONTEXT_CLASS_NAME
          Name of the WebAppContext class used to deploy a war file.
private  java.lang.Class webAppContextClass
          WebAppContext class used to deploy a war file.
 
Fields inherited from class org.objectweb.easybeans.deployer.AbsDeployer
DEFAULT_FOLDER
 
Constructor Summary
JettyDeployer()
          Build a new instance of this deployer.
 
Method Summary
private  void checkSupportedDeployable(EZBDeployable deployable)
          Check that the given deployable is supported by this deployer.
 void deploy(EZBDeployable deployable)
          Deploy a deployable.
protected  void deployWARs(EARDeployable earDeployable, java.net.URL earURL, java.lang.ClassLoader earClassLoader, java.lang.ClassLoader parentClassLoader)
          Deploy the WAR files present in the given EAR.
private static java.lang.ClassLoader getClassLoader()
           
static void setContextEvent(javax.servlet.ServletContextEvent contextEvent)
          Set the given context event object.
protected  void undeployWAR(WARDeployable warDeployable)
          Undeploy an given WAR (called by the undeploy method).
 
Methods inherited from class org.objectweb.easybeans.deployer.AbsWebContainerDeployer
deployEAR, undeploy, undeployEAR
 
Methods inherited from class org.objectweb.easybeans.deployer.AbsDeployer
deployEJB, getClassLoaderForEAR, getEmbedded, getMethod, getPersistenceUnitManager, invoke, loadClass, loadClass, newInstance, newInstance, setEmbedded, undeployEJB3FromEAR, unpackEARDeployable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.easybeans.deployer.api.EZBDeployer
setEmbedded, undeploy
 

Field Detail

logger

private static JLog logger
Logger.


jettyServer

private static java.lang.Object jettyServer
Link to the Jetty Server used to deploy the web applications. Static as shared by all jetty deployers.


WEB_APP_CONTEXT_CLASS_NAME

private static final java.lang.String WEB_APP_CONTEXT_CLASS_NAME
Name of the WebAppContext class used to deploy a war file.

See Also:
Constant Field Values

webAppContextClass

private java.lang.Class webAppContextClass
WebAppContext class used to deploy a war file.


GET_CHILD_HANDLER_METHOD_NAME

private static final java.lang.String GET_CHILD_HANDLER_METHOD_NAME
Name of the method used to get the child handler on the server object.

See Also:
Constant Field Values

HANDLER_COLLECTION_CLASS_NAME

private static final java.lang.String HANDLER_COLLECTION_CLASS_NAME
Name of the class that represent an handler collection.

See Also:
Constant Field Values

contexts

private java.lang.Object contexts
List of the contexts deployed on the current jetty server.


SET_WAR_METHOD_NAME

private static final java.lang.String SET_WAR_METHOD_NAME
Name of the method used to set the URL of the war file on the web app context.

See Also:
Constant Field Values

setWarMethod

private java.lang.reflect.Method setWarMethod
Method object used to set the URL of the war file on the web app context.


SET_CONTEXT_METHOD_NAME

private static final java.lang.String SET_CONTEXT_METHOD_NAME
Name of the method used to set the name of the context on the web app context.

See Also:
Constant Field Values

setContextPathMethod

private java.lang.reflect.Method setContextPathMethod
Method object used to set the name of the context on the web app context.


GET_CONTEXT_METHOD_NAME

private static final java.lang.String GET_CONTEXT_METHOD_NAME
Name of the method used to get the name of the context on the web app context.

See Also:
Constant Field Values

getContextPathMethod

private java.lang.reflect.Method getContextPathMethod
Method object used to get the name of the context on the web app context.


START_CONTEXT_METHOD_NAME

private static final java.lang.String START_CONTEXT_METHOD_NAME
Name of the method used to start the web app context.

See Also:
Constant Field Values

startContextMethod

private java.lang.reflect.Method startContextMethod
Method object used to start the web app context.


STOP_CONTEXT_METHOD_NAME

private static final java.lang.String STOP_CONTEXT_METHOD_NAME
Name of the method used to stop the web app context.

See Also:
Constant Field Values

stopContextMethod

private java.lang.reflect.Method stopContextMethod
Method object used to stop the web app context.


HANDLER_CLASS_NAME

private static final java.lang.String HANDLER_CLASS_NAME
Name of the class that is an handler.

See Also:
Constant Field Values

ADD_HANDLER_METHOD_NAME

private static final java.lang.String ADD_HANDLER_METHOD_NAME
Name of the method used to add an handler.

See Also:
Constant Field Values

addHandlerMethod

private java.lang.reflect.Method addHandlerMethod
Method object used to add an handler.


REMOVE_HANDLER_METHOD_NAME

private static final java.lang.String REMOVE_HANDLER_METHOD_NAME
Name of the method used to remove an handler.

See Also:
Constant Field Values

removeHandlerMethod

private java.lang.reflect.Method removeHandlerMethod
Method object used to remove an handler.


GET_ALL_HANDLER_METHOD_NAME

private static final java.lang.String GET_ALL_HANDLER_METHOD_NAME
Name of the method used to get all handlers.

See Also:
Constant Field Values

getHandlersMethod

private java.lang.reflect.Method getHandlersMethod
Method object used to get all handlers.


SET_JAVA_DELEGATION_MODEL_METHOD_NAME

private static final java.lang.String SET_JAVA_DELEGATION_MODEL_METHOD_NAME
Name of the method for changing the Java Delegation model.

See Also:
Constant Field Values

javaDelegationModelMethod

private java.lang.reflect.Method javaDelegationModelMethod
Method object used for changing the Java Delegation model.

Constructor Detail

JettyDeployer

public JettyDeployer()
              throws EZBDeployerException
Build a new instance of this deployer.

Throws:
EZBDeployerException - if the instance is not built.
Method Detail

deploy

public void deploy(EZBDeployable deployable)
            throws EZBDeployerException
Deploy a deployable. It can be an EJB jar, EAR, WAR, etc.

Specified by:
deploy in interface EZBDeployer
Parameters:
deployable - a given deployable
Throws:
EZBDeployerException - if the deployment is not done.

deployWARs

protected void deployWARs(EARDeployable earDeployable,
                          java.net.URL earURL,
                          java.lang.ClassLoader earClassLoader,
                          java.lang.ClassLoader parentClassLoader)
                   throws EZBDeployerException
Deploy the WAR files present in the given EAR.

Specified by:
deployWARs in class AbsWebContainerDeployer
Parameters:
earDeployable - the EAR containing the WARs
earURL - the EAR URL
earClassLoader - the EAR classloader
parentClassLoader - the parent classloader (EJB) to use
Throws:
EZBDeployerException - if the wars are not deployed.

getClassLoader

private static java.lang.ClassLoader getClassLoader()
Returns:
the classloader for loading the class.

checkSupportedDeployable

private void checkSupportedDeployable(EZBDeployable deployable)
                               throws EZBDeployerException
Check that the given deployable is supported by this deployer. If it is not supported, throw an error.

Parameters:
deployable - the deployable that needs to be deployed
Throws:
EZBDeployerException - if this deployable is not supported.

undeployWAR

protected void undeployWAR(WARDeployable warDeployable)
                    throws EZBDeployerException
Undeploy an given WAR (called by the undeploy method).

Specified by:
undeployWAR in class AbsWebContainerDeployer
Parameters:
warDeployable - a given WAR deployable
Throws:
EZBDeployerException - if the undeployment is not done.

setContextEvent

public static void setContextEvent(javax.servlet.ServletContextEvent contextEvent)
                            throws EZBDeployerException
Set the given context event object.

Parameters:
contextEvent - the given object.
Throws:
EZBDeployerException - if the jetty server object is not found from the given context event.