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 "Pill, Juergen" <Ju...@softwareag.com> on 2002/08/08 09:06:03 UTC

RE: question about slide example called "version"

Hello Douglas,

Could you please post your next questions to the slide list. This question
might be of general interest.

Best regards,

Juergen



 -----Original Message-----
From: 	CittaAlta@netscape.net [mailto:CittaAlta@netscape.net] 
Sent:	Wednesday, August 07, 2002 20.14 PM
To:	Juergen.Pill@softwareag.com
Subject:	question about slide example called "version"

Hello Juergen:

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
CittaAlta@Netscape.Net



__________________________________________________________________
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: question about slide example called "version"

Posted by dovan nguyen <do...@yahoo.com>.
Hello,

I'm registered on the mailing list (I think) and I've
trying to send questions to:

slide-user@jakarta.apache.org

but they always got returned to me.  Could u please
tell me how to do this properly?

Thanks,
Dovan

--- "Pill, Juergen" <Ju...@softwareag.com>
wrote:
> Hello Douglas,
> 
> Could you please post your next questions to the
> slide list. This question
> might be of general interest.
> 
> Best regards,
> 
> Juergen
> 
> 
> 
>  -----Original Message-----
> From: 	CittaAlta@netscape.net
> [mailto:CittaAlta@netscape.net] 
> Sent:	Wednesday, August 07, 2002 20.14 PM
> To:	Juergen.Pill@softwareag.com
> Subject:	question about slide example called
> "version"
> 
> Hello Juergen:
> 
> 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
> CittaAlta@Netscape.Net
> 
> 
> 
>
__________________________________________________________________
> 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:  
> <ma...@jakarta.apache.org>
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>