incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r581591 - in /incubator/sling/trunk/sample: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/java/org/apache/sling/sample/ src/main/resources/ src/main/resources/META-INF...
Date Wed, 03 Oct 2007 13:18:00 GMT
Author: fmeschbe
Date: Wed Oct  3 06:17:58 2007
New Revision: 581591

URL: http://svn.apache.org/viewvc?rev=581591&view=rev
Log:
Add samples for Sling

Added:
    incubator/sling/trunk/sample/   (with props)
    incubator/sling/trunk/sample/pom.xml   (with props)
    incubator/sling/trunk/sample/src/
    incubator/sling/trunk/sample/src/main/
    incubator/sling/trunk/sample/src/main/java/
    incubator/sling/trunk/sample/src/main/java/org/
    incubator/sling/trunk/sample/src/main/java/org/apache/
    incubator/sling/trunk/sample/src/main/java/org/apache/sling/
    incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/
    incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/Navigation.java   (with props)
    incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SampleContent.java   (with props)
    incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SamplePage.java   (with props)
    incubator/sling/trunk/sample/src/main/resources/
    incubator/sling/trunk/sample/src/main/resources/META-INF/
    incubator/sling/trunk/sample/src/main/resources/META-INF/LICENSE
    incubator/sling/trunk/sample/src/main/resources/META-INF/NOTICE
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample.xml   (with props)
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content.json
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/jsp/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/jsp/start.jsp   (with props)
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page.json
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/jsp/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/jsp/start.jsp   (with props)
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/content/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/content/home.json
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/sample_readme.txt   (with props)
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/nodetypes/
    incubator/sling/trunk/sample/src/main/resources/SLING-INF/nodetypes/test.cnd
    incubator/sling/trunk/sample/src/main/scripts/
    incubator/sling/trunk/sample/src/main/scripts/org/
    incubator/sling/trunk/sample/src/main/scripts/org/apache/
    incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/
    incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/
    incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/jsp/
    incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/jsp/component.jsp   (with props)

Propchange: incubator/sling/trunk/sample/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Oct  3 06:17:58 2007
@@ -0,0 +1,3 @@
+.project
+.classpath
+target

Added: incubator/sling/trunk/sample/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/pom.xml?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/pom.xml (added)
+++ incubator/sling/trunk/sample/pom.xml Wed Oct  3 06:17:58 2007
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>1-incubator-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>sling-sample</artifactId>
+    <version>2.0.0-incubator-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Sling - Sample Sling Application</name>
+    <description>
+        This bundle provides a simple Sling Application to show some of the
+        features and functionalities of Sling, such as node type definition,
+        content mapping, running JSPs off the repository and the bundle.
+    </description>
+
+    <build>
+        <plugins>
+            <!-- Handle the @ocm JavaDoc tags to generate the mapping descriptors -->
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-jcrocm-plugin</artifactId>
+            </plugin>
+            <!-- Compile JSP scripts into the bundle -->
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-jspc-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>compile-jsp</id>
+                        <goals>
+                            <goal>jspc</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- Installation and Deployment support -->
+            <plugin>
+                <groupId>org.apache.sling</groupId>
+                <artifactId>maven-sling-plugin</artifactId>
+            </plugin>
+            <!-- Generation of SCR descriptors -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <!-- Bundling the sample project -->
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <!-- we have to export for the classes to be visible -->
+                        <Export-Package>
+                            org.apache.sling.sample
+                        </Export-Package>
+                        
+                        <!-- node types to be created -->
+                        <Sling-Nodetypes>
+                            SLING-INF/nodetypes/test.cnd
+                        </Sling-Nodetypes>
+                        
+                        <!-- initial content to be loaded on bundle installation -->
+                        <Sling-Initial-Content>
+                            SLING-INF/content
+                        </Sling-Initial-Content>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>sling-component-api</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>sling-content-jcr</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>sling-core</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>sling-scripting-core</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>sling-scripting-jsp-taglib</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi_R4_core</artifactId>
+        </dependency>
+    </dependencies>
+</project>

