chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmpas...@apache.org
Subject svn commit: r1578909 - in /chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis: client/bindings/spi/atompub/ client/bindings/spi/atompub/objects/ client/bindings/spi/http/ co...
Date Tue, 18 Mar 2014 14:05:46 GMT
Author: jmpascal
Date: Tue Mar 18 14:05:45 2014
New Revision: 1578909

URL: http://svn.apache.org/r1578909
Log:
Update Android Client code to the latest trunk version.

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AbstractAtomPubService.java Tue Mar 18 14:05:45 2014
@@ -71,11 +71,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUnauthorizedException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisVersioningException;
-import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
-import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.Constants;
 import org.apache.chemistry.opencmis.commons.impl.ReturnVersion;
 import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
+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;
@@ -83,6 +83,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PolicyIdListImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIdImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyStringImpl;
 import org.xmlpull.v1.XmlSerializer;
 
 import android.util.Xml;
@@ -141,6 +142,10 @@ public abstract class AbstractAtomPubSer
      * Return the CMIS version of the given repository.
      */
     protected CmisVersion getCmisVersion(String repositoryId) {
+        if (CmisBindingsHelper.getForcedCmisVersion(session) != null) {
+            return CmisBindingsHelper.getForcedCmisVersion(session);
+        }
+
         RepositoryInfoCache cache = CmisBindingsHelper.getRepositoryInfoCache(session);
         RepositoryInfo info = cache.get(repositoryId);
 
@@ -447,6 +452,12 @@ public abstract class AbstractAtomPubSer
         message = extractErrorMessage(message, errorContent);
 
         switch (code) {
+        case 301:
+        case 302:
+        case 303:
+        case 307:
+            return new CmisConnectionException("Redirects are not supported (HTTP status code " + code + "): "
+                    + message, errorContent, t);
         case 400:
             if (CmisFilterNotValidException.EXCEPTION_NAME.equals(exception)) {
                 return new CmisFilterNotValidException(message, errorContent, t);
@@ -535,11 +546,18 @@ public abstract class AbstractAtomPubSer
     /**
      * Creates a CMIS object with properties and policy ids.
      */
-    protected ObjectDataImpl createObject(Properties properties, List<String> policies) {
+    protected ObjectDataImpl createObject(Properties properties, String changeToken, List<String> policies) {
         ObjectDataImpl object = new ObjectDataImpl();
 
         if (properties == null) {
             properties = new PropertiesImpl();
+            if (changeToken != null) {
+                ((PropertiesImpl) properties)
+                        .addProperty(new PropertyStringImpl(PropertyIds.CHANGE_TOKEN, changeToken));
+            }
+        } else if (changeToken != null && !properties.getProperties().containsKey(PropertyIds.CHANGE_TOKEN)) {
+            properties = new PropertiesImpl(properties);
+            ((PropertiesImpl) properties).addProperty(new PropertyStringImpl(PropertyIds.CHANGE_TOKEN, changeToken));
         }
         object.setProperties(properties);
 
@@ -941,8 +959,7 @@ public abstract class AbstractAtomPubSer
         // update
         Response resp = put(aclUrl, Constants.MEDIATYPE_ACL, new Output() {
             public void write(OutputStream out) throws Exception {
-                XmlSerializer writer = Xml.newSerializer();
-                writer.setOutput(out, AtomEntryWriter.ENCODING);
+                XmlSerializer writer = XMLUtils.createWriter(out);
                 XMLUtils.startXmlDocument(writer);
                 XMLConverter.writeAcl(writer, cmisVersion, true, acl);
                 XMLUtils.endXmlDocument(writer);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java Tue Mar 18 14:05:45 2014
@@ -59,9 +59,7 @@ import android.util.Xml;
  */
 public class AtomEntryWriter {
 
-    public static final String ENCODING = IOUtils.UTF8;
-
-    private static final int BUFFER_SIZE = 64 * 1024;
+    private static final int BUFFER_SIZE = 8 * 1024;
 
     private final CmisVersion cmisVersion;
     private final ObjectData object;
@@ -148,8 +146,7 @@ public class AtomEntryWriter {
      * @throws IllegalArgumentException
      */
     public void write(OutputStream out) throws IOException {
-        XmlSerializer writer = Xml.newSerializer();
-        writer.setOutput(out, ENCODING);
+        XmlSerializer  writer = XMLUtils.createWriter(out);
 
         // start doc
         XMLUtils.startXmlDocument(writer);
@@ -160,11 +157,11 @@ public class AtomEntryWriter {
         writer.attribute("", XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
         writer.attribute("", XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
         writer.attribute("", XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
-        /*
-         * if (contentStream != null && contentStream.getFileName() != null) {
-         * writer.attribute("", XMLConstants.PREFIX_APACHE_CHEMISTY,
-         * XMLConstants.NAMESPACE_APACHE_CHEMISTRY); }
-         */
+        
+        if (contentStream != null && contentStream.getFileName() != null) {
+          writer.attribute("", XMLConstants.PREFIX_APACHE_CHEMISTY,XMLConstants.NAMESPACE_APACHE_CHEMISTRY); 
+        }
+        
 
         // atom:id
         writeTag(writer, XMLConstants.NAMESPACE_ATOM, TAG_ATOM_ID, "urn:uuid:00000000-0000-0000-0000-00000000000");

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java Tue Mar 18 14:05:45 2014
@@ -30,6 +30,7 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CONTENT;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ENTRY;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_FEED;
+import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_HTML;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_LINK;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_NUM_ITEMS;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT;
@@ -42,8 +43,6 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_TYPE;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_URI_TEMPLATE;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_WORKSPACE;
-import static org.apache.chemistry.opencmis.commons.impl.XMLUtils.next;
-import static org.apache.chemistry.opencmis.commons.impl.XMLUtils.skip;
 
 import java.io.InputStream;
 import java.math.BigInteger;
@@ -59,6 +58,7 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
+import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.HtmlDoc;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.RepositoryWorkspace;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.ServiceDoc;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
@@ -124,6 +124,9 @@ public class AtomPubParser {
                             parseResult = parseServiceDoc(parser);
                             break;
                         }
+                    } else if (TAG_HTML.equalsIgnoreCase(name.getLocalPart())) {
+                        parseResult = new HtmlDoc();
+                        break;
                     }
                 }
 
@@ -150,7 +153,7 @@ public class AtomPubParser {
     private static ServiceDoc parseServiceDoc(XmlPullParser parser) throws XmlPullParserException {
         ServiceDoc result = new ServiceDoc();
 
-        next(parser);
+        XMLUtils.next(parser);
 
         while (true) {
             int event = parser.getEventType();
@@ -161,10 +164,10 @@ public class AtomPubParser {
                     if (TAG_WORKSPACE.equals(name.getLocalPart())) {
                         result.addWorkspace(parseWorkspace(parser));
                     } else {
-                        skip(parser);
+                        XMLUtils.skip(parser);
                     }
                 } else {
-                    skip(parser);
+                    XMLUtils.skip(parser);
                 }
             } else if (event == XmlPullParser.END_TAG) {
                 break;
@@ -184,7 +187,7 @@ public class AtomPubParser {
     private static RepositoryWorkspace parseWorkspace(XmlPullParser parser) throws XmlPullParserException {
         RepositoryWorkspace workspace = new RepositoryWorkspace();
 
-        next(parser);
+        XMLUtils.next(parser);
 
         while (true) {
             int event = parser.getEventType();
@@ -201,13 +204,13 @@ public class AtomPubParser {
             } else if (event == XmlPullParser.END_TAG) {
                 break;
             } else {
-                if (!next(parser)) {
+                if (!XMLUtils.next(parser)) {
                     break;
                 }
             }
         }
 
-        next(parser);
+        XMLUtils.next(parser);
 
         return workspace;
     }
@@ -218,7 +221,7 @@ public class AtomPubParser {
     private AtomFeed parseFeed(XmlPullParser parser) throws XmlPullParserException {
         AtomFeed result = new AtomFeed();
 
-        next(parser);
+        XMLUtils.next(parser);
 
         while (true) {
             int event = parser.getEventType();
@@ -231,27 +234,27 @@ public class AtomPubParser {
                     } else if (TAG_ENTRY.equals(name.getLocalPart())) {
                         result.addEntry(parseEntry(parser));
                     } else {
-                        skip(parser);
+                        XMLUtils.skip(parser);
                     }
                 } else if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
                     if (TAG_NUM_ITEMS.equals(name.getLocalPart())) {
                         result.addElement(parseBigInteger(parser));
                     } else {
-                        skip(parser);
+                        XMLUtils.skip(parser);
                     }
                 } else {
-                    skip(parser);
+                    XMLUtils.skip(parser);
                 }
             } else if (event == XmlPullParser.END_TAG) {
                 break;
             } else {
-                if (!next(parser)) {
+                if (!XMLUtils.next(parser)) {
                     break;
                 }
             }
         }
 
-        next(parser);
+        XMLUtils.next(parser);
 
         return result;
     }
@@ -264,7 +267,7 @@ public class AtomPubParser {
     private AtomEntry parseEntry(XmlPullParser parser) throws XmlPullParserException {
         AtomEntry result = new AtomEntry();
 
-        next(parser);
+        XMLUtils.next(parser);
 
         // walk through all tags in entry
         while (true) {
@@ -285,13 +288,13 @@ public class AtomPubParser {
             } else if (event == XmlPullParser.END_TAG) {
                 break;
             } else {
-                if (!next(parser)) {
+                if (!XMLUtils.next(parser)) {
                     break;
                 }
             }
         }
 
-        next(parser);
+        XMLUtils.next(parser);
 
         return result;
     }
@@ -338,7 +341,7 @@ public class AtomPubParser {
         }
 
         // we don't know it - skip it
-        skip(parser);
+        XMLUtils.skip(parser);
 
         return null;
     }
@@ -350,7 +353,7 @@ public class AtomPubParser {
         AtomElement result = null;
         QName childName = new QName(parser.getNamespace(), parser.getName());
 
-        next(parser);
+        XMLUtils.next(parser);
 
         // walk through the children tag
         while (true) {
@@ -362,21 +365,21 @@ public class AtomPubParser {
                     if (TAG_FEED.equals(name.getLocalPart())) {
                         result = new AtomElement(childName, parseFeed(parser));
                     } else {
-                        skip(parser);
+                        XMLUtils.skip(parser);
                     }
                 } else {
-                    skip(parser);
+                    XMLUtils.skip(parser);
                 }
             } else if (event == XmlPullParser.END_TAG) {
                 break;
             } else {
-                if (!next(parser)) {
+                if (!XMLUtils.next(parser)) {
                     break;
                 }
             }
         }
 
-        next(parser);
+        XMLUtils.next(parser);
 
         return result;
     }
@@ -404,7 +407,7 @@ public class AtomPubParser {
         }
 
         // we don't know it - skip it
-        skip(parser);
+        XMLUtils.skip(parser);
 
         return null;
     }
@@ -418,7 +421,7 @@ public class AtomPubParser {
 
         result.put("href", parser.getAttributeValue(null, "href"));
 
-        next(parser);
+        XMLUtils.next(parser);
 
         while (true) {
             int event = parser.getEventType();
@@ -428,18 +431,18 @@ public class AtomPubParser {
                         && TAG_COLLECTION_TYPE.equals(tagName.getLocalPart())) {
                     result.put("collectionType", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
                 } else {
-                    skip(parser);
+                    XMLUtils.skip(parser);
                 }
             } else if (event == XmlPullParser.END_TAG) {
                 break;
             } else {
-                if (!next(parser)) {
+                if (!XMLUtils.next(parser)) {
                     break;
                 }
             }
         }
 
-        next(parser);
+        XMLUtils.next(parser);
 
         return new AtomElement(name, result);
     }
@@ -451,7 +454,7 @@ public class AtomPubParser {
         QName name = new QName(parser.getNamespace(), parser.getName());
         Map<String, String> result = new HashMap<String, String>();
 
-        next(parser);
+        XMLUtils.next(parser);
 
         while (true) {
             int event = parser.getEventType();
@@ -463,21 +466,21 @@ public class AtomPubParser {
                     } else if (TAG_TEMPLATE_TYPE.equals(tagName.getLocalPart())) {
                         result.put("type", XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
                     } else {
-                        skip(parser);
+                        XMLUtils.skip(parser);
                     }
                 } else {
-                    skip(parser);
+                    XMLUtils.skip(parser);
                 }
             } else if (event == XmlPullParser.END_TAG) {
                 break;
             } else {
-                if (!next(parser)) {
+                if (!XMLUtils.next(parser)) {
                     break;
                 }
             }
         }
 
-        next(parser);
+        XMLUtils.next(parser);
 
         return new AtomElement(name, result);
     }
@@ -501,7 +504,7 @@ public class AtomPubParser {
         }
 
         // skip enclosed tags, if any
-        skip(parser);
+        XMLUtils.skip(parser);
 
         return new AtomElement(name, result);
     }
@@ -522,7 +525,7 @@ public class AtomPubParser {
         }
 
         // skip enclosed tags, if any
-        skip(parser);
+        XMLUtils.skip(parser);
 
         return new AtomElement(name, result);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubSpi.java Tue Mar 18 14:05:45 2014
@@ -56,7 +56,7 @@ public class CmisAtomPubSpi implements C
      */
     public CmisAtomPubSpi(BindingSession session) {
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Initializing AtomPub SPI...");
+            LOG.debug("Session {}: Initializing AtomPub SPI...", session.getSessionId());
         }
 
         this.session = session;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/DiscoveryServiceImpl.java Tue Mar 18 14:05:45 2014
@@ -42,11 +42,10 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectListImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.QueryTypeImpl;
 import org.apache.chemistry.opencmis.commons.spi.DiscoveryService;
+import org.apache.chemistry.opencmis.commons.spi.ExtendedHolder;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.xmlpull.v1.XmlSerializer;
 
-import android.util.Xml;
-
 /**
  * Discovery Service AtomPub client.
  */
@@ -64,32 +63,54 @@ public class DiscoveryServiceImpl extend
         ObjectListImpl result = new ObjectListImpl();
 
         // find the link
-        String link = loadRepositoryLink(repositoryId, Constants.REP_REL_CHANGES);
+        String link = null;
+        UrlBuilder url = null;
+
+        // if the application doesn't know the change log token but the link to
+        // the next Atom feed
+        if (changeLogToken instanceof ExtendedHolder && changeLogToken.getValue() == null) {
+            link = (String) ((ExtendedHolder<String>) changeLogToken).getExtraValue(Constants.REP_REL_CHANGES);
+            if (link != null) {
+                url = new UrlBuilder(link);
+            }
+        }
 
+        // if the application didn't provide a link to next Atom feed
         if (link == null) {
-            throw new CmisObjectNotFoundException("Unknown repository or content changes not supported!");
+            link = loadRepositoryLink(repositoryId, Constants.REP_REL_CHANGES);
+            if (link != null) {
+                url = new UrlBuilder(link);
+                url.addParameter(Constants.PARAM_CHANGE_LOG_TOKEN,
+                        (changeLogToken == null ? null : changeLogToken.getValue()));
+                url.addParameter(Constants.PARAM_PROPERTIES, includeProperties);
+                url.addParameter(Constants.PARAM_FILTER, filter);
+                url.addParameter(Constants.PARAM_POLICY_IDS, includePolicyIds);
+                url.addParameter(Constants.PARAM_ACL, includeACL);
+                url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
+            }
         }
 
-        UrlBuilder url = new UrlBuilder(link);
-        url.addParameter(Constants.PARAM_CHANGE_LOG_TOKEN, (changeLogToken == null ? null : changeLogToken.getValue()));
-        url.addParameter(Constants.PARAM_PROPERTIES, includeProperties);
-        url.addParameter(Constants.PARAM_FILTER, filter);
-        url.addParameter(Constants.PARAM_POLICY_IDS, includePolicyIds);
-        url.addParameter(Constants.PARAM_ACL, includeACL);
-        url.addParameter(Constants.PARAM_MAX_ITEMS, maxItems);
+        if (link == null) {
+            throw new CmisObjectNotFoundException("Unknown repository or content changes not supported!");
+        }
 
         // read and parse
         Response resp = read(url);
         AtomFeed feed = parse(resp.getStream(), AtomFeed.class);
+        String lastChangeLogToken = null;
 
         // handle top level
+        String nextLink = null;
         for (AtomElement element : feed.getElements()) {
             if (element.getObject() instanceof AtomLink) {
                 if (isNextLink(element)) {
                     result.setHasMoreItems(Boolean.TRUE);
+                    nextLink = ((AtomLink) element.getObject()).getHref();
                 }
             } else if (isInt(NAME_NUM_ITEMS, element)) {
                 result.setNumItems((BigInteger) element.getObject());
+            } else if (isStr("changeLogToken", element)) {
+                lastChangeLogToken = (String) element.getObject();
             }
         }
 
@@ -113,6 +134,17 @@ public class DiscoveryServiceImpl extend
             }
         }
 
+        if (changeLogToken != null) {
+            // the AtomPub binding cannot return a new change log token,
+            // but an OpenCMIS server uses a proprietary tag
+            changeLogToken.setValue(lastChangeLogToken);
+
+            // but we can provide the link to the next Atom feed
+            if (changeLogToken instanceof ExtendedHolder && nextLink != null) {
+                ((ExtendedHolder<String>) changeLogToken).setExtraValue(Constants.REP_REL_CHANGES, nextLink);
+            }
+        }
+
         return result;
     }
 
@@ -145,8 +177,7 @@ public class DiscoveryServiceImpl extend
         // post the query and parse results
         Response resp = post(url, Constants.MEDIATYPE_QUERY, new Output() {
             public void write(OutputStream out) throws Exception {
-                XmlSerializer writer = Xml.newSerializer();
-                writer.setOutput(out, AtomEntryWriter.ENCODING);
+                XmlSerializer writer = XMLUtils.createWriter(out);
                 XMLUtils.startXmlDocument(writer);
                 XMLConverter.writeQuery(writer, cmisVersion, query);
                 XMLUtils.endXmlDocument(writer);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java Tue Mar 18 14:05:45 2014
@@ -111,7 +111,7 @@ public class ObjectServiceImpl extends A
         url.addParameter(Constants.PARAM_VERSIONIG_STATE, versioningState);
 
         // set up writer
-        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, policies),
+        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
                 getCmisVersion(repositoryId), contentStream);
 
         // post the new folder object
@@ -150,7 +150,7 @@ public class ObjectServiceImpl extends A
         UrlBuilder url = new UrlBuilder(link);
 
         // set up writer
-        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, policies),
+        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
                 getCmisVersion(repositoryId));
 
         // post the new folder object
@@ -197,7 +197,7 @@ public class ObjectServiceImpl extends A
         UrlBuilder url = new UrlBuilder(link);
 
         // set up writer
-        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, policies),
+        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
                 getCmisVersion(repositoryId));
 
         // post the new folder object
@@ -240,7 +240,7 @@ public class ObjectServiceImpl extends A
         UrlBuilder url = new UrlBuilder(link);
 
         // set up writer
-        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, policies),
+        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
                 getCmisVersion(repositoryId));
 
         // post the new folder object
@@ -284,7 +284,7 @@ public class ObjectServiceImpl extends A
         UrlBuilder url = new UrlBuilder(link);
 
         // set up writer
-        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, policies),
+        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
                 getCmisVersion(repositoryId));
 
         // post the new folder object
@@ -319,12 +319,14 @@ public class ObjectServiceImpl extends A
 
         UrlBuilder url = new UrlBuilder(link);
         if (changeToken != null) {
+            // not required by the CMIS specification
+            // -> keep for backwards compatibility with older OpenCMIS servers
             url.addParameter(Constants.PARAM_CHANGE_TOKEN, changeToken.getValue());
         }
 
         // set up writer
-        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null),
-                getCmisVersion(repositoryId));
+        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, changeToken == null ? null
+                : changeToken.getValue(), null), getCmisVersion(repositoryId));
 
         // update
         Response resp = put(url, Constants.MEDIATYPE_ENTRY, new Output() {
@@ -456,10 +458,12 @@ public class ObjectServiceImpl extends A
 
         // find the down links
         String link = loadLink(repositoryId, folderId, Constants.REL_DOWN, null);
+        String childrenLink = null;
 
         if (link != null) {
             // found only a children link, but no descendants link
             // -> try folder tree link
+            childrenLink = link;
             link = null;
         } else {
             // found no or two down links
@@ -476,6 +480,10 @@ public class ObjectServiceImpl extends A
         }
 
         if (link == null) {
+            link = childrenLink;
+        }
+
+        if (link == null) {
             throwLinkException(repositoryId, folderId, Constants.REL_DOWN, Constants.MEDIATYPE_DESCENDANTS);
         }
 
@@ -582,14 +590,6 @@ public class ObjectServiceImpl extends A
             throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(), null);
         }
 
-        // get filename from Content-Disposition header
-        String filename = null;
-        String contentDisposition = resp.getContentDisposition();
-        if (contentDisposition != null) {
-            filename = MimeHelper.decodeContentDispositionFilename(contentDisposition);
-        }
-
-        // build result object
         ContentStreamImpl result;
         if (resp.getResponseCode() == 206) {
             result = new PartialContentStreamImpl();
@@ -597,6 +597,12 @@ public class ObjectServiceImpl extends A
             result = new ContentStreamImpl();
         }
 
+        String filename = null;
+        String contentDisposition = resp.getHeader("Content-Disposition");
+        if (contentDisposition != null) {
+            filename = MimeHelper.decodeContentDispositionFilename(contentDisposition);
+        }
+
         result.setFileName(filename);
         result.setLength(resp.getContentLength());
         result.setMimeType(resp.getContentTypeHeader());

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/VersioningServiceImpl.java Tue Mar 18 14:05:45 2014
@@ -155,7 +155,7 @@ public class VersioningServiceImpl exten
         url.addParameter(Constants.PARAM_CHECK_IN, "true");
 
         // set up writer
-        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, policies),
+        final AtomEntryWriter entryWriter = new AtomEntryWriter(createObject(properties, null, policies),
                 getCmisVersion(repositoryId), contentStream);
 
         // update

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomElement.java Tue Mar 18 14:05:45 2014
@@ -23,31 +23,30 @@ import java.io.Serializable;
 import javax.xml.namespace.QName;
 
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Atom Element.
  */
 public class AtomElement implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    private final QName fName;
-    private final Object fObject;
+    private final QName name;
+    private final Object object;
 
     public AtomElement(QName name, Object object) {
-        fName = name;
-        fObject = object;
+        this.name = name;
+        this.object = object;
     }
 
     public QName getName() {
-        return fName;
+        return name;
     }
 
     public Object getObject() {
-        return fObject;
+        return object;
     }
 
     @Override
     public String toString() {
-        return fName + ": " + fObject;
+        return name + ": " + object;
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomEntry.java Tue Mar 18 14:05:45 2014
@@ -19,41 +19,33 @@
 package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
 
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Atom Entry.
  */
 public class AtomEntry extends AtomBase {
 
     private static final long serialVersionUID = 1L;
 
-    private String fId;
+    private String id;
 
     public AtomEntry() {
         super();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType
-     * ()
-     */
     @Override
     public String getType() {
         return "Atom Entry";
     }
 
     public String getId() {
-        return fId;
+        return id;
     }
 
     public void setId(String id) {
-        fId = id;
+        this.id = id;
     }
 
     @Override
     public String toString() {
-        return "Entry \"" + fId + "\": " + getElements();
+        return "Entry \"" + id + "\": " + getElements();
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomFeed.java Tue Mar 18 14:05:45 2014
@@ -22,42 +22,34 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Atom Feed.
  */
 public class AtomFeed extends AtomBase {
 
     private static final long serialVersionUID = 1L;
 
-    private final List<AtomEntry> fEntries = new ArrayList<AtomEntry>();
+    private final List<AtomEntry> entries = new ArrayList<AtomEntry>();
 
     public AtomFeed() {
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType
-     * ()
-     */
     @Override
     public String getType() {
         return "Atom Feed";
     }
 
     public List<AtomEntry> getEntries() {
-        return fEntries;
+        return entries;
     }
 
     public void addEntry(AtomEntry entry) {
         if (entry != null) {
-            fEntries.add(entry);
+            entries.add(entry);
         }
     }
 
     @Override
     public String toString() {
-        return "Feed : " + getElements() + " " + fEntries;
+        return "Feed : " + getElements() + " " + entries;
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomLink.java Tue Mar 18 14:05:45 2014
@@ -21,46 +21,45 @@ package org.apache.chemistry.opencmis.cl
 import java.io.Serializable;
 
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Atom Link.
  */
 public class AtomLink implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    private String fRel;
-    private String fType;
-    private String fHref;
+    private String rel;
+    private String type;
+    private String href;
 
     public AtomLink() {
     }
 
     public String getRel() {
-        return fRel;
+        return rel;
     }
 
     public void setRel(String rel) {
-        fRel = rel;
+        this.rel = rel;
     }
 
     public String getType() {
-        return fType;
+        return type;
     }
 
     public void setType(String type) {
-        fType = type;
+        this.type = type;
     }
 
     public String getHref() {
-        return fHref;
+        return href;
     }
 
     public void setHref(String href) {
-        fHref = href;
+        this.href = href;
     }
 
     @Override
     public String toString() {
-        return "Link: rel=\"" + fRel + "\" type=\"" + fType + "\" href=\"" + fHref + "\"";
+        return "Link: rel=\"" + rel + "\" type=\"" + type + "\" href=\"" + href + "\"";
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/HtmlDoc.java Tue Mar 18 14:05:45 2014
@@ -27,4 +27,4 @@ public class HtmlDoc extends AtomBase {
         return "HTML document";
     }
 
-}
+}
\ No newline at end of file

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/RepositoryWorkspace.java Tue Mar 18 14:05:45 2014
@@ -19,40 +19,32 @@
 package org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects;
 
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Repository workspace.
  */
 public class RepositoryWorkspace extends AtomBase {
 
     private static final long serialVersionUID = 1L;
 
-    private String fId;
+    private String id;
 
     public RepositoryWorkspace() {
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType
-     * ()
-     */
     @Override
     public String getType() {
         return "Repository Workspace";
     }
 
     public String getId() {
-        return fId;
+        return id;
     }
 
     public void setId(String id) {
-        fId = id;
+        this.id = id;
     }
 
     @Override
     public String toString() {
-        return "Workspace \"" + fId + "\": " + getElements();
+        return "Workspace \"" + id + "\": " + getElements();
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/ServiceDoc.java Tue Mar 18 14:05:45 2014
@@ -22,42 +22,34 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Service Doc.
  */
 public class ServiceDoc extends AtomBase {
 
     private static final long serialVersionUID = 1L;
 
-    private final List<RepositoryWorkspace> fWorkspaces = new ArrayList<RepositoryWorkspace>();
+    private final List<RepositoryWorkspace> workspaces = new ArrayList<RepositoryWorkspace>();
 
     public ServiceDoc() {
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.opencmis.client.provider.spi.atompub.objects.AtomBase#getType
-     * ()
-     */
     @Override
     public String getType() {
         return "Service Document";
     }
 
     public List<RepositoryWorkspace> getWorkspaces() {
-        return fWorkspaces;
+        return workspaces;
     }
 
     public void addWorkspace(RepositoryWorkspace ws) {
         if (ws != null) {
-            fWorkspaces.add(ws);
+            workspaces.add(ws);
         }
     }
 
     @Override
     public String toString() {
-        return "Service Doc: " + fWorkspaces;
+        return "Service Doc: " + workspaces;
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/DefaultHttpInvoker.java Tue Mar 18 14:05:45 2014
@@ -74,10 +74,12 @@ public class DefaultHttpInvoker implemen
 
     private Response invoke(UrlBuilder url, String method, String contentType, Map<String, String> headers,
             Output writer, BindingSession session, BigInteger offset, BigInteger length) {
+        int respCode = -1;
+
         try {
             // log before connect
             if (LOG.isDebugEnabled()) {
-                LOG.debug(method + " " + url);
+                LOG.debug("Session {}: {} {}", session.getSessionId(), method, url);
             }
 
             // connect
@@ -117,9 +119,16 @@ public class DefaultHttpInvoker implemen
                 Map<String, List<String>> httpHeaders = authProvider.getHTTPHeaders(url.toString());
                 if (httpHeaders != null) {
                     for (Map.Entry<String, List<String>> header : httpHeaders.entrySet()) {
-                        if (header.getValue() != null) {
-                            for (String value : header.getValue()) {
-                                conn.addRequestProperty(header.getKey(), value);
+                        if (header.getKey() != null && header.getValue() != null && !header.getValue().isEmpty()) {
+                            String key = header.getKey();
+                            if (key.equalsIgnoreCase("user-agent")) {
+                                conn.setRequestProperty("User-Agent", header.getValue().get(0));
+                            } else {
+                                for (String value : header.getValue()) {
+                                    if (value != null) {
+                                        conn.addRequestProperty(key, value);
+                                    }
+                                }
                             }
                         }
                     }
@@ -186,13 +195,17 @@ public class DefaultHttpInvoker implemen
                 OutputStream out = new BufferedOutputStream(connOut, BUFFER_SIZE);
                 writer.write(out);
                 out.flush();
+
+                if (connOut instanceof GZIPOutputStream) {
+                    ((GZIPOutputStream) connOut).finish();
+                }
             }
 
             // connect
             conn.connect();
 
             // get stream, if present
-            int respCode = conn.getResponseCode();
+            respCode = conn.getResponseCode();
             InputStream inputStream = null;
             if ((respCode == 200) || (respCode == 201) || (respCode == 203) || (respCode == 206)) {
                 inputStream = conn.getInputStream();
@@ -200,7 +213,8 @@ public class DefaultHttpInvoker implemen
 
             // log after connect
             if (LOG.isTraceEnabled()) {
-                LOG.trace(method + " " + url + " > Headers: " + conn.getHeaderFields());
+                LOG.trace("Session {}: {} {} > Headers: {}", session.getSessionId(), method, url, conn
+                        .getHeaderFields().toString());
             }
 
             // forward response HTTP headers
@@ -212,7 +226,8 @@ public class DefaultHttpInvoker implemen
             return new Response(respCode, conn.getResponseMessage(), conn.getHeaderFields(), inputStream,
                     conn.getErrorStream());
         } catch (Exception e) {
-            throw new CmisConnectionException("Cannot access " + url + ": " + e.getMessage(), e);
+            String status = (respCode > 0 ? " (HTTP status code " + respCode + ")" : "");
+            throw new CmisConnectionException("Cannot access \"" + url + "\"" + status + ": " + e.getMessage(), e);
         }
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Tue Mar 18 14:05:45 2014
@@ -1341,9 +1341,7 @@ public final class XMLConverter {
                 throws XmlPullParserException {
             if (isCmisNamespace(name)) {
                 if (isTag(name, TAG_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE)) {
-                    Set<PropertyType> ptSet = target.canCreate();
-
-                    ptSet.add(readEnum(parser, PropertyType.class));
+                    target.canCreate().add(readEnum(parser, PropertyType.class));
                     return true;
                 }
             }
@@ -1459,9 +1457,9 @@ public final class XMLConverter {
                 }
 
                 if (isTag(name, TAG_ACLCAP_PERMISSION_MAPPING)) {
-                    Map<String, PermissionMapping> mapping = target.getPermissionMapping();
-
                     PermissionMapping pm = PERMISSION_MAPPING_PARSER.walk(parser);
+
+                    Map<String, PermissionMapping> mapping = target.getPermissionMapping();
                     mapping.put(pm.getKey(), pm);
 
                     return true;
@@ -1560,9 +1558,9 @@ public final class XMLConverter {
                 }
 
                 if (isTag(name, TAG_FEATURE_DATA)) {
-                    Map<String, String> featureData = target.getFeatureData();
-
                     String[] data = FEATURE_DATA_PARSER.walk(parser);
+
+                    Map<String, String> featureData = target.getFeatureData();
                     featureData.put(data[0], data[1]);
 
                     return true;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java Tue Mar 18 14:05:45 2014
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.co
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.GregorianCalendar;
@@ -38,10 +39,28 @@ public final class XMLUtils {
     private XMLUtils() {
     }
 
+    // --------------
+    // --- writer ---
+    // --------------
+
+    /**
+     * Creates a new XML writer.
+     */
+    public static XmlSerializer createWriter(OutputStream out) throws IOException {
+        assert out != null;
+
+        XmlSerializer writer = Xml.newSerializer();
+        writer.setOutput(out, IOUtils.UTF8);
+        
+        return writer;
+    }
+
     /**
      * Starts a XML document.
      */
     public static void startXmlDocument(XmlSerializer writer) throws IOException {
+        assert writer != null;
+        
         writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
         writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
         writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
@@ -54,6 +73,8 @@ public final class XMLUtils {
      * Ends a XML document.
      */
     public static void endXmlDocument(XmlSerializer writer) throws IOException {
+        assert writer != null;
+        
         // end document
         writer.endDocument();
         writer.flush();
@@ -65,6 +86,8 @@ public final class XMLUtils {
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, String value)
             throws IOException {
+        assert writer != null;
+
         if (value == null) {
             return;
         }
@@ -83,9 +106,12 @@ public final class XMLUtils {
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, BigInteger value)
             throws IOException {
+        assert writer != null;
+
         if (value == null) {
             return;
         }
+
         write(writer, prefix, namespace, tag, value.toString());
     }
 
@@ -94,6 +120,8 @@ public final class XMLUtils {
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, BigDecimal value)
             throws IOException {
+        assert writer != null;
+
         if (value == null) {
             return;
         }
@@ -106,6 +134,8 @@ public final class XMLUtils {
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, GregorianCalendar value)
             throws IOException {
+        assert writer != null;
+
         if (value == null) {
             return;
         }
@@ -118,6 +148,8 @@ public final class XMLUtils {
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, Boolean value)
             throws IOException {
+        assert writer != null;
+
         if (value == null) {
             return;
         }
@@ -130,6 +162,8 @@ public final class XMLUtils {
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, Enum<?> value)
             throws IOException {
+        assert writer != null;
+
         if (value == null) {
             return;
         }
@@ -153,7 +187,7 @@ public final class XMLUtils {
      */
     public static XmlPullParser createParser(InputStream stream) throws XmlPullParserException {
         XmlPullParser parser = Xml.newPullParser();
-        parser.setInput(stream, "UTF-8");
+        parser.setInput(stream, IOUtils.UTF8);
         return parser;
     }
 
@@ -161,6 +195,8 @@ public final class XMLUtils {
      * Moves the parser to the next element.
      */
     public static boolean next(XmlPullParser parser) {
+        assert parser != null;
+
         try {
             if (hasNext(parser)) {
                 parser.next();
@@ -168,11 +204,14 @@ public final class XMLUtils {
             }
             return false;
         } catch (Exception e) {
+            // EOF exceptions
             return false;
         }
     }
 
     public static boolean hasNext(XmlPullParser parser) throws XmlPullParserException {
+        assert parser != null;
+
         return parser.getEventType() != XmlPullParser.END_DOCUMENT;
     }
 
@@ -180,6 +219,8 @@ public final class XMLUtils {
      * Skips a tag or subtree.
      */
     public static void skip(XmlPullParser parser) throws XmlPullParserException {
+        assert parser != null;
+
         int level = 1;
         while (next(parser)) {
             int event = parser.getEventType();
@@ -203,6 +244,8 @@ public final class XMLUtils {
      *         <code>false</code> otherwise
      */
     public static boolean findNextStartElemenet(XmlPullParser parser) throws XmlPullParserException, IOException {
+        assert parser != null;
+
         while (true) {
             int event = parser.getEventType();
 
@@ -222,6 +265,9 @@ public final class XMLUtils {
      * Parses a tag that contains text.
      */
     public static String readText(XmlPullParser parser, int maxLength) throws XmlPullParserException {
+        assert parser != null;
+        assert maxLength >= 0;
+
         StringBuilder sb = new StringBuilder();
 
         next(parser);
@@ -255,6 +301,10 @@ public final class XMLUtils {
         return sb.toString();
     }
 
+    // ------------------
+    // ---- DOM stuff ---
+    // ------------------
+    
     public static Document newDomDocument() {
         throw new CmisRuntimeException("This method should never be used on Android!");
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java?rev=1578909&r1=1578908&r2=1578909&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java Tue Mar 18 14:05:45 2014
@@ -101,7 +101,7 @@ public abstract class XMLWalker<T> {
 
     private CmisExtensionElement handleExtensionLevel(final XmlPullParser parser, final int level)
             throws XmlPullParserException {
-        QName name = new QName(parser.getNamespace(), parser.getName());
+        final QName name = new QName(parser.getNamespace(), parser.getName());
         Map<String, String> attributes = null;
         StringBuilder sb = new StringBuilder();
         List<CmisExtensionElement> children = null;
@@ -221,18 +221,8 @@ public abstract class XMLWalker<T> {
     @SuppressWarnings("unchecked")
     public <E extends Enum<E>> E readEnum(final XmlPullParser parser, final Class<E> clazz)
             throws XmlPullParserException {
-        String value = readText(parser);
 
-        try {
-            Method m = clazz.getMethod("fromValue", String.class);
-            return (E) m.invoke(null, value);
-        } catch (Exception e) {
-            if (e instanceof IllegalArgumentException) {
-                return null;
-            } else {
-                throw new CmisInvalidArgumentException("Invalid enum value!", e);
-            }
-        }
+        return CmisEnumHelper.fromValue(readText(parser), clazz);
     }
 
     protected abstract T prepareTarget(XmlPullParser parser, QName name) throws XmlPullParserException;



Mime
View raw message