org.eclipse.jetty.osgi.boot
Class OSGiAppProvider

java.lang.Object
  extended by org.eclipse.jetty.util.component.AbstractLifeCycle
      extended by org.eclipse.jetty.deploy.providers.ScanningAppProvider
          extended by org.eclipse.jetty.osgi.boot.OSGiAppProvider
All Implemented Interfaces:
AppProvider, LifeCycle

public class OSGiAppProvider
extends ScanningAppProvider
implements AppProvider

AppProvider for OSGi. Supports the configuration of ContextHandlers and WebApps. Extends the AbstractAppProvider to support the scanning of context files located outside of the bundles.

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.


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
 
Fields inherited from class org.eclipse.jetty.deploy.providers.ScanningAppProvider
_filenameFilter
 
Fields inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
 
Constructor Summary
OSGiAppProvider()
          Default OSGiAppProvider consutructed when none are defined in the jetty.xml configuration.
OSGiAppProvider(File contextsDir)
          Default OSGiAppProvider consutructed when none are defined in the jetty.xml configuration.
 
Method Summary
 void addContext(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
 String getContextXmlDir()
          The context xml directory.
 File getContextXmlDirAsFile()
          The context xml directory.
 String getDefaultsDescriptor()
          Get the defaultsDescriptor.
 String getTldBundles()
           
 boolean isParentLoaderPriority()
          Get the parentLoaderPriority.
 void removeContext(ContextHandler context)
           
 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 setParentLoaderPriority(boolean parentLoaderPriority)
          Set the parentLoaderPriority.
 void setTldBundles(String tldBundles)
           
 
Methods inherited from class org.eclipse.jetty.deploy.providers.ScanningAppProvider
doStart, doStop, getDeployedApps, getDeploymentManager, getMonitoredDir, getScanInterval, isRecursive, setMonitoredDir, setMonitoredDir, setRecursive, setScanInterval
 
Methods inherited from class org.eclipse.jetty.util.component.AbstractLifeCycle
addLifeCycleListener, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jetty.util.component.LifeCycle
addLifeCycleListener, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
 

Constructor Detail

OSGiAppProvider

public OSGiAppProvider()
Default OSGiAppProvider consutructed when none are defined in the jetty.xml configuration.

Parameters:
contextsDir -

OSGiAppProvider

public OSGiAppProvider(File contextsDir)
                throws IOException
Default OSGiAppProvider consutructed when none are defined in the jetty.xml configuration.

Parameters:
contextsDir -
Throws:
IOException
Method Detail

createContextHandler

public ContextHandler createContextHandler(App app)
                                    throws Exception
Returns the ContextHandler that was created by WebappRegistractionHelper

Specified by:
createContextHandler in interface AppProvider
Parameters:
app - The App
Returns:
A ContextHandler
Throws:
IOException
Exception
See Also:
AppProvider

setDeploymentManager

public void setDeploymentManager(DeploymentManager deploymentManager)
Description copied from interface: AppProvider
Set the Deployment Manager

Specified by:
setDeploymentManager in interface AppProvider
Overrides:
setDeploymentManager in class ScanningAppProvider
See Also:
AppProvider

addContext

public void addContext(ContextHandler context)
                throws Exception
Parameters:
context -
Throws:
Exception

createApp

protected App createApp(String filename)
Called by the scanner of the context files directory. If we find the corresponding deployed App we reload it by returning the App. Otherwise we return null and nothing happens: presumably the corresponding OSGi webapp is not ready yet.

Overrides:
createApp in class ScanningAppProvider
Parameters:
filename - The file that is the context.xml. It is resolved by Resource.newResource(String)
Returns:
the corresponding already deployed App so that it will be reloaded. Otherwise returns null.

removeContext

public void removeContext(ContextHandler context)
                   throws Exception
Throws:
Exception

isParentLoaderPriority

public boolean isParentLoaderPriority()
Get the parentLoaderPriority.

Returns:
the parentLoaderPriority

setParentLoaderPriority

public void setParentLoaderPriority(boolean parentLoaderPriority)
Set the parentLoaderPriority.

Parameters:
parentLoaderPriority - the parentLoaderPriority to set

getDefaultsDescriptor

public String getDefaultsDescriptor()
Get the defaultsDescriptor.

Returns:
the defaultsDescriptor

setDefaultsDescriptor

public void setDefaultsDescriptor(String defaultsDescriptor)
Set the defaultsDescriptor.

Parameters:
defaultsDescriptor - the defaultsDescriptor to set

getContextXmlDirAsFile

public File getContextXmlDirAsFile()
The context xml directory. In fact it is the directory watched by the scanner.


getContextXmlDir

public String getContextXmlDir()
The context xml directory. In fact it is the directory watched by the scanner.


setContextXmlDir

public void setContextXmlDir(String contextsDir)
Set the directory in which to look for context XML files.

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.

Parameters:
contextsDir -
See Also:
ContextProvider

setTldBundles

public void setTldBundles(String tldBundles)
Parameters:
tldBundles - Comma separated list of bundles that contain tld jars that should be setup on the jetty instances created here.

getTldBundles

public String getTldBundles()
Returns:
The list of bundles that contain tld jars that should be setup on the jetty instances created here.


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.