|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.component.AbstractLifeCycle org.eclipse.jetty.overlays.OverlayedAppProvider
public class OverlayedAppProvider
Overlayed AppProvider
This AppProvider
implementation can deploy either WebAppContext
s or plain
ContextHandler
s that are assembled from a series of overlays:
Each overlays may provide the following files and subdirectories:
URLClassLoader
that is
available before any overlay.xml files are executed, so that classes from these jars may be used by the
overlay.xml.XmlConfiguration
formatted file must exist in the WEB-INF directory of an overlay and is
used to configure a ContextHandler
or WebAppContext
. The overlay.xml from the template
overlay can be used to instantiate the ContextHandler instance, so a derived class maybe used.XmlConfiguration
formatted file if it exists in a template or node overlay, is applied to a shared instance of TemplateContext
.
Any ID's created in a template are available as ID's in overlay.xml for an instance.WebAppContext.setDefaultsDescriptor(String)
. Typically this is set in the template overlay.WebAppContext.addOverrideDescriptor(String)
. This allows incremental changes to web.xml without
totally replacing it (see webapp). Typically this is used to set init parameters.Any init parameters set on the context, filters or servlets may have parameterized values, with the parameters including:
Webapp#getName()
.Template#getName()
.Template#getTemplateName()
.Template#getClassifier()()
.Node#getName()
.Instance#getName()
.Instance#getClassifier()()
.getConfigurationManager()
.ConfigurationManager.getProperties()
The OverlayedAppProvider will scan the "webapps", "templates", "nodes" and "instances" subdirectories of
the directory configured with setScanDir(File)
. New webapps and overlays and modified files within
the overlays will trigger hot deployment, redeployment or undeployment. The scan for modified files is
restricted to only top level files (eg overlay.xml) and the files matching WEB-INF/*.xml WEB-INF/lib/*
and WEB-INF/classes/*. The webapps/overlays may be directory structures or war/jar archives.
The filenames of the templates and instances are used to match them together and with a webapplication. A webapp may be named anyway, but it is good practise to include a version number (eg webapps/foo-1.2.3.war or webapps/foo-1.2.3/). A template for that webapplication must have a name that includes the template name and the war name separated by '=' (eg templates/myFoo=foo-1.2.3.jar or templates/myFoo=foo-1.2.3/). An instance overlay is named with the template name and an arbitrary instance name separated by '=' (eg instances/myFoo=instance1.jar instances/myFoo=instance2/ etc.).
If a template name does not include a webapp name, then the template is created as a ContextHandler instead of a WebAppContext (with the exact type being determined by overlay.xml).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
AbstractLifeCycle.AbstractLifeCycleListener |
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
LifeCycle.Listener |
Field Summary | |
---|---|
static List<Pattern> |
__scanPatterns
|
static String |
INSTANCES
|
static String |
LIB
|
static String |
NODES
|
static String |
OVERLAY_INSTANCE
Property set for overlay.xml and template.xml files that gives the current instance name, Instance#getName() . |
static String |
OVERLAY_INSTANCE_CLASSIFIER
Property set for overlay.xml and template.xml files that gives the current instance clasifier, Instance#getClassifier() . |
static String |
OVERLAY_NODE
Property set for overlay.xml and template.xml files that gives the current node name, as Node#getName() . |
static String |
OVERLAY_TEMPLATE
Property set for overlay.xml and template.xml files that gives the current template full name, as Template#getName() . |
static String |
OVERLAY_TEMPLATE_CLASSIFIER
Property set for overlay.xml and template.xml files that gives the current template classifier, as Template#getClassifier() . |
static String |
OVERLAY_TEMPLATE_NAME
Property set for overlay.xml and template.xml files that gives the current template name, as Template#getTemplateName() . |
static String |
OVERLAY_WEBAPP
Property set for overlay.xml and template.xml files that gives the current webapp name, as Webapp#getName() . |
static String |
OVERLAY_XML
|
static String |
OVERLAYS_DIR
Property set for overlay.xml and template.xml files that gives the root overlay scan directory as a canonical file name. |
static String |
TEMPLATE_XML
|
static String |
TEMPLATES
|
static String |
WEB_DEFAULT_XML
|
static String |
WEB_FRAGMENT_XML
|
static String |
WEBAPP
|
static String |
WEBAPPS
|
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
---|---|
OverlayedAppProvider()
|
Method Summary | |
---|---|
ContextHandler |
createContextHandler(App app)
Create Context Handler. |
protected void |
doStart()
|
protected void |
doStop()
|
ConfigurationManager |
getConfigurationManager()
|
DeploymentManager |
getDeploymentManager()
|
String |
getNodeName()
|
File |
getScanDir()
Get the scanDir. |
int |
getScanInterval()
|
String |
getServerID()
|
File |
getTmpDir()
Get the temporary directory. |
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Instance |
loadInstance(String name,
File origin)
|
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Node |
loadNode(File origin)
|
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Template |
loadTemplate(String name,
File origin)
|
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Webapp |
loadWebapp(String name,
File origin)
|
protected void |
redeploy()
Walks the defined webapps, templates, nodes and instances to determine what should be deployed, then adjust reality to match. |
protected void |
removeInstance(String name)
|
protected void |
removeNode()
|
protected void |
removeTemplate(String name)
|
protected void |
removeWebapp(String name)
|
void |
scan()
|
void |
setConfigurationManager(ConfigurationManager configurationManager)
Set the configurationManager. |
void |
setDeploymentManager(DeploymentManager deploymentManager)
Set the Deployment Manager |
void |
setNodeName(String nodeName)
|
void |
setScanDir(File scanDir)
Set the scanDir. |
void |
setScanInterval(int scanInterval)
|
void |
setServerID(String serverID)
|
void |
setTmpDir(File tmpDir)
Set the temporary directory. |
protected File |
tmpdir(String name,
String suffix)
|
protected void |
updateLayers(Set<String> layerURIs)
|
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle |
---|
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle |
---|
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop |
Field Detail |
---|
public static final String OVERLAYS_DIR
public static final String OVERLAY_WEBAPP
Webapp#getName()
.
public static final String OVERLAY_TEMPLATE
Template#getName()
.
public static final String OVERLAY_TEMPLATE_NAME
Template#getTemplateName()
.
public static final String OVERLAY_TEMPLATE_CLASSIFIER
Template#getClassifier()
.
public static final String OVERLAY_NODE
Node#getName()
.
public static final String OVERLAY_INSTANCE
Instance#getName()
.
public static final String OVERLAY_INSTANCE_CLASSIFIER
Instance#getClassifier()
.
public static final String WEBAPPS
public static final String TEMPLATES
public static final String NODES
public static final String INSTANCES
public static final String LIB
public static final String WEBAPP
public static final String OVERLAY_XML
public static final String TEMPLATE_XML
public static final String WEB_DEFAULT_XML
public static final String WEB_FRAGMENT_XML
public static final List<Pattern> __scanPatterns
Constructor Detail |
---|
public OverlayedAppProvider()
Method Detail |
---|
public void setDeploymentManager(DeploymentManager deploymentManager)
AppProvider
setDeploymentManager
in interface AppProvider
public DeploymentManager getDeploymentManager()
public ConfigurationManager getConfigurationManager()
public void setConfigurationManager(ConfigurationManager configurationManager)
configurationManager
- the configurationManager to setpublic String getServerID()
XmlConfiguration.getIdMap()
of the Server
instance. Default "Server".public void setServerID(String serverID)
serverID
- The name in XmlConfiguration.getIdMap()
of the Server
instance.public ContextHandler createContextHandler(App app) throws Exception
Callback from the deployment manager to create a context handler instance.
createContextHandler
in interface AppProvider
app
- The App
IOException
Exception
AppProvider.createContextHandler(org.eclipse.jetty.deploy.App)
public String getNodeName()
public void setNodeName(String nodeName)
nodeName
- Set the node namepublic File getScanDir()
public void setScanDir(File scanDir)
scanDir
- the scanDir to setpublic void setTmpDir(File tmpDir)
tmpDir
- the directory for temporary files. If null, then getScanDir()+"/tmp" is used if it exists, else the system default is used.public File getTmpDir()
public int getScanInterval()
Scanner.getScanInterval()
public void setScanInterval(int scanInterval)
scanInterval
- The scan intervalScanner.setScanInterval(int)
public void scan()
Scanner.scan()
protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
AbstractLifeCycle.doStart()
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
AbstractLifeCycle.doStop()
protected void updateLayers(Set<String> layerURIs)
protected File tmpdir(String name, String suffix) throws IOException
IOException
protected void redeploy()
protected void removeInstance(String name)
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Instance loadInstance(String name, File origin) throws IOException
IOException
protected void removeNode()
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Node loadNode(File origin) throws IOException
IOException
protected void removeTemplate(String name)
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Template loadTemplate(String name, File origin) throws IOException
IOException
protected void removeWebapp(String name)
protected org.eclipse.jetty.overlays.OverlayedAppProvider.Webapp loadWebapp(String name, File origin) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |