nicolaken 02/05/22 08:29:11
Added: src/scratchpad/webapp/mount/slide collection2html.xsl
Domain.xml README sitemap.xmap snippet.xconf
Log:
[PATCH] SourceFactory for jakarta slide (Bug#: 9267 )
submitter by
[EMAIL PROTECTED] (Stephan Michels)
to use: build installscratchpadwar and then remove the comments for
the webdav servlet and mapping in web.xml.
Revision Changes Path
1.1
xml-cocoon2/src/scratchpad/webapp/mount/slide/collection2html.xsl
Index: collection2html.xsl
===================================================================
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:col="http://apache.org/cocoon/slidecollection/1.0">
<!-- xmlns="http://www.w3.org/1999/xhtml">-->
<xsl:output indent="yes"/>
<xsl:param name="namespace">ownrepository</xsl:param>
<xsl:template match="/">
<html>
<head>
<title>Jakarta Slide Collection</title>
</head>
<body>
<xsl:apply-templates select="col:collection"/>
</body>
</html>
</xsl:template>
<xsl:template match="col:collection">
<table width="90%" cellspacing="0" cellpadding="5" align="center">
<tr>
<td colspan="3">
<font size="+2"><strong>Directory listing for <xsl:value-of
select="@uri"/></strong></font>
</td>
</tr>
<tr>
<td colspan="5" bgcolor="#ffffff"><a
href="/cocoon/mount/slide/{$namespace}/">Home</a></td>
</tr>
<tr bgcolor="#cccccc">
<td align="left" colspan="5"><tt><b>ACL Info</b></tt></td>
</tr>
<tr bgcolor="#cccccc">
<td align="left" colspan="2"><tt><b>Subject</b></tt></td>
<td align="left"><tt><b>Action</b></tt></td>
<td align="right"><tt><b>Inheritable</b></tt></td>
<td align="right"><tt><b>Deny</b></tt></td>
</tr>
<xsl:apply-templates select="col:permission"/>
<tr><td colspan="5" bgcolor="#ffffff"> </td></tr>
<tr bgcolor="#cccccc">
<td align="left" colspan="5"><tt><b>Lock Info</b></tt></td>
</tr>
<tr bgcolor="#cccccc">
<td align="left"><tt><b>Subject</b></tt></td>
<td align="left"><tt><b>Type</b></tt></td>
<td align="right"><tt><b>Expiration</b></tt></td>
<td align="right"><tt><b>Inheritable</b></tt></td>
<td align="right"><tt><b>Exclusive</b></tt></td>
</tr>
<xsl:apply-templates select="col:lock"/>
<tr><td colspan="5" bgcolor="#ffffff"> </td></tr>
<tr bgcolor="#cccccc">
<td align="left" colspan="3"><font
size="+1"><strong>Filename</strong></font></td>
<td align="center"><font size="+1"><strong>Size</strong></font></td>
<td align="right"><font size="+1"><strong>Last Modified</strong></font></td>
</tr>
<xsl:apply-templates select="col:collection|col:object" mode="enumerate"/>
<tr><td colspan="5"> </td></tr>
<tr><td colspan="5" bgcolor="#cccccc"><font size="-1">Jakarta Slide 1.0 + Apache
Cocoon 2</font></td></tr>
</table>
</xsl:template>
<xsl:template match="col:permission">
<tr bgcolor="#eeeeee">
<td align="left" colspan="2"><tt><xsl:value-of select="@subjecturi"/></tt></td>
<td align="left"><tt><xsl:value-of select="@actionuri"/></tt></td>
<td align="right"><tt><xsl:value-of select="@inheritable"/></tt></td>
<td align="right"><tt><xsl:value-of select="@negative"/></tt></td>
</tr>
</xsl:template>
<xsl:template match="col:lock">
<tr bgcolor="#eeeeee">
<td align="left"><tt><xsl:value-of select="@subjecturi"/></tt></td>
<td align="left"><tt><xsl:value-of select="@typeuri"/></tt></td>
<td align="right"><tt><xsl:value-of select="@expiration"/></tt></td>
<td align="right"><tt><xsl:value-of select="@inheritable"/></tt></td>
<td align="right"><tt><xsl:value-of select="@exclusive"/></tt></td>
</tr>
</xsl:template>
<xsl:template match="col:collection" mode="enumerate">
<tr bgcolor="#eeeeee">
<td align="left" colspan="4">  
<a href="/cocoon/mount/slide/browse/{$namespace}{@uri}"><tt><xsl:value-of
select="@uri"/></tt></a>
</td>
<td align="right"><tt><xsl:value-of select="@lastmodified"/></tt></td>
</tr>
</xsl:template>
<xsl:template match="col:object" mode="enumerate">
<tr bgcolor="#eeeeee">
<td align="left" colspan="3">  
<a href="/cocoon/mount/slide/view/{$namespace}{@uri}"><tt><xsl:value-of
select="@uri"/></tt></a>
</td>
<td align="right"><tt><xsl:value-of select="@contentlength"/></tt></td>
<td align="right"><tt><xsl:value-of select="@lastmodified"/></tt></td>
</tr>
</xsl:template>
</xsl:stylesheet>
1.1 xml-cocoon2/src/scratchpad/webapp/mount/slide/Domain.xml
Index: Domain.xml
===================================================================
<?xml version="1.0"?>
<slide default="ownrepository">
<namespace name="ownrepository">
<!-- ### JDBC Configuration ###
The following jdbc sample configuration uses the hsql Database Engine
a relational database engine written in Java, for more info:
http://hsqldb.sourceforge.net/
-->
<definition>
<store name="jdbc">
<nodestore classname="slidestore.reference.JDBCDescriptorsStore">
<parameter name="driver">org.hsqldb.jdbcDriver</parameter>
<parameter name="url">jdbc:hsqldb:slidestructure</parameter>
<parameter name="user">sa</parameter>
<parameter name="password"></parameter>
</nodestore>
<securitystore>
<reference store="nodestore" />
</securitystore>
<lockstore>
<reference store="nodestore" />
</lockstore>
<revisiondescriptorsstore>
<reference store="nodestore" />
</revisiondescriptorsstore>
<revisiondescriptorstore>
<reference store="nodestore" />
</revisiondescriptorstore>
<contentstore classname="slidestore.reference.FileContentStore">
<parameter name="rootpath">contentstore</parameter>
<parameter name="version">true</parameter>
<parameter name="resetBeforeStarting">false</parameter>
</contentstore>
</store>
<scope match="/" store="jdbc" />
<logger classname="org.apache.slide.util.logger.SimpleLogger"
logger-level="6" />
</definition>
<configuration>
<!-- Actions mapping -->
<default-action>/actions</default-action>
<read-object>/actions/read</read-object>
<create-object>/actions/write</create-object>
<remove-object>/actions/write</remove-object>
<grant-permission>/actions/manage</grant-permission>
<revoke-permission>/actions/manage</revoke-permission>
<read-permissions>/actions/manage</read-permissions>
<lock-object>/actions/write</lock-object>
<kill-lock>/actions/manage</kill-lock>
<read-locks>/actions/read</read-locks>
<read-revision-metadata>/actions/read</read-revision-metadata>
<create-revision-metadata>/actions/write</create-revision-metadata>
<modify-revision-metadata>/actions/write</modify-revision-metadata>
<remove-revision-metadata>/actions/write</remove-revision-metadata>
<read-revision-content>/actions/read</read-revision-content>
<create-revision-content>/actions/write</create-revision-content>
<modify-revision-content>/actions/write</modify-revision-content>
<remove-revision-content>/actions/write</remove-revision-content>
<!-- Paths configuration -->
<userspath>/users</userspath>
<guestpath>guest</guestpath>
<filespath>/files</filespath>
<parameter name="dav">true</parameter>
<parameter name="standalone">true</parameter>
<!-- Roles definition -->
<role name="root">slideroles.basic.RootRole</role>
<role name="user">slideroles.basic.UserRole</role>
<role name="guest">slideroles.basic.GuestRole</role>
<!-- Users management -->
<auto-create-users>false</auto-create-users>
<!-- Default properties mapping -->
<default-property name="foo" namespace="nsfoo/" value="bar"
role="user"/>
<default-property name="password" namespace="slide/" value=""
role="user"/>
</configuration>
<data>
<objectnode classname="org.apache.slide.structure.SubjectNode" uri="/">
<permission action="/actions" subject="root"/>
<permission action="/actions/read" subject="user"
inheritable="false"/>
<permission action="/actions/read" subject="nobody"
inheritable="false"/>
<!-- /users represents the unauthenticated user -->
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/users">
<permission action="/actions" subject="~"/>
<permission action="/actions" subject="guest"
inheritable="true" negative="true"/>
<permission action="/actions/read" subject="user"
inheritable="false"/>
<!-- Permission group example -->
<objectnode classname="org.apache.slide.structure.GroupNode"
uri="/users/groupA">
<objectnode classname="org.apache.slide.structure.LinkNode"
uri="/users/groupA/john" linkedUri="/users/john" />
<objectnode classname="org.apache.slide.structure.LinkNode"
uri="/users/groupA/root" linkedUri="/users/root" />
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/users/groupA/singleGroupMember" />
</objectnode>
<!-- /users/root represents the administrator -->
<objectnode classname="slideroles.basic.RootRoleImpl"
uri="/users/root">
<!-- Uncomment and change the password to allow login as root to
edit the namespace -->
<revision>
<property name="password"
namespace="http://jakarta.apache.org/slide/">root</property>
</revision>
</objectnode>
<!-- /users/john represents an authenticated user -->
<objectnode classname="slideroles.basic.UserRoleImpl"
uri="/users/john" >
<revision>
<property name="password"
namespace="http://jakarta.apache.org/slide/">john</property>
</revision>
</objectnode>
<!-- /users/guest represents an authenticated or unauthenticated
guest user -->
<objectnode classname="slideroles.basic.GuestRoleImpl"
uri="/users/guest" >
<revision>
<property name="password"
namespace="http://jakarta.apache.org/slide/">guest</property>
</revision>
</objectnode>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions">
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/read"/>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/write"/>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/manage"/>
</objectnode>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/files">
<!-- ### Give read/write/manage permission to guest ###
Uncomment the following line to give permission to do
all actions on /files to guest (unauthenticated users) -->
<permission action="/actions" subject="/users/guest"/>
<permission action="/actions/manage" subject="/users/john"/>
<permission action="/actions/write" subject="+/users/groupA"/>
<permission action="/actions/read" subject="nobody"/>
</objectnode>
</objectnode>
</data>
</namespace>
</slide>
1.1 xml-cocoon2/src/scratchpad/webapp/mount/slide/README
Index: README
===================================================================
====================================
Using Jakarta Slide with Cocoon
====================================
1. Uncomment the entries for WebDAV in src/webapp/WEB-INF/web.xml
1. Install the Web Application via in Tomcat
./build.sh -Dinclude.webapp.libs=yes -Dinstall.war=$TOMCAT_HOME/webapps
-Dinclude.scratchpad.libs=yes install
2. Start Tomcat
$TOMCAT_HOME/bin/catalina.sh run
3. Access WebDAV via MS WebFolders, Cadaver or what ever
http://localhost:8080/cocoon/webdav/
4. Access the slide repository via Cocoon
http://vernjava:8080/cocoon/mount/slide/browse/ownrepository/
Have fun, Stephan Michels <[EMAIL PROTECTED]>
Some things must be fixed:
* The logger should be set
* Also the base directory should be set
* <map:read src="slide://..."/> doesn't work
1.1 xml-cocoon2/src/scratchpad/webapp/mount/slide/sitemap.xmap
Index: sitemap.xmap
===================================================================
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:components>
<map:generators default="file">
<map:generator name="slidecollection"
src="org.apache.cocoon.generation.SlideCollectionGenerator"
logger="sitemap.generator.slidecollection"/>
</map:generators>
<map:serializers default="html"/>
<map:transformers default="xslt"/>
<map:readers default="resource"/>
<map:matchers default="wildcard"/>
<map:selectors default="browser"/>
</map:components>
<map:pipelines>
<map:pipeline>
<map:match pattern="">
<map:redirect-to uri="browse/ownrepository/"/>
</map:match>
<map:match pattern="browse/*/**">
<map:generate type="slidecollection" src="{1}/{2}">
<map.parameter name="username" value="root"/><!-- Doesn't work right now -->
</map:generate>
<map:transform src="collection2html.xsl">
<map:parameter name="namespace" value="{1}"/>
</map:transform>
<map:serialize type="html"/>
</map:match>
<map:match pattern="view/*/**">
<!-- Ask me how should I handle the mime type ?!?! -->
<map:read src="slide://{1}/{2}" mime-type="application/octet-stream"/>
</map:match>
<map:handle-errors>
<map:transform src="context://stylesheets/system/error2html.xsl"/>
<map:serialize status-code="500"/>
</map:handle-errors>
</map:pipeline>
</map:pipelines>
</map:sitemap>
1.1 xml-cocoon2/src/scratchpad/webapp/mount/slide/snippet.xconf
Index: snippet.xconf
===================================================================
<component-instance
class="org.apache.cocoon.components.source.SlideSourceFactory" name="slide">
<domain-configuration>/mount/slide/Domain.xml</domain-configuration>
</component-instance>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]