Author: radu
Date: Fri Apr 15 15:19:01 2016
New Revision: 1739317

URL: http://svn.apache.org/viewvc?rev=1739317&view=rev
Log:
CMS commit to sling by radu

Added:
    
sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext
   (with props)

Added: 
sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext
URL: 
http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext?rev=1739317&view=auto
==============================================================================
--- 
sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext
 (added)
+++ 
sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext
 Fri Apr 15 15:19:01 2016
@@ -0,0 +1,80 @@
+Title: Sightly Scripting Engine
+Notice:    Licensed to the Apache Software Foundation (ASF) under one
+           or more contributor license agreements.  See the NOTICE file
+           distributed with this work for additional information
+           regarding copyright ownership.  The ASF licenses this file
+           to you under the Apache License, Version 2.0 (the
+           "License"); you may not use this file except in compliance
+           with the License.  You may obtain a copy of the License at
+           .
+             http://www.apache.org/licenses/LICENSE-2.0
+           .
+           Unless required by applicable law or agreed to in writing,
+           software distributed under the License is distributed on an
+           "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+           KIND, either express or implied.  See the License for the
+           specific language governing permissions and limitations
+           under the License.
+
+The Apache Sling Sightly Scripting Engine is the Java reference implementation 
of the [Sightly HTML Templating 
Language](https://github.com/Adobe-Marketing-Cloud/sightly-spec), passing all 
the tests defined by the [Sightly Technology Compatibility 
Kit](https://github.com/Adobe-Marketing-Cloud/sightly-tck).
+
+[TOC]
+
+# Modules
+
+The Sling implementation is comprised of the following modules:
+
+1. 
[`org.apache.sling.scripting.sightly`](https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/engine)
 - the core Sightly Scripting Engine bundle
+2. 
[`org.apache.sling.scripting.sightly.js.provider`](https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/js-use-provider)
 - the Sightly JavaScript Use Provider, implementing support for the `use` 
JavaScript function
+3. 
[`org.apache.sling.scripting.sightly.models.provider`](https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/models-use-provider)
 - [Sling Models](https://sling.apache.org/documentation/bundles/models.html) 
Use Provider
+4. 
[`org.apache.sling.scripting.sightly.repl`](https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/repl)
 - Sightly Read-Eval-Print Loop Environment (REPL)
+
+# The Use-API
+
+The [Sightly HTML Templating Language 
Specification](https://github.com/Adobe-Marketing-Cloud/sightly-spec/blob/1.2/SPECIFICATION.md#4-use-api)
 explicitly defines two ways of implementing support for business logic objects:
+
+1. Java Use-API, through POJOs, that may optionally implement an `init` method:
+
+        /**
+         * Initialises the Use bean.
+         *
+         * @param bindings All bindings available to the Sightly scripts.
+         **/ 
+        public void init(javax.script.Bindings bindings);
+
+
+2. JavaScript Use-API, by using a standardised use function
+
+        /**
+         * In the following example '/libs/dep1.js' and 'dep2.js' are optional
+         * dependencies needed for this script's execution. Dependencies can
+         * be specified using an absolute path or a relative path to this
+         * script's own path.
+         *
+         * If no dependencies are needed the dependencies array can be omitted.
+         */
+        use(['dep1.js', 'dep2.js'], function (Dep1, Dep2) {
+            // implement processing
+        
+            // define this Use object's behaviour
+            return {
+                propertyName: propertyValue
+                functionName: function () {}
+            }
+        });
+        
+The Sightly implementation from Sling provides the basic POJO support through 
the 
[`org.apache.sling.scripting.sightly.pojo.Use`](https://github.com/apache/sling/blob/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/pojo/Use.java)
 interface and the 
[`org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider`](https://github.com/apache/sling/blob/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/JavaUseProvider.java),
 whereas the `use` function is implemented by the 
`org.apache.sling.scripting.sightly.js.provider` bundle.
+
+However, the Sling implementation provides a few extensions to the Use-API.
+
+## Sling-specific Use-API Extensions
+
+A full Sightly installation provides the following Use Providers, in the order 
of their priority:
+
+| Use Provider  | Bundle    | Service Ranking   | Functionality     
|Observations|
+|-------------- |--------   |-----------------  |---------------    
|----------- |
+|`org.apache.sling.scripting.sightly.impl.engine.extension.use.RenderUnitProvider`|`org.apache.sling.scripting.sightly`|100|support
 for loading Sightly templates through `data-sly-use`||
+|`org.apache.sling.scripting.sightly.models.impl.SlingModelsUseProvider`|`org.apache.sling.scripting.sightly.models.provider`|95|support
 for loading Sling Models||
+|`org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider`|`org.apache.sling.scripting.sightly`|90|support
 for loading Java objects such as: <ol><li>OSGi services</li><li>POJOs 
adaptable from `SlingHttpServletRequest` or `Resource`</li><li>POJOs that 
implement `Use`</li></ol>||
+|`org.apache.sling.scripting.sightly.js.impl.JsUseProvider`|`org.apache.sling.scripting.sightly.js.provider`|80|support
 for loading objects defined in JavaScript||
+|`org.apache.sling.scripting.sightly.impl.engine.extension.use.ScriptUseProvider`|`org.apache.sling.scripting.sightly`|0|support
 for loading objects returned by scripts interpreted by other Script Engines 
available on the platform||

Propchange: 
sling/site/trunk/content/documentation/bundles/scripting/scripting-sightly.mdtext
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to