stephan 2003/01/30 12:01:08
Modified: src/scratchpad/src/org/apache/cocoon/components/repository/impl
SlidePrincipalProvider.java SlideRepository.java
src/scratchpad/src/org/apache/cocoon/components/source/impl
SlideSource.java SlideSourceFactory.java
src/scratchpad/src/org/apache/cocoon/generation
SourceDescriptionGenerator.java
src/scratchpad/webapp/samples/slide
description2html4content.xsl
description2html4locks.xsl
description2html4permissions.xsl
description2html4properties.xsl slide.xconf web.xml
Added: src/scratchpad/lib slide-kernel-20020130.jar
slide-roles-20020130.jar slide-stores-20020130.jar
Removed: src/scratchpad/lib slide-kernel-20020814.jar
slide-roles-20020814.jar slide-stores-20020814.jar
Log:
Add new versions of the Jakarta Slide libs.
Updated the Slide Source implementation to respect a precedenting
initialization by the Slide WebDAV servlet.
Revision Changes Path
1.1 xml-cocoon2/src/scratchpad/lib/slide-kernel-20020130.jar
<<Binary file>>
1.1 xml-cocoon2/src/scratchpad/lib/slide-roles-20020130.jar
<<Binary file>>
1.1 xml-cocoon2/src/scratchpad/lib/slide-stores-20020130.jar
<<Binary file>>
1.8 +269 -183
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlidePrincipalProvider.java
Index: SlidePrincipalProvider.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlidePrincipalProvider.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SlidePrincipalProvider.java 7 Jan 2003 23:56:13 -0000 1.7
+++ SlidePrincipalProvider.java 30 Jan 2003 20:01:07 -0000 1.8
@@ -1,57 +1,53 @@
/*
- * The Apache Software License, Version 1.1
- *
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, 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 (INCLUDING, 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. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
+
+ ============================================================================
+ 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.repository.impl;
@@ -104,8 +100,8 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id$
*/
-public class SlidePrincipalProvider extends AbstractLogEnabled
- implements PrincipalProvider, Composable, Configurable, Initializable{
+public class SlidePrincipalProvider extends AbstractLogEnabled
+ implements PrincipalProvider, Composable, Configurable, Initializable {
/** The component manager instance */
private ComponentManager manager = null;
@@ -126,13 +122,13 @@
private Security security;
/** Lock helper. */
- //private Lock lock;
+ // private Lock lock;
/** Macro helper. */
private Macro macro;
/** Slide token. */
- //private SlideToken slidetoken;
+ // private SlideToken slidetoken;
private String repository = null;
private String namespace = null;
@@ -140,19 +136,25 @@
/**
* Set the current <code>ComponentManager</code> instance used by this
* <code>Composable</code>.
+ *
+ * @param manager
+ *
+ * @throws ComponentException
*/
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
/**
- * Pass the Configuration to the Configurable class. This method must
+ * Pass the Configuration to the Configurable class. This method must
* always be called after the constructor and before any other method.
*
* @param configuration the class configurations.
+ *
+ * @throws ConfigurationException
*/
public void configure(Configuration configuration)
- throws ConfigurationException {
+ throws ConfigurationException {
this.repository = configuration.getAttribute("repository", null);
this.namespace = configuration.getAttribute("namespace", null);
@@ -169,43 +171,46 @@
ComponentSelector repositories = null;
Repository repository = null;
+
try {
- repositories =
(ComponentSelector)this.manager.lookup(Repository.ROLE+"Selector");
+ repositories = (ComponentSelector)
this.manager.lookup(Repository.ROLE+
+ "Selector");
- repository = (Repository)repositories.select(this.repository);
+ repository = (Repository) repositories.select(this.repository);
- if (!(repository instanceof SlideRepository)) {
+ if ( !(repository instanceof SlideRepository)) {
getLogger().error("Can't get Slide repository");
- return ;
+ return;
}
- SlideRepository sliderepository =
- (SlideRepository)repository;
+ SlideRepository sliderepository = (SlideRepository) repository;
- if (this.namespace==null)
- this.namespace =
sliderepository.getDomain().getDefaultNamespace();
+ this.nat = sliderepository.getNamespaceToken(namespace);
- if
(sliderepository.getDomain().getNamespaceToken(this.namespace)==null)
+ if (this.nat==null) {
throw new ProcessingException("Repository with the namespace
'"+
- this.namespace+"' couldn't be
found");
+ this.namespace+
+ "' couldn't be found");
+ }
- this.nat =
sliderepository.getDomain().getNamespaceToken(this.namespace);
this.config = this.nat.getNamespaceConfig();
this.structure = nat.getStructureHelper();
this.content = nat.getContentHelper();
this.security = nat.getSecurityHelper();
- //this.lock = nat.getLockHelper();
+ // this.lock = nat.getLockHelper();
this.macro = nat.getMacroHelper();
} catch (ComponentException ce) {
getLogger().error("Could not lookup for component.", ce);
} finally {
- if ((repository!=null) && (repository instanceof Component))
- repositories.release((Component)repository);
+ if ((repository!=null) && (repository instanceof Component)) {
+ repositories.release((Component) repository);
+ }
repository = null;
- if (repositories!=null)
+ if (repositories!=null) {
this.manager.release(repositories);
+ }
repositories = null;
}
}
@@ -215,45 +220,57 @@
*
* @param caller The principal, which should do the operation
* @return List of all principals
+ *
+ * @throws ProcessingException
*/
- public Principal[] getPrincipals(Principal caller) throws
ProcessingException {
+ public Principal[] getPrincipals(Principal caller)
+ throws ProcessingException {
try {
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
String userspath = config.getUsersPath();
- ObjectNode userobjects = structure.retrieve(slidetoken,
userspath);
+ ObjectNode userobjects = structure.retrieve(slidetoken,
+ userspath);
Vector principals = new Vector();
String user;
ObjectNode userobject;
- for(Enumeration children = userobjects.enumerateChildren();
children.hasMoreElements();) {
- user = (String)children.nextElement();
+
+ for (Enumeration children = userobjects.enumerateChildren();
+ children.hasMoreElements(); ) {
+ user = (String) children.nextElement();
userobject = structure.retrieve(slidetoken, user);
- if (!(userobject instanceof GroupNode)) {
- String name =
userobject.getUri().substring(userspath.length()+1);
-
+ if ( !(userobject instanceof GroupNode)) {
+ String name =
userobject.getUri().substring(userspath.length()+
+ 1);
+
// FIXME the CVS code from slide does only implement
getRoles
Enumeration roles = this.security.getRoles(userobject);
String role = null;
- if (roles.hasMoreElements())
- role = (String)roles.nextElement();
+
+ if (roles.hasMoreElements()) {
+ role = (String) roles.nextElement();
+ }
String password = null;
+
try {
- NodeRevisionDescriptors revisionDescriptors =
- content.retrieve(slidetoken, user);
+ NodeRevisionDescriptors revisionDescriptors =
content.retrieve(slidetoken,
+
user);
// Retrieve latest revision descriptor
- NodeRevisionDescriptor revisionDescriptor =
- this.content.retrieve(slidetoken,
revisionDescriptors);
+ NodeRevisionDescriptor revisionDescriptor =
this.content.retrieve(slidetoken,
+
revisionDescriptors);
- if (revisionDescriptor.getProperty("password",
NodeProperty.SLIDE_NAMESPACE)!=null)
- password =
(String)revisionDescriptor.getProperty("password",
+ if (revisionDescriptor.getProperty("password",
NodeProperty.SLIDE_NAMESPACE)!=
+ null) {
+ password = (String)
revisionDescriptor.getProperty("password",
NodeProperty.SLIDE_NAMESPACE).getValue();
+ }
} catch (RevisionDescriptorNotFoundException rdnfe) {
// ignore
}
@@ -263,9 +280,11 @@
}
Principal[] principalArray = new Principal[principals.size()];
- int i=0;
- for(Enumeration e = principals.elements(); e.hasMoreElements() ;
i++)
- principalArray[i] = (Principal)e.nextElement();
+ int i = 0;
+
+ for (Enumeration e = principals.elements(); e.hasMoreElements();
+ i++)
+ principalArray[i] = (Principal) e.nextElement();
return principalArray;
} catch (SlideException se) {
@@ -279,8 +298,11 @@
*
* @param caller The principal, which should do the operation.
* @param principal The Principal, which should be add/modified.
+ *
+ * @throws ProcessingException
*/
- public void addPrincipal(Principal caller, Principal principal) throws
ProcessingException {
+ public void addPrincipal(Principal caller,
+ Principal principal) throws ProcessingException
{
// do the actual transaction
try {
try {
@@ -288,25 +310,27 @@
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
- String strUri = config.getUsersPath() + "/" +
principal.getName();
+ String strUri =
config.getUsersPath()+"/"+principal.getName();
// create the node in the structure
ObjectNode object;
+
object = new slideroles.basic.UserRoleImpl();
structure.create(slidetoken, object, strUri);
// create a revision with the appropriate properties set
- NodeRevisionDescriptor revision =
- new NodeRevisionDescriptor(0);
- revision.setProperty(
- new NodeProperty("resourcetype", "<collection/>",
- true));
+ NodeRevisionDescriptor revision = new
NodeRevisionDescriptor(0);
+
+ revision.setProperty(new NodeProperty("resourcetype",
+ "<collection/>",
true));
revision.setCreationDate(new Date());
revision.setLastModified(new Date());
- revision.setProperty(new NodeProperty("getcontentlength",
"0", true));
+ revision.setProperty(new NodeProperty("getcontentlength",
+ "0", true));
revision.setProperty(new NodeProperty("source", "", true));
- revision.setProperty(new NodeProperty("password",
principal.getPassword(),
- NodeProperty.SLIDE_NAMESPACE));
+ revision.setProperty(new NodeProperty("password",
+
principal.getPassword(),
+
NodeProperty.SLIDE_NAMESPACE));
content.create(slidetoken, strUri, revision, null);
nat.commit();
@@ -317,11 +341,13 @@
} catch (ServiceAccessException e) {
// low level service access failed
getLogger().warn("Could not create principal", e);
- throw new ProcessingException("Could not create principal",
e);
+ throw new ProcessingException("Could not create principal",
+ e);
} catch (Exception e) {
// any other errors are unanticipated
getLogger().warn("Could not create principal", e);
- throw new ProcessingException("Could not create principal",
e);
+ throw new ProcessingException("Could not create principal",
+ e);
}
} catch (Exception e) {
// rollback the transaction
@@ -340,20 +366,23 @@
*
* @param caller The principal, which should do the operation.
* @param principal The Principal, which should be removed.
+ *
+ * @throws ProcessingException
*/
- public void removePrincipal(Principal caller, Principal principal)
- throws ProcessingException {
+ public void removePrincipal(Principal caller,
+ Principal principal)
+ throws ProcessingException {
- if (principal.getName().length() > 0) {
+ if (principal.getName().length()>0) {
// get the helpers
Macro macro = nat.getMacroHelper();
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
// get the path of the current authenticated user
- String selfUri = config.getUsersPath() + "/" + caller.getName();
+ String selfUri = config.getUsersPath()+"/"+caller.getName();
- String strUri = config.getUsersPath() + "/" +
principal.getName();
+ String strUri = config.getUsersPath()+"/"+principal.getName();
// do the actual transaction
try {
@@ -361,15 +390,18 @@
nat.begin();
// the user may not delete herself
- if (!selfUri.equals(strUri))
- macro.delete(slidetoken, strUri, new
MacroParameters(true, false));
+ if ( !selfUri.equals(strUri)) {
+ macro.delete(slidetoken, strUri,
+ new MacroParameters(true, false));
+ }
nat.commit();
} catch (MacroException e) {
// some aspect of the delete operation failed
getLogger().warn("Could not remove principal", e);
- throw new ProcessingException("Could not remove
principal", e);
+ throw new ProcessingException("Could not remove
principal",
+ e);
}
} catch (Exception e) {
// rollback the transaction
@@ -388,35 +420,44 @@
*
* @param caller The principal, which should do the operation.
* @return List of all groups.
+ *
+ * @throws ProcessingException
*/
- public PrincipalGroup[] getPrincipalGroups(Principal caller) throws
ProcessingException {
+ public PrincipalGroup[] getPrincipalGroups(Principal caller)
+ throws ProcessingException {
try {
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
String userspath = config.getUsersPath();
- ObjectNode userobjects = structure.retrieve(slidetoken,
userspath);
+ ObjectNode userobjects = structure.retrieve(slidetoken,
+ userspath);
Vector principalgroups = new Vector();
String group;
ObjectNode groupobject;
- for(Enumeration children = userobjects.enumerateChildren();
children.hasMoreElements();) {
- group = (String)children.nextElement();
+
+ for (Enumeration children = userobjects.enumerateChildren();
+ children.hasMoreElements(); ) {
+ group = (String) children.nextElement();
groupobject = structure.retrieve(slidetoken, group);
if (groupobject instanceof GroupNode) {
- String name =
groupobject.getUri().substring(userspath.length()+1);
+ String name =
groupobject.getUri().substring(userspath.length()+
+ 1);
principalgroups.add(new PrincipalGroup(name));
}
}
PrincipalGroup[] principalgroupArray = new
PrincipalGroup[principalgroups.size()];
- int i=0;
- for(Enumeration e = principalgroups.elements();
e.hasMoreElements() ; i++)
- principalgroupArray[i] = (PrincipalGroup)e.nextElement();
+ int i = 0;
+
+ for (Enumeration e = principalgroups.elements();
+ e.hasMoreElements(); i++)
+ principalgroupArray[i] = (PrincipalGroup) e.nextElement();
return principalgroupArray;
} catch (SlideException se) {
@@ -430,8 +471,12 @@
*
* @param caller The principal, which should do the operation.
* @param group The group, which shoud be add/modified.
+ *
+ * @throws ProcessingException
*/
- public void addPrincipalGroup(Principal caller, PrincipalGroup group)
throws ProcessingException {
+ public void addPrincipalGroup(Principal caller,
+ PrincipalGroup group)
+ throws ProcessingException {
// do the actual transaction
try {
try {
@@ -439,21 +484,22 @@
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
- String strUri = config.getUsersPath() + "/" +
group.getName();
+ String strUri = config.getUsersPath()+"/"+group.getName();
// create the node in the structure
ObjectNode object = new GroupNode();
+
structure.create(slidetoken, object, strUri);
// create a revision with the appropriate properties set
- NodeRevisionDescriptor revision =
- new NodeRevisionDescriptor(0);
- revision.setProperty(
- new NodeProperty("resourcetype", "<collection/>",
- true));
+ NodeRevisionDescriptor revision = new
NodeRevisionDescriptor(0);
+
+ revision.setProperty(new NodeProperty("resourcetype",
+ "<collection/>",
true));
revision.setCreationDate(new Date());
revision.setLastModified(new Date());
- revision.setProperty(new NodeProperty("getcontentlength",
"0", true));
+ revision.setProperty(new NodeProperty("getcontentlength",
+ "0", true));
revision.setProperty(new NodeProperty("source", "", true));
content.create(slidetoken, strUri, revision, null);
@@ -488,20 +534,23 @@
*
* @param caller The principal, which should do the operation.
* @param group The group, which shoud be removed.
+ *
+ * @throws ProcessingException
*/
- public void removePrincipalGroup(Principal caller, PrincipalGroup group)
- throws ProcessingException {
+ public void removePrincipalGroup(Principal caller,
+ PrincipalGroup group)
+ throws ProcessingException {
- if (group.getName().length() > 0) {
+ if (group.getName().length()>0) {
// get the helpers
Macro macro = nat.getMacroHelper();
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
// get the path of the current authenticated user
- String selfUri = config.getUsersPath() + "/" + caller.getName();
+ String selfUri = config.getUsersPath()+"/"+caller.getName();
- String strUri = config.getUsersPath() + "/" + group.getName();
+ String strUri = config.getUsersPath()+"/"+group.getName();
// do the actual transaction
try {
@@ -509,15 +558,18 @@
nat.begin();
// the user may not delete herself
- if (!selfUri.equals(strUri))
- macro.delete(slidetoken, strUri, new
MacroParameters(true, false));
+ if ( !selfUri.equals(strUri)) {
+ macro.delete(slidetoken, strUri,
+ new MacroParameters(true, false));
+ }
nat.commit();
} catch (MacroException e) {
// some aspect of the delete operation failed
getLogger().warn("Could not remove group", e);
- throw new ProcessingException("Could not remove group",
e);
+ throw new ProcessingException("Could not remove group",
+ e);
}
} catch (Exception e) {
// rollback the transaction
@@ -537,9 +589,11 @@
* @param caller The principal, which should do the operation
* @param group The given group.
* @param principal The principal to add to this group.
+ *
+ * @throws ProcessingException
*/
- public void addMember(Principal caller, PrincipalGroup group, Principal
principal)
- throws ProcessingException {
+ public void addMember(Principal caller, PrincipalGroup group,
+ Principal principal) throws ProcessingException {
// do the actual transaction
try {
try {
@@ -547,22 +601,27 @@
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
- String strUri = config.getUsersPath() + "/" +
group.getName() + "/" + principal.getName();
+ String strUri =
config.getUsersPath()+"/"+group.getName()+"/"+
+ principal.getName();
// create the node in the structure
LinkNode link = new LinkNode();
- structure.createLink(slidetoken, link, strUri,
structure.retrieve(slidetoken,
- config.getUsersPath() + "/" + principal.getName()));
+
+ structure.createLink(slidetoken, link, strUri,
+ structure.retrieve(slidetoken,
+
config.getUsersPath()+
+ "/"+
+
principal.getName()));
// create a revision with the appropriate properties set
- NodeRevisionDescriptor revision =
- new NodeRevisionDescriptor(0);
- revision.setProperty(
- new NodeProperty("resourcetype", "<collection/>",
- true));
+ NodeRevisionDescriptor revision = new
NodeRevisionDescriptor(0);
+
+ revision.setProperty(new NodeProperty("resourcetype",
+ "<collection/>",
true));
revision.setCreationDate(new Date());
revision.setLastModified(new Date());
- revision.setProperty(new NodeProperty("getcontentlength",
"0", true));
+ revision.setProperty(new NodeProperty("getcontentlength",
+ "0", true));
revision.setProperty(new NodeProperty("source", "", true));
content.create(slidetoken, strUri, revision, null);
@@ -593,82 +652,103 @@
}
- /**
- * Returns true if the passed principal is a member of the group.
+ /**
+ * Returns true if the passed principal is a member of the group.
*
* @param caller The principal, which should do the operation
* @param group The given group.
* @param member The principal whose membership is to be checked.
* @return True if the principal is a member of this group, false
otherwise.
+ *
+ * @throws ProcessingException
*/
- public boolean isMember(Principal caller, PrincipalGroup group,
Principal member)
- throws ProcessingException {
+ public boolean isMember(Principal caller, PrincipalGroup group,
+ Principal member) throws ProcessingException {
Principal[] members = members(caller, group);
- for(int i=0; i<members.length; i++)
- if (members[i].equals(member))
+
+ for (int i = 0; i<members.length; i++)
+ if (members[i].equals(member)) {
return true;
+ }
return false;
}
- /**
- * Returns an enumeration of the members in the group. The returned
objects are instances of Principal
+ /**
+ * Returns an enumeration of the members in the group. The returned
objects are instances of Principal
*
* @param caller The principal, which should do the operation
* @param group The given group.
* @return An enumeration of the group members.
+ *
+ * @throws ProcessingException
*/
- public Principal[] members(Principal caller, PrincipalGroup group)
throws ProcessingException {
+ public Principal[] members(Principal caller,
+ PrincipalGroup group)
+ throws ProcessingException {
try {
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
String userspath = config.getUsersPath();
- ObjectNode groupobject = structure.retrieve(slidetoken,
userspath+"/"+group.getName());
+ ObjectNode groupobject = structure.retrieve(slidetoken,
+ userspath+"/"+
+ group.getName());
if (groupobject instanceof GroupNode) {
- Vector principals = new Vector();
+ Vector principals = new Vector();
String user;
ObjectNode userobject;
- for(Enumeration children = groupobject.enumerateChildren();
children.hasMoreElements();) {
- user = (String)children.nextElement();
+
+ for (Enumeration children = groupobject.enumerateChildren();
+ children.hasMoreElements(); ) {
+ user = (String) children.nextElement();
userobject = structure.retrieve(slidetoken, user);
- if (!(userobject instanceof GroupNode)) {
- String name =
userobject.getUri().substring(userspath.length()+1);
+ if ( !(userobject instanceof GroupNode)) {
+ String name =
userobject.getUri().substring(userspath.length()+
+ 1);
// FIXME the CVS code from slide does only implement
getRoles
Enumeration roles =
this.security.getRoles(userobject);
String role = null;
- if (roles.hasMoreElements())
- role = (String)roles.nextElement();
- NodeRevisionDescriptors revisionDescriptors =
- content.retrieve(slidetoken,
userobject.getUri());
+ if (roles.hasMoreElements()) {
+ role = (String) roles.nextElement();
+ }
+
+ NodeRevisionDescriptors revisionDescriptors =
content.retrieve(slidetoken,
+
userobject.getUri());
// Retrieve latest revision descriptor
NodeRevisionDescriptor revisionDescriptor =
this.content.retrieve(slidetoken,
-
revisionDescriptors);
+
revisionDescriptors);
String password = null;
+
if ((revisionDescriptor.getProperty("password",
NodeProperty.SLIDE_NAMESPACE)!=null) &&
- (revisionDescriptor.getProperty("password",
-
NodeProperty.SLIDE_NAMESPACE).getValue()!=null))
- password =
revisionDescriptor.getProperty("password",
-
NodeProperty.SLIDE_NAMESPACE).getValue().toString();
+ (revisionDescriptor.getProperty("password",
NodeProperty.SLIDE_NAMESPACE).getValue()!=
+ null)) {
+ password =
revisionDescriptor.getProperty("password",
+
NodeProperty.SLIDE_NAMESPACE).getValue().toString();
+ }
- principals.add(new Principal(name/*, role*/,
password));
+ principals.add(new Principal(name /* , role */,
+ password));
}
}
Principal[] principalArray = new
Principal[principals.size()];
- int i=0;
- for(Enumeration e = principals.elements();
e.hasMoreElements() ; i++)
- principalArray[i] = (Principal)e.nextElement();
+ int i = 0;
+
+ for (Enumeration e = principals.elements();
+ e.hasMoreElements(); i++)
+ principalArray[i] = (Principal) e.nextElement();
return principalArray;
- } else
+ } else {
return new Principal[0];
+ }
} catch (SlideException se) {
throw new ProcessingException(se);
@@ -681,31 +761,37 @@
* @param caller The principal, which should do the operation
* @param group The given group.
* @param principal The principal to remove from this group.
+ *
+ * @throws ProcessingException
*/
- public void removeMember(Principal caller, PrincipalGroup group,
Principal principal)
- throws ProcessingException {
+ public void removeMember(Principal caller, PrincipalGroup group,
+ Principal principal) throws ProcessingException
{
- if ((group.getName().length() > 0) && (principal.getName().length()
> 0)) {
+ if ((group.getName().length()>0) &&
+ (principal.getName().length()>0)) {
// get the helpers
Macro macro = nat.getMacroHelper();
SlideToken slidetoken = new SlideTokenImpl(new
CredentialsToken(caller));
- String strUri = config.getUsersPath() + "/" + group.getName() +
"/" + principal.getName();
+ String strUri = config.getUsersPath()+"/"+group.getName()+"/"+
+ principal.getName();
// do the actual transaction
try {
try {
nat.begin();
- macro.delete(slidetoken, strUri, new
MacroParameters(true, false));
+ macro.delete(slidetoken, strUri,
+ new MacroParameters(true, false));
nat.commit();
} catch (MacroException e) {
// some aspect of the delete operation failed
getLogger().warn("Could not remove member", e);
- throw new ProcessingException("Could not remove member",
e);
+ throw new ProcessingException("Could not remove member",
+ e);
}
} catch (Exception e) {
// rollback the transaction
1.10 +53 -27
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideRepository.java
Index: SlideRepository.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideRepository.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SlideRepository.java 29 Jan 2003 13:06:11 -0000 1.9
+++ SlideRepository.java 30 Jan 2003 20:01:07 -0000 1.10
@@ -9,7 +9,7 @@
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,
+ 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,
@@ -17,12 +17,12 @@
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
+ 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
+ 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]
@@ -33,7 +33,7 @@
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
+ 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
@@ -72,6 +72,7 @@
import org.apache.slide.common.Domain;
import org.apache.slide.common.EmbeddedDomain;
+import org.apache.slide.common.NamespaceAccessToken;
import org.xml.sax.InputSource;
@@ -83,8 +84,7 @@
*/
public class SlideRepository
implements Repository, ThreadSafe, Composable, Configurable,
- LogEnabled /* , Initializable */, Disposable
-{
+ LogEnabled /* , Initializable */, Disposable {
/** The component manager instance */
protected ComponentManager manager = null;
@@ -112,9 +112,7 @@
* Set the current <code>ComponentManager</code> instance used by this
* <code>Composable</code>.
*
- * @param manager
- *
- * @throws ComponentException
+ * @param manager Component manager.
*/
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
@@ -125,8 +123,6 @@
* always be called after the constructor and before any other method.
*
* @param configuration the class configurations.
- *
- * @throws ConfigurationException
*/
public void configure(Configuration configuration)
throws ConfigurationException {
@@ -138,8 +134,6 @@
* Initialialize the component. Initialization includes
* allocating any resources required throughout the
* components lifecycle.
- *
- * @throws Exception if an error occurs
*/
public void initialize() throws Exception {
@@ -148,18 +142,18 @@
Source source = null;
Configuration configuration = null;
- this.domain = new EmbeddedDomain();
- // FIXME Could not remove deprecated method, because some important
- // messages were thrown over the domain logger
- domain.setLogger(new SlideLoggerAdapter(this.logger));
-
if (Domain.isInitialized()) {
this.logger.info("Domain already initialized.");
return;
- } else {
- this.logger.info("Initializing domain.");
}
+ this.logger.info("Initializing domain.");
+
+ this.domain = new EmbeddedDomain();
+ // FIXME Could not remove deprecated method, because some important
+ // messages were thrown over the domain logger
+ domain.setLogger(new SlideLoggerAdapter(this.logger));
+
try {
resolver = (SourceResolver)
this.manager.lookup(SourceResolver.ROLE);
@@ -251,12 +245,36 @@
}
/**
+ * Returns a token for the access of the default namespace.
*
+ * @return NamespaceAccessToken Access token to the namespace
+ */
+ public NamespaceAccessToken getDefaultNamespaceToken() {
+ // Initialization on demand
+ if ((domain==null) && ( !initialized)) {
+ try {
+ initialize();
+ } catch (Exception e) {
+ this.logger.error("Could not initialize Slide repository",
e);
+ }
+ }
+
+ if (domain!=null) {
+ return
this.domain.getNamespaceToken(this.domain.getDefaultNamespace());
+ }
+
+ return Domain.accessNamespace(null, Domain.getDefaultNamespace());
+ }
+
+ /**
+ * Returns a token for the access of a namespace.
*
- * @return
+ * @param namespaceName Name of the namespace on which access is
requested
+ * @return NamespaceAccessToken Access token to the namespace
*/
- public EmbeddedDomain getDomain() {
- if (domain==null) {
+ public NamespaceAccessToken getNamespaceToken(String namespaceName) {
+ // Initialization on demand
+ if ((domain==null) && ( !initialized)) {
try {
initialize();
} catch (Exception e) {
@@ -264,6 +282,14 @@
}
}
- return this.domain;
+ if (namespaceName==null) {
+ return getDefaultNamespaceToken();
+ }
+
+ if (domain!=null) {
+ return this.domain.getNamespaceToken(namespaceName);
+ }
+
+ return Domain.accessNamespace(null, namespaceName);
}
}
1.30 +102 -191
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java
Index: SlideSource.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- SlideSource.java 30 Jan 2003 08:37:34 -0000 1.29
+++ SlideSource.java 30 Jan 2003 20:01:07 -0000 1.30
@@ -9,7 +9,7 @@
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,
+ 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,
@@ -17,12 +17,12 @@
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
+ 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
+ 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]
@@ -33,7 +33,7 @@
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
+ 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
@@ -108,9 +108,11 @@
import org.apache.slide.lock.Lock;
import org.apache.slide.lock.NodeLock;
import org.apache.slide.macro.Macro;
+import org.apache.slide.security.AccessDeniedException;
import org.apache.slide.security.NodePermission;
import org.apache.slide.security.Security;
import org.apache.slide.structure.GroupNode;
+import org.apache.slide.structure.LinkedObjectNotFoundException;
import org.apache.slide.structure.ObjectNode;
import org.apache.slide.structure.ObjectNotFoundException;
import org.apache.slide.structure.Structure;
@@ -123,20 +125,13 @@
* @version $Id$
*/
public class SlideSource extends AbstractLogEnabled
- implements Composable, Contextualizable, Source, WriteableSource,
+ implements Contextualizable, Source, WriteableSource,
ModifiableTraversableSource, MoveableSource, RestrictableSource,
- LockableSource, InspectableSource, VersionableSource
-{
-
- /** Component manager */
- private ComponentManager manager;
+ LockableSource, InspectableSource, VersionableSource {
/** Component context */
private Context context;
- /** Sytem id */
- private String systemid;
-
/** Namespace access token. */
private NamespaceAccessToken nat;
@@ -166,7 +161,10 @@
/** Pseudo scheme */
private String scheme = "slide";
- /** The URI of the source*/
+ /** The path of the source, which means the URI without the scheme */
+ private String path;
+
+ /** Uniform resource ifdentifier */
private String uri;
/** Revision number */
@@ -191,15 +189,15 @@
* Create a slide source.
*
* @param nat Namespace access token
- * @param scheme Scheme of the source
- * @param uri URI of the source.
+ * @param scheme Scheme of the source
+ * @param path Path of the source.
* @param sourcecredential Credential, which should be used.
* @param sourcerevision Revision, which should be used.
* @param sourcerevisionbranch Branch, which should be used.
*
* @throws SourceException If Exception occurs during the initialization.
*/
- public SlideSource(NamespaceAccessToken nat, String scheme, String uri,
+ public SlideSource(NamespaceAccessToken nat, String scheme, String path,
SourceCredential sourcecredential,
String sourcerevision,
String sourcerevisionbranch) throws SourceException {
@@ -210,14 +208,9 @@
this.nat = nat;
this.config = this.nat.getNamespaceConfig();
this.scheme = scheme;
- this.uri = uri;
- if ((this.uri==null) || (this.uri.length()==0)) {
- this.uri = "/";
- } else if ( !this.uri.startsWith("/")) {
- this.uri = "/"+this.uri;
- }
+ this.path = path;
+ this.uri = scheme+"://"+path;
- this.systemid = scheme+":/"+uri; // FIXME dirty hack
this.sourcerevision = sourcerevision;
this.sourcerevisionbranch = sourcerevisionbranch;
@@ -228,51 +221,11 @@
this.macro = nat.getMacroHelper();
this.slideToken = new SlideTokenImpl(credToken);
- }
-
- /**
- * Pass the ComponentManager to the composer. The Composable
implementation
- * should use the specified ComponentManager to acquire the components
it needs for execution
- *
- * @param manager The ComponentManager which this Composable uses
- *
- * @throws ComponentException If a exception occurs.
- */
- public void compose(ComponentManager manager) throws ComponentException {
- this.manager = manager;
-
- try {
- initialize(); // FIXME SourceResolver doesn't handle
Initializable
- } catch (Exception e) {
- throw new
ComponentException("org.apache.excalibur.source.Source",
- "Could not initialize component",
e);
- }
- }
-
- /**
- * Pass the Context to the component.
- * This method is called after the LogEnabled.enableLogging() (if
present)
- * method and before any other method.
- *
- * @param context The context.
- */
- public void contextualize(Context context) {
- this.context = context;
- }
-
- /**
- * Initialialize the component. Initialization includes
- * allocating any resources required throughout the
- * components lifecycle.
- *
- * @throws Exception if an error occurs
- */
- public void initialize() throws Exception {
try {
this.revisionDescriptors = content.retrieve(this.slideToken,
this.config.getFilesPath()+
- this.uri);
+ this.path);
// Retrieve latest revision descriptor
this.revisionDescriptor = content.retrieve(slideToken,
@@ -283,14 +236,30 @@
} catch (RevisionDescriptorNotFoundException rdnfe) {
- getLogger().warn("Could not retrieve revision descriptor",
rdnfe);
+ //getLogger().warn("Could not retrieve revision descriptor",
rdnfe);
this.revisionDescriptor = null;
this.sourcerevision = null;
this.sourcerevisionbranch = null;
} catch (ObjectNotFoundException onfe) {
- getLogger().debug("Source doesn't exist", onfe);
+ //getLogger().debug("Source doesn't exist", onfe);
+ // ignore
+ } catch (SlideException se) {
+ throw new SourceException("Access denied for source '"+this.uri+
+ "'", se);
}
+
+ }
+
+ /**
+ * Pass the Context to the component.
+ * This method is called after the LogEnabled.enableLogging() (if
present)
+ * method and before any other method.
+ *
+ * @param context The context.
+ */
+ public void contextualize(Context context) {
+ this.context = context;
}
/**
@@ -308,7 +277,7 @@
try {
ObjectNode object = structure.retrieve(this.slideToken,
this.config.getFilesPath()+
- this.uri);
+ this.path);
return content.retrieve(slideToken, this.revisionDescriptors,
this.revisionDescriptor).streamContent();
@@ -323,7 +292,16 @@
* @return System identifier for the source.
*/
public String getURI() {
- return this.systemid;
+ return this.uri;
+ }
+
+ /**
+ * @see org.apache.excalibur.source.Source#getScheme()
+ *
+ * @return Scheme of the source.
+ */
+ public String getScheme() {
+ return this.scheme;
}
/**
@@ -379,7 +357,7 @@
public boolean exists() {
try {
structure.retrieve(this.slideToken,
- this.config.getFilesPath()+this.uri);
+ this.config.getFilesPath()+this.path);
} catch (SlideException e) {
return false;
}
@@ -393,7 +371,7 @@
*
* @return a stream to write to
*
- * @throws IOException
+ * @throws IOException
* @throws SourceException
*/
public OutputStream getOutputStream()
@@ -441,8 +419,7 @@
* A helper can the getOutputStream() method
*/
public class SlideSourceOutputStream extends ByteArrayOutputStream
- implements LogEnabled
- {
+ implements LogEnabled {
private boolean isClosed = false;
private Logger logger = null;
@@ -458,7 +435,7 @@
/**
*
*
- * @throws IOException
+ * @throws IOException
*/
public void close() throws IOException {
super.close();
@@ -474,7 +451,7 @@
if (revisionDescriptor==null) {
revisionDescriptor = new NodeRevisionDescriptor(0);
- String resourceName = config.getFilesPath()+uri;
+ String resourceName = config.getFilesPath()+path;
int lastSlash = resourceName.lastIndexOf('/');
if (lastSlash!=-1) {
@@ -489,19 +466,17 @@
revisionDescriptor.setLastModified(new Date());
nat.begin();
-
if (revisionNumber==null) {
- content.create(slideToken, config.getFilesPath()+uri,
+ content.create(slideToken, config.getFilesPath()+path,
revisionDescriptor, null);
}
- content.store(slideToken, config.getFilesPath()+uri,
+ content.store(slideToken, config.getFilesPath()+path,
revisionDescriptor, revisionContent);
-
try {
nat.commit();
} catch (Exception cme) {
- this.logger.warn("Could not commit the transaction.",
- cme);
+ throw new CascadingIOException("Could not commit the
transaction",
+ cme);
}
} catch (ObjectNotFoundException e) {
@@ -512,7 +487,7 @@
try {
// Creating an object
structure.create(slideToken, subject,
- config.getFilesPath()+uri);
+ config.getFilesPath()+path);
} catch (SlideException se) {
throw new CascadingIOException(se);
}
@@ -535,7 +510,7 @@
String contentType = null;
try {
- contentType = ((org.apache.cocoon.environment.Context)
context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT)).getMimeType(uri);
+ contentType = ((org.apache.cocoon.environment.Context)
context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT)).getMimeType(path);
} catch (ContextException ce) {
this.logger.warn("Could not get context to determine the
mime type.");
}
@@ -556,14 +531,15 @@
revisionContent.setContent(bytes);
try {
- content.create(slideToken, config.getFilesPath()+uri,
+ content.create(slideToken, config.getFilesPath()+path,
revisionDescriptor, revisionContent);
try {
nat.commit();
} catch (Exception cme) {
- this.logger.warn("Could not commit the transaction.",
- cme);
+ throw new CascadingIOException("Could not commit the
transaction",
+ cme);
+
}
} catch (SlideException se) {
@@ -574,21 +550,16 @@
rbe);
}
- this.logger.error("Could not create source", se);
- throw new CascadingIOException(se.getMessage(), se);
+ throw new CascadingIOException("Could not create source",
+ se);
}
} catch (Exception e) {
- this.logger.error("Could not create source", e);
- throw new CascadingIOException(e.getMessage(), e);
- } finally {
-
- try {
- nat.rollback();
- } catch (Exception rbe) {
- this.logger.warn("Could not rollback the transaction.",
- rbe);
+ if (e instanceof IOException) {
+ throw (IOException)e;
}
+ throw new CascadingIOException("Could not create source", e);
+ } finally {
this.isClosed = true;
}
@@ -610,7 +581,6 @@
* <p>
* After cancel, the stream should no more be used.
*
- * @throws SourceException If the ouput stream can't be cancelled.
*/
public void cancel() throws Exception {
if (this.isClosed) {
@@ -625,7 +595,8 @@
/**
* Move the current source to a specified destination.
*
- * @param destination Destination of the source.
+ *
+ * @param source
*
* @throws SourceException If an exception occurs during
* the move.
@@ -634,9 +605,9 @@
if (source instanceof SlideSource) {
try {
this.macro.move(slideToken,
- this.config.getFilesPath()+this.uri,
+ this.config.getFilesPath()+this.path,
this.config.getFilesPath()+
- ((SlideSource) source).uri);
+ ((SlideSource) source).path);
} catch (SlideException se) {
throw new SourceException("Could not move source.", se);
}
@@ -648,7 +619,8 @@
/**
* Copy the current source to a specified destination.
*
- * @param destination Destination of the source.
+ *
+ * @param source
*
* @throws SourceException If an exception occurs during
* the copy.
@@ -657,9 +629,9 @@
if (source instanceof SlideSource) {
try {
this.macro.copy(slideToken,
- this.config.getFilesPath()+this.uri,
+ this.config.getFilesPath()+this.path,
this.config.getFilesPath()+
- ((SlideSource) source).uri);
+ ((SlideSource) source).path);
} catch (SlideException se) {
throw new SourceException("Could not move source.", se);
}
@@ -676,7 +648,7 @@
public void delete() throws SourceException {
try {
this.macro.delete(slideToken,
- this.config.getFilesPath()+this.uri);
+ this.config.getFilesPath()+this.path);
} catch (SlideException se) {
throw new SourceException("Could not delete source.", se);
}
@@ -710,58 +682,6 @@
}
/**
- * Get the value of a parameter.
- * Using this it is possible to get custom information provided by the
- * source implementation, like an expires date, HTTP headers etc.
- *
- * @param name Name of the parameter.
- *
- * @return Value of the parameter.
- */
- public String getParameter(String name) {
- return null;
- }
-
- /**
- * Get the value of a parameter.
- * Using this it is possible to get custom information provided by the
- * source implementation, like an expires date, HTTP headers etc.
- *
- * @param name Name of the parameter.
- *
- * @return Value of the parameter a long.
- */
- public long getParameterAsLong(String name) {
- return 0;
- }
-
- /**
- * Get parameter names
- * Using this it is possible to get custom information provided by the
- * source implementation, like an expires date, HTTP headers etc.
- *
- * @return
- */
- public Iterator getParameterNames() {
- return new EmptyIterator();
- }
-
- class EmptyIterator implements Iterator
- {
-
- public boolean hasNext() {
- return false;
- }
-
- public Object next() {
- return null;
- }
-
- public void remove() {
- }
- }
-
- /**
* Tests whether a resource is a collection resource.
*
* @return true if the descriptor represents a collection, false
otherwise
@@ -798,7 +718,7 @@
int i = 0;
for (Enumeration children = structure.retrieve(this.slideToken,
- this.config.getFilesPath()+this.uri).enumerateChildren();
+ this.config.getFilesPath()+this.path).enumerateChildren();
children.hasMoreElements(); )
if (((String)
children.nextElement()).startsWith(this.config.getFilesPath())) {
i++;
@@ -824,7 +744,7 @@
String child;
for (Enumeration children = structure.retrieve(this.slideToken,
- this.config.getFilesPath()+this.uri).enumerateChildren();
+ this.config.getFilesPath()+this.path).enumerateChildren();
children.hasMoreElements(); ) {
child = (String) children.nextElement();
@@ -850,17 +770,17 @@
* @return System identifier of the parent source.
*/
public String getParentSource() {
- if ((this.uri==null) || (this.uri.length()<=1)) {
+ if ((this.path==null) || (this.path.length()<=1)) {
return null;
}
- if (this.uri.endsWith("/")) {
+ if (this.path.endsWith("/")) {
return scheme+":/"+
- this.uri.substring(0, this.uri.substring(0,
- this.uri.length()-1).lastIndexOf("/"));
+ this.path.substring(0, this.path.substring(0,
+ this.path.length()-1).lastIndexOf("/"));
}
- return scheme+":/"+this.uri.substring(0, this.uri.lastIndexOf("/"));
+ return scheme+":/"+this.path.substring(0,
this.path.lastIndexOf("/"));
}
/**
@@ -897,10 +817,10 @@
try {
structure.create(slideToken, collection,
- this.config.getFilesPath()+this.uri+"/"+
+ this.config.getFilesPath()+this.path+"/"+
collectionname);
content.create(slideToken,
- this.config.getFilesPath()+this.uri+"/"+
+ this.config.getFilesPath()+this.path+"/"+
collectionname, revisionDescriptor, null);
} catch (SlideException se) {
throw new SourceException("Could not create collection.", se);
@@ -1123,15 +1043,15 @@
boolean inheritable) throws SourceException {
try {
NodePermission permission = new
NodePermission(this.config.getFilesPath()+
- this.uri, subject, action,
- inheritable, negative);
+ this.path, subject, action,
+ inheritable,
negative);
this.security.grantPermission(this.slideToken, permission);
// Last modification date
revisionDescriptor.setLastModified(new Date());
- content.store(slideToken, this.config.getFilesPath()+this.uri,
+ content.store(slideToken, this.config.getFilesPath()+this.path,
revisionDescriptor, null);
} catch (SlideException se) {
@@ -1328,15 +1248,15 @@
throws SourceException {
try {
NodePermission permission = new
NodePermission(this.config.getFilesPath()+
- this.uri, subject, action,
- inheritable, negative);
+ this.path, subject, action,
+ inheritable,
negative);
this.security.revokePermission(this.slideToken, permission);
// Last modification date
revisionDescriptor.setLastModified(new Date());
- content.store(slideToken, this.config.getFilesPath()+this.uri,
+ content.store(slideToken, this.config.getFilesPath()+this.path,
revisionDescriptor, null);
} catch (SlideException se) {
@@ -1359,7 +1279,7 @@
ObjectNode current = structure.retrieve(this.slideToken,
this.config.getFilesPath()+
- this.uri);
+ this.path);
security.checkCredentials(this.slideToken, current,
config.getReadPermissionsAction());
@@ -1648,7 +1568,7 @@
NodeLock lock;
for (Enumeration locks =
this.lock.enumerateLocks(this.slideToken,
- this.config.getFilesPath()+this.uri, false);
+ this.config.getFilesPath()+this.path, false);
locks.hasMoreElements(); ) {
lock = (NodeLock) locks.nextElement();
@@ -1682,7 +1602,7 @@
// Last modification date
revisionDescriptor.setLastModified(new Date());
- content.store(slideToken, this.config.getFilesPath()+this.uri,
+ content.store(slideToken, this.config.getFilesPath()+this.path,
revisionDescriptor, null);
} catch (SlideException se) {
throw new SourceException("Could not set property", se);
@@ -1761,7 +1681,7 @@
revisionDescriptor.setLastModified(new Date());
content.store(slideToken,
- this.config.getFilesPath()+this.uri,
+ this.config.getFilesPath()+this.path,
revisionDescriptor, null);
}
} catch (SlideException se) {
@@ -1780,7 +1700,7 @@
try {
this.revisionDescriptors = content.retrieve(this.slideToken,
this.config.getFilesPath()+
- this.uri);
+ this.path);
return this.revisionDescriptors.hasRevisions();
@@ -1815,7 +1735,7 @@
try {
this.revisionDescriptors = content.retrieve(this.slideToken,
this.config.getFilesPath()+
- this.uri);
+ this.path);
// Retrieve revision descriptor by the revision
this.revisionDescriptor = content.retrieve(slideToken,
@@ -1864,7 +1784,7 @@
try {
this.revisionDescriptors = content.retrieve(this.slideToken,
this.config.getFilesPath()+
- this.uri);
+ this.path);
return this.revisionDescriptors.getLatestRevision().toString();
@@ -1872,15 +1792,6 @@
throw new SourceException("Could not retrieve revision
descriptor",
se);
}
- }
-
- /**
- * @see org.apache.excalibur.source.Source#getProtocol()
- *
- * @return Scheme of the source.
- */
- public String getScheme() {
- return this.scheme;
}
}
1.8 +146 -126
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSourceFactory.java
Index: SlideSourceFactory.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSourceFactory.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SlideSourceFactory.java 30 Jan 2003 08:37:34 -0000 1.7
+++ SlideSourceFactory.java 30 Jan 2003 20:01:08 -0000 1.8
@@ -1,57 +1,53 @@
/*
- * The Apache Software License, Version 1.1
- *
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, 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 (INCLUDING, 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. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
+
+ ============================================================================
+ 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.source.impl;
@@ -72,6 +68,7 @@
import org.apache.cocoon.components.repository.Repository;
import org.apache.cocoon.components.repository.impl.SlideRepository;
+import org.apache.cocoon.components.source.SourceUtil;
import org.apache.cocoon.components.source.helpers.SourceCredential;
import org.apache.excalibur.source.Source;
@@ -79,8 +76,10 @@
import org.apache.excalibur.source.SourceFactory;
import org.apache.excalibur.source.SourceParameters;
+import org.apache.slide.common.NamespaceAccessToken;
+
/**
- * A factory for sources from a Jakarta SLide repository.
+ * A factory for sources from a Jakarta Slide repository.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id$
@@ -90,108 +89,126 @@
/** The component manager instance */
private ComponentManager manager = null;
- private Context context;
+ private Context context;
/**
* Set the current <code>ComponentManager</code> instance used by this
* <code>Composable</code>.
+ *
+ * @param manager Component manager.
*/
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
-
/**
* Get a <code>Source</code> object.
+ *
+ * @param uri URI of the source.
* @param parameters This is optional.
+ *
+ * @return A new source object.
*/
- public Source getSource(String location, Map parameters)
- throws MalformedURLException, IOException, SourceException {
- if ((this.getLogger()!=null) && (this.getLogger().isDebugEnabled()))
{
- this.getLogger().debug( "Creating source object for " + location
);
- }
-
- String protocol = "slide";
- int position = location.indexOf("://");
- if (position >= 0) {
- protocol = location.substring(0, position);
- position += 3;
- } else
- position = 0;
-
- // create the queryString (if available)
- String queryString = null;
- SourceParameters locationParameters = null;
- int queryStringPos = location.indexOf('?');
- if (queryStringPos != -1) {
- queryString = location.substring(queryStringPos + 1);
- location = location.substring(position-1, queryStringPos);
- locationParameters = new SourceParameters(queryString);
-
- } else if (position > 0) {
- location = location.substring(position-1);
- locationParameters = new SourceParameters();
- }
-
- if ((this.getLogger()!=null) && (this.getLogger().isDebugEnabled()))
- this.getLogger().debug( "Location is " + location + " QueryString
is " + queryString);
- this.getLogger().debug( "Source parameters: " +
locationParameters.toString());
-
- String repositoryname =
locationParameters.getParameter("cocoon-repository", null);
- String namespace =
locationParameters.getParameter("cocoon-repository-namespace", null);
- String principal =
locationParameters.getParameter("cocoon-source-principal", "guest");
- String password =
locationParameters.getParameter("cocoon-source-password", null);
- String revision =
locationParameters.getParameter("cocoon-source-revision", null);
- String branch =
locationParameters.getParameter("cocoon-source-branch", null);
+ public Source getSource(String uri,
+ Map parameters)
+ throws MalformedURLException, IOException,
+ SourceException {
+ this.getLogger().debug("Creating source object for '"+uri+"'");
+
+ String scheme = SourceUtil.getScheme(uri);
+
+ String path = SourceUtil.getPathWithoutAuthority(uri);
+
+ if ((path==null) || (path.length()==0)) {
+ path = "/";
+ } else if ( !path.startsWith("/")) {
+ path = "/"+path;
+ }
+
+ String query = SourceUtil.getQuery(uri);
+ SourceParameters queryParameters = null;
+
+ if ((query==null) || (query.length()==0)) {
+ queryParameters = new SourceParameters();
+ } else {
+ queryParameters = new SourceParameters(query);
+ }
+
+ this.getLogger().debug("Path is "+path);
+ this.getLogger().debug("Query is "+query);
+ this.getLogger().debug("Source parameters: "+
+ queryParameters.toString());
+
+ String repositoryname =
queryParameters.getParameter("cocoon-repository",
+ null);
+ String namespace =
queryParameters.getParameter("cocoon-repository-namespace",
+ null);
+ String principal =
queryParameters.getParameter("cocoon-source-principal",
+ "guest");
+ String password =
queryParameters.getParameter("cocoon-source-password",
+ null);
+ String revision =
queryParameters.getParameter("cocoon-source-revision",
+ null);
+ String branch = queryParameters.getParameter("cocoon-source-branch",
+ null);
getLogger().debug("Used prinical '"+principal+"' for source");
SourceCredential credential;
- if (password!=null)
+
+ if (password!=null) {
credential = new SourceCredential(principal, password);
- else
+ } else {
credential = new SourceCredential(principal);
+ }
- if (location.length()==0)
- location = "/";
+ if (path.length()==0) {
+ path = "/";
+ }
ComponentSelector repositories = null;
Repository repository = null;
+
try {
- repositories =
(ComponentSelector)this.manager.lookup(Repository.ROLE+"Selector");
+ repositories = (ComponentSelector)
this.manager.lookup(Repository.ROLE+
+ "Selector");
- repository = (Repository)repositories.select(repositoryname);
+ repository = (Repository) repositories.select(repositoryname);
- if (!(repository instanceof SlideRepository)) {
- getLogger().error("Can't get Slide repository");
+ if ( !(repository instanceof SlideRepository)) {
+ getLogger().error("Can't get Slide repository");
return null;
}
- SlideRepository sliderepository =
- (SlideRepository)repository;
+ SlideRepository sliderepository = (SlideRepository) repository;
- if (namespace==null)
- namespace =
sliderepository.getDomain().getDefaultNamespace();
+ NamespaceAccessToken nat =
sliderepository.getNamespaceToken(namespace);
+
+ if (nat==null) {
+ throw new SourceException("Repository with the namespace '"+
+ namespace+"' couldn't be found");
+ }
- if
(sliderepository.getDomain().getNamespaceToken(namespace)==null)
- throw new SourceException("Repository with the namespace
'"+namespace+"' couldn't be found");
+ SlideSource source = new SlideSource(nat, scheme, path,
+ credential, revision,
+ branch);
- SlideSource source = new
SlideSource(sliderepository.getDomain().getNamespaceToken(namespace),
- protocol, location, credential, revision,
branch);
+ source.enableLogging(getLogger());
source.contextualize(this.context);
- source.compose(this.manager);
-
+
return source;
} catch (ComponentException ce) {
getLogger().error("Could not lookup for component.", ce);
} finally {
- if ((repository!=null) && (repository instanceof Component))
- repositories.release((Component)repository);
+ if ((repository!=null) && (repository instanceof Component)) {
+ repositories.release((Component) repository);
+ }
repository = null;
- if (repositories!=null)
+ if (repositories!=null) {
this.manager.release(repositories);
+ }
repositories = null;
}
@@ -200,21 +217,24 @@
/**
* Release a [EMAIL PROTECTED] Source} object.
+ *
+ * @param source Source, which should be released.
*/
- public void release( Source source ) {
- if ( null != source ) {
- if ( this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("Releasing source " +
source.getURI());
- }
+ public void release(Source source) {
+ if (null!=source) {
+ this.getLogger().debug("Releasing source "+source.getURI());
// simply do nothing
}
}
- /**
- * @see
org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
- */
- public void contextualize(Context context) throws ContextException {
+
+ /**
+ * @see
org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+ *
+ * @param context The context.
+ */
+ public void contextualize(Context context) throws ContextException {
this.context = context;
- }
+ }
}
1.19 +33 -46
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java
Index: SourceDescriptionGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/SourceDescriptionGenerator.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- SourceDescriptionGenerator.java 30 Jan 2003 08:37:36 -0000 1.18
+++ SourceDescriptionGenerator.java 30 Jan 2003 20:01:08 -0000 1.19
@@ -9,7 +9,7 @@
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,
+ 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,
@@ -17,12 +17,12 @@
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
+ 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
+ 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]
@@ -33,7 +33,7 @@
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
+ 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
@@ -91,8 +91,7 @@
* @version CVS $Id$
*/
public class SourceDescriptionGenerator extends ComposerGenerator
- implements CacheableProcessingComponent, Recyclable
-{
+ implements CacheableProcessingComponent, Recyclable {
/** Namespace of the source description. */
private static final String SOURCE_NS =
"http://xml.apache.org/cocoon/source/2.0";
@@ -105,7 +104,7 @@
SOURCE_NODE_NAME;
private static final String NAME_ATTR_NAME = "name";
- private static final String SYSTEMID_ATTR_NAME = "systemid";
+ private static final String URI_ATTR_NAME = "uri";
private static final String MIMETYPE_ATTR_NAME = "mime-type";
private static final String CONTENTLENGTH_ATTR_NAME = "contentlength";
private static final String LASTMODIFIED_ATTR_NAME = "lastmodified";
@@ -175,11 +174,7 @@
* @param resolver Source Resolver
* @param objectModel Object model.
* @param location Location of the source.
- * @param parameters Parameters for the generator.
- *
- * @throws IOException If an IO exception occurs.
- * @throws ProcessingException If an exception occurs, during the
processing.
- * @throws SAXException If a SAX exception occurs.
+ * @param parameters Parameters for the generator.
*/
public void setup(SourceResolver resolver, Map objectModel,
String location,
@@ -264,14 +259,20 @@
* @param uri Uri of the source.
* @param deep Deep of the hirachy, which should traversed.
*/
- private void collectSources(Hashtable sources, String uri, int deep) {
+ private void collectSources(Hashtable sources, String uri,
+ int deep) throws ProcessingException {
Source source = null;
try {
source = this.resolver.resolveURI(uri+this.queryString);
} catch (Exception e) {
- getLogger().warn("Could not retrieve source with the id '"+uri+
- "'", e);
+ if (sources.isEmpty()) {
+ throw new ProcessingException("Could not retrieve source
with the uri '"+
+ uri+"'", e);
+ }
+
+ getLogger().debug("Could not retrieve source with the uri '"+uri+
+ "'", e);
return;
}
@@ -296,10 +297,6 @@
/**
* Generate XML data.
- *
- * @throws IOException If an IO exception occurs.
- * @throws ProcessingException If an exception occurs, during the
processing.
- * @throws SAXException If a SAX exception occurs.
*/
public void generate()
throws IOException, SAXException, ProcessingException {
@@ -308,6 +305,10 @@
this.contentHandler.startDocument();
this.contentHandler.startPrefixMapping(SOURCE_PREFIX, SOURCE_NS);
+ if (((Source) this.cachedsources.get(this.source))==null) {
+ throw new ProcessingException("Could not retrieve source
with the uri '"+
+ this.source+"'");
+ }
pushSourceDescription(this.source, this.deep);
this.contentHandler.endPrefixMapping(SOURCE_PREFIX);
@@ -321,29 +322,27 @@
/**
* Push a XML description of specified source.
*
- * @param systemid System identifier of the source.
+ * @param uri Uniform resource identifier of the source.
* @param deep Deep of the hirachy, which should traversed.
- *
- * @throws IOException If an IO exception occurs.
- * @throws ProcessingException If an exception occurs, during the
processing.
- * @throws SAXException If a SAX exception occurs.
- * @throws SourceException If a source exception occurs.
*/
- private void pushSourceDescription(String systemid,
+ private void pushSourceDescription(String uri,
int deep)
throws SAXException,
SourceException,
ProcessingException,
IOException {
- Source source = (Source) this.cachedsources.get(systemid);
+ Source source = (Source) this.cachedsources.get(uri);
+
+ if (source==null) {
+ return;
+ }
try {
AttributesImpl attributes = new AttributesImpl();
- attributes.addAttribute(SOURCE_NS, SYSTEMID_ATTR_NAME,
- SYSTEMID_ATTR_NAME, "CDATA",
- source.getURI());
+ attributes.addAttribute(SOURCE_NS, URI_ATTR_NAME, URI_ATTR_NAME,
+ "CDATA", source.getURI());
String name = source.getURI();
@@ -489,10 +488,7 @@
* Push a XML description about all properties, which
* the source owns.
*
- * @param source Source.
- *
- * @throws SAXException If a SAX exception occurs.
- * @throws SourceException If a source exception occurs.
+ * @param source Source.
*/
private void pushLiveSourceProperties(InspectableSource source)
throws SAXException, SourceException {
@@ -526,9 +522,6 @@
* were computed by source inspectors.
*
* @param source Source
- *
- * @throws SAXException If a SAX exception occurs.
- * @throws SourceException If a source exception occurs.
*/
private void pushComputedSourceProperties(Source source)
throws SAXException, SourceException {
@@ -573,9 +566,6 @@
* Push a XML description of all permissions of a source.
*
* @param source Source
- *
- * @throws SAXException If a SAX exception occurs.
- * @throws SourceException If a source exception occurs.
*/
private void pushSourcePermissions(RestrictableSource source)
throws SAXException, SourceException {
@@ -628,9 +618,6 @@
* Push a XML description about all locks of a source.
*
* @param source Source
- *
- * @throws SAXException If a SAX exception occurs.
- * @throws SourceException If a source exception occurs.
*/
public void pushSourceLocks(LockableSource source)
throws SAXException, SourceException {
1.7 +14 -14
xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4content.xsl
Index: description2html4content.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4content.xsl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- description2html4content.xsl 30 Aug 2002 08:08:10 -0000 1.6
+++ description2html4content.xsl 30 Jan 2003 20:01:08 -0000 1.7
@@ -24,24 +24,24 @@
<table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2"
align="center" width="100%">
<tr>
<td width="90%" align="left" bgcolor="#0086b2"><font size="+1"
face="arial,helvetica,sanserif"
- color="#ffffff"><xsl:value-of
select="source:source/@source:systemid"/></font></td>
+ color="#ffffff"><xsl:value-of
select="source:source/@source:uri"/></font></td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/users/">
<i>users</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/content/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/content/{substring-after(source:source/@source:uri,'://')}">
<i>content</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/properties/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/properties/{substring-after(source:source/@source:uri,'://')}">
<i>properties</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/permissions/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/permissions/{substring-after(source:source/@source:uri,'://')}">
<i>permissions</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/locks/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/locks/{substring-after(source:source/@source:uri,'://')}">
<i>locks</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/logout.html">
@@ -98,7 +98,7 @@
<tr>
<td width="100%" bgcolor="#ffffff" align="left">
<font size="+0" face="arial,helvetica,sanserif"
color="#000000">
- <a
href="/cocoon/samples/slide/content/{substring-after(@source:systemid,'://')}"
+ <a
href="/cocoon/samples/slide/content/{substring-after(@source:uri,'://')}"
><xsl:value-of select="@source:name"/></a>
</font>
</td>
@@ -147,7 +147,7 @@
<xsl:for-each select="source:children/source:source">
<tr>
<td align="left">  
- <a
href="/cocoon/samples/slide/content/{substring-after(@source:systemid,'://')}"
+ <a
href="/cocoon/samples/slide/content/{substring-after(@source:uri,'://')}"
><xsl:value-of select="@source:name"/></a>
</td>
<td align="left"><xsl:value-of
@@ -159,7 +159,7 @@
<td align="right">
<form action="" method="post">
<input type="hidden" name="method"
value="doDeleteSource"/>
- <input type="hidden" name="cocoon-source-uri"
value="[EMAIL PROTECTED]:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri"
value="[EMAIL PROTECTED]:uri}"/>
<input type="submit" name="cocoon-action-deletesource"
value="Delete"/>
</form>
</td>
@@ -169,7 +169,7 @@
<tr>
<form action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="method" value="doUploadSource"/>
- <input type="hidden" name="cocoon-source-uri"
value="[EMAIL PROTECTED]:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri"
value="[EMAIL PROTECTED]:uri}"/>
<td align="left">
<input type="text" name="cocoon-source-name" size="15"
maxlength="40"/>(optional)
</td>
@@ -186,7 +186,7 @@
<tr>
<form action="" method="post">
<input type="hidden" name="method"
value="doCreateCollection"/>
- <input type="hidden" name="cocoon-source-uri"
value="[EMAIL PROTECTED]:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri"
value="[EMAIL PROTECTED]:uri}"/>
<td align="left" colspan="4">
<input type="text" name="cocoon-source-name" size="15"
maxlength="40"/>
</td>
@@ -200,22 +200,22 @@
</xsl:when>
<xsl:when test="@source:mime-type='image/gif'">
- <img
src="/cocoon/samples/slide/view/{substring-after(@source:systemid,'://')}"/>
+ <img
src="/cocoon/samples/slide/view/{substring-after(@source:uri,'://')}"/>
</xsl:when>
<xsl:when test="@source:mime-type='image/jpeg'">
- <img
src="/cocoon/samples/slide/view/{substring-after(@source:systemid,'://')}"/>
+ <img
src="/cocoon/samples/slide/view/{substring-after(@source:uri,'://')}"/>
</xsl:when>
<xsl:when test="@source:mime-type='text/plain'">
<pre>
- <xi:include href="[EMAIL PROTECTED]:systemid}" parse="text"/>
+ <xi:include href="[EMAIL PROTECTED]:uri}" parse="text"/>
</pre>
</xsl:when>
<xsl:when test="@source:mime-type='text/xml'">
<pre>
- <xi:include href="[EMAIL PROTECTED]:systemid}" parse="text"/>
+ <xi:include href="[EMAIL PROTECTED]:uri}" parse="text"/>
</pre>
</xsl:when>
1.4 +8 -8
xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4locks.xsl
Index: description2html4locks.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4locks.xsl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- description2html4locks.xsl 19 Aug 2002 08:08:11 -0000 1.3
+++ description2html4locks.xsl 30 Jan 2003 20:01:08 -0000 1.4
@@ -23,24 +23,24 @@
<table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2"
align="center" width="100%">
<tr>
<td width="90%" align="left" bgcolor="#0086b2"><font size="+1"
face="arial,helvetica,sanserif"
- color="#ffffff"><xsl:value-of
select="source:source/@source:systemid"/></font></td>
+ color="#ffffff"><xsl:value-of
select="source:source/@source:uri"/></font></td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/users/">
<i>users</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/content/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/content/{substring-after(source:source/@source:uri,'://')}">
<i>content</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/properties/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/properties/{substring-after(source:source/@source:uri,'://')}">
<i>properties</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/permissions/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/permissions/{substring-after(source:source/@source:uri,'://')}">
<i>permissions</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/locks/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/locks/{substring-after(source:source/@source:uri,'://')}">
<i>locks</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/logout.html">
@@ -97,7 +97,7 @@
<tr>
<td width="100%" bgcolor="#ffffff" align="left">
<font size="+0" face="arial,helvetica,sanserif"
color="#000000">
- <a
href="/cocoon/samples/slide/locks/{substring-after(@source:systemid,'://')}"
+ <a
href="/cocoon/samples/slide/locks/{substring-after(@source:uri,'://')}"
><xsl:value-of select="@source:name"/></a>
</font>
</td>
@@ -150,7 +150,7 @@
<td align="right">
<form action="" method="post">
<input type="hidden" name="method" value="doDeleteLock"/>
- <input type="hidden" name="cocoon-source-uri"
value="{../../@source:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri"
value="{../../@source:uri}"/>
<input type="hidden" name="cocoon-lock-subject"
value="[EMAIL PROTECTED]"/>
<input type="submit" name="cocoon-action-deletelock"
value="Delete"/>
@@ -162,7 +162,7 @@
<tr>
<form action="" method="post">
<input type="hidden" name="method" value="doAddLock"/>
- <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:uri}"/>
<td align="left">
<input name="cocoon-lock-subject" type="text" size="20"
maxlength="40"/>
</td>
1.6 +10 -10
xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4permissions.xsl
Index: description2html4permissions.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4permissions.xsl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- description2html4permissions.xsl 19 Aug 2002 14:06:50 -0000 1.5
+++ description2html4permissions.xsl 30 Jan 2003 20:01:08 -0000 1.6
@@ -24,24 +24,24 @@
<table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2"
align="center" width="100%">
<tr>
<td width="90%" align="left" bgcolor="#0086b2"><font size="+1"
face="arial,helvetica,sanserif"
- color="#ffffff"><xsl:value-of
select="document/source:source/@source:systemid"/></font></td>
+ color="#ffffff"><xsl:value-of
select="document/source:source/@source:uri"/></font></td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/users/">
<i>users</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/content/{substring-after(document/source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/content/{substring-after(document/source:source/@source:uri,'://')}">
<i>content</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/properties/{substring-after(document/source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/properties/{substring-after(document/source:source/@source:uri,'://')}">
<i>properties</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/permissions/{substring-after(document/source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/permissions/{substring-after(document/source:source/@source:uri,'://')}">
<i>permissions</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/locks/{substring-after(document/source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/locks/{substring-after(document/source:source/@source:uri,'://')}">
<i>locks</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/logout.html">
@@ -98,7 +98,7 @@
<tr>
<td width="100%" bgcolor="#ffffff" align="left">
<font size="+0" face="arial,helvetica,sanserif"
color="#000000">
- <a
href="/cocoon/samples/slide/permissions/{substring-after(@source:systemid,'://')}"
+ <a
href="/cocoon/samples/slide/permissions/{substring-after(@source:uri,'://')}"
><xsl:value-of select="@source:name"/></a>
</font>
</td>
@@ -149,7 +149,7 @@
<td align="right">
<form action="" method="post">
<input type="hidden" name="method"
value="doRemovePrincipalPermission"/>
- <input type="hidden" name="cocoon-source-uri"
value="{../../@source:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri"
value="{../../@source:uri}"/>
<input type="hidden"
name="cocoon-source-permission-principal" value="[EMAIL PROTECTED]"/>
<input type="hidden"
name="cocoon-source-permission-privilege" value="[EMAIL PROTECTED]"/>
<input type="hidden"
name="cocoon-source-permission-inheritable" value="[EMAIL PROTECTED]"/>
@@ -164,7 +164,7 @@
<tr>
<form action="" method="post">
<input type="hidden" name="method"
value="doAddPrincipalPermission"/>
- <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:uri}"/>
<td align="left">
<select name="cocoon-source-permission-principal">
<option>ALL</option>
@@ -259,7 +259,7 @@
<td align="right">
<form action="" method="post">
<input type="hidden" name="method"
value="doRemovePrincipalGroupPermission"/>
- <input type="hidden" name="cocoon-source-uri"
value="{../../@source:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri"
value="{../../@source:uri}"/>
<input type="hidden"
name="cocoon-source-permission-principal-group" value="[EMAIL PROTECTED]"/>
<input type="hidden"
name="cocoon-source-permission-privilege" value="[EMAIL PROTECTED]"/>
<input type="hidden"
name="cocoon-source-permission-inheritable" value="[EMAIL PROTECTED]"/>
@@ -274,7 +274,7 @@
<tr>
<form action="" method="post">
<input type="hidden" name="method"
value="doAddPrincipalGroupPermission"/>
- <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:uri}"/>
<td align="left">
<select name="cocoon-source-permission-principal-group">
<xsl:for-each select="/document/pl:list/pl:group">
1.5 +8 -8
xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4properties.xsl
Index: description2html4properties.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/description2html4properties.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- description2html4properties.xsl 19 Aug 2002 11:55:12 -0000 1.4
+++ description2html4properties.xsl 30 Jan 2003 20:01:08 -0000 1.5
@@ -23,24 +23,24 @@
<table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2"
align="center" width="100%">
<tr>
<td width="90%" align="left" bgcolor="#0086b2"><font size="+1"
face="arial,helvetica,sanserif"
- color="#ffffff"><xsl:value-of
select="source:source/@source:systemid"/></font></td>
+ color="#ffffff"><xsl:value-of
select="source:source/@source:uri"/></font></td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/users/">
<i>users</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/content/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/content/{substring-after(source:source/@source:uri,'://')}">
<i>content</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/properties/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/properties/{substring-after(source:source/@source:uri,'://')}">
<i>properties</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/permissions/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/permissions/{substring-after(source:source/@source:uri,'://')}">
<i>permissions</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
-
href="/cocoon/samples/slide/locks/{substring-after(source:source/@source:systemid,'://')}">
+
href="/cocoon/samples/slide/locks/{substring-after(source:source/@source:uri,'://')}">
<i>locks</i></a>
</td>
<td nowrap="nowrap" bgcolor="#ffffff"><a
href="/cocoon/samples/slide/logout.html">
@@ -97,7 +97,7 @@
<tr>
<td width="100%" bgcolor="#ffffff" align="left">
<font size="+0" face="arial,helvetica,sanserif"
color="#000000">
- <a
href="/cocoon/samples/slide/properties/{substring-after(@source:systemid,'://')}"
+ <a
href="/cocoon/samples/slide/properties/{substring-after(@source:uri,'://')}"
><xsl:value-of select="@source:name"/></a>
</font>
</td>
@@ -151,7 +151,7 @@
<xsl:if test="namespace-uri()!='DAV:' and
../@source:type='live'">
<form action="" method="post">
<input type="hidden" name="method"
value="doDeleteProperty"/>
- <input type="hidden" name="cocoon-source-uri"
value="{../../@source:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri"
value="{../../@source:uri}"/>
<input type="hidden"
name="cocoon-source-property-namespace" value="{namespace-uri()}"/>
<input type="hidden" name="cocoon-source-property-name"
value="{local-name()}"/>
@@ -165,7 +165,7 @@
<tr>
<form action="" method="post">
<input type="hidden" name="method" value="doAddProperty"/>
- <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:systemid}"/>
+ <input type="hidden" name="cocoon-source-uri" value="[EMAIL
PROTECTED]:uri}"/>
<td align="left">
<input name="cocoon-source-property-namespace" type="text"
size="15" maxlength="40"/>
</td>
1.12 +85 -1
xml-cocoon2/src/scratchpad/webapp/samples/slide/slide.xconf
Index: slide.xconf
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/slide.xconf,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- slide.xconf 30 Aug 2002 08:00:34 -0000 1.11
+++ slide.xconf 30 Jan 2003 20:01:08 -0000 1.12
@@ -1,5 +1,23 @@
<?xml version="1.0"?>
-<slide default="myrepository">
+<slide logger="org.apache.slide.util.logger.SimpleLogger" logger-level="6"
default="myrepository">
+ <!--
+ logger
+ ~~~~~~
+ org.apache.slide.util.logger.SimpleLogger
+ default logger with 1 log level
+ log4j.Log4jLogger
+ logger with fine granularity
+ see http://jakarta.apache.org/log4j/
+
+ logger-level
+ ~~~~~~~~~~~~
+ 0 EMERGENCY
+ 1 CRITICAL
+ 2 ERROR
+ 4 WARNING
+ 6 INFO
+ 7 DEBUG
+ -->
<namespace name="myrepository">
@@ -292,4 +310,70 @@
</objectnode>
</data>
</namespace>
+
+ <!--
+ DeltaV global parameters
+ ========================
+ * historypath (mandatory=no, default="/history"):
+ Specifies a Slide path which determines the location where this DeltaV
+ server stores history data.
+
+ * workspacepath (mandatory=no, default="/workspace"):
+ Specifies a Slide path which determines the location where this DeltaV
+ server allows workspaces to reside.
+
+ * workingresourcepath (mandatory=no, default="/workingresource"):
+ Specifies a Slide path which determines the location where this DeltaV
+ server stores working resources.
+
+ * auto-version (mandatory=no, default="checkout-checkin"):
+ Controls the DeltaV auto-version behaviour.
+
+ * auto-version-control (mandatory=no, default="false"):
+ Indicates if a resource just created by a PUT should be set under
+ version-control.
+
+ * versioncontrol-exclude (mandatory=no, default=""):
+ Specifies a Slide path which determines resources which are excluded from
version-control.
+ The default value "" makes no path being excluded.
+
+ * checkout-fork (mandatory=no, default="forbidden"):
+ Controls the DeltaV check-out behaviour when a version is already
+ checked-out or has a successor.
+
+ * checkin-fork (mandatory=no, default="forbidden"):
+ Controls the DeltaV check-out behaviour when a version has already a
+ successor.
+
+ * standardLivePropertiesClass (mandatory=no,
+
default="org.apache.slide.webdav.util.resourcekind.AbstractResourceKind"):
+ Determines the "agent" knowing about what the standard live properties
are.
+ It should be a loadable class containing the following static methods:
+ - boolean isLiveProperty(String propName)
+ - boolean isProtectedProperty(String propName)
+ - boolean isComputedProperty(String propName)
+ - Set getAllLiveProperties()
+ - Set getAllProtectedProperties()
+ - Set getAllComputedProperties()
+
+ * uriRedirectorClass (mandatory=no,
+ default="org.apache.slide.webdav.util.DeltavUriRedirector"):
+ Determines the URI redirector class. The DeltaV URI redirector is in
+ charge of the following redirections:
+ - version URI to history URI, e.g. /history/2/1.4 to /history/2
+ - latest revision number for history resource to 0.0
+ - latest revision number for version resource to last URI token,
+ e.g. /history/2/1.4 to 1.4
+ It should be a loadable class containing the following static methods:
+ - String redirectUri(String uri)
+ - NodeRevisionNumber redirectLatestRevisionNumber(String uri)
+ -->
+ <parameter name="historypath">/history</parameter>
+ <parameter name="workspacepath">/workspace</parameter>
+ <parameter name="workingresourcepath">/workingresource</parameter>
+ <parameter name="auto-version">checkout-checkin</parameter>
+ <parameter name="auto-version-control">false</parameter>
+ <parameter name="versioncontrol-exclude"></parameter>
+ <parameter name="checkout-fork">forbidden</parameter>
+ <parameter name="checkin-fork">forbidden</parameter>
</slide>
1.3 +147 -26 xml-cocoon2/src/scratchpad/webapp/samples/slide/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/web.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- web.xml 27 Sep 2002 16:27:38 -0000 1.2
+++ web.xml 30 Jan 2003 20:01:08 -0000 1.3
@@ -23,7 +23,6 @@
use the following servlet-class instead of the normal one
<servlet-class>org.apache.cocoon.servlet.ParanoidCocoonServlet</servlet-class>
-
-->
<servlet-class>org.apache.cocoon.servlet.CocoonServlet</servlet-class>
@@ -38,10 +37,9 @@
</init-param>
<!--
- This parameter tells cocoon to load all the required libraries into
- it's own classloader instead of trusting the Servlet Vendor's
- classloader. If you experience strange classloader issues,
- try setting this parameter to "true".
+ This parameter tells cocoon to set the thread's context classloader to
+ its own classloader. If you experience strange classloader issues,
+ try setting this parameter to "true" or using ParanoidCocoonServlet.
-->
<init-param>
<param-name>init-classloader</param-name>
@@ -119,6 +117,15 @@
<!-- For Database Driver: -->
org.hsqldb.jdbcDriver
+ <!-- For PostgeSQL Database:
+ org.postgresql.Driver -->
+
+ <!-- For Oracle Database:
+ oracle.jdbc.driver.OracleDriver -->
+
+ <!-- ODBC
+ sun.jdbc.odbc.JdbcOdbcDriver -->
+
<!-- For parent ComponentManager sample:
org.apache.cocoon.samples.parentcm.Configurator
-->
@@ -126,38 +133,74 @@
</init-param>
<!--
- This parameter allows to specify where Cocoon should put files
- which are uploaded by the upload.xsp sample. The path specified
- is always relative to the context path of the servlet.
+ This parameter allows to specify where Cocoon should put uploaded
files.
+ The path specified can be either absolute or relative to the context
+ path of the servlet. On windows platform, absolute directory must start
+ with volume: C:\Path\To\Upload\Directory
+
The default directory is "upload-dir" in the work-directory
<init-param>
<param-name>upload-directory</param-name>
- <param-value>/WEB-INF/work/upload-dir</param-value>
+ <param-value>WEB-INF/work/upload-dir</param-value>
</init-param>
-->
<!--
- This parameter allows to specify where Cocoon should put files
- which are cached by the storing class. The path specified
- is always relative to the context path of the servlet.
+ Causes all files in multipart requests to be saved to upload-dir.
+ Default is true. Unsupported values will be interpreted as false.
+ -->
+ <init-param>
+ <param-name>autosave-uploads</param-name>
+ <param-value>false</param-value>
+ </init-param>
+
+ <!--
+ Specify handling of name conflicts when saving uploaded files
+ to disk. Acceptable values are deny, allow, rename (default).
+ Files are renamed x_filename where x is an integer value incremented
+ to make the new filename unique.
+ -->
+ <init-param>
+ <param-name>overwrite-uploads</param-name>
+ <param-value>rename</param-value>
+ </init-param>
+
+ <!--
+ Specify maximum allowed size of the upload. Defaults to 10 Mb.
+
+ <init-param>
+ <param-name>upload-max-size</param-name>
+ <param-value>10000000</param-value>
+ </init-param>
+ -->
+
+ <!--
+ This parameter allows to specify where Cocoon should create its page
+ and other objects cache. The path specified can be either absolute or
+ relative to the context path of the servlet. On windows platform,
+ absolute directory must start with volume: C:\Path\To\Cache\Directory
+
The default directory is "cache-dir" in the work-directory
<init-param>
<param-name>cache-directory</param-name>
- <param-value>/WEB-INF/work/cache-dir</param-value>
+ <param-value>WEB-INF/work/cache-dir</param-value>
</init-param>
-->
<!--
This parameter allows to specify where Cocoon should put it's
- working files. The path specified is always relative to the
- context path of the Cocoon servlet.
- Usually it is obtained from the servlet engine.
+ working files. The path specified is either absolute or relative
+ to the context path of the Cocoon servlet. On windows platform,
+ absolute directory must start with volume: C:\Path\To\Work\Directory
+
+ The default directory is "cocoon-files" directory in the servlet
+ context's temp directory (context property
javax.servlet.context.tempdir).
<init-param>
<param-name>work-directory</param-name>
- <param-value>/WEB-INF/work</param-value>
+ <param-value>WEB-INF/work</param-value>
</init-param>
-->
@@ -194,9 +237,15 @@
-->
<!--
- This parameter allows you to select the request factory. Possible
choices are as follows:
- - org.apache.cocoon.components.request.MultipartRequestFactoryImpl
- -
org.apache.cocoon.components.request.MaybeUploadRequestFactoryImpl
+ This parameter allows you to select the request factory. Possible
+ choices are as follows:
+ - org.apache.cocoon.components.request.MultipartRequestFactoryImpl
+ This is the default factory.
+ - org.apache.cocoon.components.request.MaybeUploadRequestFactoryImpl
+ You can opt in for this factory if maybeupload.jar is
+ present.
+ - org.apache.cocoon.components.request.SimpleRequestFactoryImpl
+ This factory does not allow uploads.
-->
<init-param>
<param-name>request-factory</param-name>
@@ -215,6 +264,55 @@
-->
<!--
+ If true or not set, this class will try to catch and handle all
Cocoon exceptions.
+ If false, it will rethrow them to the servlet container.
+ -->
+ <init-param>
+ <param-name>manage-exceptions</param-name>
+ <param-value>true</param-value>
+ </init-param>
+
+ <!--
+ If true, Avalon Excalibur instrumentation will be enabled on all
Instrumentable
+ components with Cocoon and your Cocoon application.
+
+ <init-param>
+ <param-name>enable-instrumentation</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ -->
+
+ <!--
+ This defines the location of the instrument manager configuration,
only used
+ if the init-param enable-instrumentation is enabled.
+
+ <init-param>
+ <param-name>instrumentation-config</param-name>
+ <param-value>/WEB-INF/instrumentation.xconf</param-value>
+ </init-param>
+ -->
+
+ <!--
+ Set encoding used by the container. If not set the ISO-8859-1 encoding
will be assumed.
+ -->
+ <!--
+ <init-param>
+ <param-name>container-encoding</param-name>
+ <param-value>utf-8</param-value>
+ </init-param>
+ -->
+
+ <!--
+ Set form encoding. This will be the character set used to decode
request parameters
+ -->
+ <!--
+ <init-param>
+ <param-name>form-encoding</param-name>
+ <param-value>utf-8</param-value>
+ </init-param>
+ -->
+
+ <!--
This parameter allows you to startup Cocoon2 immediately after startup
of your servlet engine.
-->
@@ -278,7 +376,7 @@
<init-param>
<param-name>domain</param-name>
- <param-value>/WEB-INF/Domain.xml</param-value>
+ <param-value>/samples/slide/slide.xconf</param-value>
<description>
Path to the domain configuration file, relative to the path of the
web application.
@@ -303,7 +401,7 @@
<description>
Use the 'directory-browsing' init-parameter to turn off generation
of
HTML index pages that enable browsing of collections.
- The default value is 'true'.
+ The default value is 'true'.
</description>
</init-param>
@@ -316,7 +414,6 @@
</servlet>
-
<!--
Cocoon handles all the URL space assigned to the webapp using its
sitemap.
It is recommended to leave it unchanged. Under some circumstances though
@@ -354,7 +451,31 @@
<mime-type>text/css</mime-type>
</mime-mapping>
- <!-- Authetication for the WebDAV servlet -->
+ <mime-mapping>
+ <extension>xml</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+
+ <mime-mapping>
+ <extension>xsl</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+
+ <mime-mapping>
+ <extension>xconf</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+
+ <mime-mapping>
+ <extension>xmap</extension>
+ <mime-type>text/xml</mime-type>
+ </mime-mapping>
+
+ <mime-mapping>
+ <extension>ent</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
+
<security-constraint>
<web-resource-collection>
<web-resource-name>DAV resource</web-resource-name>
@@ -379,10 +500,10 @@
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
-
+
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Slide DAV Server</realm-name>
</login-config>
-
+
</web-app>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]