KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > services > webdav > stores > FileContentStore


1 package org.jahia.services.webdav.stores;
2
3 import org.apache.slide.common.*;
4 import org.apache.slide.store.txfile.TxFileContentStore;
5
6 import java.util.Hashtable JavaDoc;
7
8 /**
9  * Created by IntelliJ IDEA.
10  * User: toto
11  * Date: Apr 24, 2003
12  * Time: 10:25:09 PM
13  * To change this template use Options | File Templates.
14  */

15 public class FileContentStore extends TxFileContentStore {
16
17     private static String JavaDoc contentPath;
18
19     private String JavaDoc path;
20
21     private Hashtable JavaDoc parameters;
22
23     public static void setContentPath (String JavaDoc contentPath) {
24         FileContentStore.contentPath = contentPath;
25     }
26
27     public FileContentStore() {
28     }
29
30     public void setParameters(Hashtable JavaDoc parameters) throws ServiceParameterErrorException, ServiceParameterMissingException {
31         this.parameters = parameters;
32         parameters.put (STORE_DIR_PARAMETER, contentPath+"/store");
33         parameters.put (WORK_DIR_PARAMETER, contentPath+"/work");
34         super.setParameters(parameters);
35     }
36
37     public synchronized void initialize (NamespaceAccessToken token)
38             throws ServiceInitializationFailedException {
39         super.initialize (token);
40
41         try {
42             Hashtable JavaDoc parameters = new Hashtable JavaDoc();
43             path = contentPath + "/" + token.getName ();
44
45             parameters.put (STORE_DIR_PARAMETER, path+"/store");
46             parameters.put (WORK_DIR_PARAMETER, path+"/work");
47
48             if (isConnected()) {
49                 disconnect();
50                 super.setParameters(parameters);
51                 connect();
52             } else {
53                 super.setParameters(parameters);
54             }
55         } catch (ServiceAccessException e) {
56             e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
57
} catch (ServiceConnectionFailedException e) {
58             e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
59
} catch (ServiceDisconnectionFailedException e) {
60             e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
61
} catch (ServiceParameterErrorException e) {
62             e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
63
} catch (ServiceParameterMissingException e) {
64             e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
65
}
66
67     }
68
69 // public void createRevisionContent(Uri uri, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent) throws ServiceAccessException, RevisionAlreadyExistException {
70
// new File(path, uri.getParentUri().getRelative()).mkdirs();
71
// super.createRevisionContent(uri, revisionDescriptor, revisionContent);
72
// }
73
//
74
// public void setParameters(Hashtable parameters) throws ServiceParameterErrorException, ServiceParameterMissingException {
75
// try {
76
// super.setParameters(parameters);
77
// } catch (ServiceParameterErrorException e) {
78
// }
79
// }
80
}
81
Popular Tags