chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1454378 - in /chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apa...
Date Fri, 08 Mar 2013 13:27:44 GMT
Author: fmui
Date: Fri Mar  8 13:27:43 2013
New Revision: 1454378

URL: http://svn.apache.org/r1454378
Log:
CMIS 1.1 AtomPub, step 2

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JaxBHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java
    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/AtomEntryParser.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
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JaxBHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JaxBHelper.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JaxBHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JaxBHelper.java Fri Mar  8 13:27:43 2013
@@ -25,14 +25,8 @@ import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlElementDecl;
-import javax.xml.bind.annotation.XmlRegistry;
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.ObjectFactory;
 
 /**
@@ -40,12 +34,7 @@ import org.apache.chemistry.opencmis.com
  */
 public final class JaxBHelper {
 
-    private static final QName CMIS_OBJECT = new QName(Constants.NAMESPACE_RESTATOM, "object");
-    private static final QName CMIS_TYPE_DEFINITION = new QName(Constants.NAMESPACE_RESTATOM, "type");
-    private static final QName CMIS_REPOSITORY_INFO = new QName(Constants.NAMESPACE_RESTATOM, "repositoryInfo");
-
     public static final ObjectFactory CMIS_OBJECT_FACTORY = new ObjectFactory();
-    public static final CMISExtraObjectFactory CMIS_EXTRA_OBJECT_FACTORY = new CMISExtraObjectFactory();
     public static final JAXBContext CONTEXT;
     static {
         JAXBContext jc = null;
@@ -53,7 +42,7 @@ public final class JaxBHelper {
         try {
             Thread.currentThread().setContextClassLoader(JaxBHelper.class.getClassLoader());
 
-            jc = JAXBContext.newInstance(ObjectFactory.class, CMISExtraObjectFactory.class);
+            jc = JAXBContext.newInstance(ObjectFactory.class);
         } catch (JAXBException e) {
             e.printStackTrace();
         } finally {
@@ -62,24 +51,6 @@ public final class JaxBHelper {
         CONTEXT = jc;
     }
 
-    @XmlRegistry
-    public static class CMISExtraObjectFactory {
-        @XmlElementDecl(namespace = Constants.NAMESPACE_RESTATOM, name = "object")
-        public JAXBElement<CmisObjectType> createObject(CmisObjectType value) {
-            return new JAXBElement<CmisObjectType>(CMIS_OBJECT, CmisObjectType.class, value);
-        }
-
-        @XmlElementDecl(namespace = Constants.NAMESPACE_RESTATOM, name = "type")
-        public JAXBElement<CmisTypeDefinitionType> createTypeDefinition(CmisTypeDefinitionType value) {
-            return new JAXBElement<CmisTypeDefinitionType>(CMIS_TYPE_DEFINITION, CmisTypeDefinitionType.class, value);
-        }
-
-        @XmlElementDecl(namespace = Constants.NAMESPACE_RESTATOM, name = "repositoryInfo")
-        public JAXBElement<CmisRepositoryInfoType> createRepositoryInfo(CmisRepositoryInfoType value) {
-            return new JAXBElement<CmisRepositoryInfoType>(CMIS_REPOSITORY_INFO, CmisRepositoryInfoType.class, value);
-        }
-    }
-
     /**
      * Private constructor.
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.java Fri Mar  8 13:27:43 2013
@@ -34,6 +34,7 @@ public class XMLConstants {
     // prefixes
     public static final String PREFIX_XSI = "xsi";
     public static final String PREFIX_ATOM = "atom";
+    public static final String PREFIX_APP = "app";
     public static final String PREFIX_CMIS = "cmis";
     public static final String PREFIX_RESTATOM = "cmisra";
     public static final String PREFIX_APACHE_CHEMISTY = "chemistry";

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Fri Mar  8 13:27:43 2013
@@ -377,19 +377,22 @@ public class XMLConverter {
         }
 
         writer.writeStartElement(namespace, TAG_TYPE);
+        if (writer.getNamespaceContext().getNamespaceURI(NAMESPACE_XSI) == null) {
+            writer.writeNamespace(PREFIX_XSI, NAMESPACE_XSI);
+        }
 
         if (source.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_DOCUMENT_TYPE);
+            writer.writeAttribute(PREFIX_XSI, NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_DOCUMENT_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_FOLDER_TYPE);
+            writer.writeAttribute(PREFIX_XSI, NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_FOLDER_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_RELATIONSHIP) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_RELATIONSHIP_TYPE);
+            writer.writeAttribute(PREFIX_XSI, NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_RELATIONSHIP_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_POLICY) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_POLICY_TYPE);
+            writer.writeAttribute(PREFIX_XSI, NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_POLICY_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_ITEM) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_ITEM_TYPE);
+            writer.writeAttribute(PREFIX_XSI, NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_ITEM_TYPE);
         } else if (source.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY) {
-            writer.writeAttribute(NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_SECONDARY_TYPE);
+            writer.writeAttribute(PREFIX_XSI, NAMESPACE_XSI, "type", PREFIX_CMIS + ":" + ATTR_SECONDARY_TYPE);
         } else {
             throw new CmisRuntimeException("Type definition has no base type id!");
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java Fri Mar  8 13:27:43 2013
@@ -69,7 +69,6 @@ public class XMLUtils {
      * Starts a XML document.
      */
     public static void startXmlDocument(XMLStreamWriter writer) throws XMLStreamException {
-        writer.setPrefix(XMLConstants.PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
         writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
         writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
         writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
@@ -85,7 +84,6 @@ public class XMLUtils {
         startXmlDocument(writer);
 
         writer.writeStartElement(XMLConstants.NAMESPACE_ATOM, "entry");
-        writer.writeNamespace(XMLConstants.PREFIX_XSI, XMLConstants.NAMESPACE_XSI);
         writer.writeNamespace(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
         writer.writeNamespace(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
         writer.writeNamespace(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.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/AtomDocumentBase.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomDocumentBase.java Fri Mar  8 13:27:43 2013
@@ -29,6 +29,8 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.chemistry.opencmis.commons.impl.Base64;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.DateTimeHelper;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 
 /**
  * Atom base class.
@@ -54,50 +56,17 @@ public abstract class AtomDocumentBase e
     }
 
     /**
-     * Writes a simple tag.
-     */
-    public void writeSimpleTag(String namespace, String name, String value) throws XMLStreamException {
-        if (value == null) {
-            return;
-        }
-
-        XMLStreamWriter xsw = getWriter();
-
-        xsw.writeStartElement(namespace, name);
-        xsw.writeCharacters(value);
-        xsw.writeEndElement();
-    }
-
-    /**
-     * Writes a simple date tag.
-     */
-    public void writeSimpleDate(String namespace, String name, GregorianCalendar value) throws XMLStreamException {
-        if (value == null) {
-            return;
-        }
-
-        writeSimpleTag(namespace, name, DateTimeHelper.formateHttpDateTime(value.getTimeInMillis()));
-    }
-
-    /**
-     * Writes a simple date tag.
-     */
-    public void writeSimpleDate(String namespace, String name, long millis) throws XMLStreamException {
-        writeSimpleTag(namespace, name, DateTimeHelper.formateHttpDateTime(millis));
-    }
-
-    /**
      * Writes an Atom id tag.
      */
     public void writeId(String id) throws XMLStreamException {
-        writeSimpleTag(Constants.NAMESPACE_ATOM, "id", id);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "id", id);
     }
 
     /**
      * Writes an Atom title tag.
      */
     public void writeTitle(String title) throws XMLStreamException {
-        writeSimpleTag(Constants.NAMESPACE_ATOM, "title", title);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "title", title);
     }
 
     /**
@@ -106,8 +75,8 @@ public abstract class AtomDocumentBase e
     public void writeAuthor(String author) throws XMLStreamException {
         XMLStreamWriter xsw = getWriter();
 
-        xsw.writeStartElement(Constants.NAMESPACE_ATOM, "author");
-        writeSimpleTag(Constants.NAMESPACE_ATOM, "name", author);
+        xsw.writeStartElement(XMLConstants.PREFIX_ATOM, "author", XMLConstants.NAMESPACE_ATOM);
+        XMLUtils.write(xsw, XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "name", author);
         xsw.writeEndElement();
     }
 
@@ -115,44 +84,48 @@ public abstract class AtomDocumentBase e
      * Writes an Atom updated tag.
      */
     public void writeUpdated(GregorianCalendar updated) throws XMLStreamException {
-        writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
-        writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_APP, XMLConstants.NAMESPACE_APP, "edited", updated);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "updated", updated);
     }
 
     /**
      * Writes an Atom updated tag.
      */
     public void writeUpdated(long updated) throws XMLStreamException {
-        writeSimpleDate(Constants.NAMESPACE_APP, "edited", updated);
-        writeSimpleDate(Constants.NAMESPACE_ATOM, "updated", updated);
+        String updatedStr = DateTimeHelper.formateHttpDateTime(updated);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_APP, XMLConstants.NAMESPACE_APP, "edited", updatedStr);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "updated", updatedStr);
     }
 
     /**
      * Writes an Atom published tag.
      */
     public void writePublished(GregorianCalendar published) throws XMLStreamException {
-        writeSimpleDate(Constants.NAMESPACE_ATOM, "published", published);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "published", published);
     }
 
     /**
      * Writes an Atom published tag.
      */
     public void writePublished(long published) throws XMLStreamException {
-        writeSimpleDate(Constants.NAMESPACE_ATOM, "published", published);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "published",
+                DateTimeHelper.formateHttpDateTime(published));
     }
 
     /**
      * Writes a CMIS pathSegment tag.
      */
     public void writePathSegment(String pathSegment) throws XMLStreamException {
-        writeSimpleTag(Constants.NAMESPACE_RESTATOM, "pathSegment", pathSegment);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM, "pathSegment",
+                pathSegment);
     }
 
     /**
      * Writes a CMIS relativePathSegment tag.
      */
     public void writeRelativePathSegment(String relativePathSegment) throws XMLStreamException {
-        writeSimpleTag(Constants.NAMESPACE_RESTATOM, "relativePathSegment", relativePathSegment);
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM,
+                "relativePathSegment", relativePathSegment);
     }
 
     /**
@@ -162,24 +135,21 @@ public abstract class AtomDocumentBase e
             throws XMLStreamException {
         XMLStreamWriter xsw = getWriter();
 
-        xsw.writeStartElement(Constants.NAMESPACE_APP, "collection");
+        xsw.writeStartElement(XMLConstants.PREFIX_APP, "collection", XMLConstants.NAMESPACE_APP);
         xsw.writeAttribute("href", href);
 
         if (collectionType != null) {
-            xsw.writeStartElement(Constants.NAMESPACE_RESTATOM, "collectionType");
-            xsw.writeCharacters(collectionType);
-            xsw.writeEndElement();
+            XMLUtils.write(xsw, XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM, "collectionType",
+                    collectionType);
         }
 
-        xsw.writeStartElement(Constants.NAMESPACE_ATOM, "title");
+        xsw.writeStartElement(XMLConstants.PREFIX_ATOM, "title", XMLConstants.NAMESPACE_ATOM);
         xsw.writeAttribute("type", "text");
         xsw.writeCharacters(text);
         xsw.writeEndElement();
 
         for (String ct : accept) {
-            xsw.writeStartElement(Constants.NAMESPACE_APP, "accept");
-            xsw.writeCharacters(ct);
-            xsw.writeEndElement();
+            XMLUtils.write(xsw, XMLConstants.PREFIX_APP, XMLConstants.NAMESPACE_APP, "accept", ct);
         }
 
         xsw.writeEndElement();
@@ -191,7 +161,7 @@ public abstract class AtomDocumentBase e
     public void writeLink(String rel, String href, String type, String id) throws XMLStreamException {
         XMLStreamWriter xsw = getWriter();
 
-        xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link");
+        xsw.writeStartElement(XMLConstants.PREFIX_ATOM, "link", XMLConstants.NAMESPACE_ATOM);
 
         xsw.writeAttribute("rel", rel);
         xsw.writeAttribute("href", href);
@@ -199,7 +169,7 @@ public abstract class AtomDocumentBase e
             xsw.writeAttribute("type", type);
         }
         if (id != null) {
-            xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "id", id);
+            xsw.writeAttribute(XMLConstants.NAMESPACE_RESTATOM, "id", id);
         }
 
         xsw.writeEndElement();
@@ -229,7 +199,7 @@ public abstract class AtomDocumentBase e
             throws XMLStreamException {
         XMLStreamWriter xsw = getWriter();
 
-        xsw.writeStartElement(Constants.NAMESPACE_ATOM, "link");
+        xsw.writeStartElement(XMLConstants.PREFIX_ATOM, "link", XMLConstants.NAMESPACE_ATOM);
 
         xsw.writeAttribute("rel", Constants.REL_ALTERNATE);
         xsw.writeAttribute("href", href);
@@ -237,7 +207,7 @@ public abstract class AtomDocumentBase e
             xsw.writeAttribute("type", type);
         }
         if (kind != null) {
-            xsw.writeAttribute(Constants.NAMESPACE_RESTATOM, "renditionKind", kind);
+            xsw.writeAttribute(XMLConstants.NAMESPACE_RESTATOM, "renditionKind", kind);
         }
         if (title != null) {
             xsw.writeAttribute("title", title);

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -18,18 +18,14 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
-import javax.xml.bind.JAXBException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
 import org.apache.chemistry.opencmis.commons.server.ObjectInfo;
 
 /**
@@ -56,13 +52,13 @@ public class AtomEntry extends AtomDocum
      * Opens the entry tag.
      */
     public void startEntry(boolean isRoot) throws XMLStreamException {
-        getWriter().writeStartElement(Constants.NAMESPACE_ATOM, "entry");
+        getWriter().writeStartElement(XMLConstants.NAMESPACE_ATOM, "entry");
 
         if (isRoot) {
-            writeNamespace(Constants.NAMESPACE_ATOM);
-            writeNamespace(Constants.NAMESPACE_CMIS);
-            writeNamespace(Constants.NAMESPACE_RESTATOM);
-            writeNamespace(Constants.NAMESPACE_APP);
+            writeNamespace(XMLConstants.NAMESPACE_ATOM);
+            writeNamespace(XMLConstants.NAMESPACE_CMIS);
+            writeNamespace(XMLConstants.NAMESPACE_RESTATOM);
+            writeNamespace(XMLConstants.NAMESPACE_APP);
             writeAllCustomNamespace();
         }
     }
