From d4bb800e1dc52f8ffe0f51b3ef275e6bc8a916e2 Mon Sep 17 00:00:00 2001 From: David Caruana Date: Thu, 4 Sep 2008 10:46:38 +0000 Subject: [PATCH] Merge from SEAMIST3 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10723 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .classpath | 30 ++++----- .../web-scripts-application-context.xml | 63 +++++++++++-------- .../repo/cmis/{ => rest}/CMISDescription.java | 2 +- .../repo/cmis/{ => rest}/CMISScript.java | 4 +- .../alfresco/repo/cmis/{ => rest}/Index.java | 2 +- .../repo/cmis/{ => rest}/Navigation.java | 2 +- .../apache/abdera/ext/cmis/CMISConstants.java | 49 +++++++++++++++ .../abdera/ext/cmis/CMISExtensionFactory.java | 52 +++++++++++++++ .../apache/abdera/ext/cmis/CMISObject.java | 62 ++++++++++++++++++ source/test-resources/create.atomentry.xml | 19 ++++++ source/test/resources/create.atomentry.xml | 3 +- 11 files changed, 242 insertions(+), 46 deletions(-) rename source/java/org/alfresco/repo/cmis/{ => rest}/CMISDescription.java (98%) rename source/java/org/alfresco/repo/cmis/{ => rest}/CMISScript.java (98%) rename source/java/org/alfresco/repo/cmis/{ => rest}/Index.java (98%) rename source/java/org/alfresco/repo/cmis/{ => rest}/Navigation.java (99%) create mode 100644 source/java/org/apache/abdera/ext/cmis/CMISConstants.java create mode 100644 source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java create mode 100644 source/java/org/apache/abdera/ext/cmis/CMISObject.java create mode 100644 source/test-resources/create.atomentry.xml diff --git a/.classpath b/.classpath index 05f0b6a38a..6531e71adb 100644 --- a/.classpath +++ b/.classpath @@ -1,15 +1,15 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index cd5aaea873..f990123efb 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -125,6 +125,7 @@ + @@ -140,18 +141,6 @@ - - - - - - - - - - - - @@ -160,14 +149,6 @@ - - cmis - - - - - - @@ -257,7 +238,6 @@ - @@ -313,7 +293,6 @@ - @@ -402,18 +381,52 @@ - + + - - + + + cmis + + + + + + + + + + + + + + + + http://www.cmis.org/CMIS/1.0 + + + object + baseType + + + + + + + + + + + + diff --git a/source/java/org/alfresco/repo/cmis/CMISDescription.java b/source/java/org/alfresco/repo/cmis/rest/CMISDescription.java similarity index 98% rename from source/java/org/alfresco/repo/cmis/CMISDescription.java rename to source/java/org/alfresco/repo/cmis/rest/CMISDescription.java index c011123e6e..a8720f27e9 100644 --- a/source/java/org/alfresco/repo/cmis/CMISDescription.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISDescription.java @@ -22,7 +22,7 @@ * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ -package org.alfresco.repo.cmis; +package org.alfresco.repo.cmis.rest; import java.io.InputStream; import java.io.Serializable; diff --git a/source/java/org/alfresco/repo/cmis/CMISScript.java b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java similarity index 98% rename from source/java/org/alfresco/repo/cmis/CMISScript.java rename to source/java/org/alfresco/repo/cmis/rest/CMISScript.java index 518774acc1..8917806f2d 100644 --- a/source/java/org/alfresco/repo/cmis/CMISScript.java +++ b/source/java/org/alfresco/repo/cmis/rest/CMISScript.java @@ -22,9 +22,9 @@ * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ -package org.alfresco.repo.cmis; +package org.alfresco.repo.cmis.rest; -import org.alfresco.repo.cmis.Navigation.TypesFilter; +import org.alfresco.repo.cmis.rest.Navigation.TypesFilter; import org.alfresco.repo.jscript.BaseScopableProcessorExtension; import org.alfresco.repo.jscript.ScriptNode; import org.alfresco.repo.web.scripts.Repository; diff --git a/source/java/org/alfresco/repo/cmis/Index.java b/source/java/org/alfresco/repo/cmis/rest/Index.java similarity index 98% rename from source/java/org/alfresco/repo/cmis/Index.java rename to source/java/org/alfresco/repo/cmis/rest/Index.java index 57b3b42a04..f70d8f7f89 100644 --- a/source/java/org/alfresco/repo/cmis/Index.java +++ b/source/java/org/alfresco/repo/cmis/rest/Index.java @@ -22,7 +22,7 @@ * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ -package org.alfresco.repo.cmis; +package org.alfresco.repo.cmis.rest; import java.io.Serializable; import java.util.ArrayList; diff --git a/source/java/org/alfresco/repo/cmis/Navigation.java b/source/java/org/alfresco/repo/cmis/rest/Navigation.java similarity index 99% rename from source/java/org/alfresco/repo/cmis/Navigation.java rename to source/java/org/alfresco/repo/cmis/rest/Navigation.java index 5cee9963bd..d0978cc3dd 100644 --- a/source/java/org/alfresco/repo/cmis/Navigation.java +++ b/source/java/org/alfresco/repo/cmis/rest/Navigation.java @@ -22,7 +22,7 @@ * the FLOSS exception, and it is also available here: * http://www.alfresco.com/legal/licensing" */ -package org.alfresco.repo.cmis; +package org.alfresco.repo.cmis.rest; import java.util.List; diff --git a/source/java/org/apache/abdera/ext/cmis/CMISConstants.java b/source/java/org/apache/abdera/ext/cmis/CMISConstants.java new file mode 100644 index 0000000000..bde6e18b65 --- /dev/null +++ b/source/java/org/apache/abdera/ext/cmis/CMISConstants.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.apache.abdera.ext.cmis; + +import javax.xml.namespace.QName; + + +/** + * CMIS Namespace definitions for the Abdera ATOM library. + * + * Encapsulates access and modification of CMIS extension values to ATOM. + * + * NOTE: Potentially, this extension can be contributed to Abdera upon + * publication of CMIS. This is why it is organised under a + * non-Alfresco Java package. It follows the conventions of all + * other Abdera extensions. + * + * @author davidc + */ +public interface CMISConstants +{ + public static final String CMIS_V10_NS = "http://www.cmis.org/CMIS/1.0"; + + public static final QName OBJECT = new QName(CMIS_V10_NS, "object"); + public static final QName BASETYPE = new QName(CMIS_V10_NS, "baseType"); + +} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java b/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java new file mode 100644 index 0000000000..1ea95ac23e --- /dev/null +++ b/source/java/org/apache/abdera/ext/cmis/CMISExtensionFactory.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.apache.abdera.ext.cmis; + +import org.apache.abdera.util.AbstractExtensionFactory; + + +/** + * CMIS Extension Factory for the Abdera ATOM Library. + * + * Encapsulates access and modification of CMIS extension values to ATOM. + * + * NOTE: Potentially, this extension can be contributed to Abdera upon + * publication of CMIS. This is why it is organised under a + * non-Alfresco Java package. It follows the conventions of all + * other Abdera extensions. + * + * @author davidc + */ +public class CMISExtensionFactory extends AbstractExtensionFactory + implements CMISConstants +{ + + public CMISExtensionFactory() + { + super(CMIS_V10_NS); + addImpl(OBJECT, CMISObject.class); + } + +} diff --git a/source/java/org/apache/abdera/ext/cmis/CMISObject.java b/source/java/org/apache/abdera/ext/cmis/CMISObject.java new file mode 100644 index 0000000000..b905aaa9c3 --- /dev/null +++ b/source/java/org/apache/abdera/ext/cmis/CMISObject.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2005-2008 Alfresco Software Limited. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + * As a special exception to the terms and conditions of version 2.0 of + * the GPL, you may redistribute this Program in connection with Free/Libre + * and Open Source Software ("FLOSS") applications as described in Alfresco's + * FLOSS exception. You should have recieved a copy of the text describing + * the FLOSS exception, and it is also available here: + * http://www.alfresco.com/legal/licensing" + */ +package org.apache.abdera.ext.cmis; + +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Element; +import org.apache.abdera.model.ElementWrapper; + + +/** + * CMIS Object Element Wrapper for the Abdera ATOM library. + * + * Encapsulates access and modification of CMIS extension values to ATOM. + * + * NOTE: Potentially, this extension can be contributed to Abdera upon + * publication of CMIS. This is why it is organised under a + * non-Alfresco Java package. It follows the conventions of all + * other Abdera extensions. + * + * @author davidc + */ +public class CMISObject extends ElementWrapper +{ + public CMISObject(Element internal) + { + super(internal); + } + + public CMISObject(Factory factory) + { + super(factory, CMISConstants.OBJECT); + } + + public String getBaseType() + { + Element child = getInternal().getFirstChild(CMISConstants.BASETYPE); + return (child == null) ? null : child.getText(); + } + +} diff --git a/source/test-resources/create.atomentry.xml b/source/test-resources/create.atomentry.xml new file mode 100644 index 0000000000..d0856ec154 --- /dev/null +++ b/source/test-resources/create.atomentry.xml @@ -0,0 +1,19 @@ + + + Iñtërnâtiônàlizætiøn - 2 + urn:uuid:12345678-1234-1234-1234-123412341234 + Create test 1 summary + 2007-02-123T17:09:02Z + Doolittle + content 1 + + http://example.org/atom04 + document + XML + standards + + + + +post /api/path/workspace/SpacesStore//children application/atom+xml Iñtërnâtiônàlizætiøn - 6urn:uuid:12345678-1234-1234-1234-123412341234Create test 1 summary2007-02-123T17:09:02ZDoolittlecontent 1document +post /test/ext application/atom+xml Iñtërnâtiônàlizætiøn - 6urn:uuid:12345678-1234-1234-1234-123412341234Create test 1 summary2007-02-123T17:09:02ZDoolittlecontent 1document \ No newline at end of file diff --git a/source/test/resources/create.atomentry.xml b/source/test/resources/create.atomentry.xml index be818f0dc4..d0856ec154 100644 --- a/source/test/resources/create.atomentry.xml +++ b/source/test/resources/create.atomentry.xml @@ -15,4 +15,5 @@ -post /api/path/workspace/SpacesStore//children application/atom+xml Iñtërnâtiônàlizætiøn - 6urn:uuid:12345678-1234-1234-1234-123412341234Create test 1 summary2007-02-123T17:09:02ZDoolittlecontent 1document \ No newline at end of file +post /api/path/workspace/SpacesStore//children application/atom+xml Iñtërnâtiônàlizætiøn - 6urn:uuid:12345678-1234-1234-1234-123412341234Create test 1 summary2007-02-123T17:09:02ZDoolittlecontent 1document +post /test/ext application/atom+xml Iñtërnâtiônàlizætiøn - 6urn:uuid:12345678-1234-1234-1234-123412341234Create test 1 summary2007-02-123T17:09:02ZDoolittlecontent 1document \ No newline at end of file