incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r585449 - in /incubator/sling/trunk: component-standard/src/main/java/org/apache/sling/component/standard/ core/ core/src/main/resources/SLING-INF/nodetypes/
Date Wed, 17 Oct 2007 11:34:09 GMT
Author: cziegeler
Date: Wed Oct 17 04:34:06 2007
New Revision: 585449

URL: http://svn.apache.org/viewvc?rev=585449&view=rev
Log:
Add a new node type: sling:Reference and corresponding components (SLING-61)

Added:
    incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceComponent.java
  (with props)
    incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceContent.java
  (with props)
    incubator/sling/trunk/core/src/main/resources/SLING-INF/nodetypes/references.cnd
Modified:
    incubator/sling/trunk/core/pom.xml

Added: incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceComponent.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceComponent.java?rev=585449&view=auto
==============================================================================
--- incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceComponent.java
(added)
+++ incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceComponent.java
Wed Oct 17 04:34:06 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.component.standard;
+
+import java.io.IOException;
+
+import org.apache.sling.component.ComponentException;
+import org.apache.sling.component.ComponentRequest;
+import org.apache.sling.component.ComponentRequestDispatcher;
+import org.apache.sling.component.ComponentResponse;
+import org.apache.sling.component.Content;
+import org.apache.sling.core.components.BaseComponent;
+
+/**
+ * The <code>ReferenceComponent</code> TODO
+ *
+ * @scr.component immediate="true" metatype="false"
+ * @scr.property name="service.description"
+ *          value="Component to handle sling:Reference content"
+ * @scr.property name="service.vendor" value="The Apache Software Foundation"
+ * @scr.service
+ */
+public class ReferenceComponent extends BaseComponent {
+
+    public static final String ID = ReferenceComponent.class.getName();
+
+    {
+        this.setContentClassName(ReferenceContent.class.getName());
+        this.setComponentId(ID);
+    }
+
+    /**
+     * @see org.apache.sling.core.components.BaseComponent#createContentInstance()
+     */
+    public Content createContentInstance() {
+        return new ReferenceContent();
+    }
+
+    /**
+     * @see org.apache.sling.core.components.BaseComponent#doInit()
+     */
+    protected void doInit() {
+        // nothing to do
+    }
+
+    /**
+     * @see org.apache.sling.core.component.Component#service(org.apache.sling.core.component.ComponentRequest,
org.apache.sling.core.component.ComponentResponse)
+     */
+    public void service(ComponentRequest request, ComponentResponse response)
+            throws IOException, ComponentException {
+
+        final ReferenceContent content = (ReferenceContent)request.getContent();
+        final String path = content.getReference();
+
+        // just forward to the referenced content
+        Content jcrContent = request.getContent(path);
+        if (jcrContent != null) {
+            ComponentRequestDispatcher crd = this.getComponentContext().getRequestDispatcher(
+                jcrContent);
+            crd.include(request, response);
+        } else {
+            throw new ComponentException("No content for path " + path);
+        }
+    }
+}

Propchange: incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceComponent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceComponent.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Added: incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceContent.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceContent.java?rev=585449&view=auto
==============================================================================
--- incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceContent.java
(added)
+++ incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceContent.java
Wed Oct 17 04:34:06 2007
@@ -0,0 +1,50 @@
+/*
+ * 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.component.standard;
+
+
+/**
+ * The <code>ReferenceContent</code> TODO
+ *
+ * @ocm.mapped jcrType="sling:Reference" discriminator="false"
+ */
+public class ReferenceContent extends org.apache.sling.content.jcr.SimpleContent {
+
+    /** @ocm.field jcrName="sling:path" */
+    private String reference;
+
+    // ---------- Mapped Content -----------------------------------------------
+
+    /**
+     * @return the reference
+     */
+    public String getReference() {
+        return this.reference;
+    }
+
+    /**
+     * @param value the reference to set
+     */
+    public void setReference(String value) {
+        this.reference = value;
+    }
+    // --------- Content interface ---------------------------------------------
+
+    public String getComponentId() {
+        return ReferenceComponent.ID;
+    }
+}

Propchange: incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceContent.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sling/trunk/component-standard/src/main/java/org/apache/sling/component/standard/ReferenceContent.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: incubator/sling/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/core/pom.xml?rev=585449&r1=585448&r2=585449&view=diff
==============================================================================
--- incubator/sling/trunk/core/pom.xml (original)
+++ incubator/sling/trunk/core/pom.xml Wed Oct 17 04:34:06 2007
@@ -89,7 +89,7 @@
                             org.apache.sling.core.impl.*
                         </Private-Package>
                         <Sling-Nodetypes>
-                            SLING-INF/nodetypes/command.cnd,SLING-INF/nodetypes/component.cnd,SLING-INF/nodetypes/selection.cnd
+                            SLING-INF/nodetypes/command.cnd,SLING-INF/nodetypes/component.cnd,SLING-INF/nodetypes/selection.cnd,SLING-INF/nodetypes/references.cnd
                         </Sling-Nodetypes>
                     </instructions>
                 </configuration>

Added: incubator/sling/trunk/core/src/main/resources/SLING-INF/nodetypes/references.cnd
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/core/src/main/resources/SLING-INF/nodetypes/references.cnd?rev=585449&view=auto
==============================================================================
--- incubator/sling/trunk/core/src/main/resources/SLING-INF/nodetypes/references.cnd (added)
+++ incubator/sling/trunk/core/src/main/resources/SLING-INF/nodetypes/references.cnd Wed Oct
17 04:34:06 2007
@@ -0,0 +1,27 @@
+//
+//  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'>
+
+//-----------------------------------------------------------------------------
+// Node type for references
+[sling:Reference]
+  - sling:path (string)
+  - sling:copyOnWrite (boolean)
+



Mime
View raw message