chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r899009 - in /incubator/chemistry/trunk/chemistry: chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/ chemistry-atompub/src/main/java/org/apache/chemistry/atompub/
Date Thu, 14 Jan 2010 00:39:54 GMT
Author: fguillaume
Date: Thu Jan 14 00:39:54 2010
New Revision: 899009

URL: http://svn.apache.org/viewvc?rev=899009&view=rev
Log:
Include links for foldertree and typedescendants in AtomPub service document

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollection.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISServiceResponse.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPubCMIS.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollection.java?rev=899009&r1=899008&r2=899009&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollection.java
Thu Jan 14 00:39:54 2010
@@ -140,7 +140,7 @@
         return request.absoluteUrlFor(TargetType.TYPE_COLLECTION, params);
     }
 
-    public String getTypeDescendantsLink(String tid, RequestContext request) {
+    public static String getTypeDescendantsLink(String tid, RequestContext request) {
         Map<String, String> params = new HashMap<String, String>();
         params.put("collection", "typedescendants");
         params.put("id", tid);
@@ -161,7 +161,7 @@
         return request.absoluteUrlFor(TargetType.TYPE_COLLECTION, params);
     }
 
-    public String getFolderTreeLink(String fid, RequestContext request) {
+    public static String getFolderTreeLink(String fid, RequestContext request) {
         Map<String, String> params = new HashMap<String, String>();
         params.put("collection", "foldertree");
         params.put("id", fid);

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISServiceResponse.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISServiceResponse.java?rev=899009&r1=899008&r2=899009&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISServiceResponse.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISServiceResponse.java
Thu Jan 14 00:39:54 2010
@@ -31,6 +31,7 @@
 import org.apache.chemistry.Repository;
 import org.apache.chemistry.RepositoryCapabilities;
 import org.apache.chemistry.RepositoryInfo;
+import org.apache.chemistry.atompub.AtomPub;
 import org.apache.chemistry.atompub.AtomPubCMIS;
 import org.apache.chemistry.atompub.URITemplate;
 import org.w3c.dom.Document;
@@ -55,6 +56,8 @@
 
     @Override
     protected void writeTo(StreamWriter sw) throws IOException {
+        RepositoryInfo info = provider.getRepository().getInfo();
+
         ((StaxStreamWriter) sw).startDocument("UTF-8", "1.0");
         sw.startService();
         ((StaxStreamWriter) sw).writeNamespace(CMIS.CMIS_PREFIX, CMIS.CMIS_NS);
@@ -78,25 +81,31 @@
                 sw.endCollection();
             }
             // CMIS links
-            // sw.startElement(AtomPub.ATOM_LINK);
-            // sw.writeAttribute("type", "application/cmistree+xml");
-            // sw.writeAttribute("rel", AtomPubCMIS.LINK_TYPES_DESCENDANTS);
-            // String tdurl = request.absoluteUrlFor(TargetType.TYPE_SERVICE,
-            // null);
-            // tdurl = tdurl.replaceFirst("/repository$", "/typesdescendants");
-            // sw.writeAttribute("href", tdurl);
-            // sw.endElement();
+            sw.startElement(AtomPub.ATOM_LINK);
+            sw.writeAttribute("rel", AtomPubCMIS.LINK_TYPE_DESCENDANTS);
+            sw.writeAttribute("type", AtomPub.MEDIA_TYPE_ATOM_FEED);
+            String tdurl = CMISTypesCollection.getTypeDescendantsLink(null,
+                    request);
+            sw.writeAttribute("href", tdurl);
+            sw.endElement();
+            sw.startElement(AtomPub.ATOM_LINK);
+            sw.writeAttribute("rel", AtomPubCMIS.LINK_FOLDER_TREE);
+            sw.writeAttribute("type", AtomPub.MEDIA_TYPE_ATOM_FEED);
+            String fturl = CMISTypesCollection.getFolderTreeLink(
+                    info.getRootFolderId().getId(), request);
+            sw.writeAttribute("href", fturl);
+            sw.endElement();
             // URI templates
-            for (URITemplate info : provider.getURITemplates(request)) {
+            for (URITemplate uritmpl : provider.getURITemplates(request)) {
                 sw.startElement(AtomPubCMIS.URI_TEMPLATE);
                 sw.startElement(AtomPubCMIS.TYPE);
-                sw.writeElementText(info.type);
+                sw.writeElementText(uritmpl.type);
                 sw.endElement();
                 sw.startElement(AtomPubCMIS.MEDIA_TYPE);
-                sw.writeElementText(info.mediaType);
+                sw.writeElementText(uritmpl.mediaType);
                 sw.endElement();
                 sw.startElement(AtomPubCMIS.TEMPLATE);
-                sw.writeElementText(info.template);
+                sw.writeElementText(uritmpl.template);
                 sw.endElement();
                 sw.endElement();
             }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPubCMIS.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPubCMIS.java?rev=899009&r1=899008&r2=899009&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPubCMIS.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/AtomPubCMIS.java
Thu Jan 14 00:39:54 2010
@@ -111,8 +111,8 @@
     public static final String LINK_FOLDER_TREE = CMIS_LINK_NS_BASE
             + "foldertree";
 
-    public static final String LINK_ROOT_DESCENDANTS = CMIS_LINK_NS_BASE
-            + "rootdescendants";
+    public static final String LINK_TYPE_DESCENDANTS = CMIS_LINK_NS_BASE
+            + "typedescendants";
 
     /*
      * ----- AtomPub Link Parameters -----



Mime
View raw message