Author: jmpascal
Date: Mon Sep 24 14:01:18 2012
New Revision: 1389383
URL: http://svn.apache.org/viewvc?rev=1389383&view=rev
Log:
Merge differences from java opencmis to android opencmis before 0.8.0 release.
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/AclServiceImpl.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/LinkCache.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/objects/AtomBase.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=1389383&r1=1389382&r2=1389383&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
Mon Sep 24 14:01:18 2012
@@ -527,8 +527,8 @@ public abstract class AbstractAtomPubSer
AtomBase parseResult = parser.getResults();
if (!clazz.isInstance(parseResult)) {
- throw new CmisConnectionException("Unexpected document! Received "
- + (parseResult == null ? "something unknown" :
parseResult.getType()) + "!");
+ throw new CmisConnectionException("Unexpected document! Received: "
+ + (parseResult == null ? "something unknown" :
parseResult.getType()));
}
return (T) parseResult;
@@ -540,6 +540,7 @@ public abstract class AbstractAtomPubSer
*/
protected HttpUtils.Response read(UrlBuilder url) {
// make the call
+ //Log.d("URL", url.toString());
HttpUtils.Response resp = HttpUtils.invokeGET(url, session);
// check response code
@@ -556,6 +557,7 @@ public abstract class AbstractAtomPubSer
*/
protected HttpUtils.Response post(UrlBuilder url, String contentType,
HttpUtils.Output writer) {
// make the call
+ //Log.d("URL", url.toString());
HttpUtils.Response resp = HttpUtils.invokePOST(url, contentType,
writer, session);
// check response code
@@ -581,6 +583,7 @@ public abstract class AbstractAtomPubSer
protected HttpUtils.Response put(UrlBuilder url, String contentType,
Map<String, String> headers,
HttpUtils.Output writer) {
// make the call
+ //Log.d("URL", url.toString());
HttpUtils.Response resp = HttpUtils.invokePUT(url, contentType,
headers, writer, session);
// check response code
@@ -597,6 +600,7 @@ public abstract class AbstractAtomPubSer
*/
protected void delete(UrlBuilder url) {
// make the call
+ //Log.d("URL", url.toString());
HttpUtils.Response resp = HttpUtils.invokeDELETE(url, session);
// check response code
@@ -841,6 +845,29 @@ public abstract class AbstractAtomPubSer
}
/**
+ * Retrieves the ACL of an object.
+ */
+ public Acl getAclInternal(String repositoryId, String objectId, Boolean
onlyBasicPermissions,
+ ExtensionsData extension) {
+
+ // find the link
+ String link = loadLink(repositoryId, objectId, Constants.REL_ACL,
Constants.MEDIATYPE_ACL);
+
+ if (link == null) {
+ throwLinkException(repositoryId, objectId, Constants.REL_ACL,
Constants.MEDIATYPE_ACL);
+ }
+
+ UrlBuilder url = new UrlBuilder(link);
+ url.addParameter(Constants.PARAM_ONLY_BASIC_PERMISSIONS,
onlyBasicPermissions);
+
+ // read and parse
+ HttpUtils.Response resp = read(url);
+ AtomAcl acl = parse(resp.getStream(), AtomAcl.class);
+
+ return acl.getACL();
+ }
+
+ /**
* Updates the ACL of an object.
*/
protected AtomAcl updateAcl(String repositoryId, String objectId, final
Acl acl, AclPropagation aclPropagation) {
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.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/AclServiceImpl.java?rev=1389383&r1=1389382&r2=1389383&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AclServiceImpl.java
Mon Sep 24 14:01:18 2012
@@ -20,12 +20,9 @@ package org.apache.chemistry.opencmis.cl
import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
import
org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAcl;
-import org.apache.chemistry.opencmis.client.bindings.spi.http.HttpUtils;
import org.apache.chemistry.opencmis.commons.data.Acl;
import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
-import org.apache.chemistry.opencmis.commons.impl.Constants;
-import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
import org.apache.chemistry.opencmis.commons.spi.AclService;
/**
@@ -62,22 +59,7 @@ public class AclServiceImpl extends Abst
}
public Acl getAcl(String repositoryId, String objectId, Boolean
onlyBasicPermissions, ExtensionsData extension) {
-
- // find the link
- String link = loadLink(repositoryId, objectId, Constants.REL_ACL,
Constants.MEDIATYPE_ACL);
-
- if (link == null) {
- throwLinkException(repositoryId, objectId, Constants.REL_ACL,
Constants.MEDIATYPE_ACL);
- }
-
- UrlBuilder url = new UrlBuilder(link);
- url.addParameter(Constants.PARAM_ONLY_BASIC_PERMISSIONS,
onlyBasicPermissions);
-
- // read and parse
- HttpUtils.Response resp = read(url);
- AtomAcl acl = parse(resp.getStream(), AtomAcl.class);
-
- return acl.getACL();
+ return getAclInternal(repositoryId, objectId, onlyBasicPermissions,
extension);
}
}
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=1389383&r1=1389382&r2=1389383&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
Mon Sep 24 14:01:18 2012
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.cl
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_DOCUMENT_TYPE;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_FOLDER_TYPE;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_POLICY_TYPE;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_PROPERTY_DEFINITION_ID;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_PROPERTY_DISPLAYNAME;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_PROPERTY_LOCALNAME;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_PROPERTY_QUERYNAME;
@@ -30,9 +31,11 @@ import static org.apache.chemistry.openc
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_HREF;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_REL;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.LINK_TYPE;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACE_DIRECT;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACE_PRINCIPAL;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACE_PRINCIPAL_ID;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACL;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACLCAP_MAPPING;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACLCAP_MAPPING_KEY;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACLCAP_MAPPING_PERMISSION;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACLCAP_PERMISSIONS;
@@ -48,8 +51,15 @@ import static org.apache.chemistry.openc
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;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_ACL;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_ALLOWABLE_ACTIONS;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_PROPERTIES;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_RENDITION;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_PATH_SEGMENT;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_PROPERTY;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_RELATIVE_PATH_SEGMENT;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_RENDITION;
+import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_REPINFO_ACL_CAPABILITY;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_REPINFO_CAPABILITIES;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_REPINFO_CHANGES_ON_TYPE;
import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_REPOSITORY_INFO;
@@ -59,17 +69,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.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_REPINFO_ACL_CAPABILITY;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.ATTR_PROPERTY_DEFINITION_ID;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_RENDITION;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACLCAP_MAPPING;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ACE_DIRECT;
-
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_PROPERTY;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_PROPERTIES;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_ALLOWABLE_ACTIONS;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_ACL;
-import static
org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT_RENDITION;
import java.io.IOException;
import java.io.InputStream;
@@ -115,8 +114,6 @@ import org.apache.chemistry.opencmis.com
import
org.apache.chemistry.opencmis.commons.impl.dataobjects.CmisExtensionElementImpl;
import
org.apache.chemistry.opencmis.commons.impl.dataobjects.PermissionDefinitionDataImpl;
import
org.apache.chemistry.opencmis.commons.impl.dataobjects.PermissionMappingDataImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -127,7 +124,7 @@ import android.util.Xml;
*/
public class AtomPubParser {
- private static final Logger log =
LoggerFactory.getLogger(AtomPubParser.class);
+ //private static final Logger log =
LoggerFactory.getLogger(AtomPubParser.class);
// public constants
public static final String LINK_REL_CONTENT = "@@content@@";
@@ -666,7 +663,7 @@ public class AtomPubParser {
//
-----------------------------------------------------------------------------------
private static RepositoryInfo parseRepositoryInfo(XmlPullParser parser)
throws Exception {
- log.debug("[START] parseRepositoryInfo...");
+ //log.debug("[START] parseRepositoryInfo...");
int eventType = parser.next();
String name = parser.getName();
String namespace = parser.getNamespace();
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.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/LinkCache.java?rev=1389383&r1=1389382&r2=1389383&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java
Mon Sep 24 14:01:18 2012
@@ -150,7 +150,8 @@ public class LinkCache implements Serial
String[] params = link.substring(i + 1).split("&");
for (String param : params) {
String[] parts = param.split("=", 2);
- if (parts[0].equals(Constants.PARAM_STREAM_ID) && parts.length
== 2) {
+ if (parts[0].equals(Constants.PARAM_STREAM_ID)
+ && parts.length == 2) {
return parts[1];
}
}
@@ -331,7 +332,7 @@ public class LinkCache implements Serial
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#toString()
*/
@Override
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=1389383&r1=1389382&r2=1389383&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
Mon Sep 24 14:01:18 2012
@@ -43,6 +43,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.data.Properties;
import org.apache.chemistry.opencmis.commons.data.PropertyData;
import org.apache.chemistry.opencmis.commons.data.PropertyId;
+import org.apache.chemistry.opencmis.commons.data.PropertyString;
import org.apache.chemistry.opencmis.commons.data.RenditionData;
import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
@@ -276,6 +277,7 @@ public class ObjectServiceImpl extends A
return entry.getId();
}
+ @SuppressWarnings("rawtypes")
public void updateProperties(String repositoryId, Holder<String> objectId,
Holder<String> changeToken,
Properties properties, ExtensionsData extension) {
// we need an object id
@@ -339,23 +341,20 @@ public class ObjectServiceImpl extends A
if (changeToken != null) {
object = (ObjectDataImpl) element.getObject();
- // TODO
- /*
- * if (object.getProperties() != null) { for
- * (CmisProperty property :
- * object.getProperties().getPropertyList()) { if
- * (PropertyIds
- *
.CHANGE_TOKEN.equals(property.getPropertyDefinitionId
- * ()) && (property instanceof CmisPropertyString)) {
- *
- * CmisPropertyString changeTokenProperty =
- * (CmisPropertyString) property; if
- * (!changeTokenProperty.getValue().isEmpty()) {
- * changeToken
- * .setValue(changeTokenProperty.getValue().get(0)); }
- *
- * break; } } }
- */
+ if (object.getProperties() != null) {
+ for (PropertyData property :
object.getProperties().getPropertyList()) {
+ if
(PropertyIds.CHANGE_TOKEN.equals(property.getId())
+ && (property instanceof
PropertyString)) {
+
+ PropertyString changeTokenProperty =
(PropertyString) property;
+ if (changeTokenProperty.getFirstValue() !=
null && changeTokenProperty.getFirstValue().length() > 0) {
+
changeToken.setValue(changeTokenProperty.getFirstValue());
+ }
+
+ break;
+ }
+ }
+ }
}
}
}
@@ -693,18 +692,7 @@ public class ObjectServiceImpl extends A
return;
}
- Acl originalAces = null;
-
- // walk through the entry and find the current ACL
- for (AtomElement element : entry.getElements()) {
- if (element.getObject() instanceof ObjectData) {
- // extract current ACL
- ObjectData object = (ObjectData) element.getObject();
- originalAces = object.getAcl();
-
- break;
- }
- }
+ Acl originalAces = getAclInternal(repositoryId, entry.getId(),
Boolean.FALSE, null);
if (originalAces != null) {
// merge and update ACL
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomBase.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/AtomBase.java?rev=1389383&r1=1389382&r2=1389383&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomBase.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/objects/AtomBase.java
Mon Sep 24 14:01:18 2012
@@ -23,14 +23,13 @@ import java.util.ArrayList;
import java.util.List;
/**
- * @author <a href="mailto:[email protected]">Florian Müller</a>
- *
+ * Base type for Atom responses.
*/
public abstract class AtomBase implements Serializable {
private static final long serialVersionUID = 1L;
- private final List<AtomElement> fElements = new ArrayList<AtomElement>();
+ private final List<AtomElement> elements = new ArrayList<AtomElement>();
protected AtomBase() {
}
@@ -38,12 +37,12 @@ public abstract class AtomBase implement
public abstract String getType();
public List<AtomElement> getElements() {
- return fElements;
+ return elements;
}
public void addElement(AtomElement element) {
if (element != null) {
- fElements.add(element);
+ elements.add(element);
}
}
}