|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.sling.launchpad.base.impl.Sling
public class Sling
The Sling
serves as the starting point for Sling.
Sling(Notifiable, Logger, LaunchpadContentProvider, Map)
method launches Apache
Felix
as the OSGi framework implementation we use.
Launch Configuration
The Apache Felix
framework requires configuration parameters to
be specified for startup. This servlet builds the list of parameters from
three locations:
sling.properties
file is read from the servlet class
path. This properties file contains default settings.loadPropertiesOverride(Map)
method.
After loading all properties, variable substitution takes place on the
property values. A variable is indicated as ${<prop-name>}
where <prop-name>
is the name of a system or configuration
property (configuration properties override system properties). Variables may
be nested and are resolved from inner-most to outer-most. For example, the
property value ${outer-${inner}}
is resolved by first resolving
${inner}
and then resolving the property whose name is the
catenation of outer-
and the result of resolving
${inner}
.
Field Summary | |
---|---|
static String |
CONFIG_PROPERTIES
The name of the default launcher properties file to setup the environment for the Felix framework (value is "sling.properties"). |
static String |
JCR_REPO_CONFIG_FILE_URL
The name of the configuration property defining the URL of an existing repository config file (repository.xml). |
static String |
JCR_REPO_HOME
The name of the configuration property defining the JCR home directory (value is "sling.repository.home"). |
protected org.apache.felix.framework.Logger |
logger
The simple logger to log messages during startup and shutdown to |
static String |
OSGI_FRAMEWORK_BUNDLES
The name of the configuration property defining a properties file defining a list of bundles, which are installed into the framework when it has been launched (value is "org.apache.osgi.bundles"). |
static String |
PROP_SYSTEM_PACKAGES
|
static String |
SLING_HOME_URL
The name of the configuration property defining the Sling home directory as an URL (value is "sling.home.url"). |
static String |
SLING_IGNORE_SYSTEM_PROPERTIES
The property to be set to ignore the system properties when building the Felix framework properties (value is "sling.ignoreSystemProperties"). |
Constructor Summary | |
---|---|
Sling(Notifiable notifiable,
org.apache.felix.framework.Logger logger,
LaunchpadContentProvider resourceProvider,
Map<String,String> propOverwrite)
Initializes this servlet by loading the framework configuration properties, starting the OSGi framework (Apache Felix) and exposing the system bundle context and the Felix instance as servlet
context attributes. |
Method Summary | |
---|---|
void |
destroy()
Destroys this servlet by shutting down the OSGi framework and hence the delegatee servlet if one is set at all. |
protected void |
doStartBundle()
Executes additional startup tasks and is called by the start(BundleContext) method. |
protected void |
doStopBundle()
Executes additional shutdown tasks and is called by the stop(BundleContext) method. |
protected org.osgi.framework.BundleContext |
getBundleContext()
Returns the BundleContext of the system bundle of the OSGi
framework launched by this servlet. |
protected void |
loadPropertiesOverride(Map<String,String> properties)
Loads additional properties into the properties object. |
void |
start(org.osgi.framework.BundleContext bundleContext)
Called when the OSGi framework is being started. |
void |
stop(org.osgi.framework.BundleContext bundleContext)
Called when the OSGi framework is being shut down. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SLING_HOME_URL
The value of this property is assigned the value of
new File(${sling.home}).toURI().toString()
before
resolving the property variables.
SharedConstants.SLING_HOME
,
Constant Field Valuespublic static final String JCR_REPO_HOME
The value of this property could be set as a system property, init-param in web.xml or property in sling.properties.
Default value to #SLING_HOME/repository_name
public static final String JCR_REPO_CONFIG_FILE_URL
The value of this property could be set as a system property, init-param in web.xml or property in sling.properties.
Default value to #SLING_HOME/repository_name/repository.xml
public static final String OSGI_FRAMEWORK_BUNDLES
This configuration property is generally set in the web application configuration and may be referenced in all property files (default, user supplied and web application parameters) used to build the framework configuration.
public static final String SLING_IGNORE_SYSTEM_PROPERTIES
true
(case does not matter),
the system properties will not be used by
loadConfigProperties(Map)
.
public static final String CONFIG_PROPERTIES
Felix
framework (value is "sling.properties").
Extensions of this class may overwrite some or all properties in this file through Web Application parameters or other properties files.
public static final String PROP_SYSTEM_PACKAGES
protected final org.apache.felix.framework.Logger logger
Constructor Detail |
---|
public Sling(Notifiable notifiable, org.apache.felix.framework.Logger logger, LaunchpadContentProvider resourceProvider, Map<String,String> propOverwrite) throws org.osgi.framework.BundleException
Felix
instance as servlet
context attributes.
org.osgi.framework.BundleException
- if the framework cannot be initialized.Method Detail |
---|
public final void destroy()
public final void start(org.osgi.framework.BundleContext bundleContext) throws Exception
javax.servlet.Servlet
class and calls the
doStartBundle()
method for implementations to execute more
startup tasks. Additionally the context
URL protocol
handler is registered.
start
in interface org.osgi.framework.BundleActivator
bundleContext
- The BundleContext
of the system
bundle of the OSGi framework.
Exception
- May be thrown if the doStartBundle()
throws.public final void stop(org.osgi.framework.BundleContext bundleContext)
doStopBundle()
method method before
unregistering as a service listener and ungetting an servlet delegatee if
one has been acquired.
stop
in interface org.osgi.framework.BundleActivator
bundleContext
- The BundleContext
of the system
bundle of the OSGi framework.protected void loadPropertiesOverride(Map<String,String> properties)
properties
object.
This implementation does nothing and may be overwritten by extensions requiring additional properties to be set.
This method is called when the servlet is initialized to prepare the
configuration for Felix
. Implementations may add
properties from implementation specific sources. Properties added here
overwrite properties loaded from the default properties file and may be
overwritten by parameters set in the web application.
The properties
object has not undergone variable
substition and properties added by this method may also contain values
refererring to other properties.
The properties added in this method will not be persisted in the
sling.properties
file in the sling.home
directory.
properties
- The Properties
object to which custom
properties may be added.protected final org.osgi.framework.BundleContext getBundleContext()
BundleContext
of the system bundle of the OSGi
framework launched by this servlet. This method only returns a non-null
object after the system bundle of the framework has been started and
before it is being stopped.
protected void doStartBundle() throws Exception
start(BundleContext)
method.
This implementation does nothing and may be overwritten by extensions requiring additional startup tasks.
Exception
- May be thrown in case of problems.protected void doStopBundle()
stop(BundleContext)
method.
This implementation does nothing and may be overwritten by extensions requiring additional shutdown tasks.
When overwriting this method, it must be made sure, that no exception may be thrown, otherwise unexpected behaviour may result.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |