sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1749652 - in /sling/site/trunk/content/documentation: bundles.mdtext bundles/repository-initialization.mdtext
Date Wed, 22 Jun 2016 10:56:46 GMT
Author: bdelacretaz
Date: Wed Jun 22 10:56:46 2016
New Revision: 1749652

URL: http://svn.apache.org/viewvc?rev=1749652&view=rev
Log:
Initial repository initialization docs

Added:
    sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext
Modified:
    sling/site/trunk/content/documentation/bundles.mdtext

Modified: sling/site/trunk/content/documentation/bundles.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles.mdtext?rev=1749652&r1=1749651&r2=1749652&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/bundles.mdtext (original)
+++ sling/site/trunk/content/documentation/bundles.mdtext Wed Jun 22 10:56:46 2016
@@ -7,6 +7,7 @@ Title: Bundles
 * [Manipulating Content - The SlingPostServlet (servlets.post)]({{ refs.manipulating-content-the-slingpostservlet-servlets-post.path
}})
 * [Rendering Content - Default GET servlets (servlets.get)]({{ refs.rendering-content-default-get-servlets.path
}})
 * [Validation]({{ refs.validation.path }})
+* [Repository Initialization]({{ refs.repository-initialization.path }})
 
 ## Resource Providers
 

Added: 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=1749652&view=auto
==============================================================================
--- sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext (added)
+++ sling/site/trunk/content/documentation/bundles/repository-initialization.mdtext Wed Jun
22 10:56:46 2016
@@ -0,0 +1,62 @@
+Title: Repository Initializers and Repository Initialization Language
+
+The `SlingRepositoryInitializer` mechanism allows for running code before the `SlingRepository`
service is registered.
+
+This is useful for initialization and content migration purposes.
+
+Please be aware of potential clustering and coordination issues when using this mechanism,
if your environment lets several Sling instances access
+the same content repository you'll need to implement a synchronization mechanism for such
operations.
+
+## SlingRepositoryInitializer
+The `SlingRepositoryInitializer` is a very simple service interface, available from version
2.4.0 of the `org.apache.sling.jcr.api` and `org.apache.sling.jcr.base` bundles.
+
+	public interface SlingRepositoryInitializer {
+	    public void processRepository(SlingRepository repo) throws Exception;
+	}
+	
+Services that implement this interface are called when setting up the JCR-based `SlingRepository`
service, before registering it as an OSGi service.
+
+They are called in increasing order of their `service.ranking` service property, which needs
to be an `Integer` as usual.
+    
+## 'repoinit' Repository Initialization Language
+The `org.apache.sling.repoinit.parser` implements a mini-language meant to create paths,
service users and Access Control Lists in a content repository.
+
+The language grammar is defined (using JavaCC which has no runtime dependencies) in the `RepoInitGrammar.jjt`
file in that module, and the automated tests provide a number of [test cases](https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/repoinit/parser/src/test/resources/testcases)
which demonstrate various features.
+
+The companion `org.apache.sling.repoinit.oak-jcr` module implements those operations on an
Oak JCR repository, using a `SlingRepositoryInitializer`
+registered by default with a service ranking of 100.
+
+Here's a current (as of V1.0.0 of the parser module) complete example from the test cases
mentioned above. The language is self-explaining but please refer to the actual test cases
for details that are guaranteed to be up to date, assuming the tests pass.
+
+    create service user user1, u-ser_2
+    set ACL on /libs,/apps
+        remove * for user1,u-ser_2
+        allow jcr:read for user1,u-ser_2
+
+        deny jcr:write for u-ser_2
+        deny jcr:lockManagement for user1
+        remove jcr:understand,some:other for u3
+    end
+
+    create service user bob_the_service
+
+    set ACL on /tmp
+        allow some:otherPrivilege for bob_the_service
+    end
+
+    create path /content/example.com(sling:Folder)
+    create path (nt:unstructured) /var
+
+    set ACL for alice, bob,fred
+	    # remove is currently not supported by the oak-jcr module
+        remove * on / 
+        allow jcr:read on /content,/var
+        deny jcr:write on /content/example.com
+        deny jcr:all on / nodetypes example:Page
+    end
+
+    create service user the-last-one
+
+## Embedding repoinit statements in the Sling provisioning model
+
+TODO: explain this
\ No newline at end of file



Mime
View raw message