chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fguilla...@apache.org
Subject svn commit: r799661 - 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-commons/src/main/java/org/apache/chemistry/impl/simpl...
Date Fri, 31 Jul 2009 16:58:37 GMT
Author: fguillaume
Date: Fri Jul 31 16:58:37 2009
New Revision: 799661

URL: http://svn.apache.org/viewvc?rev=799661&view=rev
Log:
Simplified API: removed getStream. Use getContentStream instead

Modified:
    incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java
    incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPDocument.java
    incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java
    incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
    incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java
    incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java
    incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
    incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java

Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/CMISObject.java
Fri Jul 31 16:58:37 2009
@@ -17,7 +17,6 @@
 package org.apache.chemistry;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.net.URI;
@@ -246,20 +245,13 @@
     void setValues(Map<String, Serializable> values);
 
     /**
-     * Gets a byte stream for this document.
-     *
-     * @param renditionId the rendition ID, or {@code null} for the primary
-     *            stream
-     * @return the byte stream
-     */
-    InputStream getStream(String renditionId) throws IOException;
-
-    /**
      * Gets a content stream for this document.
      *
      * @param renditionId the rendition ID, or {@code null} for the primary
      *            stream
      * @return the content stream
+     *
+     * @throws IOException
      */
     ContentStream getContentStream(String renditionId) throws IOException;
 

Modified: incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-api/src/main/java/org/apache/chemistry/Document.java
Fri Jul 31 16:58:37 2009
@@ -17,7 +17,6 @@
 package org.apache.chemistry;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.Collection;
 
 /**
@@ -109,13 +108,6 @@
      */
 
     /**
-     * Gets the primary byte stream for this document.
-     *
-     * @return the byte stream
-     */
-    InputStream getStream() throws IOException;
-
-    /**
      * Gets the primary content stream for this document.
      *
      * @return the content stream

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPDocument.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPDocument.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPDocument.java
Fri Jul 31 16:58:37 2009
@@ -121,20 +121,6 @@
         }
     }
 
-    public InputStream getStream() throws IOException {
-        String href = entry.getLink(Atom.LINK_EDIT_MEDIA);
-        if (href == null) {
-            return null;
-        }
-        Response resp = entry.connection.connector.get(new Request(href));
-        if (!resp.isOk()) {
-            throw new ContentManagerException(
-                    "Remote server returned error code: "
-                            + resp.getStatusCode());
-        }
-        return resp.getStream();
-    }
-
     public void setContentStream(ContentStream contentStream)
             throws IOException {
         throw new UnsupportedOperationException("Not yet implemented");

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/APPObject.java
Fri Jul 31 16:58:37 2009
@@ -17,7 +17,6 @@
  */
 package org.apache.chemistry.atompub.client;
 
-import java.io.InputStream;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Collections;
@@ -93,11 +92,6 @@
         throw new UnsupportedOperationException();
     }
 
-    public InputStream getStream(String renditionId) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
-    }
-
     public ContentStream getContentStream(String renditionId) {
         // TODO Auto-generated method stub
         throw new UnsupportedOperationException();

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleDocument.java
Fri Jul 31 16:58:37 2009
@@ -16,9 +16,7 @@
  */
 package org.apache.chemistry.impl.simple;
 
-import java.io.ByteArrayInputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.util.Collection;
 
 import org.apache.chemistry.ContentStream;
@@ -66,14 +64,6 @@
         throw new UnsupportedOperationException();
     }
 
-    public InputStream getStream() {
-        byte[] contentBytes = getContentBytes();
-        if (contentBytes == null) {
-            return null;
-        }
-        return new ByteArrayInputStream(contentBytes);
-    }
-
     public ContentStream getContentStream() {
         byte[] contentBytes = getContentBytes();
         if (contentBytes == null) {

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimpleObject.java
Fri Jul 31 16:58:37 2009
@@ -16,7 +16,6 @@
  */
 package org.apache.chemistry.impl.simple;
 
-import java.io.InputStream;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.List;
@@ -147,11 +146,6 @@
         return new SimpleProperty(entry, id, propertyDefinition);
     }
 
-    public InputStream getStream(String renditionId) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
-    }
-
     public ContentStream getContentStream(String renditionId) {
         // TODO Auto-generated method stub
         throw new UnsupportedOperationException();

Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrDocument.java
Fri Jul 31 16:58:37 2009
@@ -71,23 +71,6 @@
         return null;
     }
 
-    public InputStream getStream() throws IOException {
-        try {
-            Node content = node.getNode(JcrConstants.JCR_CONTENT);
-            javax.jcr.Property prop = content.getProperty(JcrConstants.JCR_DATA);
-            return prop.getStream();
-        } catch (RepositoryException e) {
-            String msg = "Unable to get stream.";
-            log.error(msg, e);
-        }
-        return null;
-    }
-
-    public InputStream getStream(String renditionId) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public String getString(String id) {
         if (id.equals(Property.CONTENT_STREAM_MIME_TYPE)) {

Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrFolder.java
Fri Jul 31 16:58:37 2009
@@ -140,11 +140,6 @@
         return BaseType.FOLDER;
     }
 
-    public InputStream getStream(String renditionId) {
-        // TODO Auto-generated method stub
-        throw new UnsupportedOperationException();
-    }
-
     public ContentStream getContentStream(String renditionId) {
         // TODO Auto-generated method stub
         throw new UnsupportedOperationException();

Modified: incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-jcr/src/main/java/org/apache/chemistry/jcr/JcrNewDocument.java
Fri Jul 31 16:58:37 2009
@@ -124,14 +124,6 @@
     }
 
     @Override
-    public InputStream getStream() throws IOException {
-        if (!saved) {
-            throw new UnsupportedOperationException();
-        }
-        return super.getStream();
-    }
-
-    @Override
     public void setContentStream(ContentStream contentStream)
             throws IOException {
 

Modified: incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java?rev=799661&r1=799660&r2=799661&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
(original)
+++ incubator/chemistry/trunk/chemistry/chemistry-tests/src/main/java/org/apache/chemistry/test/BasicTestCase.java
Fri Jul 31 16:58:37 2009
@@ -225,7 +225,6 @@
         }
         assertNotNull("doc 2 not found", other);
         assertNull(other.getContentStream());
-        assertNull(other.getStream());
 
         assertNotNull("dog not found", dog);
         ContentStream cs = dog.getContentStream();
@@ -233,7 +232,7 @@
         assertEquals("dog.jpg", cs.getFilename());
         assertEquals("image/jpeg", cs.getMimeType());
         assertNotNull(cs.getStream());
-        InputStream in = dog.getStream();
+        InputStream in = dog.getContentStream().getStream();
         assertNotNull(in);
         byte[] array = IOUtils.toByteArray(in);
         assertTrue(array.length != 0);



Mime
View raw message