Arik Shifer wrote:

>  I was trying to set the xml example to work with the local filesystem.
>  Can I use the slide provided file store as a persistent store?
>  How do setup slide to interact directly with the local filesystem?
>
>  I changed the content store section in domain.xml to:
>
>  <contentstore classname="slidestore.reference.FileContentStore">
>    <parameter name="rootpath" >files</parameter >
>  </contentstore>

Remy write:

> The current file store can only store the binary content of the objects.
>
> I had started working on a full filesystem store, but my priorities
changed
> a bit since then. What this means is that there will be one eventually,
but
> not in the immediate future (unless somebody steps up and is willing to
> take care of this, of course :).

The xml example does not put anything into the ./files directory because the
definition in the domain.xml defines a file content store and the xml
example does not define any content. The example defines a directory
structure and nodes but that is stored in the memory descriptors store
(because the domain.xml does not define a descriptors store).

If you replace the store definition in domain.xml with:

      <store name="myFileStore">
        <contentstore name="A"
         classname="slidestore.file.FileContentStoreNoVersioning">
          <parameter name="rootpath">files</parameter>
        </contentstore>
        <nodestore name="B"
         classname="slidestore.file.FileDescriptorsStoreNoVersioning">
          <parameter name="rootpath">files</parameter>
        </nodestore>
      </store>

then you will get also the descriptors in files - only problem is that this
store is buggy. I have found a few that would prevent reading from the store
and will send them to the dev list.

A sample program that populates a file with content:

package xml;

import java.util.Enumeration;
import java.util.Vector;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Date;
import org.apache.slide.structure.*;
import org.apache.slide.content.*;
import org.apache.slide.common.*;
import org.apache.slide.lock.*;
import org.apache.slide.security.*;
import org.apache.slide.authenticate.CredentialsToken;
import org.apache.slide.authenticate.SecurityToken;

/**
 * This is a test class for XML support.
 */
public class Test {

    public static void main(String[] args) {
        NamespaceAccessToken token = null;

        try {

            token = Domain.accessNamespace(new SecurityToken(new String()),
                                           "xml");

            Structure structure = token.getStructureHelper();
            Security security = token.getSecurityHelper();
            Content content = token.getContentHelper();

            CredentialsToken credToken =
                new CredentialsToken(new String("root"));
            SlideToken slideToken = new SlideToken(credToken);

            System.out.println("Storing everything in the database");

            try {
                structure.retrieve(slideToken, "/toto");
            } catch (StructureException e) {
                System.out.println
                    ("!!!!Objects don't exist : Creating objects ...");
                SubjectNode subject1 = (SubjectNode)
structure.retrieve(slideToken, "/");
                SubjectNode subject2 = new SubjectNode();
                structure.create(slideToken, subject2, "/toto");
                SubjectNode subject3 = new SubjectNode();
                structure.create(slideToken, subject3, "/toto/1.txt");

                NodeRevisionContent nrc = new NodeRevisionContent();
                nrc.setContent("Hello World\n".getBytes());
                NodeRevisionDescriptor nrd = new NodeRevisionDescriptor();

                content.create(slideToken, "/toto/1.txt", nrd, nrc);
            }

        } catch (Throwable e) {
            e.printStackTrace();
        } finally {
            System.out.println("Closing data sources");
            Domain.closeNamespace(token);
        }
    }
}


Reply via email to