You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/08/30 20:08:00 UTC
svn commit: r264821 - in /cocoon/blocks/jcr/trunk: conf/
java/org/apache/cocoon/jcr/ samples/
Author: vgritsenko
Date: Tue Aug 30 11:07:46 2005
New Revision: 264821
URL: http://svn.apache.org/viewcvs?rev=264821&view=rev
Log:
jcr samples.
Added:
cocoon/blocks/jcr/trunk/conf/jcr.xsamples (with props)
cocoon/blocks/jcr/trunk/samples/dir2samples.xsl (with props)
cocoon/blocks/jcr/trunk/samples/populate.xml (with props)
cocoon/blocks/jcr/trunk/samples/samples.xml (with props)
Removed:
cocoon/blocks/jcr/trunk/samples/jaas.config
cocoon/blocks/jcr/trunk/samples/repository.xml
Modified:
cocoon/blocks/jcr/trunk/conf/jcr-component.xconf
cocoon/blocks/jcr/trunk/conf/jcr-source.xconf
cocoon/blocks/jcr/trunk/java/org/apache/cocoon/jcr/AbstractRepository.java
cocoon/blocks/jcr/trunk/samples/sitemap.xmap
Modified: cocoon/blocks/jcr/trunk/conf/jcr-component.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/conf/jcr-component.xconf?rev=264821&r1=264820&r2=264821&view=diff
==============================================================================
--- cocoon/blocks/jcr/trunk/conf/jcr-component.xconf (original)
+++ cocoon/blocks/jcr/trunk/conf/jcr-component.xconf Tue Aug 30 11:07:46 2005
@@ -29,14 +29,14 @@
class="org.apache.cocoon.jcr.JackrabbitRepository">
<credentials login="anonymous" password=""/>
- <jaas src="context://samples/blocks/jcr/jaas.config"/>
+ <jaas src="context://samples/blocks/jcr/repotest/jaas.config"/>
<home src="context://samples/blocks/jcr/repotest"/>
<!--
<home src="file:/home/USER/repotest"/>
-->
- <configuration src="context://samples/blocks/jcr/repository.xml"/>
+ <configuration src="context://samples/blocks/jcr/repotest/repository.xml"/>
<!--
<configuration src="file:/home/USER/repository.xml"/>
-->
Modified: cocoon/blocks/jcr/trunk/conf/jcr-source.xconf
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/conf/jcr-source.xconf?rev=264821&r1=264820&r2=264821&view=diff
==============================================================================
--- cocoon/blocks/jcr/trunk/conf/jcr-source.xconf (original)
+++ cocoon/blocks/jcr/trunk/conf/jcr-source.xconf Tue Aug 30 11:07:46 2005
@@ -21,14 +21,19 @@
<xconf xpath="/cocoon/source-factories"
unless="/cocoon/source-factories/component-instance[@name = 'jcr']">
- <component-instance name="jcr" class="org.apache.cocoon.jcr.source.JCRSourceFactory">
- <folder-node type="rep:root" new-file="nt:file" new-folder="nt:folder"/>
- <folder-node type="nt:unstructured" new-file="nt:file" new-folder="nt:unstructured"/>
- <!--
- <folder-node type="nt:folder" new-file="nt:file"/>
- -->
- <file-node type="nt:file" content-path="jcr:content" content-type="nt:resource"/>
+ <component-instance name="jcr"
+ class="org.apache.cocoon.jcr.source.JCRSourceFactory">
+ <folder-node type="rep:root" new-folder="nt:folder" new-file="nt:file"/>
+ <folder-node type="nt:unstructured" new-folder="nt:unstructured" new-file="nt:file"/>
+ <folder-node type="nt:folder" new-folder="nt:folder" new-file="nt:file"/>
+
+ <file-node type="nt:file" content-path="jcr:content" content-type="nt:resource"/>
<file-node type="nt:linkedFile" content-ref="jcr:content"/>
- </component-instance>
+ <content-node type="nt:resource"
+ content-prop="jcr:data"
+ mimetype-prop="jcr:mimeType"
+ lastmodified-prop="jcr:lastModified"
+ validity-prop="jcr:lastModified"/>
+ </component-instance>
</xconf>
Added: cocoon/blocks/jcr/trunk/conf/jcr.xsamples
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/conf/jcr.xsamples?rev=264821&view=auto
==============================================================================
--- cocoon/blocks/jcr/trunk/conf/jcr.xsamples (added)
+++ cocoon/blocks/jcr/trunk/conf/jcr.xsamples Tue Aug 30 11:07:46 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ 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.
+-->
+
+<xsamples xpath="/samples" unless="group[@name='JCR']">
+
+ <group name="JCR">
+ <sample name="JCR Block" href="jcr/">
+ Java Content Repository (JSR-170) samples.
+ </sample>
+ </group>
+
+</xsamples>
Propchange: cocoon/blocks/jcr/trunk/conf/jcr.xsamples
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/jcr/trunk/conf/jcr.xsamples
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/blocks/jcr/trunk/java/org/apache/cocoon/jcr/AbstractRepository.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/java/org/apache/cocoon/jcr/AbstractRepository.java?rev=264821&r1=264820&r2=264821&view=diff
==============================================================================
--- cocoon/blocks/jcr/trunk/java/org/apache/cocoon/jcr/AbstractRepository.java (original)
+++ cocoon/blocks/jcr/trunk/java/org/apache/cocoon/jcr/AbstractRepository.java Tue Aug 30 11:07:46 2005
@@ -247,6 +247,10 @@
return session;
}
+ // TODO: When logout should be called?
+
+ // =============================================================================================
+ // Implementation methods
// =============================================================================================
private Session getCachedSession(String workspace) {
Added: cocoon/blocks/jcr/trunk/samples/dir2samples.xsl
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/samples/dir2samples.xsl?rev=264821&view=auto
==============================================================================
--- cocoon/blocks/jcr/trunk/samples/dir2samples.xsl (added)
+++ cocoon/blocks/jcr/trunk/samples/dir2samples.xsl Tue Aug 30 11:07:46 2005
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ 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.
+-->
+
+<!--+
+ | Simple repository browser
+ | CVS $Id$
+ +-->
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:c="http://apache.org/cocoon/collection/1.0">
+
+ <xsl:import href="context://stylesheets/system/xml2html.xslt"/>
+
+ <xsl:template match="/">
+ <xsl:choose>
+ <xsl:when test="c:collection">
+ <xsl:apply-templates mode="root"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="resource"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="c:collection" mode="root">
+ <samples name="JCR Browser">
+ <group name="Back">
+ <sample name="Back" href="..">to parent collection</sample>
+ </group>
+ <group name="Collection">
+ <note>
+ You are browsing collection <strong><xsl:value-of select="@name"/></strong>.
+ <br/>
+ This collection has <strong><xsl:value-of select="count(c:collection)"/></strong>
+ nested collections and it stores <strong><xsl:value-of select="count(c:resource)"/></strong>
+ resources.
+ </note>
+ </group>
+ <group name="Collections">
+ <xsl:if test="not(c:collection)">
+ <note>Collection does not have nested collections</note>
+ </xsl:if>
+ <xsl:apply-templates select="c:collection"/>
+ </group>
+ <group name="Resources">
+ <xsl:if test="not(c:resource)">
+ <note>Collection does not have resources</note>
+ </xsl:if>
+ <xsl:apply-templates select="c:resource"/>
+ </group>
+ </samples>
+ </xsl:template>
+
+ <xsl:template name="resource">
+ <samples name="JCR Browser">
+ <group name="Back">
+ <sample name="Back" href=".">to parent collection</sample>
+ </group>
+ <group name="Resource">
+ <note>
+ You are viewing resource.
+ </note>
+ </group>
+ <group name="Resource Content">
+ <xsl:call-template name="head"/>
+ <xsl:apply-templates/>
+ </group>
+ </samples>
+ </xsl:template>
+
+ <xsl:template match="c:collection">
+ <sample name="{@name}" href="./{@name}/">Browse Collection</sample>
+ </xsl:template>
+
+ <xsl:template match="c:resource">
+ <sample name="{@name}" href="./{@name}">View Resource</sample>
+ </xsl:template>
+
+ <xsl:template name="head">
+ <link href="/styles/prettycontent.css" type="text/css" rel="stylesheet"/>
+ <script src="/scripts/prettycontent.js" type="text/javascript"/>
+ </xsl:template>
+</xsl:stylesheet>
Propchange: cocoon/blocks/jcr/trunk/samples/dir2samples.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/jcr/trunk/samples/dir2samples.xsl
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/blocks/jcr/trunk/samples/populate.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/samples/populate.xml?rev=264821&view=auto
==============================================================================
--- cocoon/blocks/jcr/trunk/samples/populate.xml (added)
+++ cocoon/blocks/jcr/trunk/samples/populate.xml Tue Aug 30 11:07:46 2005
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ 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.
+-->
+
+<!--+
+ | Populates JCR repository with some sample data
+ | CVS $Id$
+ +-->
+<html>
+ <h2>Populating JCR with sample data</h2>
+
+ <h3>Import sitemap.xmap ...</h3>
+ <textarea cols="75" rows="3">
+ <s:write xmlns:s="http://apache.org/cocoon/source/1.0">
+ <s:source>jcr://cocoon/sitemap</s:source>
+ <s:fragment>
+ <i:include src="sitemap.xmap" xmlns:i="http://apache.org/cocoon/include/1.0"/>
+ </s:fragment>
+ </s:write>
+ </textarea>
+
+ <h3>Import dir2samples.xsl ...</h3>
+ <textarea cols="75" rows="3">
+ <s:write xmlns:s="http://apache.org/cocoon/source/1.0">
+ <s:source>jcr://cocoon/dir2samples.xsl</s:source>
+ <s:fragment>
+ <i:include src="dir2samples.xsl" xmlns:i="http://apache.org/cocoon/include/1.0"/>
+ </s:fragment>
+ </s:write>
+ </textarea>
+
+ <h3>Import samples.xml ...</h3>
+ <textarea cols="75" rows="3">
+ <s:write xmlns:s="http://apache.org/cocoon/source/1.0">
+ <s:source>jcr://cocoon/samples.xml</s:source>
+ <s:fragment>
+ <i:include src="samples.xml" xmlns:i="http://apache.org/cocoon/include/1.0"/>
+ </s:fragment>
+ </s:write>
+ </textarea>
+
+ <h3>Done</h3>
+ <p>Review results of all operations and go check other samples.</p>
+ <a href="./">Go Back</a>
+</html>
Propchange: cocoon/blocks/jcr/trunk/samples/populate.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/jcr/trunk/samples/populate.xml
------------------------------------------------------------------------------
svn:keywords = Id
Added: cocoon/blocks/jcr/trunk/samples/samples.xml
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/samples/samples.xml?rev=264821&view=auto
==============================================================================
--- cocoon/blocks/jcr/trunk/samples/samples.xml (added)
+++ cocoon/blocks/jcr/trunk/samples/samples.xml Tue Aug 30 11:07:46 2005
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ 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.
+-->
+
+<!--+
+ | JCR Block Samples
+ |
+ | CVS $Id$
+ +-->
+<samples name="JCR Block Samples">
+
+ <group name="Back">
+ <sample name="Back" href="../..">to Cocoon Samples main page</sample>
+ <sample name="Back" href="..">to Cocoon Blocks Samples main page</sample>
+ </group>
+
+ <group name="Init Repository">
+ <note>
+ Init repository first before checking out other samples!
+ </note>
+ <sample name="Init" href="populate">
+ Populate sample JCR Repository
+ </sample>
+ </group>
+
+ <group name="JCR Source">
+ <sample name="Root Collection" href="repository/">
+ Get root / collection.
+ </sample>
+ <sample name="Resource" href="repository/cocoon/samples.xml">
+ Get /cocoon/samples.xml resource (the welcome page).
+ </sample>
+ </group>
+
+ <group name="JCR Samples">
+ <sample name="Browser" href="browse/">
+ Simple repository browser
+ </sample>
+ <sample name="Mount" href="mount/">
+ Mount this sitemap from the repository.
+ </sample>
+ </group>
+</samples>
Propchange: cocoon/blocks/jcr/trunk/samples/samples.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/blocks/jcr/trunk/samples/samples.xml
------------------------------------------------------------------------------
svn:keywords = Id
Modified: cocoon/blocks/jcr/trunk/samples/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/blocks/jcr/trunk/samples/sitemap.xmap?rev=264821&r1=264820&r2=264821&view=diff
==============================================================================
--- cocoon/blocks/jcr/trunk/samples/sitemap.xmap (original)
+++ cocoon/blocks/jcr/trunk/samples/sitemap.xmap Tue Aug 30 11:07:46 2005
@@ -29,10 +29,69 @@
<map:pipelines>
<map:pipeline>
- <map:match pattern="**">
+ <map:match pattern="">
+ <map:redirect-to uri="welcome"/>
+ </map:match>
+
+ <map:match pattern="welcome">
+ <map:generate src="samples.xml"/>
+ <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
+ <map:parameter name="contextPath" value="{request:contextPath}"/>
+ </map:transform>
+ <map:serialize/>
+ </map:match>
+
+ <map:match pattern="populate">
+ <map:generate src="populate.xml"/>
+ <map:transform type="cinclude"/>
+ <map:transform type="write-source"/>
+ <map:serialize/>
+ </map:match>
+
+ <!-- WildcardURISelector would be just perfect here -->
+ <map:match pattern="browse/">
+ <map:generate type="traversable" src="jcr://"/>
+ <map:transform src="dir2samples.xsl"/>
+ <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
+ <map:parameter name="contextPath" value="{request:contextPath}"/>
+ </map:transform>
+ <map:serialize/>
+ </map:match>
+ <map:match pattern="browse/**/">
+ <map:generate type="traversable" src="jcr://{1}/"/>
+ <map:transform src="dir2samples.xsl"/>
+ <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
+ <map:parameter name="contextPath" value="{request:contextPath}"/>
+ </map:transform>
+ <map:serialize/>
+ </map:match>
+ <map:match pattern="browse/**">
+ <map:generate src="jcr://{1}"/>
+ <map:transform src="dir2samples.xsl"/>
+ <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
+ <map:parameter name="contextPath" value="{request:contextPath}"/>
+ </map:transform>
+ <map:serialize/>
+ </map:match>
+
+ <map:match pattern="repository/">
<map:generate type="traversable" src="jcr://"/>
<map:serialize type="xml"/>
</map:match>
+ <map:match pattern="repository/**/">
+ <map:generate type="traversable" src="jcr://{1}/"/>
+ <map:serialize type="xml"/>
+ </map:match>
+ <map:match pattern="repository/**">
+ <map:generate src="jcr://{1}"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <!-- Mount sitemap from repository -->
+ <map:match pattern="mount/**">
+ <map:mount uri-prefix="mount" src="jcr://cocoon/sitemap" check-reload="yes"/>
+ </map:match>
+
</map:pipeline>
</map:pipelines>
</map:sitemap>