You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fg...@apache.org on 2009/07/10 17:52:10 UTC
svn commit: r792994 - in /incubator/chemistry/trunk/chemistry:
chemistry-api/src/main/java/org/apache/chemistry/
chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/
Author: fguillaume
Date: Fri Jul 10 15:52:10 2009
New Revision: 792994
URL: http://svn.apache.org/viewvc?rev=792994&view=rev
Log:
CMIS-22: Make capabilities parsing more tolerant
Modified:
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/JoinCapability.java
incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/QueryCapability.java
incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/JoinCapability.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/JoinCapability.java?rev=792994&r1=792993&r2=792994&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/JoinCapability.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/JoinCapability.java Fri Jul 10 15:52:10 2009
@@ -60,6 +60,14 @@
return o;
}
+ public static JoinCapability get(String value, JoinCapability def) {
+ JoinCapability o = all.get(value);
+ if (o == null) {
+ o = def;
+ }
+ return o;
+ }
+
@Override
public String toString() {
return value;
Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/QueryCapability.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/QueryCapability.java?rev=792994&r1=792993&r2=792994&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/QueryCapability.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/QueryCapability.java Fri Jul 10 15:52:10 2009
@@ -70,6 +70,14 @@
return o;
}
+ public static QueryCapability get(String value, QueryCapability def) {
+ QueryCapability o = all.get(value);
+ if (o == null) {
+ o = def;
+ }
+ return o;
+ }
+
@Override
public String toString() {
return value;
Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java?rev=792994&r1=792993&r2=792994&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java Fri Jul 10 15:52:10 2009
@@ -20,8 +20,8 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -51,6 +51,7 @@
protected abstract void setInfo(T repo, RepositoryInfo info);
+ @SuppressWarnings("unchecked")
public T[] read(ReadContext context, InputStream in) throws IOException {
try {
StaxReader reader = StaxReader.newReader(in);
@@ -109,9 +110,11 @@
} else if (localName.equals(CMIS.CAPABILITY_VERSION_SPECIFIC_FILING.getLocalPart())) {
caps.setHasVersionSpecificFiling(Boolean.parseBoolean(reader.getElementText()));
} else if (localName.equals(CMIS.CAPABILITY_QUERY.getLocalPart())) {
- caps.setQueryCapability(QueryCapability.get(reader.getElementText()));
+ caps.setQueryCapability(QueryCapability.get(
+ reader.getElementText(), QueryCapability.NONE));
} else if (localName.equals(CMIS.CAPABILITY_JOIN.getLocalPart())) {
- caps.setJoinCapability(JoinCapability.get(reader.getElementText()));
+ caps.setJoinCapability(JoinCapability.get(
+ reader.getElementText(), JoinCapability.NO_JOIN));
}
}
} else if (localName.equals("repositorySpecificInformation")) {
@@ -146,9 +149,11 @@
} else if (localName.equals(CMIS.CAPABILITY_VERSION_SPECIFIC_FILING.getLocalPart())) {
caps.setHasVersionSpecificFiling(Boolean.parseBoolean(el2.getText()));
} else if (localName.equals(CMIS.CAPABILITY_QUERY.getLocalPart())) {
- caps.setQueryCapability(QueryCapability.get(el2.getText()));
+ caps.setQueryCapability(QueryCapability.get(
+ el2.getText(), QueryCapability.NONE));
} else if (localName.equals(CMIS.CAPABILITY_JOIN.getLocalPart())) {
- caps.setJoinCapability(JoinCapability.get(el2.getText()));
+ caps.setJoinCapability(JoinCapability.get(
+ el2.getText(), JoinCapability.NO_JOIN));
}
}
} else if (localName.equals("repositorySpecificInformation")) {