chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Streit <mcs...@gmail.com>
Subject Fwd: problem with GettingStarted application (using fileshare service WAR)
Date Wed, 30 May 2012 12:18:41 GMT
It just occurred to me.  Is it possible that this is occurring because I
switched the code to use the Web Services (WSDL) bindings and not the
AtomPub binding as it is in the downloaded source distribution?  It all
worked up until that one call it attempts to make to alter the content for
some reason.

Thanks

---------- Forwarded message ----------
From: Mark Streit <mcs130@gmail.com>
Date: Fri, May 25, 2012 at 3:26 PM
Subject: problem with GettingStarted application (using fileshare service
WAR)
To: dev@chemistry.apache.org


Hello,

Not sure where to post this question but I've been using the Apache
Chemistry 0.8.0 SNAPSHOT.  Built from source from the Apache SVN server and
the server works just fine.  Working on writing client code using the
various CLIENT API JAR files and that has worked well too.  However, today
I needed to look at an example of how something was being done in the
sample code found in:

*
asf\chemistry\opencmis\trunk\chemistry-opencmis-samples\chemistry-opencmis-getting-started
*

The code worked fine OOTB until I hit this part of the example:


*Code snippet from:* org.apache.chemistry.opencmis.doc.GettingStarted

      // Create a new document and then update its name
      final String textFileName2 = "test2.txt";
      System.out.println("creating a simple text document, " +
textFileName2);
      mimetype = "text/plain; charset=UTF-8";
      content = "This is some test content for our second document.";
      filename = textFileName2;

      buf = null;
      try {
         buf = content.getBytes("UTF-8");
      }
      catch (UnsupportedEncodingException e) {
         e.printStackTrace();
      }
      input = new ByteArrayInputStream(buf);
      contentStream =
session.getObjectFactory().createContentStream(filename, buf.length,
mimetype, input);
      properties = new HashMap<String, Object>();
      properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
      properties.put(PropertyIds.NAME, filename);
      ObjectId id2 = newFolder.createDocument(properties, contentStream,
VersioningState.NONE);

      Document doc2 = (Document) session.getObject(id2);
      System.out.println("renaming " + doc2.getName() + " to test3.txt");
      properties = new HashMap<String, Object>();
      properties.put(PropertyIds.NAME, "test3.txt");
      id2 = doc2.updateProperties(properties, false);
      System.out.println("renamed to " + doc2.getName());

      // Update the content stream
      if
(!session.getRepositoryInfo().getCapabilities().getContentStreamUpdatesCapability().equals(CapabilityContentStreamUpdates.ANYTIME))
{
         System.out.println("update without checkout not supported in this
repository");
      }
      else {
         System.out.println("updating content stream");
         content = "This is some updated test content for our renamed
second document.";
         buf = null;
         try {
            buf = content.getBytes("UTF-8");
         }
         catch (UnsupportedEncodingException e) {
            e.printStackTrace();
         }
         input = new ByteArrayInputStream(buf);
         contentStream =
session.getObjectFactory().createContentStream("test3.txt", buf.length,
mimetype, input);
         properties = new HashMap<String, Object>();
         properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
*         properties.put(PropertyIds.NAME, "test3.txt");
         doc2.setContentStream(contentStream, true);*        *// EXCEPTION
OCCURS HERE...*

         // did it work?
         try {
            content = getContentAsString(doc2.getContentStream());
         }
         catch (IOException e) {
            e.printStackTrace();
         }
         System.out.println("Contents of " + doc2.getName() + " are: " +
content);
      }

*Console output:*

creating a simple text document, test.txt
Getting object by path /ADGNewFolder/test.txt
Contents of test.txt are: This is some test content.
creating a document  called testNoContent with no ContentStream
creating a simple text document, test2.txt
renaming test2.txt to test3.txt
renamed to test2.txt
updating content stream
*Exception in thread "main"
org.apache.chemistry.opencmis.commons.exceptions.CmisStreamNotSupportedException:
Not a file!*
    at
org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractWebServicesService.convertException(AbstractWebServicesService.java:119)
    at
org.apache.chemistry.opencmis.client.bindings.spi.webservices.ObjectServiceImpl.setContentStream(ObjectServiceImpl.java:390)
    at
org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentStream(DocumentImpl.java:351)
    at
org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentStream(DocumentImpl.java:331)
    at
org.apache.chemistry.opencmis.doc.GettingStarted.main(GettingStarted.java:297)

Any input as to what may be wrong would be appreciated.  Has anyone else
hit this?

Thanks


Mark



*
*

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message