I am learning slide, and in particular, i am learning from making
modifications to example code. the example i am using is called "version"
which provides an illustration of both versioning/branching, etc. walking
through the example, i wanted to try a couple of different items: 1)
FileContentStore; 2)storing real content.
I modified your example as follows:
try {
// create the token we use to access the namespace content store
token = Domain.accessNamespace(new SecurityToken(new String()),
"version");
// obtain the various helpers
Structure structure = token.getStructureHelper();
Security security = token.getSecurityHelper();
Lock lock = token.getLockHelper();
Content content = token.getContentHelper();
// create the slide token we will use in the system
CredentialsToken credToken = new CredentialsToken(new
String("root"));
SlideToken slideToken = new SlideTokenImpl(credToken);
// create a subject with the test as the file that we will store
in the namespace
System.out.println("Creating a test subject");
SubjectNode subject = new SubjectNode();
structure.create(slideToken, subject, "/test");
// inform the namespace that test is to be versioned
content.create(slideToken, "/test", true);
// get content from a file in the same directory
File file1 = new File( "Domain.xml" );
int fileSize1 = (int)file1.length();
InputStream inputStream1 = new FileInputStream( file1 );
// get content from a file in the same directory
File file2 = new File( "Import.xml" );
int fileSize2 = (int)file2.length();
InputStream inputStream2 = new FileInputStream( file2 );
// get the descriptors from the test file in the namespace
NodeRevisionDescriptors revisionDescriptors =
content.retrieve(slideToken, "/test");
NodeRevisionContent revisionContent = new NodeRevisionContent();
// create the first instance
System.out.println( "First instance, content length: " +
fileSize1 );
NodeRevisionDescriptor revisionDescriptor = new
NodeRevisionDescriptor();
revisionDescriptor.setProperty( "revision", "0" );
revisionDescriptor.setContentLength( Integer.toString( fileSize1
) );
revisionContent.setContent( inputStream1 );
content.create(slideToken, "/test", revisionDescriptor,
revisionContent );
// create the new revision
System.out.println( "Second instance, content length: " +
fileSize2 );
revisionDescriptor = content.retrieve(slideToken,
revisionDescriptors);
revisionDescriptor.setProperty("revision", "1");
revisionDescriptor.setContentLength( Integer.toString( fileSize2
) );
revisionContent.setContent( inputStream2 );
content.create(slideToken, "/test", revisionDescriptor,
revisionContent );
// create a branch off the original
System.out.println( "Creating a branch off of the second
instance" );
revisionDescriptor = content.retrieve(slideToken,
revisionDescriptors);
content.fork(slideToken, "/test", "branch1", revisionDescriptor);
// create the new revision at this branch
System.out.println( "First instance as first revision in branch"
);
revisionDescriptor = content.retrieve(slideToken,
revisionDescriptors, "branch1");
revisionDescriptor.setProperty("revision", "2");
revisionDescriptor.setContentLength( Integer.toString( fileSize1
) );
revisionContent.setContent( inputStream1 );
content.create(slideToken, "/test", "branch1",
revisionDescriptor, revisionContent );
I am getting an access error of "Bad file descriptor", which is occuring as
I am creating a new revision within the branch. If I do not add the new
revision (i.e., comment out that portion), i get two versions and 1 branch,
just as I would expect. However, when I try to add a revision within the
branch, just as you have done within the slide examples, I can not seem to
do so. The only difference I can see bewteen the example you provided in
the slide distribution and mine, is that I am providing content as opposed
to setting it to null.
I know that I am doing something real stupid... but could you please provide
some insight. Any suggestions or ideas? Thank you so very much for
providing me with some of your time.
Cheers,
Douglas Heins
[EMAIL PROTECTED]
__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/
Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>