You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2009/03/19 14:05:13 UTC

svn commit: r755981 [1/3] - in /lenya/contributions/2_0_X/modules: atom/ atom/config/ atom/config/cocoon-xconf/ atom/java/ atom/java/src/ atom/java/src/org/ atom/java/src/org/apache/ atom/java/src/org/apache/lenya/ atom/java/src/org/apache/lenya/module...

Author: andreas
Date: Thu Mar 19 13:05:10 2009
New Revision: 755981

URL: http://svn.apache.org/viewvc?rev=755981&view=rev
Log:
Adding atom and rest modules.

Added:
    lenya/contributions/2_0_X/modules/atom/
    lenya/contributions/2_0_X/modules/atom/config/
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Assets.xconf
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Children.xconf
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Content.xconf
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Entry.xconf
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Lock.xconf
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Locks.xconf
    lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Workspace.xconf
    lenya/contributions/2_0_X/modules/atom/config/module.xml
    lenya/contributions/2_0_X/modules/atom/java/
    lenya/contributions/2_0_X/modules/atom/java/src/
    lenya/contributions/2_0_X/modules/atom/java/src/org/
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Assets.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AssetsView.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomHandler.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomUtil.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Children.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/ChildrenView.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Content.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/DocumentWrapper.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Entry.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/EntryView.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Lock.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LockView.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Locks.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LocksView.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/MessageView.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Workspace.java
    lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/WorkspaceView.java
    lenya/contributions/2_0_X/modules/atom/jx/
    lenya/contributions/2_0_X/modules/atom/jx/assets.jx
    lenya/contributions/2_0_X/modules/atom/jx/children.jx
    lenya/contributions/2_0_X/modules/atom/jx/entry.jx
    lenya/contributions/2_0_X/modules/atom/jx/lock.jx
    lenya/contributions/2_0_X/modules/atom/jx/locks.jx
    lenya/contributions/2_0_X/modules/atom/jx/message.jx
    lenya/contributions/2_0_X/modules/atom/jx/serviceLinks.jx
    lenya/contributions/2_0_X/modules/atom/jx/uuid2url.jx
    lenya/contributions/2_0_X/modules/atom/jx/workspace.jx
    lenya/contributions/2_0_X/modules/atom/sitemap.xmap
    lenya/contributions/2_0_X/modules/atom/test/
    lenya/contributions/2_0_X/modules/atom/test/canoo/
    lenya/contributions/2_0_X/modules/atom/test/canoo/dtd/
    lenya/contributions/2_0_X/modules/atom/test/canoo/dtd/Project.dtd
    lenya/contributions/2_0_X/modules/atom/test/canoo/resources/
    lenya/contributions/2_0_X/modules/atom/test/canoo/resources/concepts.html
    lenya/contributions/2_0_X/modules/atom/test/canoo/resources/conceptsEdited.html
    lenya/contributions/2_0_X/modules/atom/test/canoo/resources/conceptsInvalid.html
    lenya/contributions/2_0_X/modules/atom/test/canoo/resources/entry.xml
    lenya/contributions/2_0_X/modules/atom/test/canoo/resources/lock.xml
    lenya/contributions/2_0_X/modules/atom/test/canoo/resources/project-logo.png   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/WebTestOverview.junit.xml
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/WebTestOverview.xml
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/index.html
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/canoo.gif   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/collapseall.png   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/expandMinus.png   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/expandPlus.png   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/expandall.png   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/failed.gif   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/favicon.ico   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/less.gif   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/more.gif   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/ok.gif   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/optional.gif   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/todo.gif   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/images/webtest.jpg   (with props)
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/report.css
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/responseBrowser.html
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/responseBrowser.js
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/responseBrowserCommands.html
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/responseBrowserPreviews.html
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/showHide.js
    lenya/contributions/2_0_X/modules/atom/test/canoo/results/resources/sorttable.js
    lenya/contributions/2_0_X/modules/atom/test/canoo/test.xml
    lenya/contributions/2_0_X/modules/atom/xslt/
    lenya/contributions/2_0_X/modules/atom/xslt/entryMetaData.xsl
    lenya/contributions/2_0_X/modules/atom/xslt/prettyPrintEntry.xsl
    lenya/contributions/2_0_X/modules/rest/
    lenya/contributions/2_0_X/modules/rest/config/
    lenya/contributions/2_0_X/modules/rest/config/module.xml
    lenya/contributions/2_0_X/modules/rest/java/
    lenya/contributions/2_0_X/modules/rest/java/src/
    lenya/contributions/2_0_X/modules/rest/java/src/org/
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/lenya/
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/lenya/modules/
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/lenya/modules/resst/
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/lenya/modules/rest/
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/lenya/modules/rest/RestHandler.java
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/lenya/modules/rest/RestView.java
    lenya/contributions/2_0_X/modules/rest/java/src/org/apache/lenya/modules/rest/SimpleRestView.java
    lenya/contributions/2_0_X/modules/rest/rest.js

Added: lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Assets.xconf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Assets.xconf?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Assets.xconf (added)
+++ lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Assets.xconf Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.modules.atom.Assets']">
+  <component
+    role="org.apache.lenya.modules.atom.Assets" 
+    logger="lenya.modules.atom" 
+    class="org.apache.lenya.modules.atom.Assets"/>
+</xconf>

Added: lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Children.xconf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Children.xconf?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Children.xconf (added)
+++ lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Children.xconf Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.modules.atom.Children']">
+  <component
+    role="org.apache.lenya.modules.atom.Children" 
+    logger="lenya.modules.atom" 
+    class="org.apache.lenya.modules.atom.Children"/>
+</xconf>

Added: lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Content.xconf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Content.xconf?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Content.xconf (added)
+++ lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Content.xconf Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.modules.atom.Content']">
+  <component
+    role="org.apache.lenya.modules.atom.Content" 
+    logger="lenya.modules.atom" 
+    class="org.apache.lenya.modules.atom.Content"/>
+</xconf>

Added: lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Entry.xconf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Entry.xconf?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Entry.xconf (added)
+++ lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Entry.xconf Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.modules.atom.Entry']">
+  <component
+    role="org.apache.lenya.modules.atom.Entry" 
+    logger="lenya.modules.atom" 
+    class="org.apache.lenya.modules.atom.Entry"/>
+</xconf>

Added: lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Lock.xconf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Lock.xconf?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Lock.xconf (added)
+++ lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Lock.xconf Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.modules.atom.Lock']">
+  <component
+    role="org.apache.lenya.modules.atom.Lock" 
+    logger="lenya.modules.atom" 
+    class="org.apache.lenya.modules.atom.Lock"/>
+</xconf>

