incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r841833 [5/28] - in /websites/staging/sling/trunk/content: ./ site/ site/46-line-blog.data/ site/authentication.data/ site/documentation.data/ site/first-steps.data/ site/getting-and-building-sling.data/ site/how-to-manage-events-in-sling.d...
Date Wed, 12 Dec 2012 09:17:17 GMT
Added: websites/staging/sling/trunk/content/site/configuration.html
==============================================================================
--- websites/staging/sling/trunk/content/site/configuration.html (added)
+++ websites/staging/sling/trunk/content/site/configuration.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,353 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Configuration</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://sling.apache.org/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://www.apache.org/">
+          <IMG border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+<P><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></P>
+
+
+  <IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="" title="Configuration">Configuration</A>
+        </DIV>
+<H1><A name="Configuration-ConfigurationSupport"></A>Configuration Support</H1>
+
+
+<H2><A name="Configuration-Introduction"></A>Introduction</H2>
+
+<P>Configuration in Sling is aligned with respective support by the OSGi specification:</P>
+
+<UL>
+	<LI>Framework and Java system properties are available through the <TT>BundleContext.getProperty(String)</TT> method. These properties are provided in Sling through the Sling launcher.</LI>
+	<LI>Bundle Header values are available through the <TT>Bundle.getHeaders()</TT> and <TT>Bundle.getHeaders(String)</TT> methods. These header values are set by the bundle developer in the <TT>META-INF/MANIFEST.MF</TT> file. In fact, all main manifest attributes are available through these methods.</LI>
+	<LI>Components managed by the Service Component Runtime and declared in component descriptor files listed in the <TT>Service-Component</TT> manifest header access configuration properties through the <TT>ComponentContext.getProperties()</TT> method. These properties have three sources:
+	<OL>
+		<LI>Configuration specified specifically for factory components</LI>
+		<LI>Properties retrieved from the Configuration Admin Service</LI>
+		<LI>Properties set in the component descriptor</LI>
+	</OL>
+	</LI>
+	<LI>Configuration properties provided to <TT>ManagedService</TT> and <TT>ManagedServiceFactory</TT> instances by the Configuration Admin Service.</LI>
+</UL>
+
+
+<P>For the discussion to follow we differentiate between intial configuration provided by Framework and system properties and managed configuration provided by the Configuration Admin Service.</P>
+
+<P>Components managed by the Service Component Runtime are generally configured (as listed above) through the descriptor properties and configuration set by Configuration Admin Service configuration. The descriptor property values may be seen as configuration default values set by the component developer, which may be overwritten by user configuration through the Configuration Admin Service. Components may but are not required to make use of Framework properties by accessing the <TT>BundleContext</TT> through the <TT>ComponentContext</TT> given to the <TT>activate(ComponentContext)</TT> method of the component.</P>
+
+
+
+<H2><A name="Configuration-InitialConfiguration"></A>Initial Configuration</H2>
+
+<P>The lifecycle of the OSGi framework implemented by an instance of the <TT>org.apache.felix.framework.Felix</TT> class is managed by the Sling launcher class <TT>org.apache.sling.launcher.Sling</TT>. This class is used by the standalone main class (<TT>org.apache.sling.launcher.main.Main</TT>) and the Sling Servlet (<TT>org.apache.sling.launcher.servlet.SlingServlet</TT>) to control the lifecycle.</P>
+
+<P>The Sling launcher is responsible to provide the Framework properties to the OSGi framework. The properties are prepared as a <TT>java.util.Map&lt;String, String&gt;</TT> instance as follows (later steps may overwrite properties defined in earlier steps) :</P>
+
+<OL>
+	<LI>Load core properties from the embedded <TT>sling.properties</TT> file.</LI>
+	<LI>Resolve any property file inclusions. This is mainly used to resolve the correct JRE package definitions for the JRE version used.</LI>
+	<LI>Overwrite with any properties provided by the main class or the Sling Servlet.</LI>
+	<LI>Make sure the <TT>sling.home</TT> property is set defining a sensible default value if missing</LI>
+	<LI>Load the contents of the <TT>${sling.home}/sling.properties</TT> file</LI>
+	<LI>Overwrite properties with Java system properties. This step only considers system properties of the same names as properties already existing. That is, the system properties are not just copied into the properties here. Additionally this step my be omitted if the <TT>sling.ignoreSystemProperties</TT> property is set to <TT>true</TT>.</LI>
+	<LI>Resolve any property file inclusions. This may be used to provide more configurability depending on the integration.</LI>
+	<LI>Handle OSGi boot delegation support (see below).</LI>
+	<LI>Resolve property references of the form <TT>${propName</TT>}</LI>
+	<LI>For each property value starting with <TT>ontext:/</TT> do the following, assuming the value to be an URL with scheme <TT>context:</TT>:
+	<UL>
+		<LI>Copy the application resource to <TT>${sling.home</TT>} preserving the URL path unless such a file already exists.</LI>
+		<LI>Replace the property value with the path to the newly created file. The path has the form <TT>${sling.home}/relpath</TT>.</LI>
+	</UL>
+	</LI>
+	<LI>Store the properties as <TT>${sling.home}/sling.properties</TT> to be re-used on next startup</LI>
+	<LI>Setup Bundle auto installation for the Felix Framework</LI>
+</OL>
+
+
+<P>Using file system copies of the initial configuration and referred files, it is easy to modify this configuration without the need to unpack and repackage the web application archive.</P>
+
+<P>The only property really required is actually the <TT>sling.home</TT> property, which defines the file system location where runtime files will be placed. The default if this property is missing will be <EM>sling</EM> in the current working directory as defined the <TT>user.dir</TT> system property.</P>
+
+
+
+<H3><A name="Configuration-StandaloneApplication"></A>Standalone Application</H3>
+
+<P>When launching Sling as a standalone application the <TT>sling-app.jar</TT> file is used. This is an executable JAR File. The <TT>sling.properties</TT> file as well as the <TT>sling_install.properties</TT> and JRE specific properties files are located at the root of the JAR file hierarchy.</P>
+
+<P>The standalone application currently sets properties for the third step of the configuration setup to ensure the HTTP Servlet integration is using the Apache Felix <EM>http.jetty</EM> bundle. Additionally system properties may be set using the <TT>-D</TT> command line switch of the Java binary.</P>
+
+<P>In addition the following command line arguments are accepted:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Argument </TH>
+<TH class="confluenceTh"> Sling property </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>-l loglevel</TT> </TD>
+<TD class="confluenceTd"> <TT>org.apache.sling.osgi.log.level</TT> </TD>
+<TD class="confluenceTd"> The initial loglevel (0..4, FATAL, ERROR, WARN, INFO, DEBUG) </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>-f logfile</TT> </TD>
+<TD class="confluenceTd"> <TT>org.apache.sling.osgi.log.file</TT> </TD>
+<TD class="confluenceTd"> The log file, &quot;-&quot; for stdout </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>-c slinghome</TT> </TD>
+<TD class="confluenceTd"> <TT>sling.home</TT> </TD>
+<TD class="confluenceTd"> the sling context directory </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>-a address</TT> </TD>
+<TD class="confluenceTd"> &ndash; </TD>
+<TD class="confluenceTd"> the interfact to bind to (use 0.0.0.0 for any) (not supported yet) </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>-p port</TT> </TD>
+<TD class="confluenceTd"> <TT>org.osgi.service.http.port</TT> </TD>
+<TD class="confluenceTd"> the port to listen to (default 8080) </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>-h</TT> </TD>
+<TD class="confluenceTd"> &ndash; </TD>
+<TD class="confluenceTd"> Prints a simple usage message and exits. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>The standalone application exits with status code 0 (zero) if Sling terminates normally, that is if the OSGi framework is stopped or if just the usage note has been displayed. If any error occurrs during command line parsing, the cause is printed to the error output and the application exists with status code 1 (one). If the OSGi framework fails to start, the cause is printed to the error output and the application exists with status code 2.</P>
+
+
+<H3><A name="Configuration-WebApplication"></A>Web Application</H3>
+
+<P>When launching Sling as a web application using the <TT>sling-servlet.war</TT> or any derived Web Application archive file, the <TT>sling.properties</TT> file is located in the <TT>WEB-INF</TT> folder along with the <TT>sling_install.properties</TT> and JRE specific properties files.</P>
+
+<P>The Sling Servlet uses the Servlet Context and Servlet <TT>init-param</TT> configurations to prepare the properties for the third step of the configuration setup.</P>
+
+<P>If the OSGi framework fails to startup for any reason a <TT>javax.servlet.UnavailableException</TT>.</P>
+
+
+
+<H3><A name="Configuration-PropertyFileInclusions"></A>Property File Inclusions</H3>
+
+<P>Twice in the configuration setup (second and seventh step) any property file inclusions will be handled. Property files may be included by defining one or more properties containing a comma-separated list of properties files to include. Property file inclusion looks at the <TT>sling.include</TT> property and any other property whose prefix is <TT>sling.include.</TT>. When such properties exist, the files listed in those properties are included.</P>
+
+<P>The order of handling the property file inclusion properties is defined as natural sort order of the actual property names. So the properties of the files listed in the <TT>sling.include.first</TT> property will be loaded before the files listed in the <TT>sling.include.second</TT> but after the files listed in the <TT>sling.include.a</TT> property.</P>
+
+<P>Any file which does not exist is silently ignored.</P>
+
+<P>The names of the files are resolved as follows:</P>
+
+<OL>
+	<LI>If a resource exists at the same location as the initial <TT>sling.properties</TT> file packaged with the application, that resource is used</LI>
+	<LI>If the name is a relative file name, it is looked for in the <TT>sling.home</TT> directory</LI>
+	<LI>If the name is an absolute file name, it is used as is</LI>
+</OL>
+
+
+<P><B>Example</B></P>
+
+<P>The packaged <TT>sling.properties</TT> file contains the following properties file inclusion setting:</P>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>sling.include.jre = jre-${java.specification.version}.properties
+</PRE>
+</DIV></DIV>
+
+<P>This is used to include the JRE package list to be made visible inside the OSGi framework.</P>
+
+
+
+<H3><A name="Configuration-OSGiBootDelegationSupport"></A>OSGi Boot Delegation Support</H3>
+
+<P>Some packages may have to be shared between bundles in an OSGi framework and the rest of Java VM in which the framework has been launched. This is especially true for OSGi framework instances launched in embedding such as Servlet Containers. In the case of a Sling Application accessing a JCR Repository launched in a different Web Application, this mainly concerns an API packages as well as the JNDI Initial Factory package(s).</P>
+
+<P>To cope with this sharing issue, the OSGi core specification defines two properties, which may list packages to be used from the environment:</P>
+
+
+<UL>
+	<LI><B><TT>org.osgi.framework.system.packages</TT></B> - This property lists package names which are added to the list of exported packages of the system bundle of the OSGi framework. These packages are used in the resolution process just as any package listed in an <TT>Export-Package</TT> bundle manifest header.</LI>
+	<LI><B><TT>org.osgi.framework.bootdelegation</TT></B> -  This property lists packages, which are always used from the environment. As such, these packages will never be looked up in package wirings as are packages imported by listing them in the <TT>Import-Package</TT> bundle manifest header.</LI>
+</UL>
+
+
+
+<P>Sometimes, especially in the Servlet Container case, it is important to use the shared classes from the container and not resolve using standard OSGi resolution. In such cases, the packages of these shared classes must be listed in the <TT>org.osgi.framework.bootdelegation</TT> property. Sling provides a mechanism to extend the default setting of the <TT>org.osgi.framework.bootdelegation</TT> property by adding properties prefixed with <TT>sling.bootdelegation.</TT>. The value of each of these prefixed properties is conditionally appended to the <TT>org.osgi.framework.bootdelegation</TT> property. <EM>Conditionally</EM> means, that the property name may contain the fully qualified name of a class, which is checked to see whether to add the property value or not.</P>
+
+<P><EM>Examples</EM></P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> <TT>sling.bootdelegation.simple = com.some.package</TT> </TD>
+<TD class="confluenceTd"> This setting unconditionally adds the <TT>com.some.package</TT> package to the <TT>org.osgi.framework.bootdelegation</TT> property </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.bootdelegation.class.com.some.other.Main = com.some.other</TT> </TD>
+<TD class="confluenceTd"> This setting checks whether the <TT>com.some.other.Main</TT> class is known. If so, the <TT>com.some.other</TT> package is added to the <TT>org.osgi.framework.bootdelegation</TT> property. Otherwise the <TT>com.some.other</TT> package is not added - and therefore must be exported by a bundle if required for use inside the framework. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<P><B>Note</B> Even though packages listed in the <TT>org.osgi.framework.bootdelegation</TT> property will always be loaded from the environment, any bundles using these packages must still import them (through <TT>Import-Package</TT> or <TT>DynamicImport-Package</TT>) and the bundles must resolve for being usable.</P>
+
+
+
+<H3><A name="Configuration-OSGiSystemPackagesSupport"></A>OSGi System Packages Support</H3>
+
+<P>As listed in the above section on OSGi Boot Delegation Support, the <TT>org.osgi.framework.system.packages</TT> property may be used to extend the export list of the system bundle. Similar to the support for extending the boot delegation packages list, Sling supports extending the system packages list. The mechanism to extend the default setting of the <TT>org.osgi.framework.system.packages</TT> property by adding properties prefixed with <TT>sling.system.packages.</TT>. The value of each of these prefixed properties is conditionally appended to the <TT>org.osgi.framework.system.packages</TT> property. <EM>Conditionally</EM> means, that the property name may contain the fully qualified name of a class, which is checked to see whether to add the property value or not.</P>
+
+<P><EM>Examples</EM></P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TD class="confluenceTd"> <TT>sling.system.packages.simple = com.some.package</TT> </TD>
+<TD class="confluenceTd"> This setting unconditionally adds the <TT>com.some.package</TT> package to the <TT>org.osgi.framework.system.packages</TT> property </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.system.packages.class.com.some.other.Main = com.some.other</TT> </TD>
+<TD class="confluenceTd"> This setting checks whether the <TT>com.some.other.Main</TT> class is known. If so, the <TT>com.some.other</TT> package is added to the <TT>org.osgi.framework.system.packages</TT> property. Otherwise the <TT>com.some.other</TT> package is not added - and therefore must be exported by a bundle if required for use inside the framework. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<P><B>Note</B> Packages listed in the <TT>org.osgi.framework.system.packages</TT> required by any bundles must be imported by those bundles by listing them in the <TT>Import-Package</TT> or <TT>DynamicImport-Package</TT> manifest header.</P>
+
+
+
+<H2><A name="Configuration-Recommendationsforpropertynames"></A>Recommendations for property names</H2>
+
+<P>The following system property names are reserved:</P>
+
+<UL>
+	<LI>Names starting with <TT>org.osgi.</TT> are reserved for OSGi defined Framework properties</LI>
+	<LI>Names starting with <TT>org.apache.felix.</TT> are reserved for the Felix Framework</LI>
+	<LI>Names starting with <TT>sling.</TT> and <TT>org.apache.sling.</TT> are reserved for Sling</LI>
+</UL>
+
+
+<P>To prevent property name collisions, I suggest the following convention:</P>
+
+<UL>
+	<LI>Use fully qualified property names for initial configuration through Framework properties</LI>
+	<LI>Use unqualified property names for configuration through the Configuration Admin Service</LI>
+</UL>
+
+
+
+<H2><A name="Configuration-WellKnownProperties"></A>Well Known Properties</H2>
+
+<P>The following table is a collection of well known property names from different parts of Project Sling.</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Property </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.home</TT> </TD>
+<TD class="confluenceTd"> Defines the file system location where Project Sling will write copies of the initial configuration. This property should also be used to define other local file system locations such as the directory to use for the Apache Felix Bundle Cache (<TT>${sling.home}/felix</TT> by default). If this property is not set it defaults to <TT>${user.dir}/sling</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.home.url</TT> </TD>
+<TD class="confluenceTd"> Contains the Sling directory set in the <TT>sling.home</TT> property as a valid URL. This property may be used in situations where the Sling directory is required as an URL. This property is automatically set by the Sling application and may not be modified by configuration files. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.ignoreSystemProperties</TT> </TD>
+<TD class="confluenceTd"> Whether to overwrite any configuration properties with Java system properties or not. By default this property is set to <TT>true</TT> by the Sling Servlet but not set by the Sling main class. The reason to set this by default in the Sling Servlet is to not induce values from the environment, which may not be appropriate in the Web Application case. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>obr.repository.url</TT> </TD>
+<TD class="confluenceTd"> A comma-separated list of OSGi Bundle Repository URLs. See <EM>Important Properties</EM> on the page <A href="launch-sling.html" title="Launch Sling">Initial Provisioning and Startup</A>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.install.bundles</TT> </TD>
+<TD class="confluenceTd"> A comma-separated list of start level numbers. See <EM>Important Properties</EM> on the page <A href="launch-sling.html" title="Launch Sling">Initial Provisioning and Startup</A>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.install.&lt;n&gt;</TT> </TD>
+<TD class="confluenceTd"> A comma-separated list of bundle specifications. See <EM>Important Properties</EM> on the page <A href="launch-sling.html" title="Launch Sling">Initial Provisioning and Startup</A>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.osgi.log.*</TT> </TD>
+<TD class="confluenceTd"> Properties providing initial configuration to the Sling Log Service. See 'Important Properties' on the page <A href="launch-sling.html" title="Launch Sling">Initial Provisioning and Startup</A>. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+
+<H2><A name="Configuration-ConfigurationAdminService"></A>Configuration Admin Service</H2>
+
+<P>Configuration of the system entities, such as services and components, by the system administrator is supported the Configuration Admin Service. The Configuration Admin Service acts as the center for the management of the configuration data, to which GUI-based tools will connect to retrieve and update configuration data. The Configuration Admin Service is responsible for persisting the configuration data and for providing configuration consumers with the configuration data. Specifically services registered with the <TT>ManagedService</TT> or <TT>ManagedServiceFactory</TT> interfaces are updated with the configuration upon updated. The Service Component Runtime on the other hand recognizes updated configuration and provides it to the managed components as defined in the OSGi Declarative Services Specification.</P>
+
+<P>By default the Configuration Admin Service is installed when Sling is started for the first time. This service is used by the Service Component Runtime launching the OSGi components declared in the bundles with configuration values. The Sling Management Console provides a simple GUI to manage these configuration elements on the 'Configuration' page.</P>
+
+<P>For more information on the Configuration Admin Service refer to the OSGi Configuration Admin Service Specification in the OSGi Service Platform Service Compendium book.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by mykee on 2009-06-01 07:40:41.0
+        </DIV>
+        <DIV class="trademarkFooter">
+Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Added: websites/staging/sling/trunk/content/site/content-loading-and-nodetype-support-jcrcontentloader.html
==============================================================================
--- websites/staging/sling/trunk/content/site/content-loading-and-nodetype-support-jcrcontentloader.html (added)
+++ websites/staging/sling/trunk/content/site/content-loading-and-nodetype-support-jcrcontentloader.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,343 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Content Loading and Nodetype Support (jcr.contentloader)</TITLE>
+    <LINK rel="stylesheet" href="http://incubator.apache.org/sling/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://incubator.apache.org/sling/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://incubator.apache.org/sling/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://incubator.apache.org/sling/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://incubator.apache.org/">
+          <IMG border="0" alt="Apache Incubator" src="http://incubator.apache.org/images/apache-incubator-logo.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+                                    <P style="display: none"></P>
+
+<UL>
+	<LI><A href="documentation.html" title="Documentation">Documentation</A></LI>
+	<LI><A href="advanced-topics.html" title="Advanced Topics">Advanced Topics</A></LI>
+	<LI><A href="development.html" title="Development">Development</A></LI>
+	<LI><SPAN class="nobr"><A href="http://incubator.apache.org/sling/site/downloads.cgi" title="Visit page outside Confluence" rel="nofollow">Downloads<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><A href="contributing.html" title="Contributing">Contributing</A></LI>
+	<LI><A href="links.html" title="Links">Links</A></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/SLING/faq.html" title="Visit page outside Confluence" rel="nofollow">FAQ<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/SLING/" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><A href="project-information.html" title="Project Information">Project Information</A></LI>
+	<LI><SPAN class="nobr"><A href="http://incubator.apache.org/sling/apidocs/sling5/index.html" title="Visit page outside Confluence" rel="nofollow">Sling 5 API<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">Sponsors<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">Sponsorship<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>
+
+<IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+<P style="height: 100px"></P>
+</LI>
+</UL>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="advanced-topics.html" title="Advanced Topics">Advanced Topics</A>&nbsp;&gt;&nbsp;<A href="" title="Content Loading and Nodetype Support (jcr.contentloader)">Content Loading and Nodetype Support (jcr.contentloader)</A>
+        </DIV>
+<H1><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-ContentLoadingandNodetypeSupport"></A>Content Loading and Nodetype Support</H1>
+
+<P>Apache Sling provides support for initial content loading into a repository and for registering node types. The <TT>sling-jcr-contentloader</TT> bundle provides loading of content from a bundle into the repository and the <TT>sling-jcr-base</TT> bundle provides node type registration.</P>
+
+<H2><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-InitialContentLoading"></A>Initial Content Loading</H2>
+
+<P>Bundles can provide initial content, which is loaded into the repository when the bundle has entered the <EM>started</EM> state. Such content is expected to be contained in the bundles accessible through the Bundle entry API methods. Content to be loaded is declared in the <TT>Sling-Initial-Content</TT> bundle manifest header. This header takes a comma-separated list of bundle entry paths. Each entry and all its child entries are accessed and entered into starting with the child entries of the listed entries.</P>
+
+<P>Adding this content preserves the paths of the entries as show in this table, which assumes a <TT>Sling-Initial-Content</TT> header entry of <TT>SLING-INF/content</TT>:</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Entry </TH>
+<TH class="confluenceTh"> Repository Path </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home</TT> </TD>
+<TD class="confluenceTd"> <TT>/home</TT> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/content/playground/en/home</TT> </TD>
+<TD class="confluenceTd"> <TT>/content/playground/en/home</TT> </TD>
+</TR>
+</TBODY></TABLE>
+<P>Bundle entries are installed as follows:</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Entry Type </TH>
+<TH class="confluenceTh"> Installation method </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> Directory </TD>
+<TD class="confluenceTd"> Created as a node of type <TT>nt:folder</TT> unless a content definition file of the same name exists in the same directory as the directory to be installed. Example: A directory <TT>SLING-INF/content/dir</TT> is installed as node <TT>/dir</TT> of type <TT>nt:folder</TT> unless a <TT>SLING-INF/content/dir.xml</TT> or <TT>SLING-INF/content/dir.json</TT> file exists which defines the content for the <TT>/dir</TT> node. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> File </TD>
+<TD class="confluenceTd"> Unless the file is a content definition file (see below) an <TT>nt:file</TT> node is created for the file and an <TT>nt:resource</TT> node is created as its <TT>jcr:content</TT> child node to take the contents of the bundle file. The properties of the <TT>nt:resource</TT> node are set from file information as available. If the file is a content definition file, the content is created as defined in the file. See below for the content definition file specification. </TD>
+</TR>
+</TBODY></TABLE>
+<P>It is possible to modify the intial content loading default behaviour by using certain optional directives. Directives should be specified separated by semicolon. They are defined as follows:</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Directive </TH>
+<TH class="confluenceTh"> Definition </TH>
+<TH class="confluenceTh"> Default value </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>overwrite</TT> </TD>
+<TD class="confluenceTd"> <TT>overwrite:=(true&#124;false)</TT> </TD>
+<TD class="confluenceTd"> <TT>false</TT> </TD>
+<TD class="confluenceTd"> The overwrite directive specifies if content should be overwritten or just initially added. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>uninstall</TT> </TD>
+<TD class="confluenceTd"> <TT>uninstall:=(true&#124;false)</TT> </TD>
+<TD class="confluenceTd"> <TT>overwrite</TT> </TD>
+<TD class="confluenceTd"> The uninstall directive specifies if content should be uninstalled when bundle is unregistered. This value defaults to the value of the <TT>overwrite</TT> directive. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>path</TT> </TD>
+<TD class="confluenceTd"> <TT>path:=<EM>/target/location</EM></TT> </TD>
+<TD class="confluenceTd"> <TT>/</TT> </TD>
+<TD class="confluenceTd"> The path directive specifies the target node where initial content will be loaded. If the path does not exist yet in the repository, it is created by the content loader. The intermediate nodes are of type <TT>nt:folder</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>checkin</TT> </TD>
+<TD class="confluenceTd"> <TT>checkin:=(true&#124;false)</TT> </TD>
+<TD class="confluenceTd"> <TT>false</TT> </TD>
+<TD class="confluenceTd"> The checkin directive specifies whether versionable nodes should be checked in. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>ignoreImportProviders</TT> </TD>
+<TD class="confluenceTd"> <TT>ignoreImportProviders:=list of extensions</TT> </TD>
+<TD class="confluenceTd"> <TT>empty</TT> </TD>
+<TD class="confluenceTd"> This directive can be used to not run one of the configured extractors (see below). </TD>
+</TR>
+</TBODY></TABLE>
+<P>Examples of these directives uses could be (assumes a Sling-Initial-Content header entry of SLING-INF/content):</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Entry </TH>
+<TH class="confluenceTh"> Behaviour </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home;overwrite:=true;uninstall:=true</TT> </TD>
+<TD class="confluenceTd"> Overwrites already existing content in <EM>/home</EM> and uninstalls the content when the bundle is unregistered. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home;path:=/sites/sling_website</TT> </TD>
+<TD class="confluenceTd"> if <EM>/sites/sling_website</EM> exists it loads the content into it. Otherwise, it loads the content into root node <EM>/</EM>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home;checkin:=true</TT> </TD>
+<TD class="confluenceTd"> After content loading, versionable nodes are checked in. </TD>
+</TR>
+</TBODY></TABLE>
+
+<H2><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-Loadinginitialcontentfrombundles"></A>Loading initial content from bundles</H2>
+
+<P>Repository items to be loaded into the repository, when the bundle is first installed, may be defined in four ways:</P>
+<OL>
+	<LI>Directories</LI>
+	<LI>Files</LI>
+	<LI>XML descriptor files</LI>
+	<LI>JSON descriptor files</LI>
+</OL>
+
+
+<P>Depending on the bundle entry found in the location indicated by the Sling-Initial-Content bundle manifest header, nodes are created (and/or updated) as follows:</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-Directories"></A>Directories</H3>
+
+<P>Unless a node with the name of the directory already exists or has been defined in an XML or JSON descriptor file (see below) a directory is created as a node with the primary node type &quot;nt:folder&quot; in the repository.</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-Files"></A>Files</H3>
+
+<P>Unless a node with the name of the file already exists or has been defined in an XML or JSON descriptor file (see below) a file is created as two nodes in the repository. The node bearing the name of the file itself is created with the<BR>
+primary node type &quot;nt:file&quot;. Underneath this file node, a resource node with the primary node type &quot;nt:resource&quot; is created, which is set to the contents of the file.</P>
+
+<P>The MIME type is derived from the file name extension by first trying to resolve it from the Bundle entry URL. If this does not resolve to a MIME type, the Sling MIME type resolution service is used to try to find a mime type. If all fals, the MIME type is defaulted to &quot;application/octet-stream&quot;.&nbsp;&nbsp;</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-XMLDescriptorFiles"></A>XML Descriptor Files</H3>
+
+<P>Nodes, Properties and in fact complete subtrees may be described in XML files using either the JCR SystemView format, or the format described below. In either case, the file must have the .xml extension.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;node&gt;</SPAN>
+		&lt;!--
+			optional on top level, defaults to XML file name without .xml extension
+	       	required for child nodes
+		--&gt;
+		<SPAN class="code-tag">&lt;name&gt;</SPAN>xyz<SPAN class="code-tag">&lt;/name&gt;</SPAN>
+
+		&lt;!--
+	   		optional, defaults to nt:unstructured
+		--&gt;
+		<SPAN class="code-tag">&lt;primaryNodeType&gt;</SPAN>nt:file<SPAN class="code-tag">&lt;/primaryNodeType&gt;</SPAN>
+
+		&lt;!--
+		    optional mixin node type
+		    may be repeated for multiple mixin node types
+		--&gt;
+		<SPAN class="code-tag">&lt;mixinNodeType&gt;</SPAN>mix:versionable<SPAN class="code-tag">&lt;/mixinNodeType&gt;</SPAN>
+		<SPAN class="code-tag">&lt;mixinNodeType&gt;</SPAN>mix:lockable<SPAN class="code-tag">&lt;/mixinNodeType&gt;</SPAN>
+
+		&lt;!--
+			Optional properties for the node. Each <SPAN class="code-tag">&lt;property&gt;</SPAN> element defines
+			a single property of the node. The element may be repeated.
+		--&gt;
+		<SPAN class="code-tag">&lt;property&gt;</SPAN>
+			&lt;!--
+				required property name
+			--&gt;
+			<SPAN class="code-tag">&lt;name&gt;</SPAN>prop<SPAN class="code-tag">&lt;/name&gt;</SPAN>
+
+			&lt;!--
+				value of the property.
+				For multi-value properties, the values are defined by multiple
+				<SPAN class="code-tag">&lt;value&gt;</SPAN> elements nested inside a <SPAN class="code-tag">&lt;values&gt;</SPAN> element instead of a
+				single <SPAN class="code-tag">&lt;value&gt;</SPAN> element
+			--&gt;
+			<SPAN class="code-tag">&lt;value&gt;</SPAN>property value as string<SPAN class="code-tag">&lt;/value&gt;</SPAN>
+
+			&lt;!--
+				Optional type of the property value, defaults to String.
+				This must be one of the property type strings defined in the
+				JCR PropertyType interface.
+			<SPAN class="code-tag">&lt;type&gt;</SPAN>String<SPAN class="code-tag">&lt;/type&gt;</SPAN>
+		<SPAN class="code-tag">&lt;/property&gt;</SPAN>
+
+		&lt;!--
+			Additional child nodes. May be further nested.
+		--&gt;
+		<SPAN class="code-tag">&lt;node&gt;</SPAN>
+		....
+		<SPAN class="code-tag">&lt;/node&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/node&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<H4><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-UsingacustomXMLformat"></A>Using a custom XML format</H4>
+<P>By writing an XSLT stylesheet file, you can use whatever XML format you prefer. The XML file references an XSLT stylesheet by using the xml-stylesheet processing instruction: </P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN> encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+<SPAN class="code-tag">&lt;?xml-stylesheet href=<SPAN class="code-quote">&quot;my-transform.xsl&quot;</SPAN> type=<SPAN class="code-quote">&quot;text/xsl&quot;</SPAN>?&gt;</SPAN> <SPAN class="code-tag"><SPAN class="code-comment">&lt;!-- The path to my-transform.xsl is relative to this file --&gt;</SPAN></SPAN>
+
+<SPAN class="code-tag">&lt;your_custom_root_node&gt;</SPAN>
+   <SPAN class="code-tag">&lt;your_custom_element&gt;</SPAN>
+   ...
+   <SPAN class="code-tag">&lt;/your_custom_element&gt;</SPAN>
+...
+<SPAN class="code-tag">&lt;/your_custom_root_node&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<P>The my-transform.xsl file is then responsible for translating your format into one of the supported XML formats:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml">&lt;<SPAN class="code-keyword">xsl:stylesheet</SPAN> version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:jcr</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:mix</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/mix/1.0&quot;</SPAN> 
+  <SPAN class="code-keyword">xmlns:sv</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/sv/1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:sling</SPAN>=<SPAN class="code-quote">&quot;http://sling.apache.org/jcr/sling/1.0&quot;</SPAN>
+  <SPAN class="code-keyword">xmlns:rep</SPAN>=<SPAN class="code-quote">&quot;internal&quot;</SPAN> <SPAN class="code-keyword">xmlns:nt</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/nt/1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:xsl</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/1999/XSL/Transform&quot;</SPAN>&gt;
+
+  <SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:template</SPAN> match=<SPAN class="code-quote">&quot;your_custom_element&quot;</SPAN>&gt;</SPAN>
+    <SPAN class="code-tag">&lt;node&gt;</SPAN>
+      ...
+    <SPAN class="code-tag">&lt;/node&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:template</SPAN>&gt;</SPAN>
+  ...
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:stylesheet</SPAN>&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<H3><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-JSONDescriptorFiles"></A>JSON Descriptor Files</H3>
+
+<P>Nodes, Properties and in fact complete subtrees may be described in JSON files using the following skeleton structure (see <SPAN class="nobr"><A href="http://www.json.org/" title="Visit page outside Confluence" rel="nofollow">http://www.json.org<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> or information on the syntax of JSON) :</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">{
+		<SPAN class="code-comment">// optional node name on top level, <SPAN class="code-keyword">default</SPAN> is file name without .json ext.
+</SPAN>		<SPAN class="code-quote">&quot;name&quot;</SPAN>: <SPAN class="code-quote">&quot;nodename&quot;</SPAN>,
+
+		<SPAN class="code-comment">// optional primary node type, <SPAN class="code-keyword">default</SPAN> <SPAN class="code-quote">&quot;nt:unstructured&quot;</SPAN>
+</SPAN>		<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:ScriptedComponent&quot;</SPAN>,
+
+		<SPAN class="code-comment">// optional mixin node types as array
+</SPAN>		<SPAN class="code-quote">&quot;mixinNodeTypes&quot;</SPAN>: [ ],
+
+	    <SPAN class="code-comment">// the <SPAN class="code-quote">&quot;properties&quot;</SPAN> property is an object indexed by property name whose
+</SPAN>	    <SPAN class="code-comment">// value is either the string property value, array <SPAN class="code-keyword">for</SPAN> multi-values or
+</SPAN>	    <SPAN class="code-comment">// an object whose value[s] property denotes the property value(s) and
+</SPAN>	    <SPAN class="code-comment">// whose type property denotes the property type
+</SPAN>	    <SPAN class="code-quote">&quot;properties&quot;</SPAN>: {
+	    	<SPAN class="code-quote">&quot;sling:contentClass&quot;</SPAN>: <SPAN class="code-quote">&quot;com.day.sling.jcr.test.Test&quot;</SPAN>,
+	    	<SPAN class="code-quote">&quot;sampleMulti&quot;</SPAN>: [ <SPAN class="code-quote">&quot;v1&quot;</SPAN>, <SPAN class="code-quote">&quot;v2&quot;</SPAN> ],
+	    	<SPAN class="code-quote">&quot;sampleStruct&quot;</SPAN>: {
+	    		<SPAN class="code-quote">&quot;value&quot;</SPAN>: 1,
+	    		<SPAN class="code-quote">&quot;type&quot;</SPAN>: <SPAN class="code-quote">&quot;<SPAN class="code-object">Long</SPAN>&quot;</SPAN>
+	    	}
+	    	<SPAN class="code-quote">&quot;sampleStructMulti&quot;</SPAN>: {
+	    		<SPAN class="code-quote">&quot;value&quot;</SPAN>: [ 1, 2, 3 ],
+	    		<SPAN class="code-quote">&quot;type&quot;</SPAN>: <SPAN class="code-quote">&quot;<SPAN class="code-object">Long</SPAN>&quot;</SPAN>
+	    	}
+	    },
+
+	    <SPAN class="code-comment">// the <SPAN class="code-quote">&quot;nodes&quot;</SPAN> property is an array of objects denoting child nodes. Nodes
+</SPAN>	    <SPAN class="code-comment">// may be further nested.
+</SPAN>		<SPAN class="code-quote">&quot;nodes&quot;</SPAN>: [
+			{
+				<SPAN class="code-comment">// the name property is required on (nested) child nodes
+</SPAN>	            <SPAN class="code-quote">&quot;name&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:scripts&quot;</SPAN>,
+
+				<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:ScriptList&quot;</SPAN>,
+
+				<SPAN class="code-quote">&quot;nodes&quot;</SPAN>: [
+					{
+						<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:Script&quot;</SPAN>,
+						<SPAN class="code-quote">&quot;properties&quot;</SPAN>: {
+							<SPAN class="code-quote">&quot;sling:name&quot;</SPAN>: <SPAN class="code-quote">&quot;/test/content/jsp/start.jsp&quot;</SPAN>,
+							<SPAN class="code-quote">&quot;sling:type&quot;</SPAN>: <SPAN class="code-quote">&quot;jsp&quot;</SPAN>,
+							<SPAN class="code-quote">&quot;sling:glob&quot;</SPAN>: <SPAN class="code-quote">&quot;*&quot;</SPAN>
+						}
+					}
+				]
+			}
+		]
+	}</PRE>
+</DIV></DIV>
+
+<H3><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-Extractors"></A>Extractors</H3>
+
+<P>By default, the <TT>sling-jcr-contentloader</TT> bundle tries to extract certain file types during content loading. These include <TT>json</TT>, <TT>xml</TT>, <TT>zip</TT>, and <TT>jar</TT> files. Therefore all available extractors are used for content processing. However if some files should be put into the repository unextracted, the <TT>ignoreImportProviders</TT> directive can be used with a comma separated list of extensions that should not be extracted, like <TT>ignoreImportProviders:=jar,zip</TT>.</P>
+
+<H2><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-DeclaredNodeTypeRegistration"></A>Declared Node Type Registration</H2>
+
+<P>The <TT>sling-jcr-base</TT> bundle provides low-level repository operations which are at the heart of the functionality of Sling:</P>
+<UL>
+	<LI><B>Node Type Definitions</B> &#45; The class <TT>org.apache.sling.content.jcr.base.NodeTypeLoader</TT> provides methods to register custom node types with a repository given a repository session and a node type definition file in CND format. This class is also used by this bundle to register node types on behalf of other bundles.</LI>
+</UL>
+
+
+<P>Bundles may list node type definition files in CND format in the <TT>Sling-Nodetypes</TT> bundle header. This header is a comma-separated list of resources in the respective bundle. Each resource is taken and fed to the <TT>NodeTypeLoader</TT> to define the node types.</P>
+
+<P>After a bundle has entered the <EM>resolved</EM> state, the node types listed in the <TT>Sling-Nodetypes</TT> bundle header are registered with the repository.</P>
+
+<P>Node types installed by this mechanism will never be removed again by the <TT>sling-jcr-base</TT> bundle. Likewise, registered node types cannot currently be modified using this feature. The <TT>NodeTypeLoader</TT> will try to load nodes defined and fail with a log message if a node type has already been defined. To update existing node type definitions, native repository functionality has to be used.</P>
+
+<P>Nodetype management is currently a problematic issue, as the only API available is contained in the Jackrabbit Core library, which is generally not available to client applications - unless running in the same VM and class loader hierarchy as the Repository. Version 2 of the JCR Specification currently being developped as JSR-283 should fix this issue by providing an official node type management API. Until then, this approach is about the only solution we have.</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport%28jcr.contentloader%29-Automatedtests"></A>Automated tests</H3>
+
+<P>The initial content found in the <SPAN class="nobr"><A href="http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/content/src/main/resources/content/sling-test" title="Visit page outside Confluence" rel="nofollow">sling-test folder of the launchpad initial content<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> is verified by the <SPAN class="nobr"><A href="http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/InitialContentTest.java" title="Visit page outside Confluence" rel="nofollow">InitialContentTest<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> when running the <EM>launchpad/testing</EM> integration tests.</P>
+
+<P>Those tests can be used as verified examples of initial content loading. Contributions are welcome to improve the coverage of those tests.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by mykee on Wed May 27 13:51:00 PDT 2009
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Added: websites/staging/sling/trunk/content/site/content-loading-and-nodetype-support.html
==============================================================================
--- websites/staging/sling/trunk/content/site/content-loading-and-nodetype-support.html (added)
+++ websites/staging/sling/trunk/content/site/content-loading-and-nodetype-support.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,343 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Content Loading and Nodetype Support</TITLE>
+    <LINK rel="stylesheet" href="http://incubator.apache.org/sling/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://incubator.apache.org/sling/site/media.data/favicon.ico">
+    <META http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </HEAD>
+  <BODY>
+    <DIV class="title">
+      <DIV class="logo">
+        <A href="http://incubator.apache.org/sling/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://incubator.apache.org/sling/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://incubator.apache.org/">
+          <IMG border="0" alt="Apache Incubator" src="http://incubator.apache.org/images/apache-incubator-logo.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+                                    <P style="display: none"></P>
+
+<UL>
+	<LI><A href="documentation.html" title="Documentation">Documentation</A></LI>
+	<LI><A href="advanced-topics.html" title="Advanced Topics">Advanced Topics</A></LI>
+	<LI><A href="development.html" title="Development">Development</A></LI>
+	<LI><SPAN class="nobr"><A href="http://incubator.apache.org/sling/site/downloads.cgi" title="Visit page outside Confluence" rel="nofollow">Downloads<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><A href="contributing.html" title="Contributing">Contributing</A></LI>
+	<LI><A href="links.html" title="Links">Links</A></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/SLING/faq.html" title="Visit page outside Confluence" rel="nofollow">FAQ<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/SLING/" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><A href="project-information.html" title="Project Information">Project Information</A></LI>
+	<LI><SPAN class="nobr"><A href="http://incubator.apache.org/sling/apidocs/sling5/index.html" title="Visit page outside Confluence" rel="nofollow">Sling 5 API<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">Sponsors<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">Sponsorship<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>
+
+<IFRAME src="http://www.apache.org/ads/button.html" style="border-width:0; float: left" frameborder="0" scrolling="no" width="135" height="135"></IFRAME>
+<P style="height: 100px"></P>
+</LI>
+</UL>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="advanced-topics.html" title="Advanced Topics">Advanced Topics</A>&nbsp;&gt;&nbsp;<A href="" title="Content Loading and Nodetype Support">Content Loading and Nodetype Support</A>
+        </DIV>
+<H1><A name="ContentLoadingandNodetypeSupport-ContentLoadingandNodetypeSupport"></A>Content Loading and Nodetype Support</H1>
+
+<P>Apache Sling provides support for initial content loading into a repository and for registering node types. The <TT>sling-jcr-contentloader</TT> bundle provides loading of content from a bundle into the repository and the <TT>sling-jcr-base</TT> bundle provides node type registration.</P>
+
+<H2><A name="ContentLoadingandNodetypeSupport-InitialContentLoading"></A>Initial Content Loading</H2>
+
+<P>Bundles can provide initial content, which is loaded into the repository when the bundle has entered the <EM>started</EM> state. Such content is expected to be contained in the bundles accessible through the Bundle entry API methods. Content to be loaded is declared in the <TT>Sling-Initial-Content</TT> bundle manifest header. This header takes a comma-separated list of bundle entry paths. Each entry and all its child entries are accessed and entered into starting with the child entries of the listed entries.</P>
+
+<P>Adding this content preserves the paths of the entries as show in this table, which assumes a <TT>Sling-Initial-Content</TT> header entry of <TT>SLING-INF/content</TT>:</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Entry </TH>
+<TH class="confluenceTh"> Repository Path </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home</TT> </TD>
+<TD class="confluenceTd"> <TT>/home</TT> </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/content/playground/en/home</TT> </TD>
+<TD class="confluenceTd"> <TT>/content/playground/en/home</TT> </TD>
+</TR>
+</TBODY></TABLE>
+<P>Bundle entries are installed as follows:</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Entry Type </TH>
+<TH class="confluenceTh"> Installation method </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> Directory </TD>
+<TD class="confluenceTd"> Created as a node of type <TT>nt:folder</TT> unless a content definition file of the same name exists in the same directory as the directory to be installed. Example: A directory <TT>SLING-INF/content/dir</TT> is installed as node <TT>/dir</TT> of type <TT>nt:folder</TT> unless a <TT>SLING-INF/content/dir.xml</TT> or <TT>SLING-INF/content/dir.json</TT> file exists which defines the content for the <TT>/dir</TT> node. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> File </TD>
+<TD class="confluenceTd"> Unless the file is a content definition file (see below) an <TT>nt:file</TT> node is created for the file and an <TT>nt:resource</TT> node is created as its <TT>jcr:content</TT> child node to take the contents of the bundle file. The properties of the <TT>nt:resource</TT> node are set from file information as available. If the file is a content definition file, the content is created as defined in the file. See below for the content definition file specification. </TD>
+</TR>
+</TBODY></TABLE>
+<P>It is possible to modify the intial content loading default behaviour by using certain optional directives. Directives should be specified separated by semicolon. They are defined as follows:</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Directive </TH>
+<TH class="confluenceTh"> Definition </TH>
+<TH class="confluenceTh"> Default value </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>overwrite</TT> </TD>
+<TD class="confluenceTd"> <TT>overwrite:=(true&#124;false)</TT> </TD>
+<TD class="confluenceTd"> <TT>false</TT> </TD>
+<TD class="confluenceTd"> The overwrite directive specifies if content should be overwritten or just initially added. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>uninstall</TT> </TD>
+<TD class="confluenceTd"> <TT>uninstall:=(true&#124;false)</TT> </TD>
+<TD class="confluenceTd"> <TT>overwrite</TT> </TD>
+<TD class="confluenceTd"> The uninstall directive specifies if content should be uninstalled when bundle is unregistered. This value defaults to the value of the <TT>overwrite</TT> directive. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>path</TT> </TD>
+<TD class="confluenceTd"> <TT>path:=<EM>/target/location</EM></TT> </TD>
+<TD class="confluenceTd"> <TT>/</TT> </TD>
+<TD class="confluenceTd"> The path directive specifies the target node where initial content will be loaded. If the path does not exist yet in the repository, it is created by the content loader. The intermediate nodes are of type <TT>nt:folder</TT>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>checkin</TT> </TD>
+<TD class="confluenceTd"> <TT>checkin:=(true&#124;false)</TT> </TD>
+<TD class="confluenceTd"> <TT>false</TT> </TD>
+<TD class="confluenceTd"> The checkin directive specifies whether versionable nodes should be checked in. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>ignoreImportProviders</TT> </TD>
+<TD class="confluenceTd"> <TT>ignoreImportProviders:=list of extensions</TT> </TD>
+<TD class="confluenceTd"> <TT>empty</TT> </TD>
+<TD class="confluenceTd"> This directive can be used to not run one of the configured extractors (see below). </TD>
+</TR>
+</TBODY></TABLE>
+<P>Examples of these directives uses could be (assumes a Sling-Initial-Content header entry of SLING-INF/content):</P>
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Entry </TH>
+<TH class="confluenceTh"> Behaviour </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home;overwrite:=true;uninstall:=true</TT> </TD>
+<TD class="confluenceTd"> Overwrites already existing content in <EM>/home</EM> and uninstalls the content when the bundle is unregistered. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home;path:=/sites/sling_website</TT> </TD>
+<TD class="confluenceTd"> if <EM>/sites/sling_website</EM> exists it loads the content into it. Otherwise, it loads the content into root node <EM>/</EM>. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>SLING-INF/content/home;checkin:=true</TT> </TD>
+<TD class="confluenceTd"> After content loading, versionable nodes are checked in. </TD>
+</TR>
+</TBODY></TABLE>
+
+<H2><A name="ContentLoadingandNodetypeSupport-Loadinginitialcontentfrombundles"></A>Loading initial content from bundles</H2>
+
+<P>Repository items to be loaded into the repository, when the bundle is first installed, may be defined in four ways:</P>
+<OL>
+	<LI>Directories</LI>
+	<LI>Files</LI>
+	<LI>XML descriptor files</LI>
+	<LI>JSON descriptor files</LI>
+</OL>
+
+
+<P>Depending on the bundle entry found in the location indicated by the Sling-Initial-Content bundle manifest header, nodes are created (and/or updated) as follows:</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport-Directories"></A>Directories</H3>
+
+<P>Unless a node with the name of the directory already exists or has been defined in an XML or JSON descriptor file (see below) a directory is created as a node with the primary node type &quot;nt:folder&quot; in the repository.</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport-Files"></A>Files</H3>
+
+<P>Unless a node with the name of the file already exists or has been defined in an XML or JSON descriptor file (see below) a file is created as two nodes in the repository. The node bearing the name of the file itself is created with the<BR>
+primary node type &quot;nt:file&quot;. Underneath this file node, a resource node with the primary node type &quot;nt:resource&quot; is created, which is set to the contents of the file.</P>
+
+<P>The MIME type is derived from the file name extension by first trying to resolve it from the Bundle entry URL. If this does not resolve to a MIME type, the Sling MIME type resolution service is used to try to find a mime type. If all fals, the MIME type is defaulted to &quot;application/octet-stream&quot;.&nbsp;&nbsp;</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport-XMLDescriptorFiles"></A>XML Descriptor Files</H3>
+
+<P>Nodes, Properties and in fact complete subtrees may be described in XML files using either the JCR SystemView format, or the format described below. In either case, the file must have the .xml extension.</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;node&gt;</SPAN>
+		&lt;!--
+			optional on top level, defaults to XML file name without .xml extension
+	       	required for child nodes
+		--&gt;
+		<SPAN class="code-tag">&lt;name&gt;</SPAN>xyz<SPAN class="code-tag">&lt;/name&gt;</SPAN>
+
+		&lt;!--
+	   		optional, defaults to nt:unstructured
+		--&gt;
+		<SPAN class="code-tag">&lt;primaryNodeType&gt;</SPAN>nt:file<SPAN class="code-tag">&lt;/primaryNodeType&gt;</SPAN>
+
+		&lt;!--
+		    optional mixin node type
+		    may be repeated for multiple mixin node types
+		--&gt;
+		<SPAN class="code-tag">&lt;mixinNodeType&gt;</SPAN>mix:versionable<SPAN class="code-tag">&lt;/mixinNodeType&gt;</SPAN>
+		<SPAN class="code-tag">&lt;mixinNodeType&gt;</SPAN>mix:lockable<SPAN class="code-tag">&lt;/mixinNodeType&gt;</SPAN>
+
+		&lt;!--
+			Optional properties for the node. Each <SPAN class="code-tag">&lt;property&gt;</SPAN> element defines
+			a single property of the node. The element may be repeated.
+		--&gt;
+		<SPAN class="code-tag">&lt;property&gt;</SPAN>
+			&lt;!--
+				required property name
+			--&gt;
+			<SPAN class="code-tag">&lt;name&gt;</SPAN>prop<SPAN class="code-tag">&lt;/name&gt;</SPAN>
+
+			&lt;!--
+				value of the property.
+				For multi-value properties, the values are defined by multiple
+				<SPAN class="code-tag">&lt;value&gt;</SPAN> elements nested inside a <SPAN class="code-tag">&lt;values&gt;</SPAN> element instead of a
+				single <SPAN class="code-tag">&lt;value&gt;</SPAN> element
+			--&gt;
+			<SPAN class="code-tag">&lt;value&gt;</SPAN>property value as string<SPAN class="code-tag">&lt;/value&gt;</SPAN>
+
+			&lt;!--
+				Optional type of the property value, defaults to String.
+				This must be one of the property type strings defined in the
+				JCR PropertyType interface.
+			<SPAN class="code-tag">&lt;type&gt;</SPAN>String<SPAN class="code-tag">&lt;/type&gt;</SPAN>
+		<SPAN class="code-tag">&lt;/property&gt;</SPAN>
+
+		&lt;!--
+			Additional child nodes. May be further nested.
+		--&gt;
+		<SPAN class="code-tag">&lt;node&gt;</SPAN>
+		....
+		<SPAN class="code-tag">&lt;/node&gt;</SPAN>
+	<SPAN class="code-tag">&lt;/node&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<H4><A name="ContentLoadingandNodetypeSupport-UsingacustomXMLformat"></A>Using a custom XML format</H4>
+<P>By writing an XSLT stylesheet file, you can use whatever XML format you prefer. The XML file references an XSLT stylesheet by using the xml-stylesheet processing instruction: </P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN> encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+<SPAN class="code-tag">&lt;?xml-stylesheet href=<SPAN class="code-quote">&quot;my-transform.xsl&quot;</SPAN> type=<SPAN class="code-quote">&quot;text/xsl&quot;</SPAN>?&gt;</SPAN> <SPAN class="code-tag"><SPAN class="code-comment">&lt;!-- The path to my-transform.xsl is relative to this file --&gt;</SPAN></SPAN>
+
+<SPAN class="code-tag">&lt;your_custom_root_node&gt;</SPAN>
+   <SPAN class="code-tag">&lt;your_custom_element&gt;</SPAN>
+   ...
+   <SPAN class="code-tag">&lt;/your_custom_element&gt;</SPAN>
+...
+<SPAN class="code-tag">&lt;/your_custom_root_node&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<P>The my-transform.xsl file is then responsible for translating your format into one of the supported XML formats:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-xml">&lt;<SPAN class="code-keyword">xsl:stylesheet</SPAN> version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:jcr</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:mix</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/mix/1.0&quot;</SPAN> 
+  <SPAN class="code-keyword">xmlns:sv</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/sv/1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:sling</SPAN>=<SPAN class="code-quote">&quot;http://sling.apache.org/jcr/sling/1.0&quot;</SPAN>
+  <SPAN class="code-keyword">xmlns:rep</SPAN>=<SPAN class="code-quote">&quot;internal&quot;</SPAN> <SPAN class="code-keyword">xmlns:nt</SPAN>=<SPAN class="code-quote">&quot;http://www.jcp.org/jcr/nt/1.0&quot;</SPAN> <SPAN class="code-keyword">xmlns:xsl</SPAN>=<SPAN class="code-quote">&quot;http://www.w3.org/1999/XSL/Transform&quot;</SPAN>&gt;
+
+  <SPAN class="code-tag">&lt;<SPAN class="code-keyword">xsl:template</SPAN> match=<SPAN class="code-quote">&quot;your_custom_element&quot;</SPAN>&gt;</SPAN>
+    <SPAN class="code-tag">&lt;node&gt;</SPAN>
+      ...
+    <SPAN class="code-tag">&lt;/node&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:template</SPAN>&gt;</SPAN>
+  ...
+<SPAN class="code-tag">&lt;/<SPAN class="code-keyword">xsl:stylesheet</SPAN>&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<H3><A name="ContentLoadingandNodetypeSupport-JSONDescriptorFiles"></A>JSON Descriptor Files</H3>
+
+<P>Nodes, Properties and in fact complete subtrees may be described in JSON files using the following skeleton structure (see <SPAN class="nobr"><A href="http://www.json.org/" title="Visit page outside Confluence" rel="nofollow">http://www.json.org<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> or information on the syntax of JSON) :</P>
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">{
+		<SPAN class="code-comment">// optional node name on top level, <SPAN class="code-keyword">default</SPAN> is file name without .json ext.
+</SPAN>		<SPAN class="code-quote">&quot;name&quot;</SPAN>: <SPAN class="code-quote">&quot;nodename&quot;</SPAN>,
+
+		<SPAN class="code-comment">// optional primary node type, <SPAN class="code-keyword">default</SPAN> <SPAN class="code-quote">&quot;nt:unstructured&quot;</SPAN>
+</SPAN>		<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:ScriptedComponent&quot;</SPAN>,
+
+		<SPAN class="code-comment">// optional mixin node types as array
+</SPAN>		<SPAN class="code-quote">&quot;mixinNodeTypes&quot;</SPAN>: [ ],
+
+	    <SPAN class="code-comment">// the <SPAN class="code-quote">&quot;properties&quot;</SPAN> property is an object indexed by property name whose
+</SPAN>	    <SPAN class="code-comment">// value is either the string property value, array <SPAN class="code-keyword">for</SPAN> multi-values or
+</SPAN>	    <SPAN class="code-comment">// an object whose value[s] property denotes the property value(s) and
+</SPAN>	    <SPAN class="code-comment">// whose type property denotes the property type
+</SPAN>	    <SPAN class="code-quote">&quot;properties&quot;</SPAN>: {
+	    	<SPAN class="code-quote">&quot;sling:contentClass&quot;</SPAN>: <SPAN class="code-quote">&quot;com.day.sling.jcr.test.Test&quot;</SPAN>,
+	    	<SPAN class="code-quote">&quot;sampleMulti&quot;</SPAN>: [ <SPAN class="code-quote">&quot;v1&quot;</SPAN>, <SPAN class="code-quote">&quot;v2&quot;</SPAN> ],
+	    	<SPAN class="code-quote">&quot;sampleStruct&quot;</SPAN>: {
+	    		<SPAN class="code-quote">&quot;value&quot;</SPAN>: 1,
+	    		<SPAN class="code-quote">&quot;type&quot;</SPAN>: <SPAN class="code-quote">&quot;<SPAN class="code-object">Long</SPAN>&quot;</SPAN>
+	    	}
+	    	<SPAN class="code-quote">&quot;sampleStructMulti&quot;</SPAN>: {
+	    		<SPAN class="code-quote">&quot;value&quot;</SPAN>: [ 1, 2, 3 ],
+	    		<SPAN class="code-quote">&quot;type&quot;</SPAN>: <SPAN class="code-quote">&quot;<SPAN class="code-object">Long</SPAN>&quot;</SPAN>
+	    	}
+	    },
+
+	    <SPAN class="code-comment">// the <SPAN class="code-quote">&quot;nodes&quot;</SPAN> property is an array of objects denoting child nodes. Nodes
+</SPAN>	    <SPAN class="code-comment">// may be further nested.
+</SPAN>		<SPAN class="code-quote">&quot;nodes&quot;</SPAN>: [
+			{
+				<SPAN class="code-comment">// the name property is required on (nested) child nodes
+</SPAN>	            <SPAN class="code-quote">&quot;name&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:scripts&quot;</SPAN>,
+
+				<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:ScriptList&quot;</SPAN>,
+
+				<SPAN class="code-quote">&quot;nodes&quot;</SPAN>: [
+					{
+						<SPAN class="code-quote">&quot;primaryNodeType&quot;</SPAN>: <SPAN class="code-quote">&quot;sling:Script&quot;</SPAN>,
+						<SPAN class="code-quote">&quot;properties&quot;</SPAN>: {
+							<SPAN class="code-quote">&quot;sling:name&quot;</SPAN>: <SPAN class="code-quote">&quot;/test/content/jsp/start.jsp&quot;</SPAN>,
+							<SPAN class="code-quote">&quot;sling:type&quot;</SPAN>: <SPAN class="code-quote">&quot;jsp&quot;</SPAN>,
+							<SPAN class="code-quote">&quot;sling:glob&quot;</SPAN>: <SPAN class="code-quote">&quot;*&quot;</SPAN>
+						}
+					}
+				]
+			}
+		]
+	}</PRE>
+</DIV></DIV>
+
+<H3><A name="ContentLoadingandNodetypeSupport-Extractors"></A>Extractors</H3>
+
+<P>By default, the <TT>sling-jcr-contentloader</TT> bundle tries to extract certain file types during content loading. These include <TT>json</TT>, <TT>xml</TT>, <TT>zip</TT>, and <TT>jar</TT> files. Therefore all available extractors are used for content processing. However if some files should be put into the repository unextracted, the <TT>ignoreImportProviders</TT> directive can be used with a comma separated list of extensions that should not be extracted, like <TT>ignoreImportProviders:=jar,zip</TT>.</P>
+
+<H2><A name="ContentLoadingandNodetypeSupport-DeclaredNodeTypeRegistration"></A>Declared Node Type Registration</H2>
+
+<P>The <TT>sling-jcr-base</TT> bundle provides low-level repository operations which are at the heart of the functionality of Sling:</P>
+<UL>
+	<LI><B>Node Type Definitions</B> &#45; The class <TT>org.apache.sling.content.jcr.base.NodeTypeLoader</TT> provides methods to register custom node types with a repository given a repository session and a node type definition file in CND format. This class is also used by this bundle to register node types on behalf of other bundles.</LI>
+</UL>
+
+
+<P>Bundles may list node type definition files in CND format in the <TT>Sling-Nodetypes</TT> bundle header. This header is a comma-separated list of resources in the respective bundle. Each resource is taken and fed to the <TT>NodeTypeLoader</TT> to define the node types.</P>
+
+<P>After a bundle has entered the <EM>resolved</EM> state, the node types listed in the <TT>Sling-Nodetypes</TT> bundle header are registered with the repository.</P>
+
+<P>Node types installed by this mechanism will never be removed again by the <TT>sling-jcr-base</TT> bundle. Likewise, registered node types cannot currently be modified using this feature. The <TT>NodeTypeLoader</TT> will try to load nodes defined and fail with a log message if a node type has already been defined. To update existing node type definitions, native repository functionality has to be used.</P>
+
+<P>Nodetype management is currently a problematic issue, as the only API available is contained in the Jackrabbit Core library, which is generally not available to client applications - unless running in the same VM and class loader hierarchy as the Repository. Version 2 of the JCR Specification currently being developped as JSR-283 should fix this issue by providing an official node type management API. Until then, this approach is about the only solution we have.</P>
+
+<H3><A name="ContentLoadingandNodetypeSupport-Automatedtests"></A>Automated tests</H3>
+
+<P>The initial content found in the <SPAN class="nobr"><A href="http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/content/src/main/resources/content/sling-test" title="Visit page outside Confluence" rel="nofollow">sling-test folder of the launchpad initial content<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> is verified by the <SPAN class="nobr"><A href="http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/InitialContentTest.java" title="Visit page outside Confluence" rel="nofollow">InitialContentTest<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> when running the <EM>launchpad/testing</EM> integration tests.</P>
+
+<P>Those tests can be used as verified examples of initial content loading. Contributions are welcome to improve the coverage of those tests.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by mykee on Wed May 27 13:49:11 PDT 2009
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+



Mime
View raw message