public class OSGiAppProvider extends ScanningAppProvider implements AppProvider
This provider must not be called outside of jetty.boot: it should always be called via the OSGi service listener.
This provider supports the same set of parameters than the WebAppProvider as it supports the deployment of WebAppContexts. Except for the scanning of the webapps directory.
When the parameter autoInstallOSGiBundles is set to true, OSGi bundles that are located in the monitored directory are installed and started after the framework as finished auto-starting all the other bundles. Warning: only use this for development.
AbstractLifeCycle.AbstractLifeCycleListenerLifeCycle.Listener_filenameFilter_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING| Constructor and Description |
|---|
OSGiAppProvider()
Default OSGiAppProvider constructed when none are defined in the
jetty.xml configuration.
|
OSGiAppProvider(File contextsDir)
Default OSGiAppProvider constructed when none are defined in the
jetty.xml configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addContext(org.osgi.framework.Bundle contributor,
String pathInBundle,
ContextHandler context) |
void |
addContext(String originId,
ContextHandler context) |
protected App |
createApp(String filename)
Called by the scanner of the context files directory.
|
ContextHandler |
createContextHandler(App app)
Returns the ContextHandler that was created by WebappRegistractionHelper
|
protected void |
doStart()
Overridden to install the OSGi bundles found in the monitored folder.
|
protected void |
fileAdded(String filename)
When the file is a jar or a folder, we look if it looks like an OSGi
bundle.
|
protected void |
fileChanged(String filename) |
protected void |
fileRemoved(String filename) |
protected org.osgi.framework.Bundle |
getBundle(org.osgi.framework.BundleContext bc,
String location)
Returns a bundle according to its location.
|
String[] |
getConfigurationClasses() |
String |
getContextXmlDir()
The context xml directory.
|
File |
getContextXmlDirAsFile()
The context xml directory.
|
String |
getDefaultsDescriptor()
Get the defaultsDescriptor.
|
String |
getTldBundles() |
protected org.osgi.framework.Bundle |
installBundle(File file,
boolean start) |
boolean |
isAutoInstallOSGiBundles() |
boolean |
isExtract() |
boolean |
isParentLoaderPriority()
Get the parentLoaderPriority.
|
void |
removeContext(ContextHandler context) |
void |
setAutoInstallOSGiBundles(boolean installingOSGiBundles)
<autoInstallOSGiBundles>true</autoInstallOSGiBundles>
|
void |
setConfigurationClasses(String[] configurations) |
void |
setContextXmlDir(String contextsDir)
Set the directory in which to look for context XML files.
|
void |
setDefaultsDescriptor(String defaultsDescriptor)
Set the defaultsDescriptor.
|
void |
setDeploymentManager(DeploymentManager deploymentManager)
Set the Deployment Manager
|
void |
setExtract(boolean extract) |
void |
setParentLoaderPriority(boolean parentLoaderPriority)
Set the parentLoaderPriority.
|
void |
setTldBundles(String tldBundles) |
protected void |
uninstallBundle(File file) |
protected void |
updateBundle(File file) |
addScannerListener, doStop, getDeployedApps, getDeploymentManager, getMonitoredDirName, getMonitoredDirResource, getScanInterval, isRecursive, setMonitoredDir, setMonitoredDirName, setMonitoredDirResource, setRecursive, setScanIntervaladdLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stoppublic OSGiAppProvider()
public OSGiAppProvider(File contextsDir) throws IOException
contextsDir - IOExceptionpublic ContextHandler createContextHandler(App app) throws Exception
createContextHandler in interface AppProviderapp - The AppIOExceptionExceptionAppProviderpublic void setDeploymentManager(DeploymentManager deploymentManager)
AppProvidersetDeploymentManager in interface AppProvidersetDeploymentManager in class ScanningAppProviderAppProviderpublic void addContext(org.osgi.framework.Bundle contributor,
String pathInBundle,
ContextHandler context)
throws Exception
context - Exceptionpublic void addContext(String originId, ContextHandler context) throws Exception
context - Exceptionprotected App createApp(String filename)
createApp in class ScanningAppProviderfilename - The file that is the context.xml. It is resolved by
Resource.newResource(String)public void removeContext(ContextHandler context) throws Exception
Exceptionpublic boolean isParentLoaderPriority()
public void setParentLoaderPriority(boolean parentLoaderPriority)
parentLoaderPriority - the parentLoaderPriority to setpublic String getDefaultsDescriptor()
public void setDefaultsDescriptor(String defaultsDescriptor)
defaultsDescriptor - the defaultsDescriptor to setpublic File getContextXmlDirAsFile()
public String getContextXmlDir()
public boolean isExtract()
public void setExtract(boolean extract)
public boolean isAutoInstallOSGiBundles()
public void setAutoInstallOSGiBundles(boolean installingOSGiBundles)
installingOSGiBundles - public void setContextXmlDir(String contextsDir)
If a webapp call "foo/" or "foo.war" is discovered in the monitored directory, then the ContextXmlDir is examined to see if a foo.xml file exists. If it does, then this deployer will not deploy the webapp and the ContextProvider should be used to act on the foo.xml file.
Also if this directory contains some osgi bundles, it will install them.
contextsDir - ContextProviderpublic void setTldBundles(String tldBundles)
tldBundles - Comma separated list of bundles that contain tld jars
that should be setup on the jetty instances created here.public String getTldBundles()
public void setConfigurationClasses(String[] configurations)
configurations - The configuration class names.public String[] getConfigurationClasses()
protected void doStart()
throws Exception
doStart in class ScanningAppProviderExceptionprotected void fileAdded(String filename) throws Exception
Really a simple trick to get going quickly with development.
fileAdded in class ScanningAppProviderExceptionprotected void fileChanged(String filename) throws Exception
fileChanged in class ScanningAppProviderExceptionprotected void fileRemoved(String filename) throws Exception
fileRemoved in class ScanningAppProviderExceptionprotected org.osgi.framework.Bundle getBundle(org.osgi.framework.BundleContext bc,
String location)
location - protected org.osgi.framework.Bundle installBundle(File file, boolean start)
protected void uninstallBundle(File file)
protected void updateBundle(File file)
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.