@@ -78,9 +74,8 @@ public class AtomEntry extends AtomDocum
      * Writes an object.
      */
     public void writeObject(ObjectData object, ObjectInfo info, String contentSrc, String contentType,
-            String pathSegment, String relativePathSegment) throws XMLStreamException, JAXBException {
-        CmisObjectType objectJaxb = convert(object);
-        if (objectJaxb == null) {
+            String pathSegment, String relativePathSegment, CmisVersion cmisVersion) throws XMLStreamException {
+        if (object == null) {
             return;
         }
 
@@ -92,7 +87,8 @@ public class AtomEntry extends AtomDocum
 
         writeContent(contentSrc, contentType);
 
-        JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(objectJaxb), getWriter(), true);
+        XMLConverter.writeObject(getWriter(), cmisVersion, XMLConstants.TAG_OBJECT, XMLConstants.NAMESPACE_RESTATOM,
+                object);
 
         writePathSegment(pathSegment);
         writeRelativePathSegment(relativePathSegment);
@@ -101,9 +97,8 @@ public class AtomEntry extends AtomDocum
     /**
      * Writes a delete object.
      */
-    public void writeDeletedObject(ObjectData object) throws XMLStreamException, JAXBException {
-        CmisObjectType objectJaxb = convert(object);
-        if (objectJaxb == null) {
+    public void writeDeletedObject(ObjectData object, CmisVersion cmisVersion) throws XMLStreamException {
+        if (object == null) {
             return;
         }
 
@@ -115,17 +110,15 @@ public class AtomEntry extends AtomDocum
         writeTitle(object.getId());
         writeUpdated(now);
 
-        JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(objectJaxb), getWriter(), true);
+        XMLConverter.writeObject(getWriter(), cmisVersion, XMLConstants.TAG_OBJECT, XMLConstants.NAMESPACE_RESTATOM,
+                object);
     }
 
     /**
      * Writes a type.
-     * 
-     * @throws JAXBException
      */
-    public void writeType(TypeDefinition type) throws XMLStreamException, JAXBException {
-        CmisTypeDefinitionType typeJaxb = convert(type);
-        if (typeJaxb == null) {
+    public void writeType(TypeDefinition type, CmisVersion cmisVersion) throws XMLStreamException {
+        if (type == null) {
             return;
         }
 
@@ -136,7 +129,7 @@ public class AtomEntry extends AtomDocum
         writeTitle(type.getDisplayName());
         writeUpdated(now);
 
-        JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createTypeDefinition(typeJaxb), getWriter(), true);
+        XMLConverter.writeTypeDefinition(getWriter(), cmisVersion, XMLConstants.NAMESPACE_RESTATOM, type);
     }
 
     /**
@@ -148,7 +141,7 @@ public class AtomEntry extends AtomDocum
         }
 
         XMLStreamWriter xsw = getWriter();
-        xsw.writeStartElement(Constants.NAMESPACE_ATOM, "content");
+        xsw.writeStartElement(XMLConstants.PREFIX_ATOM, "content", XMLConstants.NAMESPACE_ATOM);
 
         xsw.writeAttribute("src", src);
         if (type != null) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.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/AtomEntryParser.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.java Fri Mar  8 13:27:43 2013
@@ -31,7 +31,6 @@ import java.util.Map;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
@@ -51,6 +50,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.Converter;
 import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
@@ -190,11 +190,7 @@ public class AtomEntryParser {
         }
 
         cappedStream = new CappedInputStream(stream, MAX_STREAM_LENGTH);
-
-        XMLInputFactory factory = XMLInputFactory.newInstance();
-        factory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
-        factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE);
-        XMLStreamReader parser = factory.createXMLStreamReader(cappedStream);
+        XMLStreamReader parser = XMLUtils.createParser(cappedStream);
 
         while (true) {
             int event = parser.getEventType();

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -26,6 +26,8 @@ import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 
 /**
  * Atom Feed class.
@@ -104,11 +106,7 @@ public class AtomFeed extends AtomDocume
      * Writes a CMIS numItems tag.
      */
     public void writeNumItems(BigInteger numItems) throws XMLStreamException {
-        if (numItems == null) {
-            return;
-        }
-
-        writeSimpleTag(Constants.NAMESPACE_RESTATOM, "numItems", numItems.toString());
+        XMLUtils.write(getWriter(), XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM, "numItems", numItems);
     }
 
     /**

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
-import javax.xml.bind.JAXBException;
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
@@ -36,6 +35,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer;
 import org.apache.chemistry.opencmis.commons.enums.BaseTypeId;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
@@ -153,7 +153,8 @@ public final class AtomPubUtils {
      */
     public static void writeObjectEntry(CmisService service, AtomEntry entry, ObjectData object,
             List<ObjectInFolderContainer> children, String repositoryId, String pathSegment,
-            String relativePathSegment, UrlBuilder baseUrl, boolean isRoot) throws XMLStreamException, JAXBException {
+            String relativePathSegment, UrlBuilder baseUrl, boolean isRoot, CmisVersion cmisVersion)
+            throws XMLStreamException {
         if (object == null) {
             throw new CmisRuntimeException("Object not set!");
         }
@@ -178,7 +179,8 @@ public final class AtomPubUtils {
             contentSrc = contentSrcBuilder.toString();
         }
 
-        entry.writeObject(object, info, contentSrc, info.getContentType(), pathSegment, relativePathSegment);
+        entry.writeObject(object, info, contentSrc, info.getContentType(), pathSegment, relativePathSegment,
+                cmisVersion);
 
         // write links
         entry.writeServiceLink(baseUrl.toString(), repositoryId);
@@ -265,7 +267,7 @@ public final class AtomPubUtils {
 
         // write children
         if ((children != null) && (children.size() > 0)) {
-            writeObjectChildren(service, entry, info, children, repositoryId, baseUrl);
+            writeObjectChildren(service, entry, info, children, repositoryId, baseUrl, cmisVersion);
         }
 
         // we are done
@@ -280,7 +282,8 @@ public final class AtomPubUtils {
      */
     public static void writeContentChangesObjectEntry(CmisService service, AtomEntry entry, ObjectData object,
             List<ObjectInFolderContainer> children, String repositoryId, String pathSegment,
-            String relativePathSegment, UrlBuilder baseUrl, boolean isRoot) throws XMLStreamException, JAXBException {
+            String relativePathSegment, UrlBuilder baseUrl, boolean isRoot, CmisVersion cmisVersion)
+            throws XMLStreamException {
         if (object == null) {
             throw new CmisRuntimeException("Object not set!");
         }
@@ -294,7 +297,7 @@ public final class AtomPubUtils {
 
         if (info != null) {
             writeObjectEntry(service, entry, object, children, repositoryId, pathSegment, relativePathSegment, baseUrl,
-                    isRoot);
+                    isRoot, cmisVersion);
             return;
         }
 
@@ -302,7 +305,7 @@ public final class AtomPubUtils {
         entry.startEntry(isRoot);
 
         // write object
-        entry.writeDeletedObject(object);
+        entry.writeDeletedObject(object, cmisVersion);
 
         // write links
         entry.writeServiceLink(baseUrl.toString(), repositoryId);
@@ -315,8 +318,8 @@ public final class AtomPubUtils {
      * Writes an objects entry children feed.
      */
     public static void writeObjectChildren(CmisService service, AtomEntry entry, ObjectInfo folderInfo,
-            List<ObjectInFolderContainer> children, String repositoryId, UrlBuilder baseUrl) throws XMLStreamException,
-            JAXBException {
+            List<ObjectInFolderContainer> children, String repositoryId, UrlBuilder baseUrl, CmisVersion cmisVersion)
+            throws XMLStreamException {
 
         // start
         AtomFeed feed = new AtomFeed(entry.getWriter());
@@ -344,7 +347,7 @@ public final class AtomPubUtils {
         for (ObjectInFolderContainer container : children) {
             if ((container != null) && (container.getObject() != null)) {
                 writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(),
-                        repositoryId, container.getObject().getPathSegment(), null, baseUrl, false);
+                        repositoryId, container.getObject().getPathSegment(), null, baseUrl, false, cmisVersion);
             }
         }
 
@@ -357,13 +360,13 @@ public final class AtomPubUtils {
      * Writes the a type entry.
      */
     public static void writeTypeEntry(AtomEntry entry, TypeDefinition type, List<TypeDefinitionContainer> children,
-            String repositoryId, UrlBuilder baseUrl, boolean isRoot) throws XMLStreamException, JAXBException {
+            String repositoryId, UrlBuilder baseUrl, boolean isRoot, CmisVersion cmisVersion) throws XMLStreamException {
 
         // start
         entry.startEntry(isRoot);
 
         // write type
-        entry.writeType(type);
+        entry.writeType(type, cmisVersion);
 
         // write links
         entry.writeServiceLink(baseUrl.toString(), repositoryId);
@@ -383,7 +386,7 @@ public final class AtomPubUtils {
 
         // write children
         if ((children != null) && (children.size() > 0)) {
-            writeTypeChildren(entry, type, children, repositoryId, baseUrl);
+            writeTypeChildren(entry, type, children, repositoryId, baseUrl, cmisVersion);
         }
 
         // we are done
@@ -394,7 +397,7 @@ public final class AtomPubUtils {
      * Writes the a type entry children feed.
      */
     private static void writeTypeChildren(AtomEntry entry, TypeDefinition type, List<TypeDefinitionContainer> children,
-            String repositoryId, UrlBuilder baseUrl) throws XMLStreamException, JAXBException {
+            String repositoryId, UrlBuilder baseUrl, CmisVersion cmisVersion) throws XMLStreamException {
 
         // start
         AtomFeed feed = new AtomFeed(entry.getWriter());
@@ -425,7 +428,7 @@ public final class AtomPubUtils {
         for (TypeDefinitionContainer container : children) {
             if ((container != null) && (container.getTypeDefinition() != null)) {
                 writeTypeEntry(entry, container.getTypeDefinition(), container.getChildren(), repositoryId, baseUrl,
-                        false);
+                        false, cmisVersion);
             }
         }
 

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -40,13 +40,15 @@ import javax.xml.bind.Unmarshaller;
 
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.data.ObjectList;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectType;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisQueryType;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
@@ -170,6 +172,7 @@ public final class DiscoveryService {
         feed.writePagingLinks(pagingUrl, maxItems, skipCount, results.getNumItems(), results.hasMoreItems(),
                 AtomPubUtils.PAGE_SIZE);
 
+        CmisVersion cmisVersion = context.getCmisVersion();
         if (results.getObjects() != null) {
             AtomEntry entry = new AtomEntry(feed.getWriter());
             int idCounter = 0;
@@ -178,7 +181,7 @@ public final class DiscoveryService {
                     continue;
                 }
                 idCounter++;
-                writeQueryResultEntry(entry, result, "id-" + idCounter, now);
+                writeQueryResultEntry(entry, result, "id-" + idCounter, now, cmisVersion);
             }
         }
 
@@ -187,10 +190,9 @@ public final class DiscoveryService {
         feed.endDocument();
     }
 
-    private static void writeQueryResultEntry(AtomEntry entry, ObjectData result, String id, GregorianCalendar now)
-            throws Exception {
-        CmisObjectType resultJaxb = convert(result);
-        if (resultJaxb == null) {
+    private static void writeQueryResultEntry(AtomEntry entry, ObjectData result, String id, GregorianCalendar now,
+            CmisVersion cmisVersion) throws Exception {
+        if (result == null) {
             return;
         }
 
@@ -205,7 +207,8 @@ public final class DiscoveryService {
         entry.writeUpdated(now);
 
         // write query result object
-        JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(resultJaxb), entry.getWriter(), true);
+        XMLConverter.writeObject(entry.getWriter(), cmisVersion, XMLConstants.TAG_OBJECT,
+                XMLConstants.NAMESPACE_RESTATOM, result);
 
         // we are done
         entry.endEntry();
@@ -269,7 +272,8 @@ public final class DiscoveryService {
                 if (object == null) {
                     continue;
                 }
-                writeContentChangesObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
+                writeContentChangesObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false,
+                        context.getCmisVersion());
             }
         }
 

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -94,7 +94,8 @@ public final class MultiFilingService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         entry.endDocument();
     }
 
@@ -134,7 +135,8 @@ public final class MultiFilingService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -182,7 +182,7 @@ public final class NavigationService {
                     continue;
                 }
                 writeObjectEntry(service, entry, object.getObject(), null, repositoryId, object.getPathSegment(), null,
-                        baseUrl, false);
+                        baseUrl, false, context.getCmisVersion());
             }
         }
 
@@ -258,7 +258,7 @@ public final class NavigationService {
                 continue;
             }
             writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(), repositoryId,
-                    container.getObject().getPathSegment(), null, baseUrl, false);
+                    container.getObject().getPathSegment(), null, baseUrl, false, context.getCmisVersion());
         }
 
         // we are done
@@ -334,7 +334,7 @@ public final class NavigationService {
                 continue;
             }
             writeObjectEntry(service, entry, container.getObject().getObject(), container.getChildren(), repositoryId,
-                    container.getObject().getPathSegment(), null, baseUrl, false);
+                    container.getObject().getPathSegment(), null, baseUrl, false, context.getCmisVersion());
         }
 
         // we are done
@@ -396,7 +396,7 @@ public final class NavigationService {
                 continue;
             }
             writeObjectEntry(service, entry, object.getObject(), null, repositoryId, null,
-                    object.getRelativePathSegment(), baseUrl, false);
+                    object.getRelativePathSegment(), baseUrl, false, context.getCmisVersion());
         }
 
         // we are done
@@ -484,7 +484,8 @@ public final class NavigationService {
                 if (object == null) {
                     continue;
                 }
-                writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
+                writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false,
+                        context.getCmisVersion());
             }
         }
 

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -129,7 +129,8 @@ public final class ObjectService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         entry.endDocument();
     }
 
@@ -166,7 +167,8 @@ public final class ObjectService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         entry.endDocument();
     }
 
