Hi Eelco, I am sorry i cannot help you much, as i am also new to Slide, but i guess you could help me a bit. Can you tell me what settings you needed to do to actually use an RDBMS as the database for the slide.
Please do let me know. Regards, Arif -----Original Message----- From: Eelco Hillenius [mailto:[EMAIL PROTECTED] Sent: 28 February 2003 23:33 To: [EMAIL PROTECTED] Subject: newbe on usage of low-level (non webdav) client API Hi all, I am quite new to Slide and I am having a hard time finding out the best way of using it. I have just started building a CMS application that uses Slide for a content repository. The first question that arises is whether I should use the WebDav API or the lower level API? I assume that, as my both code and Slide will run in the same VM, it will be much better performance-wise to use the lower level API. Is that right? The second question is if, using the plain client API, the test class that you can find below shows the correct usage of the API. I am just trying to add, retrieve and remove a file (named test.xml). The test runs fine...(data shows up in RDBMS) but I have got the feeling I am doing too much. And I do not understand that if I want to get things working I have to do something like: structureHelper.create(slideToken, rootuser, "/files/test.xml"); This adds the SubjectNode rootuser. I would rather just add a file node or something... But I probably just do not understand some of the concepts of the Slide API. Maybe I have to implement my own types of ObjectNodes? Could someone please help me on this? Cheers, Eelco Hillenius Here's the code: import java.io.*; import junit.framework.TestCase; import org.apache.slide.structure.*; import org.apache.slide.content.*; import org.apache.slide.common.*; import org.apache.slide.authenticate.*; /** * Testing storing of a file in the repository */ public class StoreTest extends TestCase { protected NamespaceAccessToken nsAccessToken; protected CredentialsToken credToken; protected SlideToken slideToken; protected Structure structureHelper; protected Content contentHelper; protected SubjectNode rootuser; public StoreTest(String name) { super(name); } protected void setUp() throws Exception { nsAccessToken = Domain.accessNamespace(new SecurityToken(new String()), "mynamespace"); credToken = new CredentialsToken(new String("root")); slideToken = new SlideTokenImpl(credToken); structureHelper = nsAccessToken.getStructureHelper(); contentHelper = nsAccessToken.getContentHelper(); rootuser = (SubjectNode)structureHelper.retrieve(slideToken, "/users/root"); } protected void tearDown() throws Exception { Domain.closeNamespace(nsAccessToken); } /** * test adding a file to the repository */ public void testAddFile() { try { InputStream is = getClass().getResourceAsStream("test.xml"); nsAccessToken.begin(); structureHelper.create(slideToken, rootuser, "/files/test.xml"); contentHelper.create(slideToken, "/files/test.xml", true); NodeRevisionDescriptors revisionDescriptors = contentHelper.retrieve(slideToken, "/files/test.xml"); NodeRevisionDescriptor revisionDescriptor = new NodeRevisionDescriptor(-1); revisionDescriptor.setProperty("revision", "1"); NodeRevisionContent nodeRevContent = new NodeRevisionContent(); nodeRevContent.setContent(is); contentHelper.create(slideToken, "/files/test.xml", revisionDescriptor, nodeRevContent); nsAccessToken.commit(); is.close(); } catch (Throwable e) { e.printStackTrace(); try { nsAccessToken.rollback(); } catch(Exception _e) { } } } /** * test reading a file from the repository */ public void testReadFile() { try { NodeRevisionDescriptors revisionDescriptors = contentHelper.retrieve(slideToken, "/files/test.xml"); NodeRevisionDescriptor revisionDescriptor = contentHelper.retrieve(slideToken, revisionDescriptors); NodeRevisionContent revContent = contentHelper.retrieve(slideToken, revisionDescriptors, revisionDescriptor); System.out.println("content: " + String.valueOf(revContent.getContent())); System.out.println("rev: " + revisionDescriptors.getLatestRevision()); } catch (Throwable e) { e.printStackTrace(); } } /** * test deleting a file from the repository */ public void testDeleteFile() { try { nsAccessToken.begin(); structureHelper.remove(slideToken, rootuser); nsAccessToken.commit(); } catch (Throwable e) { e.printStackTrace(); try { nsAccessToken.rollback(); } catch(Exception _e) { } } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
