You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2018/08/15 13:34:41 UTC
[sling-whiteboard] branch master updated: Renaming complete
This is an automated email from the ASF dual-hosted git repository.
bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 2001756 Renaming complete
2001756 is described below
commit 2001756483d353d8f01bf66333ddeed0e8864767
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Wed Aug 15 15:34:32 2018 +0200
Renaming complete
---
resource-schemas/README.md | 28 +++++++++++++
resource-schemas/{rtdx-core => }/pom.xml | 7 ++--
resource-schemas/rtdx-core/README.md | 20 ---------
.../resourceschemas}/api/ResourceProperty.java | 2 +-
.../sling/resourceschemas/api/ResourceSchema.java} | 19 ++++-----
.../api/ResourceSchemaRegistry.java} | 19 +++++----
.../api/ResourceSchemasConstants.java} | 8 ++--
.../schemas/DefaultResourceSchemaRegistry.java} | 32 +++++++--------
.../resourceschemas/demo/schemas/DemoSchemas.java} | 48 +++++++++++-----------
.../sling/resourceschemas}/impl/HtmlGenerator.java | 18 ++++----
.../resourceschemas}/impl/RedirectFilter.java | 18 ++++----
.../servlets/DefaultHtmlServlet.java | 28 ++++++-------
12 files changed, 128 insertions(+), 119 deletions(-)
diff --git a/resource-schemas/README.md b/resource-schemas/README.md
new file mode 100644
index 0000000..64ba9c5
--- /dev/null
+++ b/resource-schemas/README.md
@@ -0,0 +1,28 @@
+Apache Sling Resource Schemas prototype
+=======================================
+
+For now this is just a *rough* proof of concept...
+
+The Sling Resource Schemas extensions generate generic hypermedia user interfaces to manage content,
+based on resource schemas that define the various types of resources and how they can
+be nested.
+
+To test the demo schemas, which allow for managing a very basic blog with folders and posts, install
+this bundle on Sling, create a resource with the `srs/demo/root`
+resource type and navigate to it with the `.srs.html` selector and extension:
+
+ $ curl -u admin:admin -F sling:resourceType=srs/demo/root http://localhost:8080/test
+ $ curl -u admin:admin http://localhost:8080/test.srs.html
+
+ <html><body><div class='srs-page'>
+ <h1>Sling Resource Schemas: generated edit forms<br/>for /test</h1><hr/>
+ ....
+
+This module generates a basic HTML UI that allows you to navigate, create and edit resources
+based on the Resource Schemas.
+
+That interface is meant to be usable by machine clients as well, but that hasn't been tested so far.
+Using standard hypermedia formats like Siren or HAL might be an option.
+
+For now, the Resource Schemas are hardcoded in the `DemoSchemas` class. They should later be read from
+structured text files provided as OSGi bundle resources or in the Sling content repository.
\ No newline at end of file
diff --git a/resource-schemas/rtdx-core/pom.xml b/resource-schemas/pom.xml
similarity index 92%
rename from resource-schemas/rtdx-core/pom.xml
rename to resource-schemas/pom.xml
index 4c53ada..7f7047a 100644
--- a/resource-schemas/rtdx-core/pom.xml
+++ b/resource-schemas/pom.xml
@@ -19,12 +19,13 @@
<version>32</version>
<relativePath/>
</parent>
- <artifactId>org.apache.sling.rtdx.core</artifactId>
+ <artifactId>org.apache.sling.resourceschemas.core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>Apache Sling RTD-X Core</name>
+ <name>Apache Sling Resource Schemas</name>
<description>
- Sling Resource Type Definition Extensions Core
+ Prototype using Schemas for Sling Resources, to
+ create discoverable HTTP APIs
</description>
<properties>
<sling.java.version>8</sling.java.version>
diff --git a/resource-schemas/rtdx-core/README.md b/resource-schemas/rtdx-core/README.md
deleted file mode 100644
index 8e92c43..0000000
--- a/resource-schemas/rtdx-core/README.md
+++ /dev/null
@@ -1,20 +0,0 @@
-Apache Sling RTD-X Extensions
-=============================
-
-As of January 19th, 2018 this is just a *very rough* proof of concept...
-
-The RTD-X extensions generate generic hypermedia user interfaces to manage content,
-based on resource models that define the various types of resources and how they can
-be nested.
-
-To test the demo models, install this bundle on Sling, create a resource with the `rtdx/root`
-resource type and navigate to it with the `.rtdx.html` selector and extension.
-
-The RTD-X module generates a basic HTML UI that allows you to navigate, create and edit resources
-based on the models.
-
-That interface is meant to be usable by machine clients as well, but that hasn't been tested so far.
-Using standard hypermedia formats like Siren or HAL might be an option.
-
-For now, the resource models are hardcoded in the `DemoModels` class. They should later be read from
-structured text files provided as OSGi bundle resources or in the Sling content repository.
\ No newline at end of file
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceProperty.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceProperty.java
similarity index 97%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceProperty.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceProperty.java
index 23c1cc2..f103b83 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceProperty.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceProperty.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.api;
+package org.apache.sling.resourceschemas.api;
/** Define a Property of a Resource: name, type, required etc */
public class ResourceProperty {
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceModel.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchema.java
similarity index 88%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceModel.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchema.java
index 4544e0d..d28be11 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceModel.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchema.java
@@ -15,19 +15,18 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.api;
+package org.apache.sling.resourceschemas.api;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
-/** Define the Model of a Resource: its description,
+/** Define the Schema of a Resource: its description,
* properties, links to other Resource types etc.
* Objects of this class are immutable.
*/
-public class ResourceModel {
+public class ResourceSchema {
private final Builder b;
@@ -58,12 +57,12 @@ public class ResourceModel {
return this;
}
- public ResourceModel build() {
- return new ResourceModel(this);
+ public ResourceSchema build() {
+ return new ResourceSchema(this);
}
}
- private ResourceModel(Builder b) {
+ private ResourceSchema(Builder b) {
this.b = b;
}
@@ -81,12 +80,12 @@ public class ResourceModel {
return sb.toString();
}
- /** @return the name of this model */
+ /** @return the name of this schema */
public String getName() {
return b.name;
}
- /** @return a textual description of this model */
+ /** @return a textual description of this schema */
public String getDescription() {
return b.description;
}
@@ -98,7 +97,7 @@ public class ResourceModel {
return Collections.unmodifiableCollection(b.postHereResourceTypes);
}
- /** @return an Iterator over the Resource Properties of this model */
+ /** @return an Iterator over the Resource Properties of this schema */
public Collection<ResourceProperty> getProperties() {
return Collections.unmodifiableCollection(b.properties);
}
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceModelRegistry.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchemaRegistry.java
similarity index 68%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceModelRegistry.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchemaRegistry.java
index cfbde49..cba32c9 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/ResourceModelRegistry.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchemaRegistry.java
@@ -15,20 +15,21 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.api;
+package org.apache.sling.resourceschemas.api;
import java.util.Collection;
-/** Give access to registered ResourceModels */
-public interface ResourceModelRegistry {
- /** Return the ResourceModel for the specified resource type
+/** Give access to registered ResourceSchemas */
+public interface ResourceSchemaRegistry {
+
+ /** Return the ResourceSchema for the specified resource type
* @param resourceType the desired resource type
- * @return the corresponding ResourceModel, or null if not found
+ * @return the corresponding ResourceSchema, or null if not found
*/
- public ResourceModel getModel(String resourceType);
+ public ResourceSchema getSchema(String resourceType);
- /** Iterate over all registered Models
- * @return an immutable Collection of all registered ResourceModels
+ /** Iterate over all registered ResourceSchema
+ * @return an immutable Collection of all registered ResourceSchemas
*/
- public Collection<ResourceModel> getModels();
+ public Collection<ResourceSchema> getSchemas();
}
\ No newline at end of file
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/RtdxConstants.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchemasConstants.java
similarity index 81%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/RtdxConstants.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchemasConstants.java
index 4b1fd92..ecaafd5 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/api/RtdxConstants.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/api/ResourceSchemasConstants.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.api;
+package org.apache.sling.resourceschemas.api;
-public class RtdxConstants {
- public static String RTDX_SELECTOR = "rtdx";
+public class ResourceSchemasConstants {
+ public static String SRS_SELECTOR = "srs";
public static String EXT_HTML = "html";
- public static String RTDX_FORM_MARKER_PARAMETER = ":rtdx-form-marker";
+ public static String SRS_FORM_MARKER_PARAMETER = ":srs-form-marker";
public static String POST_METHOD = "POST";
}
\ No newline at end of file
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/demo/models/DefaultResourceModelRegistry.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DefaultResourceSchemaRegistry.java
similarity index 55%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/demo/models/DefaultResourceModelRegistry.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DefaultResourceSchemaRegistry.java
index fc671ed..cf0ba67 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/demo/models/DefaultResourceModelRegistry.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DefaultResourceSchemaRegistry.java
@@ -15,40 +15,40 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.demo.models;
+package org.apache.sling.resourceschemas.demo.schemas;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import org.apache.sling.rtdx.api.*;
+import org.apache.sling.resourceschemas.api.*;
import java.util.Map;
import org.osgi.service.component.annotations.Component;
-/** Temporary ResourceModelRegistry that provides a set of
- * demo ResourceModels */
-@Component(service = ResourceModelRegistry.class,
+/** Temporary ResourceSchemaRegistry that provides a set of
+ demo ResourceSchemas */
+@Component(service = ResourceSchemaRegistry.class,
property = {
- "service.description=RTD-X Default ResourceModel Registry",
+ "service.description=Sling Resource Schemas Default ResourceSchema Registry",
"service.vendor=The Apache Software Foundation"
})
-public class DefaultResourceModelRegistry implements ResourceModelRegistry {
+public class DefaultResourceSchemaRegistry implements ResourceSchemaRegistry {
- private final Map<String, ResourceModel> models = new HashMap<>();
+ private final Map<String, ResourceSchema> schemas = new HashMap<>();
- public DefaultResourceModelRegistry() {
- // TODO models are hardcoded for now
- for(ResourceModel m : DemoModels.getModels()) {
- models.put(m.getName(), m);
+ public DefaultResourceSchemaRegistry() {
+ // TODO schemas are hardcoded for now
+ for(ResourceSchema m : DemoSchemas.getSchemas()) {
+ schemas.put(m.getName(), m);
}
}
@Override
- public ResourceModel getModel(String resourceType) {
- return models.get(resourceType);
+ public ResourceSchema getSchema(String resourceType) {
+ return schemas.get(resourceType);
}
@Override
- public Collection<ResourceModel> getModels() {
- return Collections.unmodifiableCollection(models.values());
+ public Collection<ResourceSchema> getSchemas() {
+ return Collections.unmodifiableCollection(schemas.values());
}
}
\ No newline at end of file
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/demo/models/DemoModels.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DemoSchemas.java
similarity index 59%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/demo/models/DemoModels.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DemoSchemas.java
index 7736de0..c777218 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/demo/models/DemoModels.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/demo/schemas/DemoSchemas.java
@@ -15,53 +15,53 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.demo.models;
+package org.apache.sling.resourceschemas.demo.schemas;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import org.apache.sling.rtdx.api.*;
+import org.apache.sling.resourceschemas.api.*;
-/** Demonstration ResourceModels - those should rather be provided
+/** Demonstration ResourceSchemas- those should rather be provided
* by YAML or other structured text files, ready dynamically
* from bundle resources or the Sling content repository
*/
-class DemoModels {
+class DemoSchemas {
- static Collection<ResourceModel> getModels() {
- final List<ResourceModel> list = new ArrayList<>();
+ static Collection<ResourceSchema> getSchemas() {
+ final List<ResourceSchema> list = new ArrayList<>();
- list.add(ResourceModel.BUILDER()
- .withName("rtdx/root")
- .withDescription("RTD-X Root")
- .withPostHereResourceType("rtdx/blog/home")
+ list.add(ResourceSchema.BUILDER()
+ .withName("srs/demo/root")
+ .withDescription("SRS Demo Root")
+ .withPostHereResourceType("srs/demo/blog/home")
.build()
);
- list.add(ResourceModel.BUILDER()
- .withName("rtdx/blog/home")
+ list.add(ResourceSchema.BUILDER()
+ .withName("srs/demo/blog/home")
.withDescription("Homepage of a Blog")
- .withPostHereResourceType("rtdx/blog/post")
- .withPostHereResourceType("rtdx/blog/folder")
- .withProperty(new ResourceProperty("title", "Title", true, "rtdx:string"))
+ .withPostHereResourceType("srs/demo/blog/post")
+ .withPostHereResourceType("srs/demo/blog/folder")
+ .withProperty(new ResourceProperty("title", "Title", true, "srs:string"))
.build()
);
- list.add(ResourceModel.BUILDER()
- .withName("rtdx/blog/folder")
+ list.add(ResourceSchema.BUILDER()
+ .withName("srs/demo/blog/folder")
.withDescription("Folder for Blog Posts")
- .withPostHereResourceType("rtdx/blog/post")
- .withPostHereResourceType("rtdx/blog/folder")
- .withProperty(new ResourceProperty("title", "Title", true, "rtdx:string"))
+ .withPostHereResourceType("srs/demo/blog/post")
+ .withPostHereResourceType("srs/demo/blog/folder")
+ .withProperty(new ResourceProperty("title", "Title", true, "srs:string"))
.build()
);
- list.add(ResourceModel.BUILDER()
- .withName("rtdx/blog/post")
+ list.add(ResourceSchema.BUILDER()
+ .withName("srs/demo/blog/post")
.withDescription("Blog Post")
- .withProperty(new ResourceProperty("title", "Title", true, "rtdx:string"))
- .withProperty(new ResourceProperty("text", "Text", true, "rtdx:richtext"))
+ .withProperty(new ResourceProperty("title", "Title", true, "srs:string"))
+ .withProperty(new ResourceProperty("text", "Text", true, "srs:richtext"))
.build()
);
return Collections.unmodifiableCollection(list);
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/impl/HtmlGenerator.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/impl/HtmlGenerator.java
similarity index 89%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/impl/HtmlGenerator.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/impl/HtmlGenerator.java
index 39d7f9f..e95e391 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/impl/HtmlGenerator.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/impl/HtmlGenerator.java
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.impl;
+package org.apache.sling.resourceschemas.impl;
import java.io.PrintWriter;
import java.util.Iterator;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.rtdx.api.*;
+import org.apache.sling.resourceschemas.api.*;
import org.apache.sling.api.request.ResponseUtil;
@@ -53,7 +53,7 @@ public class HtmlGenerator {
}
public void generateNavigation(Resource r) {
- w.println("<div class='rtdx-navigation'><h2>Navigation</h2>");
+ w.println("<div class='srs-navigation'><h2>Navigation</h2>");
w.println("<ul>");
if(r.getParent() != null) {
@@ -73,7 +73,7 @@ public class HtmlGenerator {
w.println("</ul></div>");
}
- public void generateEditForm(Resource r, ResourceModel m) {
+ public void generateEditForm(Resource r, ResourceSchema m) {
if(m.getProperties().isEmpty()) {
return;
}
@@ -82,25 +82,25 @@ public class HtmlGenerator {
r.adaptTo(ValueMap.class),
"Edit the current Resource",
r.getPath() + " (" + m.getDescription() + ")",
- "rtdx-edit-form",
+ "srs-edit-form",
"",
addSelectorsAndExtension(request, r.getPath()),
null);
}
- public void generateCreateForm(String parentPath, ResourceModel m) {
+ public void generateCreateForm(String parentPath, ResourceSchema m) {
form(
m,
null,
null,
"Create a " + m.getDescription() + " here",
- "rtdx-create-form",
+ "srs-create-form",
parentPath + "/*",
"*",
- RtdxConstants.RTDX_FORM_MARKER_PARAMETER);
+ ResourceSchemasConstants.SRS_FORM_MARKER_PARAMETER);
}
- public void form(ResourceModel m, ValueMap vm, String title, String subtitle, String cssClass, String actionPath, String redirectPath, String formMarkerFieldName) {
+ public void form(ResourceSchema m, ValueMap vm, String title, String subtitle, String cssClass, String actionPath, String redirectPath, String formMarkerFieldName) {
// TODO should use templates
// TODO escape values
w.println("<br/>");
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/impl/RedirectFilter.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/impl/RedirectFilter.java
similarity index 80%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/impl/RedirectFilter.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/impl/RedirectFilter.java
index ef6b284..3f3913e 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/impl/RedirectFilter.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/impl/RedirectFilter.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.impl;
+package org.apache.sling.resourceschemas.impl;
import java.io.IOException;
import javax.servlet.Filter;
@@ -27,15 +27,15 @@ import javax.servlet.ServletResponse;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper;
-import org.apache.sling.rtdx.api.RtdxConstants;
+import org.apache.sling.resourceschemas.api.ResourceSchemasConstants;
import org.osgi.service.component.annotations.Component;
/** Servlet Filter that provides the correct redirects when creating
- * Resources from RTD-X forms.
+ * Resources from Sling Resource Schemas generated forms
*/
@Component(service = Filter.class,
property = {
- "service.description=RTD-X Redirect Filter",
+ "service.description=Sling Resource Schemas Redirect Filter",
"service.vendor=The Apache Software Foundation",
"sling.filter.scope=request"
})
@@ -43,8 +43,8 @@ public class RedirectFilter implements Filter {
public static final String LOCATION_HEADER = "Location";
- class RtdxResponseWrapper extends SlingHttpServletResponseWrapper {
- RtdxResponseWrapper(SlingHttpServletResponse r) {
+ class ResponseWrapper extends SlingHttpServletResponseWrapper {
+ ResponseWrapper(SlingHttpServletResponse r) {
super(r);
}
@@ -62,7 +62,7 @@ public class RedirectFilter implements Filter {
}
private String transformRedirectUrl(String url) {
- return url + "." + RtdxConstants.RTDX_SELECTOR + "." + RtdxConstants.EXT_HTML;
+ return url + "." + ResourceSchemasConstants.SRS_SELECTOR + "." + ResourceSchemasConstants.EXT_HTML;
}
}
@@ -79,8 +79,8 @@ public class RedirectFilter implements Filter {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if(request instanceof SlingHttpServletRequest) {
final SlingHttpServletRequest sr = (SlingHttpServletRequest)request;
- if(sr.getMethod().equals(RtdxConstants.POST_METHOD) && sr.getParameter(RtdxConstants.RTDX_FORM_MARKER_PARAMETER) != null) {
- response = new RtdxResponseWrapper((SlingHttpServletResponse)response);
+ if(sr.getMethod().equals(ResourceSchemasConstants.POST_METHOD) && sr.getParameter(ResourceSchemasConstants.SRS_FORM_MARKER_PARAMETER) != null) {
+ response = new ResponseWrapper((SlingHttpServletResponse)response);
}
}
chain.doFilter(request, response);
diff --git a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/servlets/DefaultHtmlServlet.java b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/servlets/DefaultHtmlServlet.java
similarity index 74%
rename from resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/servlets/DefaultHtmlServlet.java
rename to resource-schemas/src/main/java/org/apache/sling/resourceschemas/servlets/DefaultHtmlServlet.java
index 1c2fe6b..227f8f0 100644
--- a/resource-schemas/rtdx-core/src/main/java/org/apache/sling/rtdx/servlets/DefaultHtmlServlet.java
+++ b/resource-schemas/src/main/java/org/apache/sling/resourceschemas/servlets/DefaultHtmlServlet.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.sling.rtdx.servlets;
+package org.apache.sling.resourceschemas.servlets;
import java.io.IOException;
import java.io.PrintWriter;
@@ -26,20 +26,20 @@ import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.servlets.SlingSafeMethodsServlet;
-import org.apache.sling.rtdx.api.ResourceModel;
-import org.apache.sling.rtdx.api.ResourceModelRegistry;
-import org.apache.sling.rtdx.impl.HtmlGenerator;
+import org.apache.sling.resourceschemas.api.ResourceSchema;
+import org.apache.sling.resourceschemas.impl.HtmlGenerator;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
+import org.apache.sling.resourceschemas.api.ResourceSchemaRegistry;
/** SlingServlet that generates the default HTML representations
- * to allow CRUD operations on resources backed by RTD-X models.
+ * to allow CRUD operations on resources backed by Sling Resource Schemas
*/
@Component(service = Servlet.class,
property = {
- "service.description=RTD-X Default HTML Servlet",
+ "service.description=Sling Resource Schemas Default HTML Servlet",
"service.vendor=The Apache Software Foundation",
- "sling.servlet.selectors=rtdx",
+ "sling.servlet.selectors=srs",
"sling.servlet.extensions=html",
"sling.servlet.resourceTypes=sling/servlet/default",
"sling.servlet.methods=GET"
@@ -47,18 +47,18 @@ import org.osgi.service.component.annotations.Reference;
public class DefaultHtmlServlet extends SlingSafeMethodsServlet {
@Reference
- private ResourceModelRegistry registry;
+ private ResourceSchemaRegistry registry;
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
final Resource r = request.getResource();
final String resourceType = r.getResourceType();
- final ResourceModel m = registry.getModel(resourceType);
+ final ResourceSchema m = registry.getSchema(resourceType);
if(m == null) {
response.sendError(
HttpServletResponse.SC_BAD_REQUEST,
- "ResourceModel not found for resource type " + resourceType + " at " + request.getResource().getPath());
+ "ResourceSchema not found for resource type " + resourceType + " at " + request.getResource().getPath());
return;
}
@@ -66,8 +66,8 @@ public class DefaultHtmlServlet extends SlingSafeMethodsServlet {
response.setContentType("text/html");
final PrintWriter w = response.getWriter();
- w.println("<html><body><div class='rtdx-page'>");
- w.println("<h1>RTD-X generated editing forms<br/>for " + r.getPath() + "</h1><hr/>\n");
+ w.println("<html><body><div class='srs-page'>");
+ w.println("<h1>Sling Resource Schemas: generated edit forms<br/>for " + r.getPath() + "</h1><hr/>\n");
final HtmlGenerator h = new HtmlGenerator(request, w);
h.generateNavigation(r);
@@ -78,9 +78,9 @@ public class DefaultHtmlServlet extends SlingSafeMethodsServlet {
w.println("<h2>Create Child Resources</h2>");
}
for(String rt : m.getPostHereResourceTypes()) {
- final ResourceModel em = registry.getModel(rt);
+ final ResourceSchema em = registry.getSchema(rt);
if(em == null) {
- w.println("<p>WARNING: model not found for resource type " + rt + "</p>");
+ w.println("<p>WARNING: ResourceSchema not found for resource type " + rt + "</p>");
} else {
h.generateCreateForm(r.getPath(), em);
}