Propchange: incubator/sling/trunk/sample/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/Navigation.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/Navigation.java?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/Navigation.java (added)
+++ incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/Navigation.java Wed Oct  3 06:17:58 2007
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+package org.apache.sling.sample;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+
+import org.apache.sling.component.ComponentException;
+import org.apache.sling.component.ComponentRequest;
+import org.apache.sling.component.ComponentResponse;
+import org.apache.sling.component.Content;
+import org.apache.sling.core.Constants;
+import org.apache.sling.core.components.BaseComponent;
+
+/**
+ * The <code>Navigation</code> class is a very simple navigation component
+ * which just draws a (nested) list of child "pages". A child content is
+ * considered a "page" if the Content object is an instance of the
+ * {@link SamplePage} class.
+ *
+ * @scr.component immediate="true" metatype="false"
+ * @scr.property name="service.description" value="Sample Navigation Component"
+ * @scr.property name="service.vendor" value="The Apache Software Foundation"
+ * @scr.service interface="org.apache.sling.component.Component"
+ */
+public class Navigation extends BaseComponent {
+
+    @Override
+    protected void doInit() {
+        // nothing to do
+    }
+
+    public void service(ComponentRequest request, ComponentResponse response)
+            throws ComponentException, IOException {
+
+        // start the navigation at the location of the current content
+        listChildren(request, response, request.getContent());
+
+    }
+
+    private void listChildren(ComponentRequest request,
+            ComponentResponse response, Content current)
+            throws ComponentException, IOException {
+
+        // / the children of the current content, terminate if there are none
+        Enumeration<Content> children = request.getChildren(current);
+        if (!children.hasMoreElements()) {
+            return;
+        }
+
+        // to not draw the link to the content of the current page, we
+        // retrieve the path of the page level content
+        Content requestContent = (Content) request.getAttribute(Constants.ATTR_REQUEST_CONTENT);
+        String requestPath = requestContent.getPath();
+
+        PrintWriter pw = response.getWriter();
+        pw.println("<ul>");
+
+        while (children.hasMoreElements()) {
+            Content child = children.nextElement();
+
+            // if the child is a page, add an entry with optional link and
+            // recursively call this method to draw the children of the child
+            if (child instanceof SamplePage) {
+                String title = ((SamplePage) child).getTitle();
+                pw.print("<li>");
+
+                if (child.getPath().equals(requestPath)) {
+                    pw.print(title);
+                } else {
+                    pw.print("<a href=\"" + child.getPath() + ".html\">");
+                    pw.print(title);
+                    pw.print("</a>");
+                }
+                pw.println("</li>");
+
+                // children of the current page, too
+                listChildren(request, response, child);
+            }
+        }
+
+        pw.println("</ul>");
+    }
+}

Propchange: incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/Navigation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SampleContent.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SampleContent.java?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SampleContent.java (added)
+++ incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SampleContent.java Wed Oct  3 06:17:58 2007
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+package org.apache.sling.sample;
+
+import org.apache.sling.content.jcr.BaseContent;
+
+/**
+ * The <code>SampleContent</code> class defines sample content for this bundle.
+ * This content object is based on the "sling:SampleContent" node type.
+ *
+ * @ocm.mapped jcrType="sling:SampleContent"
+ */
+public class SampleContent extends BaseContent {
+
+    /** @ocm.field */
+    private String title;
+
+    /** @ocm.field */
+    private String text;
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public String getText() {
+        return text;
+    }
+}

Propchange: incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SampleContent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SamplePage.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SamplePage.java?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SamplePage.java (added)
+++ incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SamplePage.java Wed Oct  3 06:17:58 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package org.apache.sling.sample;
+
+import org.apache.sling.content.jcr.BaseContent;
+
+/**
+ * The <code>SamplePage</code> is a page level sample content object
+ *
+ * @ocm.mapped jcrType="sling:SamplePage"
+ */
+public class SamplePage extends BaseContent {
+
+    /** @ocm.field */
+    private String title;
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+}

Propchange: incubator/sling/trunk/sample/src/main/java/org/apache/sling/sample/SamplePage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/META-INF/LICENSE?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/META-INF/LICENSE (added)
+++ incubator/sling/trunk/sample/src/main/resources/META-INF/LICENSE Wed Oct  3 06:17:58 2007
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.

