chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r800995 - in /incubator/chemistry/trunk/chemistry: chemistry-api/src/main/java/org/apache/chemistry/ chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/ chemistry-atompub-server/src/main/java/org/apache/chemistry/ato...
Date Tue, 04 Aug 2009 21:53:07 GMT
Author: fguillaume
Date: Tue Aug  4 21:53:07 2009
New Revision: 800995

URL: http://svn.apache.org/viewvc?rev=800995&view=rev
Log:
CMIS-44: added folder paths. Fix content type for AtomPub feeds

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java
    incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Property.java
    incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-server/src/main/java/org/apache/chemistry/atompub/server/CMISCollection.java
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java
    incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Connection.java
Tue Aug  4 21:53:07 2009
@@ -108,6 +108,14 @@
      */
     CMISObject getObject(ObjectId object);
 
+    /**
+     * Gets a folder given its path.
+     *
+     * @param path the folder path
+     * @return the folder, or {@code null} if not found
+     */
+    Folder getFolder(String path);
+
     /*
      * ----- Discovery Services -----
      */

Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Property.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Property.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Property.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Property.java
Tue Aug  4 21:53:07 2009
@@ -83,6 +83,8 @@
 
     String PARENT_ID = "cmis:ParentId";
 
+    String PATH = "cmis:PathName"; // TODO-0.63
+
     String ALLOWED_CHILD_OBJECT_TYPE_IDS = "cmis:AllowedChildObjectTypeIds";
 
     /*

Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/SPI.java
Tue Aug  4 21:53:07 2009
@@ -313,6 +313,20 @@
             boolean includeAllowableActions, boolean includeRelationships);
 
     /**
+     * Gets the properties of a folder, given its path.
+     *
+     * @param path the folder path
+     * @param filter the properties filter, or {@code null} for all properties
+     * @param includeAllowableActions {@code true} to include allowable actions
+     * @param includeRelationships {@code true} if relationships should be
+     *            included as well
+     * @return the properties of the folder, or {@code null} if the object is
+     *         not found
+     */
+    ObjectEntry getFolderByPath(String path, String filter,
+            boolean includeAllowableActions, boolean includeRelationships);
+
+    /**
      * Gets the list of associated renditions for an object.
      * <p>
      * A rendition filter can be included. It is either {@code "*"} (

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPConnection.java
Tue Aug  4 21:53:07 2009
@@ -424,6 +424,17 @@
         throw new UnsupportedOperationException();
     }
 
+    public ObjectEntry getFolderByPath(String path, String filter,
+            boolean includeAllowableActions, boolean includeRelationships) {
+        // TODO Auto-generated method stub
+        throw new UnsupportedOperationException();
+    }
+
+    public Folder getFolder(String path) {
+        // TODO Auto-generated method stub
+        throw new UnsupportedOperationException();
+    }
+
     public List<Rendition> getRenditions(ObjectId object, String filter,
             int maxItems, int skipCount) {
         return Collections.emptyList();

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=800995&r1=800994&r2=800995&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
Tue Aug  4 21:53:07 2009
@@ -19,6 +19,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.abdera.model.Feed;
 import org.apache.abdera.protocol.server.ProviderHelper;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
@@ -26,6 +27,7 @@
 import org.apache.abdera.protocol.server.context.ResponseContextException;
 import org.apache.abdera.protocol.server.impl.AbstractEntityCollectionAdapter;
 import org.apache.chemistry.Repository;
+import org.apache.chemistry.atompub.AtomPub;
 
 /**
  * Base abstract class for the CMIS collections.
@@ -73,6 +75,13 @@
      * ----- AbstractCollectionAdapter -----
      */
 
