Binding Demo


<store name="mystore" classname="">
    <nodestore classname=...>

For more information on the domain.xml file see DomainConfig.

"The properties file is in one of the slide server jars (the slide kernel jar?). So if you want to change the then extract it from the archive and put it into the slide/WEB-INF/classes dir so that it overrides the properties in the jar."

For more information on the file see SlidePropertiesFile.

IMPORTANT NOTE: Under no circumstances the binding configuration of a store should be changed from disabled to enabled, or vice-versa, while the store contains data, as no migration of the data will take place!

Thanks to Warwick Burrows and Neil Padgen (or whoever first posted the example below in the mailing list)


package testing;

import javax.ejb.EJBException;

import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpURL;
import org.apache.webdav.lib.WebdavResource;

public class PutSomethingInSlide {

    public static void main(String[] args) throws Exception
        WebdavResource container = null;
        HttpURL url = new HttpURL("http://localhost:8080/slide/files/");
        url.setUserinfo("root", "root");
        container = new WebdavResource(url);
        if (container == null)
            throw new Exception("Container WebdavResource is null!");
        container.putMethod("/slide/files/hello.txt", "Hello world\n");
        url = new HttpURL("http://localhost:8080/slide/files/hello.txt");
        url.setUserinfo("root", "root");
        WebdavResource item = new WebdavResource(url);
        if (item == null)
            throw new Exception("Item WebdavResource is null!");

        // now let's try binding it to another name
        boolean result = item.bindMethod("/slide/files/helloagain.txt");
        System.out.println("bindMethod result: " + result);
        url = new HttpURL("http://localhost:8080/slide/files/helloagain.txt");
        url.setUserinfo("root", "root");
            WebdavResource boundItem = new WebdavResource(url);
            System.out.println("boundItem existence: " + boundItem.getExistence());
        catch (HttpException e)
            System.out.println("no boundItem: " + e.getMessage());


You should now be able to see a hello.txt and helloagain.txt under files from your WebDAV client software.

Useful Notes: Based on my limited experience (someone please correct me if I'm wrong), you can only bind file resources to a binding that points to an existing directory. For example, if your Slide directory structure is:

files/items files/stuff

Inside the 'files' directory is 'blah.txt'. You can bind 'blah.txt' as 'files/items/cools.txt' or 'files/stuff/cools.txt', but not as 'files/brian/cools.txt' because the 'brian' folder does not exist.

BindingDemo (last edited 2009-09-20 22:02:35 by localhost)