chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r961315 - in /incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub: AtomPubParser.java CmisAtomPubConstants.java
Date Wed, 07 Jul 2010 09:18:57 GMT
Author: fmui
Date: Wed Jul  7 09:18:55 2010
New Revision: 961315

URL: http://svn.apache.org/viewvc?rev=961315&view=rev
Log:
- hardened workaround for Chemistry bug

Modified:
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
    incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java?rev=961315&r1=961314&r2=961315&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
Wed Jul  7 09:18:55 2010
@@ -56,9 +56,6 @@ import org.apache.chemistry.opencmis.com
 
 /**
  * AtomPub Parser.
- * 
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
  */
 public class AtomPubParser implements CmisAtomPubConstants {
 
@@ -310,14 +307,17 @@ public class AtomPubParser implements Cm
                     || TAG_RELATIVE_PATH_SEGMENT.equals(name.getLocalPart())) {
                 return parseText(parser);
             } else if (TAG_TYPE.equals(name.getLocalPart())) {
-                String typeAttr = parser.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
"type");
-                if (typeAttr.endsWith("cmisTypeDocumentDefinitionType")) {
+                // workaround for old Chemistry code - ignore the type namespace
+                String typeAttr = parser.getAttributeValue(Constants.NAMESPACE_XSI, "type");
+                if (typeAttr == null) {
+                    return unmarshalElement(parser, CmisTypeDefinitionType.class);
+                } else if (typeAttr.endsWith(ATTR_DOCUMENT_TYPE)) {
                     return unmarshalElement(parser, CmisTypeDocumentDefinitionType.class);
-                } else if (typeAttr.endsWith("cmisTypeFolderDefinitionType")) {
+                } else if (typeAttr.endsWith(ATTR_FOLDER_TYPE)) {
                     return unmarshalElement(parser, CmisTypeFolderDefinitionType.class);
-                } else if (typeAttr.endsWith("cmisTypeRelationshipDefinitionType")) {
+                } else if (typeAttr.endsWith(ATTR_RELATIONSHIP_TYPE)) {
                     return unmarshalElement(parser, CmisTypeRelationshipDefinitionType.class);
-                } else if (typeAttr.endsWith("cmisTypePolicyDefinitionType")) {
+                } else if (typeAttr.endsWith(ATTR_POLICY_TYPE)) {
                     return unmarshalElement(parser, CmisTypePolicyDefinitionType.class);
                 }
                 throw new CmisRuntimeException("Cannot read type definition!");

Modified: incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java?rev=961315&r1=961314&r2=961315&view=diff
==============================================================================
--- incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java
(original)
+++ incubator/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java
Wed Jul  7 09:18:55 2010
@@ -18,9 +18,15 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.atompub;
 
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeDocumentDefinitionType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeFolderDefinitionType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypePolicyDefinitionType;
+import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisTypeRelationshipDefinitionType;
+
 /**
- * @author <a href="mailto:fmueller@opentext.com">Florian M&uuml;ller</a>
- * 
+ * Constants for AtomPub.
  */
 public interface CmisAtomPubConstants {
 
@@ -55,6 +61,11 @@ public interface CmisAtomPubConstants {
     String TAG_CONTENT_MEDIATYPE = "mediatype";
     String TAG_CONTENT_BASE64 = "base64";
 
+    String ATTR_DOCUMENT_TYPE = CmisTypeDocumentDefinitionType.class.getAnnotation(XmlType.class).name();
+    String ATTR_FOLDER_TYPE = CmisTypeFolderDefinitionType.class.getAnnotation(XmlType.class).name();
+    String ATTR_RELATIONSHIP_TYPE = CmisTypeRelationshipDefinitionType.class.getAnnotation(XmlType.class).name();
+    String ATTR_POLICY_TYPE = CmisTypePolicyDefinitionType.class.getAnnotation(XmlType.class).name();
+
     // allowable actions
     String TAG_ALLOWABLEACTIONS = "allowableActions";
 



Mime
View raw message