+    @Override
+    public ResponseContext buildGetFeedResponse(Feed feed) {
+        ResponseContext rc = super.buildGetFeedResponse(feed);
+        rc.setContentType(AtomPub.MEDIA_TYPE_ATOM_FEED);
+        return rc;
+    }
+
     // called by AbstractProvider.process if unknown TargetType
     @Override
     public ResponseContext extensionRequest(RequestContext request) {

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleConnection.java
Tue Aug  4 21:53:07 2009
@@ -326,6 +326,8 @@
             if (pd.isRequired() && !data.containsKey(id)) {
                 if (Property.NAME.equals(id)) {
                     update.put(Property.NAME, objectId);
+                } else if (Property.PATH.equals(id)) {
+                    update.put(Property.PATH, "XXX"); // TODO
                 } else if (Property.CREATED_BY.equals(id)) {
                     update.put(Property.CREATED_BY, "system"); // TODO
                 } else if (Property.CREATION_DATE.equals(id)) {
@@ -460,6 +462,17 @@
         return new SimpleObjectEntry(data, this);
     }
 
+    public ObjectEntry getFolderByPath(String path, String filter,
+            boolean includeAllowableActions, boolean includeRelationships) {
+        // TODO Auto-generated method stub
+        throw new UnsupportedOperationException();
+    }
+
+    public Folder getFolder(String path) {
+        // TODO Auto-generated method stub
+        throw new UnsupportedOperationException();
+    }
+
     public CMISObject getObject(ObjectId object) {
         SimpleData data = repository.datas.get(object.getId());
         if (data == null) {

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleType.java
Tue Aug  4 21:53:07 2009
@@ -177,6 +177,11 @@
             "Parent Id", "", false, PropertyType.ID, false, null, false, true,
             null, Updatability.READ_ONLY, true, true, 0, null, null, -1, null);
 
+    public static final SimplePropertyDefinition PROP_PATH = new SimplePropertyDefinition(
+            Property.PATH, "def:path", null, Property.PATH, "Path", "", false,
+            PropertyType.STRING, false, null, false, true, null,
+            Updatability.READ_ONLY, true, true, 0, null, null, -1, null);
+
     public static final SimplePropertyDefinition PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS = new
SimplePropertyDefinition(
             Property.ALLOWED_CHILD_OBJECT_TYPE_IDS,
             "def:allowedchildobjecttypeids", null,
@@ -237,6 +242,7 @@
 
     public static final List<PropertyDefinition> PROPS_FOLDER_BASE = commonPlus(
             PROP_PARENT_ID, //
+            PROP_PATH, //
             PROP_ALLOWED_CHILD_OBJECT_TYPE_IDS);
 
     public static final List<PropertyDefinition> PROPS_RELATIONSHIP_BASE = commonPlus(

Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrConnection.java
Tue Aug  4 21:53:07 2009
@@ -380,6 +380,34 @@
         return null;
     }
 
+    public ObjectEntry getFolderByPath(String path, String filter,
+            boolean includeAllowableActions, boolean includeRelationships) {
+        try {
+            if (path == null || path.equals("") || path.equals("/")) {
+                return (ObjectEntry) getRootFolder();
+            } else {
+                if (path.startsWith("/")) {
+                    path = path.substring(1);
+                }
+                Node node = session.getRootNode().getNode(path);
+                if (node.isNodeType(JcrConstants.NT_FOLDER)) {
+                    return new JcrFolder(node);
+                } else if (node.isNodeType(JcrConstants.NT_FILE)) {
+                    return new JcrDocument(node);
+                }
+            }
+        } catch (RepositoryException e) {
+            String msg = "Unable to get object: " + path;
+            log.error(msg, e);
+        }
+        return null;
+    }
+
+    public Folder getFolder(String path) {
+        // TODO Auto-generated method stub
+        throw new UnsupportedOperationException();
+    }
+
     public Map<String, Serializable> getPropertiesOfLatestVersion(
             String versionSeriesId, boolean major, String filter) {
         // TODO Auto-generated method stub

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java?rev=800995&r1=800994&r2=800995&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/MainServlet.java
Tue Aug  4 21:53:07 2009
@@ -50,23 +50,43 @@
     public static final String CMIS_SERVICE = "/repository";
 
     public static void main(String[] args) throws Exception {
+        String host = HOST;
+        int port = PORT;
+        int minutes = MINUTES;
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if ("--help".equals(arg)) {
+                System.err.println("Usage: ... [-h HOST] [-p PORT] [-t TIME(minutes)]");
+                System.exit(0);
+            }
+            if (i == args.length - 1) {
+                continue;
+            }
+            // 2-arg
+            if ("--host".equals(arg) || "-h".equals(arg)) {
+                host = args[++i];
+            } else if ("--port".equals(arg) || "-p".equals(arg)) {
+                port = Integer.parseInt(args[++i]);
+            } else if ("--time".equals(arg) || "-t".equals(arg)) {
+                minutes = Integer.parseInt(args[++i]);
+            }
+        }
         Repository repository = BasicHelper.makeRepository(ROOT_ID);
         Server server = new Server();
         Connector connector = new SocketConnector();
-        connector.setHost(HOST);
-        connector.setPort(PORT);
+        connector.setHost(host);
+        connector.setPort(port);
         server.setConnectors(new Connector[] { connector });
         Servlet servlet = new CMISServlet(repository);
         ServletHolder servletHolder = new ServletHolder(servlet);
         Context context = new Context(server, SERVLET_PATH, Context.SESSIONS);
         context.addServlet(servletHolder, "/*");
         server.start();
-        String url = "http://" + HOST + ':' + PORT + SERVLET_PATH
+        String url = "http://" + host + ':' + port + SERVLET_PATH
                 + CMIS_SERVICE;
         log.info("CMIS server started, AtomPub service url: " + url);
-        Thread.sleep(60 * MINUTES);
+        Thread.sleep(60 * minutes);
         server.stop();
         log.info("CMIS server stopped");
     }
-
 }



Mime
View raw message