stephan 2002/07/04 10:32:41
Modified: src/scratchpad/src/org/apache/cocoon/acting
SourceUploadAction.java
src/scratchpad/src/org/apache/cocoon/components/repository/impl
slide.xconf
src/scratchpad/src/org/apache/cocoon/components/source/impl
SlideSourceFactory.java
src/scratchpad/webapp/samples/slide rdf2html4content.xsl
rdf2html4properties.xsl
Added: src/scratchpad/src/org/apache/cocoon/components/repository
Principal.java PrincipalGroup.java
PrincipalProvider.java Repository.java
principalprovider.roles
src/scratchpad/src/org/apache/cocoon/components/repository/impl
SlidePrincipalProvider.java SlideRepository.java
slidepp.xconf
Removed: src/scratchpad/src/org/apache/cocoon/components/repository
SourceRepository.java
src/scratchpad/src/org/apache/cocoon/components/repository/impl
SlideSourceRepository.java
Log:
Some classes for user management of repositories added.
SourceRepository to Repository renamed since the source resolving
went totally to the SlideSourceFactory.
Revision Changes Path
1.3 +1 -3
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceUploadAction.java
Index: SourceUploadAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceUploadAction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SourceUploadAction.java 2 Jul 2002 16:54:25 -0000 1.2
+++ SourceUploadAction.java 4 Jul 2002 17:32:41 -0000 1.3
@@ -143,8 +143,6 @@
else
uri = uri+"/"+filename;
- System.out.println("uri="+uri);
-
Source source = resolver.resolveURI(uri);
if (source instanceof RestrictableSource)
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/Principal.java
Index: Principal.java
===================================================================
/*
* 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/>.
*/
package org.apache.cocoon.components.repository;
/**
* This class represents a principal. The implementation is based
* on the interface java.security.Principal.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id: Principal.java,v 1.1 2002/07/04 17:32:41 stephan Exp $
*/
public class Principal implements java.security.Principal {
private String name = null;
private String role = null;
private String password = null;
public Principal(String name) {
this.name = name;
}
public Principal(String name, String password) {
this.name = name;
this.password = password;
}
public Principal(String name, String role, String password) {
this.name = name;
this.role = role;
this.password = password;
}
/**
* Returns the name of the principal
*
* @return Name of principal
*/
public String getName() {
return this.name;
}
/**
* Sets the name
*
* @param name Name of principal
*/
public void setName(String name) {
this.name = name;
}
/**
* Returns the role of the principal
*
* @return Role of the principal
*/
public String getRole() {
return this.role;
}
/**
* Sets the role of the user
*
* @param Role of the principal
*/
public void setRole(String role) {
this.role = role;
}
/**
* Returns the password of the principal
*
* @return Password of the principal
*/
public String getPassword() {
return this.password;
}
/**
* Sets the password of the user
*
* @param password Password of the principal
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Compares this principal to the specified object. Returns true
* if the object passed in matches the principal.
*
* @param another Principal to compare with.
* @return True if the principal passed in is the same as that
* encapsulated by this principal, and false otherwise.
*/
public boolean equals(Object another) {
if (another instanceof java.security.Principal)
return this.name.equals(((java.security.Principal)another).getName());
return false;
}
/**
* Returns a string representation of this principal.
*
* @return A string representation of this principal.
*/
public String toString() {
return this.name;
}
/**
* Returns a hashcode for this principal.
*
* @return A hashcode for this principal.
*/
public int hashCode() {
return this.name.hashCode();
}
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/PrincipalGroup.java
Index: PrincipalGroup.java
===================================================================
/*
* 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/>.
*/
package org.apache.cocoon.components.repository;
/**
* This class represents a group of principals.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id: PrincipalGroup.java,v 1.1 2002/07/04 17:32:41 stephan Exp $
*/
public class PrincipalGroup {
private String name = null;
public PrincipalGroup(String name) {
this.name = name;
}
/**
* Returns the name of the group.
*
* @return Name of the group.
*/
public String getName() {
return this.name = name;
}
/**
* Sets the name of the group.
*
* @param Name of the group.
*/
public void setName(String name) {
this.name = name;
}
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/PrincipalProvider.java
Index: PrincipalProvider.java
===================================================================
/*
* 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/>.
*/
package org.apache.cocoon.components.repository;
import org.apache.avalon.framework.component.Component;
import org.apache.cocoon.ProcessingException;
import java.util.Enumeration;
/**
* Manager for principals and grop of users. The implementation
* is similar to the classes java.security.* .
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id: PrincipalProvider.java,v 1.1 2002/07/04 17:32:41 stephan Exp $
*/
public interface PrincipalProvider extends Component {
/** Role for the component */
public final static String ROLE =
"org.apache.cocoon.components.repository.PrincipalProvider";
/**
* Return all users.
*
* @param caller The principal, which should do the operation
* @return List of all principals
*/
public Principal[] getPrincipals(Principal caller)
throws ProcessingException;
/**
* Add or modify a given principal.
*
* @param caller The principal, which should do the operation.
* @param principal The Principal, which should be add/modified.
*/
public void addPrincipal(Principal caller, Principal principal)
throws ProcessingException;
/**
* Return all groups.
*
* @param caller The principal, which should do the operation.
* @return List of all groups.
*/
public PrincipalGroup[] getPrincipalGroups(Principal caller)
throws ProcessingException;
/**
* Add or modify a given group.
*
* @param caller The principal, which should do the operation.
* @param group The group, which shoud be add/modified.
*/
public void addPrincipalGroup(Principal caller, PrincipalGroup group)
throws ProcessingException;
/**
* Adds the specified member to the group.
*
* @param caller The principal, which should do the operation
* @param group The given group.
* @param user The principal to add to this group.
*/
public void addMember(Principal caller, PrincipalGroup group, Principal user)
throws ProcessingException;
/**
* 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.
*/
public boolean isMember(Principal caller, PrincipalGroup group, Principal
member)
throws ProcessingException;
/**
* Returns an array 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 array of the group members.
*/
public Principal[] members(Principal caller, PrincipalGroup group)
throws ProcessingException;
/**
* Removes the specified member from the group.
*
* @param caller The principal, which should do the operation
* @param group The given group.
* @param principal The principal to remove from this group.
*/
public void removeMember(Principal caller, PrincipalGroup group, Principal
principal)
throws ProcessingException;
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/Repository.java
Index: Repository.java
===================================================================
/*
* 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/>.
*/
package org.apache.cocoon.components.repository;
import org.apache.avalon.framework.component.Component;
/**
* This interface represents a repository from a CMS.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id: Repository.java,v 1.1 2002/07/04 17:32:41 stephan Exp $
*/
public interface Repository extends Component {
/** Role for the component */
public final static String ROLE =
"org.apache.cocoon.components.repository.SourceRepository";
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/principalprovider.roles
Index: principalprovider.roles
===================================================================
<?xml version="1.0"?>
<xroles xpath="/role-list"
unless="role[@name='org.apache.cocoon.components.repository.PrincipalProvider']">
<role name="org.apache.cocoon.components.repository.PrincipalProvider"
shorthand="principalprovider"
default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
</xroles>
1.8 +1 -1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slide.xconf
Index: slide.xconf
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slide.xconf,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- slide.xconf 1 Jul 2002 18:57:46 -0000 1.7
+++ slide.xconf 4 Jul 2002 17:32:41 -0000 1.8
@@ -11,7 +11,7 @@
default="slide">
<!-- Default implementation via Jakarta Slide -->
- <component-instance
class="org.apache.cocoon.components.repository.impl.SlideSourceRepository"
+ <component-instance
class="org.apache.cocoon.components.repository.impl.SlideRepository"
name="slide"
logger="core.repositories.slide"
file="context://samples/slide/slide.xconf"/>
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlidePrincipalProvider.java
Index: SlidePrincipalProvider.java
===================================================================
/*
* 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/>.
*/
package org.apache.cocoon.components.repository.impl;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.component.ComponentSelector;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.repository.Principal;
import org.apache.cocoon.components.repository.PrincipalGroup;
import org.apache.cocoon.components.repository.PrincipalProvider;
import org.apache.cocoon.components.repository.Repository;
import org.apache.cocoon.components.repository.impl.SlideRepository;
import org.apache.slide.authenticate.CredentialsToken;
import org.apache.slide.authenticate.SecurityToken;
//import org.apache.slide.common.EmbeddedDomain;
import org.apache.slide.common.NamespaceAccessToken;
import org.apache.slide.common.NamespaceConfig;
import org.apache.slide.common.SlideException;
import org.apache.slide.common.SlideToken;
import org.apache.slide.common.SlideTokenImpl;
import org.apache.slide.content.Content;
import org.apache.slide.content.NodeProperty;
//import org.apache.slide.content.NodeRevisionContent;
import org.apache.slide.content.NodeRevisionDescriptor;
import org.apache.slide.content.NodeRevisionDescriptors;
//import org.apache.slide.content.RevisionContentNotFoundException;
import org.apache.slide.content.RevisionDescriptorNotFoundException;
//import org.apache.slide.content.RevisionNotFoundException;
import org.apache.slide.content.NodeRevisionNumber;
import org.apache.slide.lock.Lock;
//import org.apache.slide.lock.NodeLock;
//import org.apache.slide.lock.ObjectLockedException;
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.ObjectNode;
import org.apache.slide.structure.ObjectNotFoundException;
import org.apache.slide.structure.Structure;
import org.apache.slide.structure.SubjectNode;
import java.util.Enumeration;
import java.util.Vector;
/**
* Manger for principals and groups of principals
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id: SlidePrincipalProvider.java,v 1.1 2002/07/04 17:32:41 stephan Exp $
*/
public class SlidePrincipalProvider extends AbstractLogEnabled
implements PrincipalProvider, Composable, Configurable, Initializable{
/** The component manager instance */
private ComponentManager manager = null;
/** Namespace access token. */
private NamespaceAccessToken nat;
/** Configuration of namespace */
private NamespaceConfig config;
/** Structure helper. */
private Structure structure;
/** Content helper. */
private Content content;
/** Security helper. */
private Security security;
/** Lock helper. */
private Lock lock;
/** Macro helper. */
private Macro macro;
/** Slide token. */
private SlideToken slidetoken;
private String repository = null;
private String namespace = null;
/*public SlidePrincipalProvider(NamespaceAccessToken nat, SlideToken slidetoken)
{
this.config = this.nat.getNamespaceConfig();
this.structure = nat.getStructureHelper();
this.content = nat.getContentHelper();
this.security = nat.getSecurityHelper();
this.lock = nat.getLockHelper();
this.macro = nat.getMacroHelper();
this.slidetoken = slidetoken;
}*/
/**
* Set the current <code>ComponentManager</code> instance used by this
* <code>Composable</code>.
*/
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
/**
* 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.
*/
public void configure(Configuration configuration)
throws ConfigurationException {
this.repository = configuration.getAttribute("repository", "slide");
this.namespace = configuration.getAttribute("namespace", "slide");
}
/**
* Initialialize the component. Initialization includes
* allocating any resources required throughout the
* components lifecycle.
*
* @throws Exception if an error occurs
*/
public void initialize() throws Exception {
ComponentSelector repositories = null;
Repository repository = null;
try {
repositories =
(ComponentSelector)this.manager.lookup(Repository.ROLE+"Selector");
repository = (Repository)repositories.select(this.repository);
if (!(repository instanceof SlideRepository)) {
getLogger().error("Can't get Slide repository");
return ;
}
SlideRepository sliderepository =
(SlideRepository)repository;
if (this.namespace==null)
this.namespace = sliderepository.getDomain().getDefaultNamespace();
if (sliderepository.getDomain().getNamespaceToken(namespace)==null)
throw new ProcessingException("Repository with the namespace
'"+this.namespace+"' couldn't be found");
this.nat = sliderepository.getDomain().getNamespaceToken(this.namespace);
this.structure = nat.getStructureHelper();
this.content = nat.getContentHelper();
this.security = nat.getSecurityHelper();
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);
repository = null;
if (repositories!=null)
this.manager.release(repositories);
repositories = null;
}
}
/**
* Return all users.
*
* @param caller The principal, which should do the operation
* @return List of all principals
*/
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);
Vector principals = new Vector();
String user;
ObjectNode userobject;
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(),
userobject.getUri().length()-userspath.length());
// FIXME the CVS code from slide does only implement getRoles
/*Enumeration roles = this.security.getRoles(user);
String role = null;
if (roles.hasMoreElements())
role = (String)children.nextElement();*/
NodeRevisionDescriptors revisionDescriptors =
content.retrieve(this.slidetoken, user);
// Retrieve latest revision descriptor
NodeRevisionDescriptor revisionDescriptor =
this.content.retrieve(slidetoken, revisionDescriptors);
String password =
revisionDescriptor.getProperty("password").getValue().toString();
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();
return principalArray;
} catch (SlideException se) {
throw new ProcessingException(se);
}
}
/**
* Add or modify a given principal.
*
* @param caller The principal, which should do the operation.
* @param principal The Principal, which should be add/modified.
*/
public void addPrincipal(Principal caller, Principal principal) throws
ProcessingException {
}
/**
* Return all groups.
*
* @param caller The principal, which should do the operation.
* @return List of all groups.
*/
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);
Vector principalgroups = new Vector();
String group;
ObjectNode groupobject;
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(),
groupobject.getUri().length()-userspath.length());
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();
return principalgroupArray;
} catch (SlideException se) {
throw new ProcessingException(se);
}
}
/**
* Add or modify a given group.
*
* @param caller The principal, which should do the operation.
* @param group The group, which shoud be add/modified.
*/
public void addPrincipalGroup(Principal caller, PrincipalGroup group) throws
ProcessingException {
}
/**
* Adds the specified member to the group.
*
* @param caller The principal, which should do the operation
* @param group The given group.
* @param user The principal to add to this group.
*/
public void addMember(Principal caller, PrincipalGroup group, Principal user)
throws ProcessingException {
}
/**
* 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.
*/
public boolean isMember(Principal caller, PrincipalGroup group, Principal
member) throws ProcessingException {
return false;
}
/**
* 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.
*/
public Principal[] members(Principal caller, PrincipalGroup group) throws
ProcessingException {
return null;
}
/**
* Removes the specified member from the group.
*
* @param caller The principal, which should do the operation
* @param group The given group.
* @param principal The principal to remove from this group.
*/
public void removeMember(Principal caller, PrincipalGroup group, Principal
principal) throws ProcessingException {
}
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlideRepository.java
Index: SlideRepository.java
===================================================================
/*
* 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/>.
*/
package org.apache.cocoon.components.repository.impl;
import org.apache.avalon.excalibur.xml.Parser;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.apache.avalon.framework.component.ComponentManager;
import org.apache.avalon.framework.component.Composable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.thread.ThreadSafe;
//import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.components.repository.Repository;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceException;
import org.apache.excalibur.source.SourceResolver;
//import org.apache.slide.authenticate.CredentialsToken;
import org.apache.slide.common.EmbeddedDomain;
//import org.apache.slide.common.SlideTokenImpl;
import org.xml.sax.InputSource;
//import java.util.Map;
/**
* The class represent a manger for slide repositories
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephan Michels</a>
* @version $Id: SlideRepository.java,v 1.1 2002/07/04 17:32:41 stephan Exp $
*/
public class SlideRepository implements Repository, ThreadSafe,
Composable, Configurable, LogEnabled,
Initializable {
/** The component manager instance */
protected ComponentManager manager = null;
private EmbeddedDomain domain = new EmbeddedDomain();
private Logger logger;
private String file;
/**
* Provide component with a logger.
*
* @param logger the logger
*/
public void enableLogging(Logger logger) {
this.logger = logger;
domain.setLogger(new SlideLoggerAdapter(this.logger));
}
/**
* Set the current <code>ComponentManager</code> instance used by this
* <code>Composable</code>.
*/
public void compose(ComponentManager manager) throws ComponentException {
this.manager = manager;
}
/**
* 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.
*/
public void configure(Configuration configuration)
throws ConfigurationException {
this.file = configuration.getAttribute("file", "WEB-INF/slide.xconf");
}
/**
* Initialialize the component. Initialization includes
* allocating any resources required throughout the
* components lifecycle.
*
* @throws Exception if an error occurs
*/
public void initialize() throws Exception {
SourceResolver resolver = null;
Parser parser = null;
Source source = null;
Configuration configuration = null;
try {
resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
parser = (Parser)this.manager.lookup(Parser.ROLE);
SAXConfigurationHandler confighandler = new SAXConfigurationHandler();
source = resolver.resolveURI(this.file);
parser.parse(new InputSource(source.getInputStream()), confighandler);
configuration = confighandler.getConfiguration();
} catch (Exception e) {
this.logger.error("Could not load slide configuration file", e);
return;
} finally {
if (source!=null)
resolver.release(source);
if (parser!=null)
this.manager.release(parser);
if (resolver!=null)
this.manager.release(resolver);
}
try {
domain.setDefaultNamespace(configuration.getAttribute("default",
"slide"));
this.logger.info("Initializing Domain");
Configuration[] namespaceDefinitions =
configuration.getChildren("namespace");
for (int i=0; i<namespaceDefinitions.length; i++) {
// Initializes a new namespace based on the given configuration data.
this.logger.info("Initializing namespace : "
+ namespaceDefinitions[i].getAttribute("name"));
String name = namespaceDefinitions[i].getAttribute("name");
Configuration namespaceDefinition =
namespaceDefinitions[i].getChild("definition");
Configuration namespaceConfigurationDefinition =
namespaceDefinitions[i].getChild("configuration");
Configuration namespaceBaseDataDefinition =
namespaceDefinitions[i].getChild("data");
domain.addNamespace(name, new
SlideLoggerAdapter(this.logger.getChildLogger(name)),
new
SlideConfigurationAdapter(namespaceDefinition),
new
SlideConfigurationAdapter(namespaceConfigurationDefinition),
new
SlideConfigurationAdapter(namespaceBaseDataDefinition));
this.logger.info("Namespace configuration complete");
}
} catch (ConfigurationException ce) {
this.logger.error("Could not configure Slide domain", ce);
return;
}
}
public EmbeddedDomain getDomain() {
return this.domain;
}
/**
* Returns the user manager by a given admin user.
*/
/*public UserManager getUserManager(User admin) throws ProcessingException {
return new
SlideUserManager(domain.getNamespaceToken(domain.getDefaultNamespace()),
new SlideTokenImpl(new CredentialsToken(admin.getPrincipal())));
}*/
}
1.1
xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slidepp.xconf
Index: slidepp.xconf
===================================================================
<?xml version="1.0"?>
<xconf xpath="/cocoon"
unless="component[@role='org.apache.cocoon.components.repository.PrincipalProviderSelector']">
<!-- Principal providers:
The principal providers handles principals/users, they should use for user
management,
-->
<component role="org.apache.cocoon.components.repository.PrincipalProviderSelector"
class="org.apache.cocoon.components.ExtendedComponentSelector"
logger="core.repositories" default="slide">
<!-- Default implementation via Jakarta Slide -->
<component-instance
class="org.apache.cocoon.components.repository.impl.SlidePrincipalProvider"
name="slide" logger="core.repositories.slide"
repository="slide" namespace="slide"/>
</component>
</xconf>
1.3 +22 -22
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SlideSourceFactory.java 2 Jul 2002 16:54:25 -0000 1.2
+++ SlideSourceFactory.java 4 Jul 2002 17:32:41 -0000 1.3
@@ -70,8 +70,8 @@
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.Constants;
-import org.apache.cocoon.components.repository.SourceRepository;
-import org.apache.cocoon.components.repository.impl.SlideSourceRepository;
+import org.apache.cocoon.components.repository.Repository;
+import org.apache.cocoon.components.repository.impl.SlideRepository;
import org.apache.cocoon.components.source.RestrictableSource;
import org.apache.cocoon.components.source.VersionableSource;
import org.apache.cocoon.components.source.helpers.SourceCredential;
@@ -141,7 +141,7 @@
locationParameters = new SourceParameters();
}
- String repository = locationParameters.getParameter("cocoon-repository",
null);
+ 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);
@@ -157,40 +157,40 @@
if (location.length()==0)
location = "/";
- ComponentSelector sourcerepositories = null;
- SourceRepository sourcerepository = null;
+ ComponentSelector repositories = null;
+ Repository repository = null;
try {
- sourcerepositories =
(ComponentSelector)this.manager.lookup(SourceRepository.ROLE+"Selector");
+ repositories =
(ComponentSelector)this.manager.lookup(Repository.ROLE+"Selector");
- sourcerepository =
(SourceRepository)sourcerepositories.select(repository);
+ repository = (Repository)repositories.select(repositoryname);
- if (!(sourcerepository instanceof SlideSourceRepository)) {
- getLogger().error("Can't get Slide source repository");
+ if (!(repository instanceof SlideRepository)) {
+ getLogger().error("Can't get Slide repository");
return null;
}
- SlideSourceRepository slidesourcerepository =
- (SlideSourceRepository)sourcerepository;
+ SlideRepository sliderepository =
+ (SlideRepository)repository;
if (namespace==null)
- namespace = slidesourcerepository.getDomain().getDefaultNamespace();
+ namespace = sliderepository.getDomain().getDefaultNamespace();
- if
(slidesourcerepository.getDomain().getNamespaceToken(namespace)==null)
+ if (sliderepository.getDomain().getNamespaceToken(namespace)==null)
throw new SourceException("Repository with the namespace
'"+namespace+"' couldn't be found");
- return new
SlideSource(slidesourcerepository.getDomain().getNamespaceToken(namespace),
+ return new
SlideSource(sliderepository.getDomain().getNamespaceToken(namespace),
protocol, location, credential, revision,
branch);
} catch (ComponentException ce) {
getLogger().error("Could not lookup for component.", ce);
} finally {
- if ((sourcerepository!=null) && (sourcerepository instanceof Component))
- sourcerepositories.release((Component)sourcerepository);
- sourcerepository = null;
-
- if (sourcerepositories!=null)
- this.manager.release(sourcerepositories);
- sourcerepositories = null;
+ if ((repository!=null) && (repository instanceof Component))
+ repositories.release((Component)repository);
+ repository = null;
+
+ if (repositories!=null)
+ this.manager.release(repositories);
+ repositories = null;
}
return null;
1.2 +6 -4
xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl
Index: rdf2html4content.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- rdf2html4content.xsl 2 Jul 2002 23:42:39 -0000 1.1
+++ rdf2html4content.xsl 4 Jul 2002 17:32:41 -0000 1.2
@@ -128,7 +128,7 @@
<table width="100%" cellspacing="0" cellpadding="5" align="center">
<font size="+0" face="arial,helvetica,sanserif" color="#000000">
<tr>
- <td align="left"><b>Child</b></td>
+ <td align="left"><b>Filename</b></td>
<td align="left"><b>Type</b></td>
<td align="left"><b>Size</b></td>
<td align="left"><b>Last Modified</b></td>
@@ -142,11 +142,12 @@
><xsl:value-of select="@rdf:resource"/></a>
</td>
<xsl:variable name="location"><xsl:value-of
select="@rdf:resource"/></xsl:variable>
- <td align="left"></td>
<td align="left"><xsl:value-of
-
select="/rdf:RDF/rdf:Description[@rdf:about=$location]/dav:getcontentlength"/></td>
+
select="/rdf:RDF/rdf:Description[@rdf:about=$location]/source:mime-type"/></td>
<td align="left"><xsl:value-of
-
select="/rdf:RDF/rdf:Description[@rdf:about=$location]/dav:etlastmodified"/></td>
+
select="/rdf:RDF/rdf:Description[@rdf:about=$location]/source:contentlength"/></td>
+ <td align="left"><xsl:value-of
+
select="/rdf:RDF/rdf:Description[@rdf:about=$location]/dav:getlastmodified"/></td>
<td align="right">
<form action="" method="post">
<input type="hidden" name="uri" value="{../../@rdf:about}"/>
@@ -163,6 +164,7 @@
<input name="filename" type="text" size="25" maxlength="40"/>
</td>
<td align="left" colspan="3">
+ File:
<input type="file" name="file" size="30" />
</td>
<td align="right">
1.3 +2 -2
xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4properties.xsl
Index: rdf2html4properties.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4properties.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rdf2html4properties.xsl 2 Jul 2002 23:42:39 -0000 1.2
+++ rdf2html4properties.xsl 4 Jul 2002 17:32:41 -0000 1.3
@@ -143,7 +143,7 @@
<td align="left"><xsl:value-of select="local-name(.)"/></td>
<td align="left"><xsl:value-of select="."/></td>
<td align="right">
- <form action="" method="get">
+ <form action="" method="post">
<input type="hidden" name="uri" value="{../@rdf:about}"/>
<input type="hidden" name="namespace" value="{namespace-uri()}"/>
<input type="hidden" name="name" value="{local-name()}"/>
@@ -155,7 +155,7 @@
</xsl:for-each>
<tr>
- <form action="" method="get">
+ <form action="" method="post">
<input type="hidden" name="uri" value="{@rdf:about}"/>
<td align="left">
<input name="namespace" type="text" size="25" maxlength="40"/>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]