incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r600554 - in /incubator/sling/trunk/sling/sample/src/main: java/org/apache/sling/sample/ resources/SLING-INF/content/sample/content/ resources/SLING-INF/content/sling/scripts/sling/SampleContent/ resources/SLING-INF/content/sling/scripts/sl...
Date Mon, 03 Dec 2007 14:37:05 GMT
Author: fmeschbe
Date: Mon Dec  3 06:37:04 2007
New Revision: 600554

URL: http://svn.apache.org/viewvc?rev=600554&view=rev
Log:
SLING-109 Support Resource adapter

Modified:
    incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/Navigation.java
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp
    incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp
    incubator/sling/trunk/sling/sample/src/main/scripts/sling/scripts/org/apache/sling/sample/html.jsp

Modified: incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/Navigation.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/Navigation.java?rev=600554&r1=600553&r2=600554&view=diff
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/Navigation.java
(original)
+++ incubator/sling/trunk/sling/sample/src/main/java/org/apache/sling/sample/Navigation.java
Mon Dec  3 06:37:04 2007
@@ -77,9 +77,8 @@
 
             // if the child is a page, add an entry with optional link and
             // recursively call this method to draw the children of the child
-            Object child = childResource.getObject();
-            if (child instanceof SamplePage) {
-                SamplePage page = (SamplePage) child;
+            SamplePage page = childResource.adaptTo(SamplePage.class);
+            if (page != null) {
                 String title = page.getTitle();
                 pw.print("<li>");
 

Modified: incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json?rev=600554&r1=600553&r2=600554&view=diff
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json
(original)
+++ incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sample/content/home.json
Mon Dec  3 06:37:04 2007
@@ -45,6 +45,7 @@
 			        "name": "content",
 					"primaryNodeType": "sling:SampleContent",
 					"properties": {
+					    "sling:resourceType": "org/apache/sling/sample",
 						"title": "JSP Rendered Content",
 						"text": "This Content is rendered by a JSP script embeded in the Bundle."
 					}

Modified: incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp?rev=600554&r1=600553&r2=600554&view=diff
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp
(original)
+++ incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SampleContent/html.jsp
Mon Dec  3 06:37:04 2007
@@ -24,16 +24,13 @@
 <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %>
 
 <%-- Ensure the presence of the ComponentAPI objects --%>
-<sling:defineObjects />
-<%
-    SampleContent content = (SampleContent) slingRequest.getResource().getObject();
-%>
+<sling:defineObjects mappedObjectName="sampleContent" mappedObjectClass="SampleContent"
/>
 
-<h1><%= content.getTitle() %></h1>
-<p><%= content.getText() %></p>
+<h1><%= sampleContent.getTitle() %></h1>
+<p><%= sampleContent.getText() %></p>
 <table border="1" cellpadding="3" cellspacing="0">
 <%
-	Iterator<Resource> ci = resourceManager.listChildren(slingRequest.getResource());
+	Iterator<Resource> ci = resourceManager.listChildren(resource);
 	while (ci.hasNext()) {
 		Resource child = ci.next();
 		%><tr><td><sling:include resource="<%= child %>" /></td></tr><%

Modified: incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp?rev=600554&r1=600553&r2=600554&view=diff
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp
(original)
+++ incubator/sling/trunk/sling/sample/src/main/resources/SLING-INF/content/sling/scripts/sling/SamplePage/html.jsp
Mon Dec  3 06:37:04 2007
@@ -24,17 +24,14 @@
 <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%>
 
 <%-- Ensure the presence of the ComponentAPI objects --%>
-<sling:defineObjects />
-<%
-    SamplePage content = (SamplePage) slingRequest.getResource().getObject();
-%>
+<sling:defineObjects mappedObjectName="samplePage" mappedObjectClass="SamplePage" />
 <%-- This is a top level component, so we have to draw the html and head tags --%>
 <html>
 <head>
-<title><%=content.getTitle()%></title>
+<title><%= samplePage.getTitle() %></title>
 </head>
 <body>
-<h1><%=content.getTitle()%></h1>
+<h1><%= samplePage.getTitle() %></h1>
 
 <table style="border: none; height: 90%;">
 	<tr valign="top">

Modified: incubator/sling/trunk/sling/sample/src/main/scripts/sling/scripts/org/apache/sling/sample/html.jsp
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/sample/src/main/scripts/sling/scripts/org/apache/sling/sample/html.jsp?rev=600554&r1=600553&r2=600554&view=diff
==============================================================================
--- incubator/sling/trunk/sling/sample/src/main/scripts/sling/scripts/org/apache/sling/sample/html.jsp
(original)
+++ incubator/sling/trunk/sling/sample/src/main/scripts/sling/scripts/org/apache/sling/sample/html.jsp
Mon Dec  3 06:37:04 2007
@@ -23,16 +23,13 @@
 <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0" %>
 
 <%-- Ensure the presence of the ComponentAPI objects --%>
-<sling:defineObjects />
-<%
-    SampleContent content = (SampleContent) slingRequest.getResource().getObject();
-%>
+<sling:defineObjects mappedObjectName="sampleContent" mappedObjectClass="SampleContent"
/>
 
-<h1><%= content.getTitle() %></h1>
-<p><%= content.getText() %></p>
+<h1><%= sampleContent.getTitle() %></h1>
+<p><%= sampleContent.getText() %></p>
 <table border="1" cellpadding="3" cellspacing="0">
 <%
-	Iterator<Resource> ci = slingRequest.getResourceResolver().listChildren(slingRequest.getResource());
+	Iterator<Resource> ci = resourceManager.listChildren(resource);
 	while (ci.hasNext()) {
 		Resource child = ci.next();
 		%><tr><td><sling:include resource="<%= child %>" /></td></tr><%



Mime
View raw message