You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by "Thomson, Judi R" <Ju...@pnl.gov> on 2001/07/18 18:05:51 UTC
Using the slide API
I want to use the java API for slide directly instead of going through the DAV
interface. I'm having trouble keeping straight the sequence of steps I need to
save a file. There is a test program in the examples that loads the Domain.xml
file and shows me how to manipulate the structure, but I also need to be able to
save a file.
Basically I want to do something like:
create a new node in the structure
assign an input stream to that node
have it save the input stream to disk (based on the location identified in the
node)
We've been playing with the token.getStructureHelper(), and
token.getContentHelper() methods, but we're just not getting the operations
right somehow and its not saving anything to disk.
Any suggestions appreciated!
Thanks
Judi
****************************************
Judi Thomson
Senior Research Scientist (Data and Knowledge Engineering)
Pacific Northwest National Laboratory
(operated by Battelle)
Richland, WA
509.375.4438
****************************************
RE: Using the slide API
Posted by Raj Kumar <ko...@intalio.com>.
To be able to create a file on the hard disk you need the following entry in
the Domain.xml file.
<contentstore name="file"
classname="slidestore.file.FileContentStoreNoVersioning">
<parameter name="rootpath">files</parameter>
</contentstore>
or
<contentstore name="file"
classname="slidestore.reference.FileContentStore">
<parameter name="rootpath">files</parameter>
</contentstore>
depending on whether you need versioning or not.
If you run the version example(in examples/version directory) with the above
entry for the
contentstore in the Domain.xml file and have code which looks this in the
Test.java file you should see some files
being created on your hard disk.
String sample = "This is sample content being created";
// get the revision descriptors for the node /test
NodeRevisionDescriptors revisionDescriptors =
content.retrieve(slideToken, "/test");
// get the latest revision descriptor for the node /test
NodeRevisionDescriptor revisionDescriptor = content.retrieve
(slideToken, revisionDescriptors);
revisionDescriptor.setContentLength(sample.length());
NodeRevisionContent chars = new NodeRevisionContent();
StringBufferInputStream reader = new StringBufferInputStream(sample);
// set the content
chars.setContent(reader);
// this should create the file on your hard disk
content.create(slideToken, "/test", revisionDescriptor, chars);
rajkumar
-----Original Message-----
From: Thomson, Judi R [mailto:Judi.Thomson@pnl.gov]
Sent: Wednesday, July 18, 2001 9:06 AM
To: 'slide-user@jakarta.apache.org'
Subject: Using the slide API
I want to use the java API for slide directly instead of going through the
DAV
interface. I'm having trouble keeping straight the sequence of steps I need
to
save a file. There is a test program in the examples that loads the
Domain.xml
file and shows me how to manipulate the structure, but I also need to be
able to
save a file.
Basically I want to do something like:
create a new node in the structure
assign an input stream to that node
have it save the input stream to disk (based on the location identified in
the
node)
We've been playing with the token.getStructureHelper(), and
token.getContentHelper() methods, but we're just not getting the operations
right somehow and its not saving anything to disk.
Any suggestions appreciated!
Thanks
Judi
****************************************
Judi Thomson
Senior Research Scientist (Data and Knowledge Engineering)
Pacific Northwest National Laboratory
(operated by Battelle)
Richland, WA
509.375.4438
****************************************