unico 2004/01/20 03:14:00
Modified: src/blocks/slide/WEB-INF slide.xconf
Added: src/blocks/slide/java/org/apache/cocoon/components/slide/impl
ContextTxFileContentStore.java
ContextTxXMLFileDescriptorsStore.java
Log:
reinstate context relative file stores, now based on Tx implementation
Revision Changes Path
1.1
cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/slide/impl/ContextTxFileContentStore.java
Index: ContextTxFileContentStore.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.components.slide.impl;
import java.io.File;
import java.util.Hashtable;
import org.apache.slide.common.Domain;
import org.apache.slide.common.ServiceParameterErrorException;
import org.apache.slide.common.ServiceParameterMissingException;
import org.apache.slide.store.txfile.TxFileContentStore;
/**
* Specialized version of the TxFileContentStore from the
* Jakarta Slide project, which respects the context path and work directory.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version CVS $Id: ContextTxFileContentStore.java,v 1.1 2004/01/20 11:13:59
unico Exp $
*/
public class ContextTxFileContentStore extends TxFileContentStore {
public ContextTxFileContentStore() {
}
public void setParameters(Hashtable parameters)
throws ServiceParameterErrorException,
ServiceParameterMissingException {
// resolve the rootpath parameter relative to the webapp context path
String rootpath = (String) parameters.get(STORE_DIR_PARAMETER);
rootpath = new
File(Domain.getParameter("contextpath"),rootpath).toString();
parameters.put(STORE_DIR_PARAMETER,rootpath);
// resolve the workpath parameter relative to the cocoon work
directory
String workpath = (String) parameters.get(WORK_DIR_PARAMETER);
workpath = new
File(Domain.getParameter("workdir"),workpath).toString();
parameters.put(WORK_DIR_PARAMETER,workpath);
super.setParameters(parameters);
}
}
1.1
cocoon-2.1/src/blocks/slide/java/org/apache/cocoon/components/slide/impl/ContextTxXMLFileDescriptorsStore.java
Index: ContextTxXMLFileDescriptorsStore.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.components.slide.impl;
import java.io.File;
import java.util.Hashtable;
import org.apache.slide.common.Domain;
import org.apache.slide.common.ServiceParameterErrorException;
import org.apache.slide.common.ServiceParameterMissingException;
import org.apache.slide.store.txfile.TxXMLFileDescriptorsStore;
/**
* Specialized version of the TxXMLFileDescriptorStore from the
* Jakarta Slide project, which respects the context path and work directory.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version CVS $Id: ContextTxXMLFileDescriptorsStore.java,v 1.1 2004/01/20
11:13:59 unico Exp $
*/
public class ContextTxXMLFileDescriptorsStore extends
TxXMLFileDescriptorsStore {
public ContextTxXMLFileDescriptorsStore() {
}
public void setParameters(Hashtable parameters)
throws ServiceParameterErrorException,
ServiceParameterMissingException {
// resolve the rootpath parameter relative to the webapp context path
String rootpath = (String) parameters.get(STORE_DIR_PARAMETER);
rootpath = new
File(Domain.getParameter("contextpath"),rootpath).toString();
parameters.put(STORE_DIR_PARAMETER,rootpath);
// resolve the workpath parameter relative to the cocoon work
directory
String workpath = (String) parameters.get(WORK_DIR_PARAMETER);
workpath = new
File(Domain.getParameter("workdir"),workpath).toString();
parameters.put(WORK_DIR_PARAMETER,workpath);
super.setParameters(parameters);
}
}
1.6 +8 -7 cocoon-2.1/src/blocks/slide/WEB-INF/slide.xconf
Index: slide.xconf
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/slide/WEB-INF/slide.xconf,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- slide.xconf 15 Jan 2004 10:53:20 -0000 1.5
+++ slide.xconf 20 Jan 2004 11:13:59 -0000 1.6
@@ -23,9 +23,11 @@
<definition>
<store name="tx">
- <nodestore
classname="org.apache.slide.store.txfile.TxXMLFileDescriptorsStore">
- <parameter name="rootpath">store\metadata</parameter>
- <parameter name="workpath">work\metadata</parameter>
+ <nodestore
classname="org.apache.cocoon.components.slide.impl.ContextTxXMLFileDescriptorsStore">
+ <!-- rootpath parameter is relative to the webapp
context path -->
+ <parameter name="rootpath">slide</parameter>
+ <!-- workpath parameter is relative to the cocoon work
directory -->
+ <parameter name="workpath">slide</parameter>
<parameter name="encoding">UTF-8</parameter>
</nodestore>
<securitystore>
@@ -40,9 +42,9 @@
<revisiondescriptorstore>
<reference store="nodestore"/>
</revisiondescriptorstore>
- <contentstore
classname="org.apache.slide.store.txfile.TxFileContentStore">
- <parameter name="rootpath">store\content</parameter>
- <parameter name="workpath">work\content</parameter>
+ <contentstore
classname="org.apache.cocoon.components.slide.impl.ContextTxFileContentStore">
+ <parameter name="rootpath">slide</parameter>
+ <parameter name="workpath">slide</parameter>
</contentstore>
</store>
<scope match="/" store="tx"/>
@@ -74,7 +76,6 @@
<!-- Paths configuration -->
<userspath>/users</userspath>
<rolespath>/roles</rolespath>
- <groupspath>/groups</groupspath>
<actionspath>/actions</actionspath>
<filespath>/files</filespath>