logo       
Google Custom Search
    AddThis Social Bookmark Button

svn commit: r233504 - in /lenya/trunk/src/publets/jcr: config/ java/src/org: msg#00057

Subject: svn commit: r233504 - in /lenya/trunk/src/publets/jcr: config/ java/src/org/apache/lenya/cms/cocoon/ java/src/org/apache/lenya/cms/cocoon/generation/ java/src/org/apache/lenya/cms/jcr/usecases/ usecases/importExport/
Author: andreas
Date: Fri Aug 19 09:09:40 2005
New Revision: 233504

URL: http://svn.apache.org/viewcvs?rev=233504&view=rev
Log:
Added usecase for JCR import+export (see bug #36273). Credits to Felix 
Roethenbacher.

Added:
    lenya/trunk/src/publets/jcr/config/usecase-export.xconf
    lenya/trunk/src/publets/jcr/config/usecase-import.xconf
    lenya/trunk/src/publets/jcr/config/usecase-importExport.xconf
    lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/cocoon/
    lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/cocoon/generation/
    
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/cocoon/generation/JCRSysViewGenerator.java
    
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImport.java
    
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImportException.java
    lenya/trunk/src/publets/jcr/usecases/importExport/
    lenya/trunk/src/publets/jcr/usecases/importExport/importExport.jx
    lenya/trunk/src/publets/jcr/usecases/importExport/usecase.xmap
Removed:
    lenya/trunk/src/publets/jcr/config/usecases.xconf

Added: lenya/trunk/src/publets/jcr/config/usecase-export.xconf
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/config/usecase-export.xconf?rev=233504&view=auto
==============================================================================
--- lenya/trunk/src/publets/jcr/config/usecase-export.xconf (added)
+++ lenya/trunk/src/publets/jcr/config/usecase-export.xconf Fri Aug 19 09:09:40 
2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!-- $Id: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
+
+<xconf xpath="/cocoon/usecases" 
unless="/cocoon/usecases/component-instance[@name = 'jcr.export']">
+
+  <component-instance name="jcr.export" logger="lenya.jcr"
+    class="org.apache.lenya.cms.usecase.DummyUsecase">
+    <view uri="/core/publets/jcr/importExport/lenya-repository-content.xml" 
menu="false"/>
+  </component-instance>
+  
+</xconf>

Added: lenya/trunk/src/publets/jcr/config/usecase-import.xconf
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/config/usecase-import.xconf?rev=233504&view=auto
==============================================================================
--- lenya/trunk/src/publets/jcr/config/usecase-import.xconf (added)
+++ lenya/trunk/src/publets/jcr/config/usecase-import.xconf Fri Aug 19 09:09:40 
2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!-- $Id: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
+
+<xconf xpath="/cocoon/usecases" 
unless="/cocoon/usecases/component-instance[@name = 'jcr.import']">
+  
+  <component-instance name="jcr.import" logger="lenya.jcr"
+    class="org.apache.lenya.cms.jcr.usecases.Import">
+    <view template="publets/jcr/usecases/import.jx" menu="false"/>
+  </component-instance>
+  
+</xconf>

Added: lenya/trunk/src/publets/jcr/config/usecase-importExport.xconf
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/config/usecase-importExport.xconf?rev=233504&view=auto
==============================================================================
--- lenya/trunk/src/publets/jcr/config/usecase-importExport.xconf (added)
+++ lenya/trunk/src/publets/jcr/config/usecase-importExport.xconf Fri Aug 19 
09:09:40 2005
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!-- $Id: doctypes.xconf 164635 2005-04-25 20:01:43Z tschlabach $ -->
+
+<xconf xpath="/cocoon/usecases" 
unless="/cocoon/usecases/component-instance[@name = 'jcr.importExport']">
+
+  <component-instance name="jcr.importExport" logger="lenya.jcr"
+    class="org.apache.lenya.cms.jcr.usecases.JCRImport">
+    <view template="publets/jcr/usecases/importExport/importExport.jx" 
menu="false"/>
+  </component-instance>
+  
+</xconf>

Added: 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/cocoon/generation/JCRSysViewGenerator.java
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/cocoon/generation/JCRSysViewGenerator.java?rev=233504&view=auto
==============================================================================
--- 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/cocoon/generation/JCRSysViewGenerator.java
 (added)
+++ 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/cocoon/generation/JCRSysViewGenerator.java
 Fri Aug 19 09:09:40 2005
@@ -0,0 +1,90 @@
+/*
+ * Copyright  1999-2004 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.
+ *
+ */
+
+/* @version $Id:$*/
+package org.apache.lenya.cms.cocoon.generation;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.jcr.LoginException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.parameters.ParameterException;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.generation.ServiceableGenerator;
+import org.apache.log4j.Logger;
+import org.xml.sax.SAXException;
+
+/**
+ * Generator to provide a JCR view.
+ */
+public class JCRSysViewGenerator extends ServiceableGenerator {
+    private static final Logger log = 
Logger.getLogger(JCRSysViewGenerator.class);
+
+    protected static final String ROOT_PARAMETER = "root";
+
+    protected String root;
+
+    public void setup(SourceResolver resolver, Map objectModel, String src, 
Parameters par)
+            throws ProcessingException, SAXException, IOException {
+        try {
+            root = par.getParameter(ROOT_PARAMETER);
+        } catch (ParameterException e) {
+            throw new ProcessingException("'root' parameter not found", e);
+        }
+
+        super.setup(resolver, objectModel, src, par);
+    }
+
+    public void generate() throws IOException, SAXException, 
ProcessingException {
+        Repository repo = null;
+        try {
+            repo = (Repository) manager.lookup(Repository.class.getName());
+        } catch (Exception e) {
+            throw new CascadingRuntimeException("Cannot lookup repository", e);
+        }
+
+        Session session;
+        try {
+            session = repo.login();
+        } catch (LoginException e) {
+            throw new ProcessingException("Login to repository failed", e);
+        } catch (RepositoryException e) {
+            throw new ProcessingException("Cannot access repository", e);
+        }
+
+        // Export repository system view: with binary content, recurse.
+        try {
+            log.debug("Generating JCR system view at node [" + root + "]");
+            session.exportSystemView(root, this.contentHandler, false, false);
+        } catch (PathNotFoundException e) {
+            throw new ProcessingException("Export root path not found", e);
+        } catch (SAXException e) {
+            throw new ProcessingException("Export of repository system view 
failed", e);
+        } catch (RepositoryException e) {
+            throw new ProcessingException("Cannot access repository", e);
+        }
+    }
+
+}

Added: 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImport.java
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImport.java?rev=233504&view=auto
==============================================================================
--- 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImport.java
 (added)
+++ 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImport.java
 Fri Aug 19 09:09:40 2005
@@ -0,0 +1,196 @@
+/*
+ * Copyright  1999-2004 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.
+ *
+ */
+/* $Id:$ */
+package org.apache.lenya.cms.jcr.usecases;
+
+import java.io.IOException;
+
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.Item;
+import javax.jcr.LoginException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Workspace;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.servlet.multipart.Part;
+import org.apache.lenya.cms.usecase.AbstractUsecase;
+import org.apache.log4j.Logger;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Import JCR content.
+ */
+public class JCRImport extends AbstractUsecase {
+    private static final Logger log = Logger.getLogger(JCRImport.class);
+    
+    private static final String IMPORT_TARGET_PARAM = 
"lenya.usecase.importExport.import";
+    private static final String IMPORT_TARGET_PUBLICATION = "publication";
+    private static final String IMPORT_TARGET_REPOSITORY = "repository";
+    
+    private static final String JCR_LENYA_ROOT = "/";
+    private static final String JCR_LENYA_BASE_NAME = "lenya";
+    private static final String JCR_LENYA_PUBLICATON_ROOT = "/lenya/pubs";
+    
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
+     */
+    protected void doExecute() throws Exception {
+        Request request = ContextHelper.getRequest(this.context);
+        
+        Part jcrImport = (Part)request.get("jcrcontent");
+        
+        // Get name of first JCR node ('lenya' or publication name).
+        String firstNodeName;
+        try {
+            firstNodeName = getFirstNodeName(new 
InputSource(jcrImport.getInputStream()));
+        } catch (Exception e) {
+            throw new JCRImportException("Error getting first node name of 
import data");
+        }
+        if (firstNodeName == null) {
+            throw new JCRImportException("Reading repository import data 
failed");
+        }
+
+        Repository repo = null;
+        try {
+            repo = (Repository)manager.lookup(Repository.class.getName());
+        } catch (Exception e) {
+            throw new CascadingRuntimeException("Cannot lookup repository", e);
+        }
+        
+        try {
+            Session session;
+            try {
+                session = repo.login();
+            } catch (LoginException e1) {
+                throw new JCRImportException("Login to repository failed", e1);
+            } catch (RepositoryException e1) {
+                throw new JCRImportException("Cannot access repository", e1);
+            }
+            
+            Workspace ws = session.getWorkspace();
+    
+            String importTarget = request.getParameter(IMPORT_TARGET_PARAM);
+            if (IMPORT_TARGET_REPOSITORY.equals(importTarget)) {
+                // Import Lenya repository
+                log.debug("Importing Lenya repository into JCR");
+                if (!JCR_LENYA_BASE_NAME.equals(firstNodeName)) {
+                    throw new JCRImportException("Corrupt Lenya repository 
data file");
+                }
+                if (!session.itemExists(JCR_LENYA_ROOT)) {
+                    throw new JCRImportException("Lenya JCR root not found [" 
+ JCR_LENYA_ROOT + "]");
+                }
+                // Remove existing Lenya repository.
+                String lenyaBasePath = JCR_LENYA_ROOT +
+                    (JCR_LENYA_ROOT.endsWith("/") ? JCR_LENYA_BASE_NAME : "/" 
+ JCR_LENYA_BASE_NAME);
+                if (session.itemExists(lenyaBasePath)) {
+                    Item jcrLenyaBase = session.getItem(lenyaBasePath);
+                    jcrLenyaBase.remove();
+                    session.save();
+                }
+    
+                // Import Lenya repository. Use workspace instead of session 
because of performance.
+                try {
+                    ws.importXML(JCR_LENYA_ROOT, jcrImport.getInputStream(),
+                            ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
+                } catch (Exception e) {
+                    throw new JCRImportException("Error importing data into 
workspace");
+                }
+            } else if (IMPORT_TARGET_PUBLICATION.equals(importTarget)) {
+                // Import Lenya publication 
+                log.debug("Importing Lenya publication into JCR");
+                if (!session.itemExists(JCR_LENYA_PUBLICATON_ROOT)) {
+                    throw new JCRImportException("Lenya JCR root not found [" 
+ JCR_LENYA_ROOT + "]");
+                    // TODO: Create JCR_LENYA_PUBLICATON_ROOT
+                }
+                
+                // Remove existing Lenya repository.
+                String lenyaPublicationPath = JCR_LENYA_PUBLICATON_ROOT +
+                    (JCR_LENYA_PUBLICATON_ROOT.endsWith("/") ? firstNodeName : 
"/" + firstNodeName);
+                if (session.itemExists(lenyaPublicationPath)) {
+                    Item jcrPublicationBase = 
session.getItem(lenyaPublicationPath);
+                    jcrPublicationBase.remove();
+                    session.save();
+                }
+    
+                // Import Lenya publication. Use workspace instead of session 
because of performance.
+                try {
+                    ws.importXML(JCR_LENYA_PUBLICATON_ROOT, 
jcrImport.getInputStream(),
+                            ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
+                } catch (Exception e) {
+                    throw new JCRImportException("Error importing data into 
workspace");
+                }
+            }
+        } catch (RepositoryException e) {
+            throw new JCRImportException("Error accessing JCR repository while 
importing data", e);
+        }
+
+        super.doExecute();
+    }
+
+    /**
+     * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
+     */
+    protected void initParameters() {
+        super.initParameters();
+    }
+    
+    private String getFirstNodeName(InputSource xmlInput)
+        throws SAXException, IOException
+    {
+        XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+        
+        FirstNodeNameHandler contentHandler = new FirstNodeNameHandler(); 
+        xmlReader.setContentHandler(contentHandler);
+        xmlReader.parse(xmlInput);
+        return contentHandler.getFirstNodeName();
+    }
+    
+    class FirstNodeNameHandler extends DefaultHandler
+    {
+        private static final String NODE_NAME_Q_ATTR = "sv:name";
+        
+        private boolean isFirstElement = true;
+        private String firstNodeName = null;
+        
+        /**
+         * @see 
org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, 
java.lang.String, java.lang.String, org.xml.sax.Attributes)
+         */
+        public void startElement(String uri, String localName, String qName, 
Attributes attributes)
+            throws SAXException
+        {
+            if (isFirstElement) {
+                firstNodeName = attributes.getValue(NODE_NAME_Q_ATTR);
+                isFirstElement = false;
+            } else {
+                super.startElement(uri, localName, qName, attributes);
+            }
+        }
+        
+        protected String getFirstNodeName() {
+            return firstNodeName;
+        }
+    }
+}

Added: 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImportException.java
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImportException.java?rev=233504&view=auto
==============================================================================
--- 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImportException.java
 (added)
+++ 
lenya/trunk/src/publets/jcr/java/src/org/apache/lenya/cms/jcr/usecases/JCRImportException.java
 Fri Aug 19 09:09:40 2005
@@ -0,0 +1,37 @@
+/*
+ * Copyright  1999-2004 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.
+ *
+ */
+/* $Id:$ */
+package org.apache.lenya.cms.jcr.usecases;
+
+public class JCRImportException extends Exception {
+    
+    public JCRImportException() {
+        super();
+    }
+    
+    public JCRImportException(String message) {
+        super(message);
+    }
+    
+    public JCRImportException(String message, Throwable cause) {
+        super(message, cause);
+    }
+    
+    public JCRImportException(Throwable cause) {
+        super(cause);
+    }
+}

Added: lenya/trunk/src/publets/jcr/usecases/importExport/importExport.jx
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/usecases/importExport/importExport.jx?rev=233504&view=auto
==============================================================================
--- lenya/trunk/src/publets/jcr/usecases/importExport/importExport.jx (added)
+++ lenya/trunk/src/publets/jcr/usecases/importExport/importExport.jx Fri Aug 
19 09:09:40 2005
@@ -0,0 +1,142 @@
+<!--
+  Copyright 1999-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.
+-->
+<!-- $Id: serverStatus.jx 164233 2005-04-22 13:01:45Z jwkaltz $ -->
+
+<page:page
+  xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";
+  xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0";
+  xmlns="http://www.w3.org/1999/xhtml";
+  xmlns:i18n="http://apache.org/cocoon/i18n/2.1";
+  xmlns:cinclude="http://apache.org/cocoon/include/1.0";
+  >
+  <page:title><i18n:text>JCR Import/Export</i18n:text></page:title>
+  
+  <page:body>
+    <!--
+    <jx:import uri="admin/tabs.jx"/>
+    <div id="contentblock1" class="lenya-tab">
+    -->
+    <jx:import uri="templates/messages.jx"/>
+    
+    <p><i18n:text>Import and export repository content in XML data 
format.</i18n:text></p>
+    <p><b><i18n:text>Note:</i18n:text></b> <i18n:text>Works with JCR 
repository only!</i18n:text></p>
+    
+    <table>
+      <tr>
+        <td>
+          <div class="lenya-box-body">
+            <table class="lenya-table">
+              <tr>
+                <th  class="lenya-caption" 
colspan="2"><i18n:text>Publication</i18n:text></th>
+              </tr>
+              <tr>
+                <td>
+                  <form method="POST" enctype="multipart/form-data">
+                    <input type="hidden" name="lenya.continuation" 
value="${continuation.id}"/>
+                    <input type="hidden" name="lenya.usecase" 
value="${request.getParameter('lenya.usecase')}"/>
+                    <input type="hidden" 
name="lenya.usecase.importExport.import" value="publication"/>
+                    <input type="hidden" name="submit" value=""/>
+                    
+                    <div class="lenya-box-body">
+                      <table class="lenya-table">
+                        <tr>
+                          <th 
class="lenya-caption"><i18n:text>Import</i18n:text></th>
+                        </tr>
+                        <tr>
+                          <td>
+                            <input type="file" name="jcrcontent" maxlength="0" 
accept="text/xml"/>
+                            <input i18n:attr="value" type="submit" 
value="Import"/>
+                            <br/><br/>
+                            
<b><i18n:text>Note:</i18n:text></b><i18n:text>Existing publication will be 
overwritten!</i18n:text> 
+                          </td>
+                        </tr>
+                      </table>
+                    </div>
+                  </form>
+                </td>
+                <td>
+                  <div class="lenya-box-body">
+                    <table class="lenya-table">
+                      <tr>
+                        <th 
class="lenya-entry-caption"><i18n:text>Export</i18n:text></th>
+                      </tr>
+                      <tr>
+                        <td nowrap=""><a 
href="${request.requestURI}?lenya.usecase=jcr.export&amp;scope=publication" 
target="_blank">Download Publication Content</a></td>
+                      </tr>
+                    </table>
+                  </div>
+                </td>
+              </tr>
+            </table>
+          </div>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <div class="lenya-box-body">
+            <table class="lenya-table">
+              <tr>
+                <th  class="lenya-caption" 
colspan="2"><i18n:text>Repository</i18n:text></th>
+              </tr>
+              <tr>
+                <td>
+                  <form method="POST" enctype="multipart/form-data">
+                    <input type="hidden" name="lenya.continuation" 
value="${continuation.id}"/>
+                    <input type="hidden" name="lenya.usecase" 
value="${request.getParameter('lenya.usecase')}"/>
+                    <input type="hidden" 
name="lenya.usecase.importExport.import" value="repository"/>
+                    <input type="hidden" name="submit" value=""/>
+                    
+                    <div class="lenya-box-body">
+                      <table class="lenya-table">
+                        <tr>
+                          <th 
class="lenya-caption"><i18n:text>Import</i18n:text></th>
+                        </tr>
+                        <tr>
+                          <td>
+                            <input type="file" name="jcrcontent" maxlength="0" 
accept="text/xml"/>
+                            <input i18n:attr="value" type="submit" 
value="Import"/>
+                            <br/><br/>
+                            <b><i18n:text>Note:</i18n:text></b><i18n:text>All 
existing Lenya data will be overwritten!</i18n:text> 
+                          </td>
+                        </tr>
+                      </table>
+                    </div>
+                  </form>
+                </td>
+                <td>
+                  <div class="lenya-box-body">
+                    <table class="lenya-table">
+                      <tr>
+                        <th 
class="lenya-entry-caption"><i18n:text>Export</i18n:text></th>
+                      </tr>
+                      <tr>
+                        <td nowrap=""><a 
href="${request.requestURI}?lenya.usecase=jcr.export&amp;scope=repository" 
target="_blank">Download Repository Content</a></td>
+                      </tr>
+                    </table>
+                  </div>
+                </td>
+              </tr>
+            </table>
+          </div>
+        </td>
+      </tr>
+    </table>
+    
+    <!--
+    </div>
+    -->
+  </page:body>
+</page:page>
\ No newline at end of file

Added: lenya/trunk/src/publets/jcr/usecases/importExport/usecase.xmap
URL: 
http://svn.apache.org/viewcvs/lenya/trunk/src/publets/jcr/usecases/importExport/usecase.xmap?rev=233504&view=auto
==============================================================================
--- lenya/trunk/src/publets/jcr/usecases/importExport/usecase.xmap (added)
+++ lenya/trunk/src/publets/jcr/usecases/importExport/usecase.xmap Fri Aug 19 
09:09:40 2005
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 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.
+-->
+
+<!-- $Id$ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
+  
+  <map:components>
+    <map:generators default="file">
+      <map:generator name="jcr-sys-view" label="content,data" 
logger="sitemap.generator.jcr-sys-view" pool-grow="2" pool-max="5" pool-min="2" 
src="org.apache.lenya.cms.cocoon.generation.JCRSysViewGenerator"/>
+    </map:generators>
+  </map:components>
+  
+  <map:pipelines>
+    
+    <map:pipeline>
+
+      <map:match pattern="lenya-repository-content.xml">
+        <map:select type="parameter">
+          <map:parameter name="parameter-selector-test" 
value="{request-param:scope}"/>
+          <map:when test="repository">
+            <map:generate type="jcr-sys-view">
+              <map:parameter name="root" value="/lenya"/>
+            </map:generate>
+          </map:when>
+          <map:otherwise>
+            <map:generate type="jcr-sys-view">
+              <map:parameter name="root" 
value="/lenya/pubs/{page-envelope:publication-id}"/>
+            </map:generate>
+          </map:otherwise>
+        </map:select>
+        <map:serialize type="xml"/>
+      </map:match>
+        
+    </map:pipeline>
+    
+  </map:pipelines>
+
+</map:sitemap>



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>