You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2012/05/23 21:56:05 UTC

svn commit: r1342002 - in /chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/ chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/ap...

Author: fmui
Date: Wed May 23 19:56:04 2012
New Revision: 1342002

URL: http://svn.apache.org/viewvc?rev=1342002&view=rev
Log:
CMIS-533: Server: enabled custom namespaces

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/NamespaceDefinitions.java
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomFeed.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java

Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/NamespaceDefinitions.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/NamespaceDefinitions.java?rev=1342002&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/NamespaceDefinitions.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-api/src/main/java/org/apache/chemistry/opencmis/commons/server/NamespaceDefinitions.java Wed May 23 19:56:04 2012
@@ -0,0 +1,38 @@
+/*
+ * 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.chemistry.opencmis.commons.server;
+
+import java.util.Map;
+
+/**
+ * Defines a set of namespaces that are added to the root tag of AtomPub XML
+ * responses.
+ * 
+ * Objects that implement the {@link CmisService} interface may also implement
+ * this interface.
+ */
+public interface NamespaceDefinitions {
+
+    /**
+     * Returns the namespaces.
+     * 
+     * @return a map of namespaces; key = prefix, value = namespace URI
+     */
+    Map<String, String> getNamespaces();
+}

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntry.java Wed May 23 19:56:04 2012
@@ -63,6 +63,7 @@ public class AtomEntry extends AtomDocum
             writeNamespace(Constants.NAMESPACE_CMIS);
             writeNamespace(Constants.NAMESPACE_RESTATOM);
             writeNamespace(Constants.NAMESPACE_APP);
+            writeAllCustomNamespace();
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomFeed.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomFeed.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomFeed.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomFeed.java Wed May 23 19:56:04 2012
@@ -61,6 +61,7 @@ public class AtomFeed extends AtomDocume
             writeNamespace(Constants.NAMESPACE_CMIS);
             writeNamespace(Constants.NAMESPACE_RESTATOM);
             writeNamespace(Constants.NAMESPACE_APP);
+            writeAllCustomNamespace();
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomPubUtils.java Wed May 23 19:56:04 2012
@@ -25,6 +25,7 @@ package org.apache.chemistry.opencmis.se
 import java.math.BigInteger;
 import java.util.GregorianCalendar;
 import java.util.List;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.xml.bind.JAXBException;
@@ -40,6 +41,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
+import org.apache.chemistry.opencmis.commons.server.NamespaceDefinitions;
 import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
 import org.apache.chemistry.opencmis.commons.server.RenditionInfo;
 
@@ -117,6 +119,18 @@ public final class AtomPubUtils {
     }
 
     // -------------------------------------------------------------------------
+    // --- namespaces ---
+    // -------------------------------------------------------------------------
+
+    public static Map<String, String> getNamespaces(Object obj) {
+        if (obj instanceof NamespaceDefinitions) {
+            return ((NamespaceDefinitions) obj).getNamespaces();
+        }
+
+        return null;
+    }
+
+    // -------------------------------------------------------------------------
     // --- entry builder ---
     // -------------------------------------------------------------------------
 
