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 ; 7 8 15 public class FileContentStore extends TxFileContentStore { 16 17 private static String contentPath; 18 19 private String path; 20 21 private Hashtable parameters; 22 23 public static void setContentPath (String contentPath) { 24 FileContentStore.contentPath = contentPath; 25 } 26 27 public FileContentStore() { 28 } 29 30 public void setParameters(Hashtable 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 parameters = new Hashtable (); 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(); } catch (ServiceConnectionFailedException e) { 58 e.printStackTrace(); } catch (ServiceDisconnectionFailedException e) { 60 e.printStackTrace(); } catch (ServiceParameterErrorException e) { 62 e.printStackTrace(); } catch (ServiceParameterMissingException e) { 64 e.printStackTrace(); } 66 67 } 68 69 } 81 | Popular Tags |