com.sun.grizzly.http.servlet.deployer
Class GrizzlyWebServerDeployer

java.lang.Object
  extended by com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer

public class GrizzlyWebServerDeployer
extends Object

We have 4 cases : #1 - war #2 - web.xml #3 - folder that contains at least one war #4 - folder of a deployed war (will use the /WEB-INF/web.xml) if #3 find war, it will deployed it, if not, will try #4 if it found nothing, #2

Author:
Sebastien Dionne, Hubert Iwaniuk

Field Summary
protected  Map<String,DeploymentID> deployedApplicationMap
           
protected  WarDeployer deployer
           
protected  ScheduledExecutorService executor
           
protected static String ROOT
           
protected  URLClassLoader serverLibLoader
           
protected  String watchDogFolder
           
protected  Map<String,WatchedFile> watchedFileMap
           
protected  long watchInterval
           
protected static String WEB_XML
           
static String WEB_XML_PATH
           
protected  WebApp webDefault
           
protected  String webxmlPath
           
protected  GrizzlyWebServer ws
           
 
Constructor Summary
GrizzlyWebServerDeployer()
           
 
Method Summary
 void deploy(String rootFolder, String context, String path, URLClassLoader webAppCL, WebApp superApp)
           
 void deployApplication(DeployableConfiguration conf)
           
 void deployApplication(DeployableConfiguration conf, URLClassLoader serverLibLoader, WebApp webDefault)
           
 void deployApplications(DeployerServerConfiguration conf)
           
protected  void deployCustom(String location, URLClassLoader serverLibLoader, WebApp defaultSupportWebApp)
           
 void deployWar(DeployableConfiguration conf, URLClassLoader serverLibLoader, WebApp defaultWebApp)
          Deploy WAR file.
static Map.Entry<String,URLClassLoader> explodeAndCreateWebAppClassLoader(String appliPath, URLClassLoader serverLibLoader)
          Deprecated. trying to get remove it
static String fixPath(String path)
          TODO extract to utils
static String getContext(String path)
          Return the context that will be used to deploy the application
protected  WarDeployer getWarDeployer()
           
 String getWatchDogFolder()
           
 Map<String,WatchedFile> getWatchedFileMap()
           
 String getWorkFolder()
           
static DeployerServerConfiguration init(String[] args)
           
 void launch(DeployerServerConfiguration conf)
           
static void main(String[] args)
           
 void start()
           
 void stop()
           
 void undeployApplication(String context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT

protected static final String ROOT
See Also:
Constant Field Values

WEB_XML

protected static final String WEB_XML
See Also:
Constant Field Values

WEB_XML_PATH

public static final String WEB_XML_PATH

ws

protected GrizzlyWebServer ws

webxmlPath

protected String webxmlPath

deployer

protected WarDeployer deployer

serverLibLoader

protected URLClassLoader serverLibLoader

webDefault

protected WebApp webDefault

deployedApplicationMap

protected Map<String,DeploymentID> deployedApplicationMap

executor

protected ScheduledExecutorService executor

watchInterval

protected long watchInterval

watchDogFolder

protected String watchDogFolder

watchedFileMap

protected Map<String,WatchedFile> watchedFileMap
Constructor Detail

GrizzlyWebServerDeployer

public GrizzlyWebServerDeployer()
Method Detail

main

public static void main(String[] args)
Parameters:
args - Command line parameters.

init

public static DeployerServerConfiguration init(String[] args)

launch

public void launch(DeployerServerConfiguration conf)

getWorkFolder

public String getWorkFolder()
Returns:
the work folder
See Also:
WarDeployer.getWorkFolder()

getWatchDogFolder

public String getWatchDogFolder()
Returns:
the folder to watch for the WatchDog

deployApplications

public void deployApplications(DeployerServerConfiguration conf)
                        throws Exception
Throws:
Exception

deployApplication

public void deployApplication(DeployableConfiguration conf)
                       throws Exception
Throws:
Exception

undeployApplication

public void undeployApplication(String context)
                         throws Exception
Throws:
Exception

deployApplication

public void deployApplication(DeployableConfiguration conf,
                              URLClassLoader serverLibLoader,
                              WebApp webDefault)
                       throws Exception
Throws:
Exception

getWarDeployer

protected WarDeployer getWarDeployer()
Returns:
the WarDeployer instance used to deploy/undeploy applications

deployWar

public void deployWar(DeployableConfiguration conf,
                      URLClassLoader serverLibLoader,
                      WebApp defaultWebApp)
               throws DeployException
Deploy WAR file.

Parameters:
configuration - of WAR file.
serverLibLoader - Server wide ClassLoader. Optional.
defaultWebApp - webdefault application, get's merged with application to deploy. Optional.
Throws:
DeployException - Deployment failed.

getContext

public static String getContext(String path)
Return the context that will be used to deploy the application

Parameters:
path - : file path where the application is
Returns:
the context

fixPath

public static String fixPath(String path)
TODO extract to utils


deployCustom

protected void deployCustom(String location,
                            URLClassLoader serverLibLoader,
                            WebApp defaultSupportWebApp)
                     throws Exception
Throws:
Exception

deploy

public void deploy(String rootFolder,
                   String context,
                   String path,
                   URLClassLoader webAppCL,
                   WebApp superApp)
            throws Exception
Throws:
Exception

explodeAndCreateWebAppClassLoader

public static Map.Entry<String,URLClassLoader> explodeAndCreateWebAppClassLoader(String appliPath,
                                                                                 URLClassLoader serverLibLoader)
                                                                          throws IOException
Deprecated. trying to get remove it

Make available the content of a War file to the current Thread Context ClassLoader. This function as to be executed before the start() because the new classpath won't take effect. TODO This potentially can be replaced by ClassLoaderUtil.createURLClassLoader(String, ClassLoader)

Parameters:
appliPath -
serverLibLoader -
Returns:
the exploded war file location and web app CL.
Throws:
IOException

stop

public void stop()

start

public void start()
           throws IOException
Throws:
IOException

getWatchedFileMap

public Map<String,WatchedFile> getWatchedFileMap()


Copyright © 2012 Oracle Corporation. All Rights Reserved.