Added: incubator/sling/trunk/sample/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/META-INF/NOTICE?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/META-INF/NOTICE (added)
+++ incubator/sling/trunk/sample/src/main/resources/META-INF/NOTICE Wed Oct  3 06:17:58 2007
@@ -0,0 +1,5 @@
+Apache Sling Sample
+Copyright 2007 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample.xml?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample.xml (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample.xml Wed Oct  3 06:17:58 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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 samples are located under the nt:unstructured "sample" node
+    
+    Defining the node in this sample.xml file overwrites the default node
+    type nt:folder which would have been used for the sample directory if
+    this file would not be available. See the node /sample/page/jsp for
+    example, which has no definition in any XML or JSON file and thus is
+    created as an nt:folder node.
+-->
+<node>
+    <primaryNodeType>nt:unstructured</primaryNodeType>
+    
+    <!-- the children components and content must also be nt:unstructured -->
+    <node>
+        <name>components</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+    </node>
+    <node>
+        <name>content</name>
+        <primaryNodeType>nt:unstructured</primaryNodeType>
+    </node>
+    
+</node>

Propchange: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content.json
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content.json?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content.json (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content.json Wed Oct  3 06:17:58 2007
@@ -0,0 +1,7 @@
+{
+	"primaryNodeType": "sling:ScriptedComponent",
+    
+    "properties": {
+    	"sling:contentClass": "org.apache.sling.sample.SampleContent"
+    }
+}

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/jsp/start.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/jsp/start.jsp?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/jsp/start.jsp (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/jsp/start.jsp Wed Oct  3 06:17:58 2007
@@ -0,0 +1,38 @@
+<%--
+    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.
+--%>
+<%@page session="false" %>
+<%@page import="org.apache.sling.sample.*" %>
+<%@page import="org.apache.sling.component.*" %>
+<%@page import="java.util.*" %>
+<%@taglib prefix="sling" uri="http://jackrabbit.apache.org/taglibs/sling/1.0" %>
+
+<%-- Ensure the presence of the ComponentAPI objects --%>
+<sling:defineObjects contentClass="SampleContent"/>
+
+<h1><%= content.getTitle() %></h1>
+<p><%= content.getText() %></p>
+<table border="1" cellpadding="3" cellspacing="0">
+<%
+	Enumeration ci = renderRequest.getChildren(content);
+	while (ci.hasMoreElements()) {
+		Content child = (Content) ci.nextElement();
+		%><tr><td><sling:include content="<%= child %>" /></td></tr><%
+	}
+%>
+</table>
\ No newline at end of file

Propchange: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/content/jsp/start.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page.json
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page.json?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page.json (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page.json Wed Oct  3 06:17:58 2007
@@ -0,0 +1,7 @@
+{
+	"primaryNodeType": "sling:ScriptedComponent",
+    
+    "properties": {
+    	"sling:contentClass": "org.apache.sling.sample.SamplePage"
+    }
+}

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/jsp/start.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/jsp/start.jsp?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/jsp/start.jsp (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/jsp/start.jsp Wed Oct  3 06:17:58 2007
@@ -0,0 +1,62 @@
+<%--
+    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.
+--%>
+<%@page session="false"%>
+<%@page import="org.apache.sling.sample.*"%>
+<%@page import="org.apache.sling.component.*"%>
+<%@taglib prefix="sling"
+	uri="http://jackrabbit.apache.org/taglibs/sling/1.0"%>
+
+<%-- Ensure the presence of the ComponentAPI objects --%>
+<sling:defineObjects contentClass="SamplePage" />
+
+<%-- This is a top level component, so we have to draw the html and head tags --%>
+<html>
+<head>
+<title><%= content.getTitle() %></title>
+</head>
+<body>
+<h1><%= content.getTitle() %></h1>
+
+<table style="border: none; height: 90%; ">
+	<tr valign="top">
+		<td style="padding-top: 20px; padding-right: 20px; background-color: cornsilk">
+		<%
+		final String naviRootPath = "/sample/content";
+		Content naviRoot = new Content() {
+		    public String getComponentId() {
+		        return Navigation.class.getName();
+		    }
+		    public String getPath() {
+		        return naviRootPath;
+		    }
+		};
+		%> <sling:include content="<%= naviRoot %>" />
+		</td>
+		<td>
+		<table>
+			<tr>
+				<td><sling:include path="content" /></td>
+			</tr>
+		</table>
+		</td>
+	</tr>
+</table>
+
+</body>
+</html>
\ No newline at end of file

Propchange: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/components/page/jsp/start.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/content/home.json
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/content/home.json?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/content/home.json (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/content/home.json Wed Oct  3 06:17:58 2007
@@ -0,0 +1,63 @@
+{
+	"primaryNodeType": "sling:SamplePage",
+	"properties": {
+		"sling:componentId": "/sample/components/page",
+		"title": "This is a Sample Page"
+	},
+	
+	"nodes": [
+		{
+	        "name": "content",
+			"primaryNodeType": "sling:SampleContent",
+			"properties": {
+				"sling:componentId": "/sample/components/content",
+				"title": "Welcome to the Sample Component",
+				"text": "The Sample Component is a simple component showing nested content"
+			}
+		},
+		
+		{
+	        "name": "moreinfo",
+			"primaryNodeType": "sling:SamplePage",
+			"properties": {
+				"sling:componentId": "/sample/components/page",
+				"title": "More Information"
+			},
+			
+			"nodes": [
+				{
+			        "name": "content",
+					"primaryNodeType": "sling:SampleContent",
+					"properties": {
+						"sling:componentId": "/sample/components/content",
+						"title": "Page Providing More Information",
+						"text": "This page provides more information on this tool, yet it seems empty."
+					}
+				}
+			]
+		},
+		
+		{
+	        "name": "moreinfojsp",
+			"primaryNodeType": "sling:SamplePage",
+			"properties": {
+				"sling:componentId": "/sample/components/page",
+				"title": "Bundle-JSP Page"
+			},
+			
+			"nodes": [
+				{
+			        "name": "content",
+					"primaryNodeType": "sling:SampleContent",
+					"properties": {
+						"sling:componentId": "org.apache.sling.sample.jsp.component_jsp",
+						"title": "JSP Rendered Content",
+						"text": "This Content is rendered by a JSP script embeded in the Bundle."
+					}
+				}
+			]
+		}
+		
+	]
+
+}

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/sample_readme.txt
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/sample_readme.txt?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/sample_readme.txt (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/sample_readme.txt Wed Oct  3 06:17:58 2007
@@ -0,0 +1,156 @@
+Loading initial content from bundles
+====================================
+
+
+Repository items to be loaded into the repository, when the bundle is first
+installed, may be defined in four ways:
+
+   1. Directories
+   2. Files
+   3. XML descriptor files
+   4. JSON descriptor files
+
+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:
+
+
+Directories
+-----------
+
+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 "nt:folder" in the repository.
+
+
+Files
+-----
+
+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
+primary node type "nt:file". Underneath this file node, a resource node with
+the primary node type "nt:resource" is created, which is set to the contents
+of the file.
+
+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 "application/octet-stream".
+
+
+XML Descriptor Files
+--------------------
+
+Nodes, Properties and in fact complete subtrees may be described in XML files
+using the following skeleton structure:
+
+	<node>
+		<!--
+			optional on top level, defaults to XML file name without .xml extension
+	       	required for child nodes
+		-->
+		<name>xyz</name>
+	   
+		<!--
+	   		optional, defaults to nt:unstructured
+		-->
+		<primaryNodeType>nt:file</primaryNodeType>
+		
+		<!--
+		    optional mixin node type
+		    may be repeated for multiple mixin node types
+		-->
+		<mixinNodeType>mix:versionable</mixinNodeType>
+		<mixinNodeType>mix:lockable</mixinNodeType>
+		
+		<!--
+			Optional properties for the node. Each <property> element defines
+			a single property of the node. The element may be repeated.
+		-->
+		<property>
+			<!--
+				required property name
+			-->
+			<name>prop</name>
+			
+			<!--
+				value of the property.
+				For multi-value properties, the values are defined by multiple
+				<value> elements nested inside a <values> element instead of a
+				single <value> element
+			-->
+			<value>property value as string</value>
+			
+			<!--
+				Optional type of the property value, defaults to String.
+				This must be one of the property type strings defined in the
+				JCR PropertyType interface.
+			<type>String</type>
+		</property>
+		
+		<!--
+			Additional child nodes. May be further nested.
+		-->
+		<node>
+		....
+		</node>
+	</node>
+
+
+JSON Descriptor Files
+---------------------
+
+Nodes, Properties and in fact complete subtrees may be described in JSON files
+using the following skeleton structure (see http://www.json.org for information
+on the syntax of JSON) :
+
+	{
+		// optional node name on top level, default is file name without .json ext.
+		"name": "nodename",
+		
+		// optional primary node type, default "nt:unstructured"
+		"primaryNodeType": "sling:ScriptedComponent",
+		
+		// optional mixin node types as array
+		"mixinNodeTypes": [ ],
+	    
+	    // the "properties" property is an object indexed by property name whose
+	    // value is either the string property value, array for multi-values or
+	    // an object whose value[s] property denotes the property value(s) and
+	    // whose type property denotes the property type
+	    "properties": {
+	    	"sling:contentClass": "com.day.sling.jcr.test.Test",
+	    	"sampleMulti": [ "v1", "v2" ],
+	    	"sampleStruct": {
+	    		"value": 1,
+	    		"type": "Long"
+	    	}
+	    	"sampleStructMulti": {
+	    		"value": [ 1, 2, 3 ],
+	    		"type": "Long"
+	    	}
+	    },
+	    
+	    // the "nodes" property is an array of objects denoting child nodes. Nodes
+	    // may be further nested.
+		"nodes": [
+			{
+				// the name property is required on (nested) child nodes
+	            "name": "sling:scripts",
+	            
+				"primaryNodeType": "sling:ScriptList",
+				
+				"nodes": [
+					{
+						"primaryNodeType": "sling:Script",
+						"properties": {
+							"sling:name": "/test/content/jsp/start.jsp",
+							"sling:type": "jsp",
+							"sling:glob": "*"
+						}
+					}
+				]
+			}
+		]
+	}

Propchange: incubator/sling/trunk/sample/src/main/resources/SLING-INF/content/sample/sample_readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/trunk/sample/src/main/resources/SLING-INF/nodetypes/test.cnd
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/resources/SLING-INF/nodetypes/test.cnd?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/resources/SLING-INF/nodetypes/test.cnd (added)
+++ incubator/sling/trunk/sample/src/main/resources/SLING-INF/nodetypes/test.cnd Wed Oct  3 06:17:58 2007
@@ -0,0 +1,41 @@
+//
+//  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.
+//
+
+<sling = 'http://jackrabbit.apache.org/sling/1.0'>
+<nt  = 'http://www.jcp.org/jcr/nt/1.0'>
+
+// Node type for the SampleContent objects
+[sling:SampleContent] > sling:Content
+
+  - 'title' (String)
+    copy
+
+  - 'text' (String)
+    copy
+
+// Node type for the SamplePage objects
+[sling:SamplePage] > sling:Content
+
+  // The page title
+  - 'title' (String)
+    copy
+
+  // The contents of the page
+  + 'content' (nt:base)
+    copy
\ No newline at end of file

Added: incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/jsp/component.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/jsp/component.jsp?rev=581591&view=auto
==============================================================================
--- incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/jsp/component.jsp (added)
+++ incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/jsp/component.jsp Wed Oct  3 06:17:58 2007
@@ -0,0 +1,38 @@
+<%--
+    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.
+--%>
+<%@page session="false" %>
+<%@page import="org.apache.sling.sample.*" %>
+<%@page import="org.apache.sling.component.*" %>
+<%@page import="java.util.*" %>
+<%@taglib prefix="sling" uri="http://jackrabbit.apache.org/taglibs/sling/1.0" %>
+
+<%-- Ensure the presence of the ComponentAPI objects --%>
+<sling:defineObjects contentClass="SampleContent"/>
+
+<h1><%= content.getTitle() %></h1>
+<p><%= content.getText() %></p>
+<table border="1" cellpadding="3" cellspacing="0">
+<%
+	Enumeration ci = renderRequest.getChildren(content);
+	while (ci.hasMoreElements()) {
+		Content child = (Content) ci.nextElement();
+		%><tr><td><sling:include content="<%= child %>" /></td></tr><%
+	}
+%>
+</table>
\ No newline at end of file

Propchange: incubator/sling/trunk/sample/src/main/scripts/org/apache/sling/sample/jsp/component.jsp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message