Author: bdelacretaz Date: Thu Aug 18 12:07:39 2016 New Revision: 1756765 URL: http://svn.apache.org/viewvc?rev=1756765&view=rev Log: SLING-5969 - update repoinit docs
Modified: sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext Modified: sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext?rev=1756765&r1=1756764&r2=1756765&view=diff ============================================================================== --- sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext (original) +++ sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext Thu Aug 18 12:07:39 2016 @@ -83,23 +83,50 @@ The language is self-explaining but plea create service user the-last-one -## Embedding repoinit statements in the Sling provisioning model +## Providing repoinit statements from the Sling provisioning model or other URLs -The `slingstart-maven-plugin`, from V1.4.2 on, allows for embedding "special" sections in the Sling provisioning model by starting +This requires the `org.apache.sling.provisioning.model` bundle, version 1.4.2 or later. + +All bundles required for this feature need to be active before the `SlingRepository` service starts. + +From version 1.0.2 of the `org.apache.sling.jcr.repoinit` bundle, the `o.a.s.jcr.repoinit.RepositoryInitializer` component uses an OSGi +configuration as shown in this example to define where to read repoinit statements: + + org.apache.sling.jcr.repoinit.impl.RepositoryInitializer + references=["model:context:/resources/provisioning/model.txt","model@repoinitTwo:context:/resources/provisioning/model.txt"] + +This example defines two _references_ to URLs that supply repoinit statements. Their syntax is described below. + +By default the `RepositoryInitializer` uses the first URL shown in the above example, which points to the provisioning model that's embedded by default in the Sling Launchpad runnable jar. + +Note that previous versions of the `org.apache.sling.jcr.repoinit` bundle used different configuration parameters. From version 1.0.2 on, warnings are logged if those old parameters (_text.url,text.format,model.section.name_) are used. + +### References to Sling Provisioning Model additional sections +The `slingstart-maven-plugin`, from V1.4.2 on, allows for embedding so-called "additional sections" in the Sling provisioning model by starting their name with a colon. -The `o.a.s.jcr.repoinit` bundle uses this feature to execute `repoinit` statements provided by Sling provisioning models, as in this -example: +The `o.a.s.jcr.repoinit` bundle can use this feature to execute `repoinit` statements provided by Sling provisioning models, as in this +provisioning model example fragment: [:repoinit] create path /repoinit/provisioningModelTest create service user provisioningModelUser -The `org.apache.sling.repoinit.jcr.RepositoryInitializer` component reads the provisioning model text using a configurable URL, which defaults to `context:/resources/provisioning/model.txt`, to get the model that our `maven-slingstart-plugin` embeds in the Sling launchpad, the `context:` protocol being handled by the launchpad's `ContextProtocolHandler` by default. +To read repoinit statements from such an additional provisioning model section, the `RepositoryInitializer` configuration shown above uses references like + + model@repoinitTwo:context:/resources/provisioning/model.txt + +Where _model_ means "use the provisioning model format", _repoinitTwo_ is the name of the additional section to read statements from in the provisioning +model (without the leading colon) and _context:/resources/..._ is the URL to use to retrieve the provisioning model. -Configuring a different URL and if needed creating a protocol handler will allow other launchers to provide the provisioning model, or directly provide repoinit statements. See that component's OSGi config descriptions for details. +The section name in that reference is optional and defaults to _repoinit_. If it's not specified the `@` should be omitted as well. + +### References to URLs providing raw repoinit statements +Configuring `RepositoryInitializer` like in this example, with the _raw_ prefix, means that its content is passed as is to the repoinit parser: -This also requires the `org.apache.sling.provisioning.model` bundle, version 1.4.2 or later. + raw:classpath://some-repoinit-file.txt + +Which points to a `classpath:` URL to provide the raw repoinit statements. -All bundles required for this feature need to be active before the `SlingRepository` service starts. +