Added: lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Locks.xconf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Locks.xconf?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Locks.xconf (added)
+++ lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Locks.xconf Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.modules.atom.Locks']">
+  <component
+    role="org.apache.lenya.modules.atom.Locks" 
+    logger="lenya.modules.atom" 
+    class="org.apache.lenya.modules.atom.Locks"/>
+</xconf>

Added: lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Workspace.xconf
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Workspace.xconf?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Workspace.xconf (added)
+++ lenya/contributions/2_0_X/modules/atom/config/cocoon-xconf/Workspace.xconf Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="/cocoon/component[@role = 'org.apache.lenya.modules.atom.Workspace']">
+  <component
+    role="org.apache.lenya.modules.atom.Workspace" 
+    logger="lenya.modules.atom" 
+    class="org.apache.lenya.modules.atom.Workspace"/>
+</xconf>

Added: lenya/contributions/2_0_X/modules/atom/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/config/module.xml?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/config/module.xml (added)
+++ lenya/contributions/2_0_X/modules/atom/config/module.xml Thu Mar 19 13:05:10 2009
@@ -0,0 +1,26 @@
+<?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.
+-->
+
+<module xmlns="http://apache.org/lenya/module/1.0">
+  <id>org.apache.lenya.modules.atom</id>
+  <depends module="org.apache.lenya.modules.rest"/>
+  <package>org.apache.lenya.modules</package>
+  <version>1.0-alpha1</version>
+  <name>Atom Syndication Format and Publishing Protocol</name>
+  <lenya-version>@lenya.version@</lenya-version>
+  <description>Support for the Atom Syndication Format and Publishing Protocol</description>
+</module>

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Assets.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Assets.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Assets.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Assets.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,157 @@
+package org.apache.lenya.modules.atom;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.StringTokenizer;
+
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Response;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.io.IOUtils;
+import org.apache.lenya.cms.metadata.MetaData;
+import org.apache.lenya.cms.metadata.dublincore.DublinCore;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentLocator;
+import org.apache.lenya.cms.publication.DocumentManager;
+import org.apache.lenya.cms.publication.Proxy;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.publication.ResourceType.Sample;
+import org.apache.lenya.cms.site.SiteUtil;
+import org.apache.lenya.modules.rest.RestView;
+import org.apache.lenya.util.Assert;
+
+public class Assets extends AtomHandler {
+
+    protected static final String HEADER_SLUG = "Slug";
+    protected static final String HEADER_LOCATION = "Location";
+    protected static final String ASSET_RESOURCE_TYPE = "resource";
+    protected static final String HEADER_CONTENT_LANGUAGE = "Content-Language";
+    protected static final String CONTENT_TYPE_URLENCODED = "application/x-www-form-urlencoded";
+
+    public RestView delete() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView get() throws Exception {
+        DocumentWrapper wrapper = getDocumentWrapper();
+        if (wrapper == null) {
+            return new AssetsView(this.manager, getArea());
+        } else {
+            return new AssetsView(this.manager, wrapper.getDocument());
+        }
+    }
+
+    public RestView post() throws Exception {
+        DocumentManager documentManager = null;
+        ServiceSelector selector = null;
+        ResourceType resourceType = null;
+        try {
+            Document parent = getModifiableDocument();
+            Publication pub = parent.getPublication();
+            DocumentFactory factory = pub.getFactory();
+
+            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
+            selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
+            resourceType = (ResourceType) selector.select(ASSET_RESOURCE_TYPE);
+
+            String slug = getHeader(HEADER_SLUG);
+            String language = getHeader(HEADER_CONTENT_LANGUAGE, parent.getLanguage());
+            String mimeType = getRequest().getContentType();
+            // FIXME: Canoo WebTest doesn't allow to set the Content-Type
+            // header
+            if (mimeType.equals(CONTENT_TYPE_URLENCODED)) {
+                mimeType = "image/png";
+            }
+
+            StringTokenizer tokens = new StringTokenizer(slug, ".");
+            String name = getValidDocumentName(tokens.nextToken());
+
+            String extension = tokens.nextToken();
+            Assert.isTrue("Slug contains only one dot", !tokens.hasMoreTokens());
+
+            String path = getAvailablePath(name, language);
+            String title = name.substring(0, 1).toUpperCase() + name.substring(1);
+
+            boolean visibleInNav = false;
+
+            Sample sample = resourceType.getSample(resourceType.getSampleNames()[0]);
+            Document document = documentManager.add(factory, resourceType, sample.getUri(), pub,
+                    parent.getArea(), path, language, extension, title, visibleInNav);
+
+            InputStream in = getInputStream();
+            OutputStream out = document.getOutputStream();
+            try {
+                IOUtils.copy(in, out);
+            } finally {
+                if (in != null) {
+                    in.close();
+                }
+                if (out != null) {
+                    out.flush();
+                    out.close();
+                }
+            }
+
+            document.setMimeType(mimeType);
+
+            MetaData dublinCore = document.getMetaData(DublinCore.DC_NAMESPACE);
+            dublinCore.setValue(DublinCore.ELEMENT_TITLE, title);
+
+            document.getSession().commit();
+            setLocationHeader(document);
+            return new MessageView("Asset successfully added.", HttpStatus.SC_CREATED);
+        } catch (Exception e) {
+            getLogger().error("Could not add asset: ", e);
+            return new MessageView("Asset could not be added.", HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        } finally {
+            if (documentManager != null) {
+                this.manager.release(documentManager);
+            }
+            if (selector != null) {
+                if (resourceType != null) {
+                    selector.release(resourceType);
+                }
+                this.manager.release(selector);
+            }
+        }
+    }
+
+    protected void setLocationHeader(Document document) {
+        Response response = ObjectModelHelper.getResponse(getObjectModel());
+        Proxy proxy = document.getPublication().getProxy(document, getRequest().isSecure());
+        response.setHeader(HEADER_LOCATION, proxy.getURL(document) + "?lenya.usecase=atom.entry");
+    }
+
+    public RestView put() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    protected String getHeader(String name) {
+        String value = getRequest().getHeader(name);
+        Assert.notNull(name + " header", value);
+        return value;
+    }
+
+    protected String getHeader(String name, String defaultValue) {
+        Assert.notNull("default value for header " + name, defaultValue);
+        String value = getRequest().getHeader(name);
+        return value != null ? value : defaultValue;
+    }
+
+    protected String getValidDocumentName(String name) {
+        return name.replaceAll("[^A-Za-z0-9]", "");
+    }
+
+    protected String getAvailablePath(String name, String language) throws Exception {
+        Document doc = getDocumentWrapper().getDocument();
+        DocumentLocator requestedLocator = doc.getLocator().getChild(name).getLanguageVersion(
+                language);
+        DocumentLocator availableLocator = SiteUtil.getAvailableLocator(this.manager, doc
+                .getFactory(), requestedLocator);
+        return availableLocator.getPath();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AssetsView.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AssetsView.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AssetsView.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AssetsView.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,54 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.lenya.cms.publication.Area;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentException;
+import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.modules.atom.AtomUtil.DocumentFilter;
+
+public class AssetsView extends ChildrenView {
+
+    public AssetsView(ServiceManager manager, Document doc) {
+        super(manager, doc);
+    }
+
+    public AssetsView(ServiceManager manager, Area area) {
+        super(manager, area);
+    }
+
+    protected DocumentFilter getFilter() {
+        return new DocumentFilter() {
+            public boolean matches(Document doc) {
+                try {
+                    return doc.getResourceType().getName().equals(Assets.ASSET_RESOURCE_TYPE);
+                } catch (DocumentException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        };
+    }
+
+    public String[] getAssetMimeTypes() throws Exception {
+        ServiceSelector selector = null;
+        ResourceType resourceType = null;
+        try {
+            selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
+            resourceType = (ResourceType) selector.select(Assets.ASSET_RESOURCE_TYPE);
+            return resourceType.getMimeTypes();
+        } finally {
+            if (selector != null) {
+                if (resourceType != null) {
+                    selector.release(resourceType);
+                }
+                this.manager.release(selector);
+            }
+        }
+    }
+    
+    public String getUri() {
+        return "assets.xml";
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomHandler.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomHandler.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomHandler.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomHandler.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,138 @@
+/*
+ * 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.lenya.modules.atom;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.component.Component;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.http.HttpEnvironment;
+import org.apache.cocoon.util.PostInputStream;
+import org.apache.lenya.ac.Identity;
+import org.apache.lenya.cms.cocoon.components.context.ContextUtility;
+import org.apache.lenya.cms.publication.Area;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.lenya.cms.publication.DocumentUtil;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.URLInformation;
+import org.apache.lenya.cms.repository.RepositoryUtil;
+import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.modules.rest.RestHandler;
+import org.apache.lenya.util.ServletHelper;
+
+public abstract class AtomHandler extends AbstractLogEnabled implements Initializable, Serviceable,
+        Component, RestHandler {
+
+    protected static final String WORKFLOW_EVENT = "edit";
+
+    private DocumentWrapper documentWrapper;
+    protected ServiceManager manager;
+
+    private Request request;
+
+    private Map objectModel;
+
+    private Identity identity;
+
+    private Area area;
+
+    public void initialize() throws Exception {
+        ContextUtility context = null;
+        try {
+            context = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
+            this.request = context.getRequest();
+            this.objectModel = context.getObjectModel();
+            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, this.request);
+            this.identity = factory.getSession().getIdentity();
+            final String url = ServletHelper.getWebappURI(this.request);
+            URLInformation info = new URLInformation(url);
+            Publication pub = factory.getPublication(info.getPublicationId());
+            this.area = pub.getArea(info.getArea());
+            if (factory.isDocument(url)) {
+                Document document = factory.getFromURL(url);
+                this.documentWrapper = new DocumentWrapper(document);
+            }
+        } finally {
+            if (context != null) {
+                this.manager.release(context);
+            }
+        }
+    }
+    
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+    }
+
+    protected Document getModifiableDocument() throws Exception {
+        Identity identity = getIdentity();
+        if (identity == null) {
+            String msg = "Can't obtain modifiable document without being logged in.";
+            throw new RuntimeException(msg);
+        }
+        Session session = RepositoryUtil.createSession(this.manager, identity, true);
+        DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
+        return factory.get(getDocumentWrapper().getDocument().getIdentifier());
+    }
+
+    protected DocumentWrapper getDocumentWrapper() {
+        return this.documentWrapper;
+    }
+
+    protected Identity getIdentity() {
+        return this.identity;
+    }
+
+    /**
+     * @return The input stream of the current request.
+     * @throws IOException
+     *             if the request content is empty.
+     */
+    protected InputStream getInputStream() throws IOException {
+        HttpServletRequest httpRequest = (HttpServletRequest) this.objectModel
+                .get(HttpEnvironment.HTTP_REQUEST_OBJECT);
+        int len = this.request.getContentLength();
+        if (len > 0) {
+            return new PostInputStream(httpRequest.getInputStream(), len);
+        } else {
+            throw new IOException("content length is 0");
+        }
+    }
+
+    protected Request getRequest() {
+        return this.request;
+    }
+    
+    protected Area getArea() {
+        return this.area;
+    }
+    
+    protected Map getObjectModel() {
+        return this.objectModel;
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomUtil.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomUtil.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomUtil.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/AtomUtil.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,42 @@
+package org.apache.lenya.modules.atom;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.site.SiteException;
+import org.apache.lenya.cms.site.SiteNode;
+
+public class AtomUtil {
+
+    /**
+     * @param nodes The site nodes to include.
+     * @param filter The document filter to apply.
+     * @param recursive If the tree should be traversed recursively.
+     * @return A list of {@link Document}s.
+     * @throws SiteException if an error occurs.
+     */
+    protected static List getChildList(SiteNode[] nodes, DocumentFilter filter, boolean recursive)
+            throws SiteException {
+        List children = new ArrayList();
+        for (int i = 0; i < nodes.length; i++) {
+            String[] languages = nodes[i].getLanguages();
+            for (int l = 0; l < languages.length; l++) {
+                Document document = nodes[i].getLink(languages[l]).getDocument();
+                if (filter.matches(document)) {
+                    children.add(document);
+                }
+            }
+            if (recursive) {
+                SiteNode[] subNodes = nodes[i].getChildren();
+                children.addAll(getChildList(subNodes, filter, true));
+            }
+        }
+        return children;
+    }
+    
+    public static interface DocumentFilter {
+        boolean matches(Document doc);
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Children.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Children.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Children.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Children.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,28 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.lenya.modules.rest.RestView;
+
+public class Children extends AtomHandler {
+
+    public RestView delete() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView get() throws Exception {
+        DocumentWrapper wrapper = getDocumentWrapper();
+        if (wrapper == null) {
+            return new ChildrenView(this.manager, getArea());
+        } else {
+            return new ChildrenView(this.manager, wrapper.getDocument());
+        }
+    }
+
+    public RestView post() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView put() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/ChildrenView.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/ChildrenView.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/ChildrenView.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/ChildrenView.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,66 @@
+package org.apache.lenya.modules.atom;
+
+import java.util.List;
+
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.cms.publication.Area;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.site.SiteNode;
+import org.apache.lenya.modules.atom.AtomUtil.DocumentFilter;
+import org.apache.lenya.modules.rest.RestView;
+import org.apache.lenya.util.Assert;
+
+public class ChildrenView implements RestView {
+
+    protected ServiceManager manager;
+    private Document document;
+    private Area area;
+    
+    public ChildrenView(ServiceManager manager, Document doc) {
+        this(manager);
+        Assert.notNull("document", doc);
+        this.document = doc;
+    }
+
+    public ChildrenView(ServiceManager manager, Area area) {
+        this(manager);
+        Assert.notNull("area", area);
+        this.area = area;
+    }
+
+    private ChildrenView(ServiceManager manager) {
+        Assert.notNull("manager", manager);
+        this.manager = manager;
+    }
+    
+    public Document[] getDocuments() throws Exception {
+        List children;
+        if (this.document == null) {
+            SiteNode[] nodes = this.area.getSite().getTopLevelNodes();
+            children = AtomUtil.getChildList(nodes, getFilter(), true);
+        } else {
+            SiteNode node = this.document.getLink().getNode();
+            SiteNode[] nodes = node.getChildren();
+            children = AtomUtil.getChildList(nodes, getFilter(), false);
+        }
+        return (Document[]) children.toArray(new Document[children.size()]);
+    }
+
+    protected DocumentFilter getFilter() {
+        return new DocumentFilter() {
+            public boolean matches(Document doc) {
+                return true;
+            }
+        };
+    }
+
+    public int getStatusCode() {
+        return HttpStatus.SC_OK;
+    }
+
+    public String getUri() {
+        return "children.xml";
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Content.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Content.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Content.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Content.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,97 @@
+package org.apache.lenya.modules.atom;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.workflow.WorkflowUtil;
+import org.apache.lenya.modules.rest.RestView;
+import org.apache.lenya.modules.rest.SimpleRestView;
+import org.apache.lenya.xml.DocumentHelper;
+import org.apache.lenya.xml.Schema;
+import org.apache.lenya.xml.ValidationUtil;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class Content extends AtomHandler {
+
+    public RestView put() throws Exception {
+        Document doc = getModifiableDocument();
+        DocumentWrapper wrapper = getDocumentWrapper();
+        if (!wrapper.canCheckOut()) {
+            String msg = "Can't save document " + wrapper
+            + " since it is already checked out by a different user.";
+            return new MessageView(msg, HttpStatus.SC_PRECONDITION_FAILED);
+        }
+
+        org.w3c.dom.Document xmlDoc = DocumentHelper.readDocument(getInputStream());
+
+        ResourceType resourceType = doc.getResourceType();
+        Schema schema = resourceType.getSchema();
+        List errors = new ArrayList();
+        ValidationErrorHandler validationHandler = new ValidationErrorHandler(errors);
+        ValidationUtil.validate(this.manager, xmlDoc, schema, validationHandler);
+
+        if (validationHandler.success()) {
+            SourceUtil.writeDOM(xmlDoc, doc.getOutputStream());
+            Session session = doc.getSession();
+            WorkflowUtil.invoke(this.manager, session, getLogger(), doc, WORKFLOW_EVENT);
+            session.commit();
+            wrapper.checkout();
+            return new MessageView("Document successfully saved.", HttpStatus.SC_OK);
+        } else {
+            String msg = "Validation failed:\n";
+            for (Iterator i = errors.iterator(); i.hasNext(); ) {
+                msg = msg + "\n" + i.next();
+            }
+            return new MessageView(msg, HttpStatus.SC_PRECONDITION_FAILED);
+        }
+    }
+
+    protected static class ValidationErrorHandler implements org.xml.sax.ErrorHandler {
+
+        private boolean success = true;
+        private List errors;
+
+        public ValidationErrorHandler(List errors) {
+            this.errors = errors;
+        }
+
+        public boolean success() {
+            return this.success;
+        }
+
+        public void error(SAXParseException exception) throws SAXException {
+            this.success = false;
+            errors.add(exception.getMessage());
+        }
+
+        public void fatalError(SAXParseException exception) throws SAXException {
+            this.success = false;
+            errors.add(exception.getMessage());
+        }
+
+        public void warning(SAXParseException exception) throws SAXException {
+            errors.add(exception.getMessage());
+        }
+
+    }
+
+    public RestView delete() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView get() throws Exception {
+        return new SimpleRestView("content.xml", HttpStatus.SC_OK);
+    }
+
+    public RestView post() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/DocumentWrapper.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/DocumentWrapper.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/DocumentWrapper.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/DocumentWrapper.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,48 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.util.Assert;
+
+public class DocumentWrapper {
+    
+    private Document document;
+    
+    public DocumentWrapper(Document doc) {
+        Assert.notNull("document", doc);
+        this.document = doc;
+    }
+    
+    public Document getDocument() {
+        return this.document;
+    }
+
+    public boolean canCheckIn() throws Exception {
+        return getDocument().getRepositoryNode().isCheckedOut();
+    }
+
+    public void checkin() throws Exception {
+        Node node = getDocument().getRepositoryNode();
+        if (node.isCheckedOutBySession(node.getSession())) {
+            node.checkin();
+        } else {
+            node.forceCheckIn();
+        }
+    }
+
+    public boolean canCheckOut() throws Exception {
+        Document doc = getDocument();
+        String userId = doc.getSession().getIdentity().getUser().getId();
+        Node node = doc.getRepositoryNode();
+        return !node.isCheckedOut() || node.getCheckoutUserId().equals(userId);
+    }
+
+    public void checkout() throws Exception {
+        getDocument().getRepositoryNode().checkout(false);
+    }
+
+    public String toString() {
+        return getDocument().getCanonicalWebappURL();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Entry.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Entry.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Entry.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Entry.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,107 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.cms.metadata.Element;
+import org.apache.lenya.cms.metadata.ElementSet;
+import org.apache.lenya.cms.metadata.MetaData;
+import org.apache.lenya.cms.metadata.MetaDataRegistry;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.workflow.WorkflowUtil;
+import org.apache.lenya.modules.rest.RestView;
+import org.apache.lenya.xml.DocumentHelper;
+
+public class Entry extends AtomHandler {
+
+    public RestView delete() throws Exception {
+        try {
+            Document doc = getModifiableDocument();
+            Session session = doc.getSession();
+            doc.getLink().delete();
+            doc.delete();
+            session.commit();
+        } catch (Exception e) {
+            getLogger().error("Could not delete document: ", e);
+            String msg = "Could not delete document: " + e.getMessage();
+            return new MessageView(msg, HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        }
+        return new MessageView("Document successfully deleted.", HttpStatus.SC_OK);
+    }
+
+    public RestView get() throws Exception {
+        return new EntryView(getDocumentWrapper().getDocument());
+    }
+
+    public RestView post() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView put() throws Exception {
+        try {
+            Document doc = getModifiableDocument();
+            DocumentWrapper wrapper = getDocumentWrapper();
+            if (!wrapper.canCheckOut()) {
+                String msg = "Can't save document " + wrapper
+                        + " since it is already checked out by a different user.";
+                return new MessageView(msg, HttpStatus.SC_PRECONDITION_FAILED);
+            }
+
+            org.w3c.dom.Document xmlDoc = DocumentHelper.readDocument(getInputStream());
+            org.w3c.dom.Element docElem = xmlDoc.getDocumentElement();
+
+            Session session = doc.getSession();
+            MetaDataRegistry registry = null;
+
+            try {
+                registry = (MetaDataRegistry) this.manager.lookup(MetaDataRegistry.ROLE);
+                String[] namespaces = registry.getNamespaceUris();
+                for (int ns = 0; ns < namespaces.length; ns++) {
+                    String namespace = namespaces[ns];
+                    MetaData metaData = doc.getMetaData(namespace);
+                    ElementSet elementSet = registry.getElementSet(namespace);
+                    Element[] elements = elementSet.getElements();
+                    for (int e = 0; e < elements.length; e++) {
+                        Element element = elements[e];
+                        if (element.isEditable()) {
+                            String name = element.getName();
+                            org.w3c.dom.Element xmlElems[] = DocumentHelper.getChildren(docElem,
+                                    namespace, name);
+                            if (xmlElems.length == 1) {
+                                metaData.setValue(name, getTrimmedValue(xmlElems[0]));
+                            } else if (xmlElems.length > 1) {
+                                if (element.isMultiple()) {
+                                    metaData.removeAllValues(name);
+                                    for (int v = 0; v < xmlElems.length; v++) {
+                                        metaData.addValue(name, getTrimmedValue(xmlElems[v]));
+                                    }
+                                } else {
+                                    metaData.setValue(name, getTrimmedValue(xmlElems[0]));
+                                    getLogger().warn(
+                                            "Ignoring some values for non-multiple element ["
+                                                    + element.getName() + "]");
+                                }
+                            }
+                        }
+                    }
+                }
+            } finally {
+                if (registry != null) {
+                    this.manager.release(registry);
+                }
+            }
+
+            WorkflowUtil.invoke(this.manager, session, getLogger(), doc, WORKFLOW_EVENT);
+            session.commit();
+            return new MessageView("Meta data successfully saved.", HttpStatus.SC_OK);
+        } catch (Exception e) {
+            getLogger().error("Could not save meta data: ", e);
+            String msg = "Could not save meta data: " + e.getMessage();
+            return new MessageView(msg, HttpStatus.SC_INTERNAL_SERVER_ERROR);
+        }
+    }
+
+    protected String getTrimmedValue(org.w3c.dom.Element element) {
+        return DocumentHelper.getSimpleElementText(element).trim();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/EntryView.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/EntryView.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/EntryView.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/EntryView.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,54 @@
+package org.apache.lenya.modules.atom;
+
+import java.net.MalformedURLException;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.lang.StringUtils;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.ResourceType;
+import org.apache.lenya.modules.rest.RestView;
+import org.apache.lenya.util.Assert;
+import org.apache.lenya.xml.Schema;
+
+public class EntryView implements RestView {
+    
+    private Document document;
+
+    public EntryView(Document doc) {
+        Assert.notNull("document", doc);
+        this.document = doc;
+    }
+
+    public int getStatusCode() {
+        return HttpStatus.SC_OK;
+    }
+
+    public String getUri() {
+        return "entry.xml";
+    }
+    
+    public Document getDocument() throws Exception {
+        return this.document;
+    }
+    
+    public String getSchemaUri() throws Exception {
+        Document doc = getDocument();
+        ResourceType type = doc.getResourceType();
+        Schema schema = type.getSchema();
+        if (schema == null) {
+            throw new RuntimeException("The resource type '" + type.getName() + "' has no schema.");
+        }
+        else {
+            String uri = schema.getURI();
+            if (uri.startsWith("fallback://lenya/modules/")) {
+                String path = StringUtils.substringAfter(uri, "fallback://lenya/modules/");
+                String module = StringUtils.substringBefore(path, "/");
+                path = StringUtils.substringAfter(path, module + "/resources");
+                return "/" + doc.getPublication().getId() + "/modules/" + module + path;
+            } else {
+                throw new MalformedURLException("Don't know how to create HTTP URL from : " + uri);
+            }
+        }
+    }
+    
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Lock.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Lock.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Lock.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Lock.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,37 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.modules.rest.RestView;
+
+public class Lock extends AtomHandler {
+
+    public RestView delete() throws Exception {
+        DocumentWrapper wrapper = getDocumentWrapper();
+        if (wrapper.canCheckIn()) {
+            wrapper.checkin();
+            return new MessageView("Document successfully unlocked.", HttpStatus.SC_OK);
+        }
+        else {
+            return new MessageView("Could not unlock document.", HttpStatus.SC_PRECONDITION_FAILED);
+        }
+    }
+
+    public RestView get() throws Exception {
+        DocumentWrapper wrapper = getDocumentWrapper();
+        if (wrapper.getDocument().getRepositoryNode().isCheckedOut()) {
+            return new LockView(getDocumentWrapper().getDocument());
+        }
+        else {
+            return new MessageView("Document is not locked.", HttpStatus.SC_NOT_FOUND);
+        }
+    }
+
+    public RestView post() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView put() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LockView.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LockView.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LockView.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LockView.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,22 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.modules.rest.SimpleRestView;
+import org.apache.lenya.util.Assert;
+
+public class LockView extends SimpleRestView {
+
+    private Document document;
+
+    public LockView(Document doc) {
+        super("lock.xml", HttpStatus.SC_OK);
+        Assert.notNull("document", doc);
+        this.document = doc;
+    }
+    
+    public Document getDocument() {
+        return this.document;
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Locks.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Locks.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Locks.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Locks.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,41 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Response;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.cms.publication.Proxy;
+import org.apache.lenya.modules.rest.RestView;
+
+public class Locks extends AtomHandler {
+
+    protected static final String HEADER_LOCATION = "Location";
+
+    public RestView delete() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView get() throws Exception {
+        return new LocksView(getDocumentWrapper().getDocument());
+    }
+
+    public RestView post() throws Exception {
+        DocumentWrapper wrapper = getDocumentWrapper();
+        if (wrapper.canCheckOut()) {
+            wrapper.checkout();
+            Response response = ObjectModelHelper.getResponse(getObjectModel());
+            Document document = wrapper.getDocument();
+            Proxy proxy = document.getPublication().getProxy(document, getRequest().isSecure());
+            response.setHeader(HEADER_LOCATION, proxy.getURL(document) + "?lenya.usecase=atom.lock");
+            return new MessageView("Document successfully locked.", HttpStatus.SC_CREATED);
+        }
+        else {
+            return new MessageView("Document can't be locked.", HttpStatus.SC_PRECONDITION_FAILED);
+        }
+    }
+
+    public RestView put() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LocksView.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LocksView.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LocksView.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/LocksView.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,22 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.cms.publication.Document;
+import org.apache.lenya.modules.rest.SimpleRestView;
+import org.apache.lenya.util.Assert;
+
+public class LocksView extends SimpleRestView {
+
+    private Document document;
+
+    public LocksView(Document doc) {
+        super("locks.xml", HttpStatus.SC_OK);
+        Assert.notNull("document", doc);
+        this.document = doc;
+    }
+    
+    public Document getDocument() {
+        return this.document;
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/MessageView.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/MessageView.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/MessageView.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/MessageView.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,20 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.lenya.modules.rest.SimpleRestView;
+import org.apache.lenya.util.Assert;
+
+public class MessageView extends SimpleRestView {
+
+    private String message;
+
+    public MessageView(String message, int statusCode) {
+        super("message.txt", statusCode);
+        Assert.notNull("message", message);
+        this.message = message;
+    }
+    
+    public String getMessage() {
+        return this.message;
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Workspace.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Workspace.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Workspace.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/Workspace.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,24 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.lenya.modules.rest.RestView;
+
+public class Workspace extends AtomHandler {
+
+    public RestView delete() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView get() throws Exception {
+        return new WorkspaceView(getArea(), "workspace.xml", HttpStatus.SC_OK);
+    }
+
+    public RestView post() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+    public RestView put() throws Exception {
+        throw new UnsupportedOperationException();
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/WorkspaceView.java
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/WorkspaceView.java?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/WorkspaceView.java (added)
+++ lenya/contributions/2_0_X/modules/atom/java/src/org/apache/lenya/modules/atom/WorkspaceView.java Thu Mar 19 13:05:10 2009
@@ -0,0 +1,21 @@
+package org.apache.lenya.modules.atom;
+
+import org.apache.lenya.cms.publication.Area;
+import org.apache.lenya.modules.rest.SimpleRestView;
+import org.apache.lenya.util.Assert;
+
+public class WorkspaceView extends SimpleRestView {
+
+    private Area area;
+
+    public WorkspaceView(Area area, String uri, int statusCode) {
+        super(uri, statusCode);
+        Assert.notNull("area", area);
+        this.area = area;
+    }
+    
+    public Area getArea() {
+        return this.area;
+    }
+
+}

Added: lenya/contributions/2_0_X/modules/atom/jx/assets.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/assets.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/assets.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/assets.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<collection xmlns="http://www.w3.org/2007/app"
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <jx:forEach var="mimeType" items="${view.getAssetMimeTypes()}">
+    <accept>${mimeType}</accept>
+  </jx:forEach>
+  <jx:forEach var="doc" items="${view.getDocuments()}">
+    <member href="${doc.getCanonicalWebappURL()}?lenya.usecase=atom.entry"
+      title="${doc.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}"/>
+  </jx:forEach>
+</collection>

Added: lenya/contributions/2_0_X/modules/atom/jx/children.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/children.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/children.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/children.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<collection xmlns="http://www.w3.org/2007/app"
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <jx:forEach var="doc" items="${view.getDocuments()}">
+    <member href="${doc.getCanonicalWebappURL()}?lenya.usecase=atom.entry"
+      title="${doc.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}"/>
+  </jx:forEach>
+</collection>

Added: lenya/contributions/2_0_X/modules/atom/jx/entry.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/entry.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/entry.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/entry.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<entry xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+  xmlns="http://www.w3.org/2005/Atom"
+  xmlns:meta="http://apache.org/lenya/metadata/1.0">
+  
+  <jx:set var="document" value="${view.getDocument()}"/>
+  <jx:set var="docUrl" value="${document.getCanonicalWebappURL()}"/>
+  <jx:set var="dcElements" value="${document.getMetaData('http://purl.org/dc/elements/1.1/')}"/>
+  
+  <id>${document.getUUID()}:${document.getLanguage()}</id>
+  <title type="text">${document.getLink().getLabel()}</title>
+  <summary>${dcElements.getFirstValue('title')}</summary>
+  <author>${dcElements.getFirstValue('creator')}</author>
+  <category scheme="http://apache.org/lenya/atom/categories/language">${document.getLanguage()}</category>
+  <updated>${document.getLastModified()}</updated>
+  <content type="${document.getMimeType()}" src="lenya-document:${document.getUUID()},lang=${document.getLanguage()}"/>
+  
+  <jx:forEach var="namespace" items="${document.getMetaDataNamespaceUris()}">
+    <jx:set var="metadata" value="${document.getMetaData(namespace)}"/>
+    <jx:forEach var="element" items="${metadata.getElementSet().getElements()}">
+      <jx:if test="${element.isEditable()}">
+        <jx:set var="name" value="${element.getName()}"/>
+        <jx:forEach var="value" items="${metadata.getValues(name)}">
+          <meta:element namespace="${namespace}" name="${name}">${value}</meta:element>
+        </jx:forEach>
+      </jx:if>
+    </jx:forEach>
+  </jx:forEach>
+  
+  <link rel="edit" type="application/atom+xml" href="${docUrl}?lenya.usecase=atom.entry"/>
+  <link rel="lock" type="application/atomcoll+xml" href="${docUrl}?lenya.usecase=atom.locks"/>
+  <link rel="assets" type="application/atomcoll+xml" href="${docUrl}?lenya.usecase=atom.assets"/>
+  <link rel="children" type="application/atomcoll+xml" href="${docUrl}?lenya.usecase=atom.children"/>
+  <link rel="edit-media" type="${document.getMimeType()}" href="${docUrl}?lenya.usecase=atom.content"/>
+  
+  <jx:set var="formats" value="${Packages.java.util.Arrays.asList(document.getResourceType().getFormats())}"/>
+  <jx:if test="${formats.contains('xhtml.xsl')}">
+    <edit:edit xmlns:edit="http://apache.org/lenya/editing">
+      <edit:styles>
+        <edit:style transformPageContext="false"
+          href="/modules/atom${document.getResourceType().getFormatURI('xhtml.xsl')}">
+          <edit:parameter name="editor" value="firedocs"/>
+        </edit:style>
+      </edit:styles>
+      <edit:page-context href="${docUrl}#content"/>
+      <edit:inserts href="${docUrl}?lenya.usecase=atom.inserts"/>
+      <edit:schema type="relaxNG" href="${view.getSchemaUri()}"/>
+      <edit:uri-resolver protocol="lenya-document"
+        href="${docUrl}?lenya.usecase=atom.uuid2url&amp;url="/>
+    </edit:edit>
+  </jx:if>
+</entry>
+

Added: lenya/contributions/2_0_X/modules/atom/jx/lock.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/lock.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/lock.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/lock.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<entry xmlns="http://www.w3.org/2005/Atom"
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <jx:set var="document" value="${view.getDocument()}"/>
+  <title>
+    Lock for resource '${document.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}'
+  </title>
+  <link rel="self" type="application/atom+xml"
+    href="${document.getCanonicalWebappURL()}?lenya.usecase=atom.lock"/>
+  <id>lock:${document.getUUID()}:${document.getLanguage()}</id>
+  <author><name>${document.getRepositoryNode().getCheckoutUserId()}</name></author>
+</entry>

Added: lenya/contributions/2_0_X/modules/atom/jx/locks.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/locks.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/locks.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/locks.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<collection xmlns="http://www.w3.org/2007/app"
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <jx:set var="document" value="${view.getDocument()}"/>
+  <jx:set var="node" value="${document.getRepositoryNode()}"/>
+  <jx:if test="${node.isCheckedOut()}">
+    <member href="${document.getCanonicalWebappURL()}?lenya.usecase=atom.lock"
+      title="Lock for resource '${document.getMetaData('http://purl.org/dc/elements/1.1/').getFirstValue('title')}' by user '${node.getCheckoutUserId()}'"/>
+  </jx:if>
+</collection>

Added: lenya/contributions/2_0_X/modules/atom/jx/message.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/message.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/message.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/message.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+  xmlns="http://www.w3.org/2005/Atom">${view.getMessage()}</jx:template>

Added: lenya/contributions/2_0_X/modules/atom/jx/serviceLinks.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/serviceLinks.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/serviceLinks.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/serviceLinks.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<head xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  <jx:set var="pub" value="${parameters.getParameter('pub')}"/>
+  <jx:set var="area" value="${parameters.getParameter('area')}"/>
+  <jx:set var="documentUrl" value="${parameters.getParameter('documentUrl')}"/>
+  <link rel="service" type="application/atomserv+xml"
+    href="/${pub}/${area}/?lenya.usecase=atom.workspace"
+    title="Atom Publishing Protocol Service Document"/>
+  <link rel="service.edit" type="application/x.atom+xml"
+    href="/${pub}/${area}${documentUrl}?lenya.usecase=atom.entry"
+    title="Edit with atompub"/>
+</head>

Added: lenya/contributions/2_0_X/modules/atom/jx/uuid2url.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/uuid2url.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/uuid2url.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/uuid2url.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">${parameters.getParameter('url')}</jx:template>
\ No newline at end of file

Added: lenya/contributions/2_0_X/modules/atom/jx/workspace.jx
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/jx/workspace.jx?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/jx/workspace.jx (added)
+++ lenya/contributions/2_0_X/modules/atom/jx/workspace.jx Thu Mar 19 13:05:10 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<service xmlns="http://www.w3.org/2007/app"
+  xmlns:atom="http://www.w3.org/2005/Atom"
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
+  >
+  <jx:set var="area" value="${view.getArea()}"/>
+  <jx:set var="url" value="${'/' + area.getPublication().getId() + '/' + area.getName() + '/'}"/>
+  <workspace>
+    <atom:title>Documents</atom:title>
+    <collection href="${url}?lenya.usecase=atom.children">
+      <atom:title>Top Level Documents</atom:title>
+      <accept>application/atom+xml;type=entry</accept>
+      <categories fixed="yes">
+        <jx:forEach var="lang" items="${area.getPublication().getLanguages()}">
+          <atom:category scheme="http://apache.org/lenya/atom/categories/language" term="${lang}" />
+        </jx:forEach>
+      </categories>
+    </collection>
+  </workspace>
+  <workspace>
+    <atom:title>Assets</atom:title>
+    <collection href="${url}?lenya.usecase=atom.assets">
+      <atom:title>Global Assets</atom:title>
+      <accept>image/png</accept>
+      <accept>image/jpeg</accept>
+      <accept>image/gif</accept>
+    </collection>
+  </workspace>
+  <firedocs:metadata xmlns:firedocs="www.firedocs.org/metadata/1.0">
+    <firedocs:schema type="relaxNG" href="/modules/firedocs/metadata.rng"/>
+  </firedocs:metadata>
+</service>

Added: lenya/contributions/2_0_X/modules/atom/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/sitemap.xmap?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/sitemap.xmap (added)
+++ lenya/contributions/2_0_X/modules/atom/sitemap.xmap Thu Mar 19 13:05:10 2009
@@ -0,0 +1,103 @@
+<?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.
+-->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+  
+  <map:components>
+    <map:transformers default="xslt">
+      <map:transformer name="proxy-xsl" logger="lenya.sitemap.transformer.proxy"
+        src="org.apache.lenya.cms.cocoon.transformation.ProxyTransformer">
+        <urls type="relative"/>
+        <transform namespace="http://www.w3.org/1999/XSL/Transform" element="include" attribute="href"/>
+        <transform namespace="http://www.w3.org/1999/XSL/Transform" element="import" attribute="href"/>
+      </map:transformer>
+    </map:transformers>
+  </map:components>
+  
+  <map:flow language="javascript">
+    <map:script src="fallback://lenya/modules/rest/rest.js"/>
+  </map:flow>
+  
+  <map:pipelines>
+      
+    <map:pipeline type="noncaching">
+      
+      <map:match pattern="view/content.xml">
+        <map:read mime-type="application/xml" src="lenya-document:"/>
+      </map:match>
+      
+      <!--
+        Generic REST usecase views.
+      -->
+      <map:match pattern="view/*.*">
+        <map:generate type="jx" src="jx/{1}.jx"/>
+        <map:match pattern="view/*.txt">
+          <map:serialize type="text" status-code="{flow-attr:view/statusCode}"/>
+        </map:match>
+        <map:match pattern="view/*.xml">
+          <map:match pattern="view/entry.xml">
+            <map:transform src="xslt/entryMetaData.xsl"/>
+          </map:match>
+          <map:serialize type="xml" status-code="{flow-attr:view/statusCode}"/>
+        </map:match>
+      </map:match>
+      
+      <map:match type="usecase" pattern="atom.inserts">
+        <map:read mime-type="application/xml" src="lenya-document:?format=editingInserts"/>
+      </map:match>
+      
+      <map:match type="usecase" pattern="atom.uuid2url">
+        <map:generate type="jx" src="jx/uuid2url.jx">
+          <map:parameter name="url" value="{proxy:{uuid2url:{request-param:url}}}"/>
+        </map:generate>
+        <map:act type="set-header">
+          <map:parameter name="Location" value="{proxy:{uuid2url:{request-param:url}}}"/>
+        </map:act>
+        <map:serialize type="text"/>
+      </map:match>
+      
+      <!--
+        Generic REST usecase pipeline.
+        -->
+      <map:match type="usecase" pattern="atom.*">
+        <map:call function="handleRequest">
+          <map:parameter name="handler" value="org.apache.lenya.modules.atom.{1}"/>
+        </map:call>
+      </map:match>
+      
+      <map:match pattern="serviceLinks">
+        <map:generate type="jx" src="jx/serviceLinks.jx">
+          <map:parameter name="pub" value="{page-envelope:publication-id}"/>
+          <map:parameter name="area" value="{page-envelope:area}"/>
+          <map:parameter name="documentUrl" value="{page-envelope:document-url}"/>
+        </map:generate>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+      <map:match pattern="**.xsl">
+        <map:generate src="fallback://lenya/{1}.xsl" mime-type="application/xslt+xml"/>
+        <map:transform src="fallback://lenya/modules/firedocs/xslt/translate-xsl-includes.xsl"/>
+        <map:transform type="proxy-xsl"/>
+        <map:serialize type="xml"/>
+      </map:match>
+      
+    </map:pipeline>
+    
+  </map:pipelines>
+
+</map:sitemap>

Added: lenya/contributions/2_0_X/modules/atom/test/canoo/dtd/Project.dtd
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/test/canoo/dtd/Project.dtd?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/test/canoo/dtd/Project.dtd (added)
+++ lenya/contributions/2_0_X/modules/atom/test/canoo/dtd/Project.dtd Thu Mar 19 13:05:10 2009
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+This file is generated automatically from the information contained in the folder includes.
+Do not edit it else you risk to lose your changes.
+-->
+
+

Added: lenya/contributions/2_0_X/modules/atom/test/canoo/resources/concepts.html
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/test/canoo/resources/concepts.html?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/test/canoo/resources/concepts.html (added)
+++ lenya/contributions/2_0_X/modules/atom/test/canoo/resources/concepts.html Thu Mar 19 13:05:10 2009
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0">
+<!--
+  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.
+-->
+
+<!-- $Id: index_en 528434 2007-04-13 10:42:52Z andreas $ -->
+  <head>
+    <title>Concepts</title>
+  </head>
+  <body>
+    <h1>Concepts</h1>
+    
+    <h2>Publications</h2>
+    
+    <p>In Apache Lenya, a website is called a
+    <strong>publication</strong>.</p>
+    
+    <h2>Areas: Authoring, Live, ...</h2>
+
+    <p>Apache Lenya separates between different areas:</p>
+    <ul>
+      <li>The authoring area is for creating and editing of
+      content. All CMS functions are available here.</li>
+
+      <li>Once the content has been published it is moved to the live
+      area. The live area can be served by a web server directly or
+      you can add another intermediate step where the content is
+      replicated from the live area to the actual web server. In any
+      case the live area simply serves as a preview to the content
+      that will be served by the web server.</li>
+      <li>
+        Other standard areas are and archive. If necessary, further
+        areas can be declared.
+      </li>
+    </ul>
+    
+    <h2>Resource Types</h2>
+
+    <p>As Apache Lenya is based on Apache Cocoon, it has strong XML and
+    XSLT foundations. It is possible to ensure that a document
+    conforms to an XML schema. Typically you define different types of
+    documents, like an news article or an opinion piece, conforming to
+    different XML schemas. These different types are referred to as
+    document types. They are used to ensure the XML schema conformance
+    when editing and typically also when preparing a presentation of
+    the document, where an opinion piece has a different layout than a
+    news article.</p>
+
+  </body>
+</html>
\ No newline at end of file

Added: lenya/contributions/2_0_X/modules/atom/test/canoo/resources/conceptsEdited.html
URL: http://svn.apache.org/viewvc/lenya/contributions/2_0_X/modules/atom/test/canoo/resources/conceptsEdited.html?rev=755981&view=auto
==============================================================================
--- lenya/contributions/2_0_X/modules/atom/test/canoo/resources/conceptsEdited.html (added)
+++ lenya/contributions/2_0_X/modules/atom/test/canoo/resources/conceptsEdited.html Thu Mar 19 13:05:10 2009
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:lenya="http://apache.org/cocoon/lenya/page-envelope/1.0">
+<!--
+  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.
+-->
+
+<!-- $Id: index_en 528434 2007-04-13 10:42:52Z andreas $ -->
+  <head>
+    <title>Concepts</title>
+  </head>
+  <body>
+    <h1>Concepts</h1>
+
+    <p>atomTest</p>
+    
+    <h2>Publications</h2>
+    
+    <p>In Apache Lenya, a website is called a
+    <strong>publication</strong>.</p>
+    
+    <h2>Areas: Authoring, Live, ...</h2>
+
+    <p>Apache Lenya separates between different areas:</p>
+    <ul>
+      <li>The authoring area is for creating and editing of
+      content. All CMS functions are available here.</li>
+
+      <li>Once the content has been published it is moved to the live
+      area. The live area can be served by a web server directly or
+      you can add another intermediate step where the content is
+      replicated from the live area to the actual web server. In any
+      case the live area simply serves as a preview to the content
+      that will be served by the web server.</li>
+      <li>
+        Other standard areas are and archive. If necessary, further
+        areas can be declared.
+      </li>
+    </ul>
+    
+    <h2>Resource Types</h2>
+
+    <p>As Apache Lenya is based on Apache Cocoon, it has strong XML and
+    XSLT foundations. It is possible to ensure that a document
+    conforms to an XML schema. Typically you define different types of
+    documents, like an news article or an opinion piece, conforming to
+    different XML schemas. These different types are referred to as
+    document types. They are used to ensure the XML schema conformance
+    when editing and typically also when preparing a presentation of
+    the document, where an opinion piece has a different layout than a
+    news article.</p>
+
+  </body>
+</html>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org