@@ -204,11 +218,10 @@ public final class AtomPubUtils {
 
         if (info.getRenditionInfos() != null) {
             for (RenditionInfo ri : info.getRenditionInfos()) {
-                UrlBuilder rurl = compileUrlBuilder(baseUrl, RESOURCE_CONTENT,
-                        info.getId());
+                UrlBuilder rurl = compileUrlBuilder(baseUrl, RESOURCE_CONTENT, info.getId());
                 rurl.addParameter(Constants.PARAM_STREAM_ID, ri.getId());
-                entry.writeAlternateLink(rurl.toString(), ri.getContenType(),
-                        ri.getKind(), ri.getTitle(), ri.getLength());
+                entry.writeAlternateLink(rurl.toString(), ri.getContenType(), ri.getKind(), ri.getTitle(),
+                        ri.getLength());
             }
         }
 
@@ -247,7 +260,7 @@ public final class AtomPubUtils {
 
     /**
      * Writes the a object entry in a content changes list.
-     *
+     * 
      * Content changes objects need special treatment because some of them could
      * have been deleted and an object info cannot be generated.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java Wed May 23 19:56:04 2012
@@ -23,6 +23,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_QUERY;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrlBuilder;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeContentChangesObjectEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
@@ -156,7 +157,7 @@ public class DiscoveryService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -238,7 +239,7 @@ public class DiscoveryService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java Wed May 23 19:56:04 2012
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.se
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ENTRY;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getEnumParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
@@ -92,7 +93,7 @@ public class MultiFilingService {
 
         // write XML
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }
@@ -132,7 +133,7 @@ public class MultiFilingService {
 
         // write XML
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java Wed May 23 19:56:04 2012
@@ -33,6 +33,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrlBuilder;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
@@ -107,7 +108,7 @@ public final class NavigationService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -224,7 +225,7 @@ public final class NavigationService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -299,7 +300,7 @@ public final class NavigationService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -374,7 +375,7 @@ public final class NavigationService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -394,9 +395,8 @@ public final class NavigationService {
             if ((object == null) || (object.getObject() == null)) {
                 continue;
             }
-            writeObjectEntry(service, entry, object.getObject(), null,
-                    repositoryId, null, object.getRelativePathSegment(),
-                    baseUrl, false);
+            writeObjectEntry(service, entry, object.getObject(), null, repositoryId, null,
+                    object.getRelativePathSegment(), baseUrl, false);
         }
 
         // we are done
@@ -454,7 +454,7 @@ public final class NavigationService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java Wed May 23 19:56:04 2012
@@ -22,6 +22,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ENTRY;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getEnumParameter;
@@ -127,7 +128,7 @@ public final class ObjectService {
 
         // write XML
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }
@@ -164,7 +165,7 @@ public final class ObjectService {
 
         // write XML
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }
@@ -322,7 +323,7 @@ public final class ObjectService {
         UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
 
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }
@@ -363,7 +364,7 @@ public final class ObjectService {
         UrlBuilder baseUrl = compileBaseUrl(request, repositoryId);
 
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }
@@ -486,7 +487,7 @@ public final class ObjectService {
 
         // write XML
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java Wed May 23 19:56:04 2012
@@ -23,6 +23,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrlBuilder;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
 
 import java.util.List;
@@ -74,7 +75,7 @@ public class PolicyService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -138,7 +139,7 @@ public class PolicyService {
 
         // write XML
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writePolicyEntry(service, entry, objectId, policy, repositoryId, baseUrl);
         entry.endDocument();
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java Wed May 23 19:56:04 2012
@@ -22,6 +22,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrlBuilder;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
@@ -86,7 +87,7 @@ public class RelationshipService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java Wed May 23 19:56:04 2012
@@ -35,6 +35,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrlBuilder;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeTypeEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBigIntegerParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
@@ -99,7 +100,7 @@ public final class RepositoryService {
         // write XML
         ServiceDocument serviceDoc = new ServiceDocument();
 
-        serviceDoc.startDocument(response.getOutputStream());
+        serviceDoc.startDocument(response.getOutputStream(), getNamespaces(service));
         serviceDoc.startServiceDocument();
 
         if (infoDataList != null) {
@@ -271,7 +272,7 @@ public final class RepositoryService {
         response.setContentType(Constants.MEDIATYPE_FEED);
 
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -352,7 +353,7 @@ public final class RepositoryService {
         response.setContentType(Constants.MEDIATYPE_FEED);
 
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements
@@ -412,7 +413,7 @@ public final class RepositoryService {
         response.setContentType(Constants.MEDIATYPE_ENTRY);
 
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeTypeEntry(entry, type, null, repositoryId, compileBaseUrl(request, repositoryId), true);
         entry.endDocument();
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ServiceDocument.java Wed May 23 19:56:04 2012
@@ -31,9 +31,6 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * Service document class.
- *
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- *
  */
 public class ServiceDocument extends AtomDocumentBase {
 
@@ -47,6 +44,7 @@ public class ServiceDocument extends Ato
         writeNamespace(Constants.NAMESPACE_ATOM);
         writeNamespace(Constants.NAMESPACE_CMIS);
         writeNamespace(Constants.NAMESPACE_RESTATOM);
+        writeAllCustomNamespace();
     }
 
     public void endServiceDocument() throws XMLStreamException {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java Wed May 23 19:56:04 2012
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.se
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.RESOURCE_ENTRY;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileBaseUrl;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.compileUrl;
+import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.getNamespaces;
 import static org.apache.chemistry.opencmis.server.impl.atompub.AtomPubUtils.writeObjectEntry;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getBooleanParameter;
 import static org.apache.chemistry.opencmis.server.shared.HttpUtils.getStringParameter;
@@ -87,7 +88,7 @@ public class VersioningService {
 
         // write XML
         AtomEntry entry = new AtomEntry();
-        entry.startDocument(response.getOutputStream());
+        entry.startDocument(response.getOutputStream(), getNamespaces(service));
         writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
         entry.endDocument();
     }
@@ -117,7 +118,7 @@ public class VersioningService {
 
         // write XML
         AtomFeed feed = new AtomFeed();
-        feed.startDocument(response.getOutputStream());
+        feed.startDocument(response.getOutputStream(), getNamespaces(service));
         feed.startFeed(true);
 
         // write basic Atom feed elements

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java?rev=1342002&r1=1342001&r2=1342002&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/XMLDocumentBase.java Wed May 23 19:56:04 2012
@@ -19,6 +19,7 @@
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
 import java.io.OutputStream;
+import java.util.Map;
 
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -38,16 +39,24 @@ public abstract class XMLDocumentBase {
     public static final String PREFIX_XSI = "xsi";
 
     private XMLStreamWriter writer;
+    private Map<String, String> namespaces;
 
     /**
      * Sets the namespaces for the document.
      */
-    public void setNamespaces() throws XMLStreamException {
+    public void setNamespaces(Map<String, String> namespaces) throws XMLStreamException {
         writer.setPrefix(PREFIX_ATOM, Constants.NAMESPACE_ATOM);
         writer.setPrefix(PREFIX_CMIS, Constants.NAMESPACE_CMIS);
         writer.setPrefix(PREFIX_RESTATOM, Constants.NAMESPACE_RESTATOM);
         writer.setPrefix(PREFIX_APP, Constants.NAMESPACE_APP);
         writer.setPrefix(PREFIX_XSI, Constants.NAMESPACE_XSI);
+
+        if (namespaces != null) {
+            this.namespaces = namespaces;
+            for (Map.Entry<String, String> ns : namespaces.entrySet()) {
+                writer.setPrefix(ns.getKey(), ns.getValue());
+            }
+        }
     }
 
     /**
@@ -58,16 +67,27 @@ public abstract class XMLDocumentBase {
     }
 
     /**
+     * Writes custom namespace declaration to the current tag.
+     */
+    public void writeAllCustomNamespace() throws XMLStreamException {
+        if (namespaces != null) {
+            for (Map.Entry<String, String> ns : namespaces.entrySet()) {
+                writer.writeNamespace(ns.getKey(), ns.getValue());
+            }
+        }
+    }
+
+    /**
      * Starts the document and sets the namespaces.
      */
-    public void startDocument(OutputStream out) throws XMLStreamException {
+    public void startDocument(OutputStream out, Map<String, String> namespaces) throws XMLStreamException {
         // create a writer
         XMLOutputFactory factory = XMLOutputFactory.newInstance();
         writer = factory.createXMLStreamWriter(out, "UTF-8");
 
         // start the document
         writer.writeStartDocument("UTF-8", "1.0");
-        setNamespaces();
+        setNamespaces(namespaces);
     }
 
     /**