org.crsh.plugin
Class WebPluginLifeCycle

java.lang.Object
  extended by org.crsh.plugin.PluginLifeCycle
      extended by org.crsh.plugin.Embedded
          extended by org.crsh.plugin.WebPluginLifeCycle

public class WebPluginLifeCycle
extends Embedded


Field Summary
private  ServletContext context
          .
private static Map<String,PluginContext> contextMap
          .
private static Object lock
          .
private  Map<String,FSMountFactory<?>> mountContexts
          .
private  boolean registered
          .
 
Fields inherited from class org.crsh.plugin.PluginLifeCycle
log
 
Constructor Summary
WebPluginLifeCycle()
           
 
Method Summary
 void contextDestroyed(ServletContextEvent sce)
           
 void contextInitialized(ServletContextEvent sce)
           
protected  PluginDiscovery createDiscovery(ServletContext context, ClassLoader classLoader)
          Create the service loader discovery, this can be subclassed to provide an implementation, the current implementation returns a ServiceLoaderDiscovery instance.
protected  String getDefaultCmdMountPointConfig()
           
protected  String getDefaultConfMountPointConfig()
           
protected  Map<String,FSMountFactory<?>> getMountFactories()
          This implementation register three file system drivers: file : the current file system classpath : the classpath war : the war content
static PluginContext getPluginContext(String contextPath)
          Returns a plugin context associated with the servlet context or null if such context does not exist.
protected  String resolveCmdMountPointConfig()
           
protected  String resolveConfMountPointConfig()
           
private  String resolvePathProperty(String propertyName, String defaultValue)
          The path property is resolved from the servlet context parameters.
 
Methods inherited from class org.crsh.plugin.Embedded
create, createCommandFS, createConfFS, createFS, start
 
Methods inherited from class org.crsh.plugin.PluginLifeCycle
getConfig, getContext, setConfig, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lock

private static final Object lock
.


contextMap

private static final Map<String,PluginContext> contextMap
.


registered

private boolean registered
.


mountContexts

private Map<String,FSMountFactory<?>> mountContexts
.


context

private ServletContext context
.

Constructor Detail

WebPluginLifeCycle

public WebPluginLifeCycle()
Method Detail

getPluginContext

public static PluginContext getPluginContext(String contextPath)
                                      throws NullPointerException
Returns a plugin context associated with the servlet context or null if such context does not exist.

Parameters:
contextPath - the context path
Returns:
the associated plugin context
Throws:
NullPointerException - if the servlet context argument is null

getMountFactories

protected Map<String,FSMountFactory<?>> getMountFactories()
This implementation register three file system drivers:

Overrides:
getMountFactories in class Embedded
Returns:
the drivers

createDiscovery

protected PluginDiscovery createDiscovery(ServletContext context,
                                          ClassLoader classLoader)
Create the service loader discovery, this can be subclassed to provide an implementation, the current implementation returns a ServiceLoaderDiscovery instance.

Parameters:
context - the servlet context
classLoader - the class loader
Returns:
the plugin discovery

contextInitialized

public void contextInitialized(ServletContextEvent sce)

resolvePathProperty

private String resolvePathProperty(String propertyName,
                                   String defaultValue)
The path property is resolved from the servlet context parameters. When the parameter does not exist, the defaultValue argument is used instead, so it should not be null. After the path is resolved, it is interpolated using the JVM system properties and the syntax defined by the Utils.interpolate(String, java.util.Map) function.

Parameters:
propertyName - the property name to resolve
defaultValue - the default property value
Returns:
the path value

resolveConfMountPointConfig

protected String resolveConfMountPointConfig()
Overrides:
resolveConfMountPointConfig in class Embedded
Returns:
the value returned by resolvePathProperty(String, String) with the crash.mountpointconfig.conf name and the getDefaultConfMountPointConfig() default value

resolveCmdMountPointConfig

protected String resolveCmdMountPointConfig()
Overrides:
resolveCmdMountPointConfig in class Embedded
Returns:
the value returned by resolvePathProperty(String, String) with the crash.mountpointconfig.cmd name and the getDefaultCmdMountPointConfig() default value

getDefaultCmdMountPointConfig

protected String getDefaultCmdMountPointConfig()
Returns:
war:/WEB-INF/crash/commands/

getDefaultConfMountPointConfig

protected String getDefaultConfMountPointConfig()
Returns:
war:/WEB-INF/crash/

contextDestroyed

public void contextDestroyed(ServletContextEvent sce)


Copyright © 2015 eXo Platform SAS. All Rights Reserved.