@@ -324,7 +326,8 @@ public final class ObjectService {
 
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         entry.endDocument();
     }
 
@@ -365,7 +368,8 @@ public final class ObjectService {
 
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         entry.endDocument();
     }
 
@@ -493,7 +497,8 @@ public final class ObjectService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletReq
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
@@ -95,7 +96,8 @@ public final class PolicyService {
             if (policy == null) {
                 continue;
             }
-            writePolicyEntry(service, entry, objectInfo.getId(), policy, repositoryId, baseUrl);
+            writePolicyEntry(service, entry, objectInfo.getId(), policy, repositoryId, baseUrl,
+                    context.getCmisVersion());
         }
 
         // we are done
@@ -140,7 +142,7 @@ public final class PolicyService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writePolicyEntry(service, entry, objectId, policy, repositoryId, baseUrl);
+        writePolicyEntry(service, entry, objectId, policy, repositoryId, baseUrl, context.getCmisVersion());
         entry.endDocument();
     }
 
@@ -164,7 +166,7 @@ public final class PolicyService {
      * Writes an entry that is attached to an object.
      */
     private static void writePolicyEntry(CmisService service, AtomEntry entry, String objectId, ObjectData policy,
-            String repositoryId, UrlBuilder baseUrl) throws Exception {
+            String repositoryId, UrlBuilder baseUrl, CmisVersion cmisVersion) throws Exception {
         CmisObjectType resultJaxb = convert(policy);
         if (resultJaxb == null) {
             return;
@@ -179,7 +181,7 @@ public final class PolicyService {
         entry.startEntry(false);
 
         // write the object
-        entry.writeObject(policy, info, null, null, null, null);
+        entry.writeObject(policy, info, null, null, null, null, cmisVersion);
 
         // write links
         UrlBuilder selfLink = compileUrlBuilder(baseUrl, RESOURCE_POLICIES, objectId);

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -116,7 +116,8 @@ public final class RelationshipService {
             if (object == null) {
                 continue;
             }
-            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
+            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false,
+                    context.getCmisVersion());
         }
 
         // we are done

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -56,6 +56,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityChanges;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
@@ -104,6 +105,7 @@ public final class RepositoryService {
         serviceDoc.startServiceDocument();
 
         if (infoDataList != null) {
+            CmisVersion cmisVersion = context.getCmisVersion();
             for (RepositoryInfo infoData : infoDataList) {
                 if (infoData == null) {
                     continue;
@@ -178,7 +180,7 @@ public final class RepositoryService {
                 }
 
                 // add repository info
-                serviceDoc.writeRepositoryInfo(infoData);
+                serviceDoc.writeRepositoryInfo(infoData, cmisVersion);
 
                 // add links
 
@@ -313,7 +315,7 @@ public final class RepositoryService {
         if ((typeList != null) && (typeList.getList() != null)) {
             AtomEntry entry = new AtomEntry(feed.getWriter());
             for (TypeDefinition type : typeList.getList()) {
-                writeTypeEntry(entry, type, null, repositoryId, baseUrl, false);
+                writeTypeEntry(entry, type, null, repositoryId, baseUrl, false, context.getCmisVersion());
             }
         }
 
@@ -387,7 +389,7 @@ public final class RepositoryService {
             for (TypeDefinitionContainer container : typeTree) {
                 if ((container != null) && (container.getTypeDefinition() != null)) {
                     writeTypeEntry(entry, container.getTypeDefinition(), container.getChildren(), repositoryId,
-                            baseUrl, false);
+                            baseUrl, false, context.getCmisVersion());
                 }
             }
         }
@@ -414,7 +416,8 @@ public final class RepositoryService {
 
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeTypeEntry(entry, type, null, repositoryId, compileBaseUrl(request, repositoryId), true);
+        writeTypeEntry(entry, type, null, repositoryId, compileBaseUrl(request, repositoryId), true,
+                context.getCmisVersion());
         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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -18,16 +18,14 @@
  */
 package org.apache.chemistry.opencmis.server.impl.atompub;
 
-import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
-
-import javax.xml.bind.JAXBException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisRepositoryInfoType;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 
 /**
  * Service document class.
@@ -39,11 +37,11 @@ public class ServiceDocument extends Ato
 
     public void startServiceDocument() throws XMLStreamException {
         XMLStreamWriter xsw = getWriter();
-        xsw.writeStartElement(Constants.NAMESPACE_APP, "service");
-        writeNamespace(Constants.NAMESPACE_APP);
-        writeNamespace(Constants.NAMESPACE_ATOM);
-        writeNamespace(Constants.NAMESPACE_CMIS);
-        writeNamespace(Constants.NAMESPACE_RESTATOM);
+        xsw.writeStartElement(XMLConstants.PREFIX_APP, "service", XMLConstants.NAMESPACE_APP);
+        writeNamespace(XMLConstants.NAMESPACE_APP);
+        writeNamespace(XMLConstants.NAMESPACE_ATOM);
+        writeNamespace(XMLConstants.NAMESPACE_CMIS);
+        writeNamespace(XMLConstants.NAMESPACE_RESTATOM);
         writeAllCustomNamespace();
     }
 
@@ -52,30 +50,27 @@ public class ServiceDocument extends Ato
     }
 
     public void startWorkspace(String title) throws XMLStreamException {
-        getWriter().writeStartElement(Constants.NAMESPACE_APP, "workspace");
-        writeSimpleTag(Constants.NAMESPACE_ATOM, "title", title);
+        XMLStreamWriter xsw = getWriter();
+
+        xsw.writeStartElement(XMLConstants.PREFIX_APP, "workspace", XMLConstants.NAMESPACE_APP);
+        XMLUtils.write(xsw, XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM, "title", title);
     }
 
     public void endWorkspace() throws XMLStreamException {
         getWriter().writeEndElement();
     }
 
-    public void writeRepositoryInfo(RepositoryInfo repInfo) throws JAXBException {
-        CmisRepositoryInfoType repInfoJaxb = convert(repInfo);
-        if (repInfoJaxb == null) {
-            return;
-        }
-
-        JaxBHelper.marshal(JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createRepositoryInfo(repInfoJaxb), getWriter(), true);
+    public void writeRepositoryInfo(RepositoryInfo repInfo, CmisVersion cmisVersion) throws XMLStreamException {
+        XMLConverter.writeRepositoryInfo(getWriter(), cmisVersion, XMLConstants.NAMESPACE_RESTATOM, repInfo);
     }
 
     public void writeUriTemplate(String template, String type, String mediatype) throws XMLStreamException {
         XMLStreamWriter xsw = getWriter();
 
-        xsw.writeStartElement(Constants.NAMESPACE_RESTATOM, "uritemplate");
-        writeSimpleTag(Constants.NAMESPACE_RESTATOM, "template", template);
-        writeSimpleTag(Constants.NAMESPACE_RESTATOM, "type", type);
-        writeSimpleTag(Constants.NAMESPACE_RESTATOM, "mediatype", mediatype);
+        xsw.writeStartElement(XMLConstants.PREFIX_RESTATOM, "uritemplate", XMLConstants.NAMESPACE_RESTATOM);
+        XMLUtils.write(xsw, XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM, "template", template);
+        XMLUtils.write(xsw, XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM, "type", type);
+        XMLUtils.write(xsw, XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM, "mediatype", mediatype);
         xsw.writeEndElement();
     }
 }

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -89,7 +89,8 @@ public final class VersioningService {
         // write XML
         AtomEntry entry = new AtomEntry();
         entry.startDocument(response.getOutputStream(), getNamespaces(service));
-        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true);
+        writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, true,
+                context.getCmisVersion());
         entry.endDocument();
     }
 
@@ -143,7 +144,8 @@ public final class VersioningService {
             if (object == null) {
                 continue;
             }
-            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false);
+            writeObjectEntry(service, entry, object, null, repositoryId, null, null, baseUrl, false,
+                    context.getCmisVersion());
         }
 
         // we are done

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=1454378&r1=1454377&r2=1454378&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 Fri Mar  8 13:27:43 2013
@@ -21,23 +21,17 @@ package org.apache.chemistry.opencmis.se
 import java.io.OutputStream;
 import java.util.Map;
 
-import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.chemistry.opencmis.commons.impl.Constants;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 
 /**
  * Base class for XML documents.
  */
 public abstract class XMLDocumentBase {
 
-    public static final String PREFIX_ATOM = "atom";
-    public static final String PREFIX_CMIS = "cmis";
-    public static final String PREFIX_RESTATOM = "cmisra";
-    public static final String PREFIX_APP = "app";
-    public static final String PREFIX_XSI = "xsi";
-
     private XMLStreamWriter writer;
     private Map<String, String> namespaces;
 
@@ -45,11 +39,10 @@ public abstract class XMLDocumentBase {
      * Sets the namespaces for the document.
      */
     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);
+        writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
+        writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
+        writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
+        writer.setPrefix(XMLConstants.PREFIX_APP, XMLConstants.NAMESPACE_APP);
 
         if (namespaces != null) {
             this.namespaces = namespaces;
@@ -82,8 +75,7 @@ public abstract class XMLDocumentBase {
      */
     public void startDocument(OutputStream out, Map<String, String> namespaces) throws XMLStreamException {
         // create a writer
-        XMLOutputFactory factory = XMLOutputFactory.newInstance();
-        writer = factory.createXMLStreamWriter(out, "UTF-8");
+        writer = XMLUtils.createWriter(out);
 
         // start the document
         writer.writeStartDocument("UTF-8", "1.0");

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java Fri Mar  8 13:27:43 2013
@@ -41,8 +41,8 @@ import java.util.Set;
 import java.util.TimeZone;
 
 import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.chemistry.opencmis.commons.PropertyIds;
 import org.apache.chemistry.opencmis.commons.data.Ace;
@@ -76,6 +76,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.CapabilityJoin;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityQuery;
 import org.apache.chemistry.opencmis.commons.enums.CapabilityRenditions;
+import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.enums.SupportedPermissions;
 import org.apache.chemistry.opencmis.commons.enums.Updatability;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
@@ -94,6 +95,9 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.Converter;
 import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
 import org.apache.chemistry.opencmis.commons.impl.MimeTypes;
+import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlEntryImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlListImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.AccessControlPrincipalDataImpl;
@@ -1938,18 +1942,25 @@ public class FileShareRepository {
         }
 
         // create object
-        CmisObjectType object = new CmisObjectType();
-        object.setProperties(Converter.convert(properties));
+        ObjectDataImpl object = new ObjectDataImpl();
+        object.setProperties(properties);
 
-        // write it
+        OutputStream stream = null;
         try {
-            JAXBElement<CmisObjectType> objElement = JaxBHelper.CMIS_EXTRA_OBJECT_FACTORY.createObject(object);
-
-            Marshaller m = JaxBHelper.createMarshaller();
-            m.setProperty("jaxb.formatted.output", true);
-            m.marshal(objElement, propFile);
+            stream = new BufferedOutputStream(new FileOutputStream(propFile));
+            XMLStreamWriter writer = XMLUtils.createWriter(stream);
+            XMLConverter.writeObject(writer, CmisVersion.CMIS_1_1, XMLConstants.NAMESPACE_CMIS, object);
+            writer.close();
         } catch (Exception e) {
             throw new CmisStorageException("Couldn't store properties!", e);
+        } finally {
+            if (stream != null) {
+                try {
+                    stream.close();
+                } catch (IOException e2) {
+                    // ignore
+                }
+            }
         }
     }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java?rev=1454378&r1=1454377&r2=1454378&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareServiceFactory.java Fri Mar  8 13:27:43 2013
@@ -20,20 +20,20 @@
  */
 package org.apache.chemistry.opencmis.fileshare;
 
-import java.io.File;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.InputStream;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLStreamReader;
 
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.impl.Converter;
-import org.apache.chemistry.opencmis.commons.impl.JaxBHelper;
-import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDefinitionType;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.server.AbstractServiceFactory;
 import org.apache.chemistry.opencmis.commons.server.CallContext;
 import org.apache.chemistry.opencmis.commons.server.CmisService;
@@ -207,15 +207,21 @@ public class FileShareServiceFactory ext
         return result.toString();
     }
 
-    @SuppressWarnings("unchecked")
     private static TypeDefinition loadType(String filename) {
         TypeDefinition result = null;
 
         try {
-            Unmarshaller u = JaxBHelper.createUnmarshaller();
-            JAXBElement<CmisTypeDefinitionType> type = (JAXBElement<CmisTypeDefinitionType>) u.unmarshal(new File(
-                    filename));
-            result = Converter.convert(type.getValue());
+            InputStream stream = new BufferedInputStream(new FileInputStream(filename));
+
+            XMLStreamReader parser = XMLUtils.createParser(stream);
+            if (!XMLUtils.findNextStartElemenet(parser)) {
+                return null;
+            }
+
+            result = XMLConverter.convertTypeDefinition(parser);
+
+            parser.close();
+            stream.close();
         } catch (Exception e) {
             LOG.info("Could not load type: '" + filename + "'", e);
         }



Mime
View raw message