incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Sling > The Sling Launchpad
Date Fri, 30 Jul 2010 22:02:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLING&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">The
Sling Launchpad</a></h2>
    <h4>Page <b>edited</b> by             <a href="">Felix
                         <h4>Changes (2)</h4>
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">h1.
The Sling Launchpad <br> <br>{toc:minLevel=2|maxLevel=3} <br> <br>This
tries to explain how exactly the Sling Launchpad works, what constitutes the Sling Launchpad
and how you can use the Sling Launchpad to custom create you Sling launchers. <br> <br>
<br>h2. Sling Home <br> <br>Since Sling requires some space on the filesystem
to store various files Sling has to know where this filesystem space is located. <br>
<br>The following is a list of uses for the Sling Home directory: <br> <br>*
{{}} -- The main configuration file used by Sling to launch the framework.
It mainly contains OSGi framework configuration and initial configuration for some bundles.
This file is read on each startup of _Launcher JAR_. That is, changes to this file require
a restart of the _Launcher JAR_. <br>* {{}} --  This
is the _Launcher JAR_ file used by the Standalone Application or the Web Application to start
the OSGi Framework. This file is initially placed when first starting Sling and may later
be updated by updating the system bundle with a new _Launcher JAR_. <br>* {{felix}}
-- The directory into which the Apache Felix Framework places the bundles, which have been
installed into the system. This does generally not need to be touched. <br>* {{config}}
-- The directory into which the Apache Felix Configuration Admin Service stores the configurationes.
Do not change any files in this directory, since changes will not generally be picked up.
<br>* {{jackrabbit}} -- The directory in which the Apache Jackrabbit JCR repository
is started. Amongst other things this also contains the Jackrabbit configuration file {{repository.xml}}.
You may modify this file, but don&#39;t forget to restart the Embedded Jackrabbit Repository
bundle after doing this. <br>* {{logs}} -- Contains the log files generated by Sling.
By default this contains the error.log and its rotated generations. <br> <br>
<br>h2. Command Line Options <br> <br> <br>The Java Standalone Application
supports a number of command line options, which influence the operation of the launch process.
<br> <br>|| Option || Argument || Description || <br>| {{start}} | -- |
Open a TCP/IP server socket when starting Sling. Uses option {{-j}} to define the local socket
address. | <br>| {{status}} | -- | Check whether a (remote) Sling application is running.
Uses option {{-j}} to define the address of the Sling instance to check. Note, that the Sling
application terminates after checking for the (remote) Sling status. | <br>| {{stop}}
| -- | Stop a (remote) Sling application is running. Uses option {{-j}} to define the address
of the Sling instance to stop. Note, that the Sling application terminates after stopping
the (remote) Sling instance. | <br>| {{-c}} | slinghome | The directory in which Sling
locates its initial configuration file {{}} and where files of Sling itself
such as the Apache Felix bundle archive or the JCR repository files are stored. This defaults
to the {{sling}} folder in the current working directory. This is the value which is commonly
refered to as {{$\{sling.home}.}} <br>| {{-l}} | loglevel | Sets the initial loglevel
as an integer in the range 0 to 4 or as one of the well known level strings {{ERROR}}, {{WARN}},
{{INFO}}, or {{DEBUG}}. This option overwrites the {{}} setting
the {{}} file. The default is {{INFO}}. | <br>| {{-f}} | logfile | 
The log file to use or {{-}} to log to standard out. This option overwrites the {{}}
setting the {{}} file. The default is {{$\{sling.home}/logs/error.log}}. |
<br>| {{-a}} | address | The interfact to bind to (use for any). This option
is not implemented yet. | <br>| {{-p}} | port |  The port to listen (default 8080) to
handle HTTP requests. This option overwrites the {{org.osgi.service.http.port}} setting the
{{}} file. | <br>| {{-j}} | [ host &quot;:&quot; ] port |  The
socket address to listen on for control connections ({{start}} or to use as the remote endpoint
for the control connection ({{status}} and {{stop}}. If this parameter has no arguments or
is not specified, the address defaults to port 63000 on localhost/ If only the port
is specified localhost/ is used as the host part of the address. | <br>| {{-h}}
| -- | Prints a simple usage message listing all available command line options. | <br>
<br>The Sling Standalone application looks for a definition of the {{sling.home}} setting
in the following locations in order of precendence: <br> <br># The {{-c}} command
line option <br># The {{sling.home}} system property <br># The {{SLING_HOME}}
environment variable <br># If none of the above resolves to a non-null value, the default
value of {{sling}} is assumed <br> <br> <br>h3. Security Implication <br>
<br>Note that using a control connection for the Sling Standalone Application presents
a potential security issue. For this reason the following defaults apply: <br> <br>*
The server side socket for a running Sling Standalone Application is only created if the application
is started with the {{start}} command line option. If this option is omitted -- the default
-- the server side socket is not created and the Sling Standalone Application instance cannot
be remotely controlled. <br>* The default host name for the socket is localhost/
meaning that the socket is only accessible from the same system as the Sling Standalone Application
is running on. If the socket is accessible from remote systems additional must be taken to
prevent malicious attackers to stop the system. The server side control connection implementation
implements no security precaution (except from supporting to not create such a connection
at all). <br> <br> <br>h2. Servlet Parameters <br> <br>The Web
Application does not require specific servlet parameters. Those which are specified are used
to overwrite any properties with the same name from the {{}} file. One exception
to this rule is the {{sling.home}} parameter, which is used to set the value of the {{sling.home}}
property. If no parameter with this name is defined the Sling home directory is derived from
the context path at which the Sling Web Application is registered. <br> <br>The
{{sling.home}} folders for Sling Web Applications without the {{sling.home}} servlet parameter
are all located in the {{sling}} folder in the current working directory as reported by the
{{user.dir}} system property. The name of the actual directory is derived from the Web Application
Context Path by replacing all slash characters {{/}} by underscore characters {{\_}}. For
the root context a single underscore character {{\_}} is used. <br> <br>Examples:
<br> <br>|| Servlet Context || Default {{sling.home}} || <br>| _root_ |
{{sling/\_}} | <br>| {{/sling}} | {{sling/\_sling}} | <br>| {{/sling/instance1}}
| {{sling/\_sling\_instance1}} | <br> <br>Starting with Launchpad Base 2.2.2 the
fixed prefix {{sling}} is configurable with the {{sling.home.prefix}} system property. If
this property is set the value used as the prefix. <br> <br>Examples: Assume the
{{sling.home.prefix}} system property is set to {{/var/sling}} <br> <br>|| Servlet
Context || Default {{sling.home}} || <br>| _root_ | {{/var/sling/\_}} | <br>|
{{/sling}} | {{/var/sling/\_sling}} | <br>| {{/sling/instance1}} | {{/var/sling/\_sling\_instance1}}
| <br> <br> <br>h2. <br> <br>The {{}}
file contains the initial setup of the Sling Application and the OSGi framework. Some of the
parameters are required and should not be modified without a very good reason. Some parameters
may be freely modified to your needs. Please see the inlined comment in the {{}}
file installed when Sling is first started. <br> <br>One thing to note is, that
the {{}} file is a simple Java Properties file with support for property references.
That is, the value of properties may refer other property values by means of the well known
{{$\{name}}} notation. Such property references may even be cascaded as in <br> <br>{code}
<br>java.packages=${jre-${java.specification.version}} <br>{code} <br> <br>
<br>h2. Components <br> <br>The Sling Launchapd consists of _Launchbad Base_
project and three additional projects which ultimately create a Standalone Java Application
and a Web Appliction with standard parts of Sling. <br> <br> <br>h3. Launchpad
Base <br> <br>The _Launchpad Base_ projects creates the following artifacts, which
are required in actual setups to get a Sling application: <br> <br>* *Launcher
JAR* -- The primary artifact of the Base project contains the actual support to launch the
Apache Felix OSGi Framework and install bundles, which are packaged with the application.
It also contains the Apache Felix Framework together with the OSGi R4.1 Core and Compendium
libraries as well as the Equinox HttpService bridge and the Servlet API. <br> <br>*
*App JAR* -- The secondary artifact with classifier _app_ is a minimal Standalone Java Application
which may be started by simply typing <br> <br>{code} <br>$ java -jar
<br>{code} <br> <br>* *Web App Archive* -- The secondary artifact with classifier
_webapp_ is a minimal Web Application, which may simply be deployed into your favirourite
servlet container, provided it supports at least Servlet API 2.4. <br> <br>* *Source
JAR* -- The secondary artifact with the classifier _sources_ is simple the source of the _Launchpad
Base_ project. <br> <br>To build a very basic Sling launcher, the _Launchpad Base_
is actually all you need. But to really glue this together and get a usable system, some more
work is required. Lets see how the additionaly projects _Launchpad Bundles_, _Launchpad App_,
and _Launchpad WebApp_ get to that. <br> <br> <br>h3. Launchpad Bundles
<br> <br>The second project we want to look at is the _Launchpad Bundles_ project.
This is a very simple project in that it only collects together a number of OSGi bundles,
which will make up the final application. The bundles are stored in a (big) Java Archive in
folders whose path is formed with {{resources/9}} where {{9}} is a start level which is assigned
to the bundles as they are installed. The special start level {{0}} instructs the installer
to not actually assign a specific start level to the bundles contained in that folder. <br>
<br>Currently the following start level assignement is used by the _Launchpad Bundles_
project: <br> <br>|| Start Level || Bundle Group || Bundle(s) || <br>| 1
| Basic bundles required for the correct operation of Sling |
<br>| 5 | Apache Felix Web Console | org.apache.felix.bundlerepository, org.apache.felix.webconsole, | <br>| 10 | OSGi Compendium Service Implementations
| org.apache.felix.configadmin, org.apache.felix.eventadmin, org.apache.felix.metatype, org.apache.felix.scr
| <br>| 15 | JCR Repository (Jackrabbit) | commons-collections, commons-io-1.4.jar <br>commons-lang,
jackrabbit-api, jackrabbit-jcr-commons,,,,,, | <br>| 0 | Actual Sling Application bundles |,,,,,,,,,,,,,,,,,,,,,
| <br> <br> <br> <br>h3. Launchpad App and Launchpad WebApp <br>
<br>The _Launchpad App_ and _Launchpad WebApp_ bundles are actually projects which just
glue together artifacts from the Launchpad projects. There is nothing special about them.
Here&#39;s what is done: <br> <br>* Take the appropriate secondary artifact
from the _Launchpad Base_ project: _app_ for the Standalone Java Application or _webapp_ for
the Web Application and unpack <br>* Take the _Launchpad Base_ primary artifact and
place it under the name {{}} into the {{resources}} folder
<br>* Take the _Launchpad Bundles_ artifact and unpack it <br>* Finally pack all
together into a single big JAR or WAR file <br> <br>That&#39;s it. The resulting
artifact may be directly used to launch the Standalone Java Application or may directly be
deployed into any Servlet API 2.4 (or later) compliant servlet container. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">This
page has been moved to [SLINGxSITE:The Sling Launchpad] <br></td></tr>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>This page has been moved to <a href="/confluence/display/SLINGxSITE/The+Sling+Launchpad"
title="The Sling Launchpad">The Sling Launchpad</a></p>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
        <a href="">View
        <a href="">View
        <a href=";showCommentArea=true#addcomment">Add

View raw message