KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > slide > impl > ContextTxFileContentStore


1 /*
2  * Copyright 1999-2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.components.slide.impl;
17
18 import java.io.File JavaDoc;
19 import java.util.Hashtable JavaDoc;
20
21 import org.apache.slide.common.Domain;
22 import org.apache.slide.common.ServiceParameterErrorException;
23 import org.apache.slide.common.ServiceParameterMissingException;
24 import org.apache.slide.store.txfile.TxFileContentStore;
25
26 /**
27  * Specialized version of the TxFileContentStore from the
28  * Jakarta Slide project, which respects the context path and work directory.
29  *
30  * @version CVS $Id: ContextTxFileContentStore.java 30932 2004-07-29 17:35:38Z vgritsenko $
31  */

32 public class ContextTxFileContentStore extends TxFileContentStore {
33     
34     public ContextTxFileContentStore() {
35     }
36     
37     public void setParameters(Hashtable JavaDoc parameters)
38         throws ServiceParameterErrorException, ServiceParameterMissingException {
39         
40         // resolve the rootpath parameter relative to the webapp context path
41
String JavaDoc rootpath = (String JavaDoc) parameters.get(STORE_DIR_PARAMETER);
42         rootpath = new File JavaDoc(Domain.getParameter("contextpath"),rootpath).toString();
43         parameters.put(STORE_DIR_PARAMETER,rootpath);
44         
45         // resolve the workpath parameter relative to the cocoon work directory
46
String JavaDoc workpath = (String JavaDoc) parameters.get(WORK_DIR_PARAMETER);
47         workpath = new File JavaDoc(Domain.getParameter("workdir"),workpath).toString();
48         parameters.put(WORK_DIR_PARAMETER,workpath);
49         
50         super.setParameters(parameters);
51     }
52
53 }
54
Popular Tags