I just got the time to put my stuff together. This work is about enlisting
Slide in JTA transactions when using the API directly. For additional
information, please refer to the topic "Application Server and Slide
Application integration" in the mailing list.
The main contribution is subclassing ExtendedStore (attached as
ExternalTransactionStore.java) to allow for an extra parameter that
specifies the JNDI name of the transaction manager.
I had to alter org.apache.slide.common.AbstractService (attached as
AbstractService.java). There are a few comparisons of the form:
"currentContext.getGlobalTransactionId() !=
xid.getGlobalTransactionId()"
that don't work for JBoss' implementation of Xid, because
getGlobalTransactionId() returns a clone of the internal field value.
Comparing by value solves the problem:
"!Arrays.equals(currentContext.getGlobalTransactionId(),
xid.getGlobalTransactionId())"
Lastly, Namespace has to expose a method to override the default transaction
manager.
package org.apache.slide.common;
public final class Namespace {
/**
* Allows for overriding the default transaction manager used by this
* namespace.
* @param transactionManager the new transaction manager
*/
public void initTransactionManager(
TransactionManager transactionManager) {
if (this.transactionManager instanceof SlideTransactionManager) {
this.transactionManager = transactionManager;
}
}
}
I'm attaching a sample domain configuration file (SlideDomain.xml) using the
new store. Also attached is a sample datasource configuration
(repository-ds.xml) that works with JBoss. Note that no dependency on JBoss
is created; the only requirement is that the app server makes its
transaction manager available through JNDI.
Please tell me if everything is ok.
-Alejandro
--- Original message ---
Why not use the wrapper classes that fake 2P commit? They should work...
Concerning the usefulness of your implementation, you just name it, if
anyone wants to go directly to the Slide API and not use the WebDAV layer
the JCA approach is useless.
Could you please find a datasource configuration that works with JBoss and
submit all needed info / classes / config to have it in in JBoss.
Please, also add the ASF copyright and the slide package header to your
classes. I will add your stuff to the CVS then.
<?xml version="1.0" encoding="UTF-8"?>
<slide default="repository-test" logger="log4j.Log4jLogger" logger-level="6">
<namespace name="repository-test">
<definition>
<store name="general-store"
classname="org.apache.slide.store.ExternalTransactionStore">
<parameter name="tx-manager-name">java:/TransactionManager</parameter>
<nodestore classname="org.apache.slide.store.impl.rdbms.J2EEStore">
<parameter name="datasource">java:/RepositoryTestDS</parameter>
<parameter name="adapter">
org.apache.slide.store.impl.rdbms.MySql41RDBMSAdapter</parameter>
<!-- leave the transaction manager in charge of db commits/rollbacks -->
<parameter name="tm-commits">true</parameter>
</nodestore>
<securitystore>
<reference store="nodestore"/>
</securitystore>
<lockstore>
<reference store="nodestore"/>
</lockstore>
<revisiondescriptorsstore>
<reference store="nodestore"/>
</revisiondescriptorsstore>
<revisiondescriptorstore>
<reference store="nodestore"/>
</revisiondescriptorstore>
<contentstore>
<reference store="nodestore"/>
</contentstore>
</store>
<scope match="/" store="general-store"/>
</definition>
<configuration>
<!-- Actions mapping -->
<read-object>/actions/read</read-object>
<create-object>/actions/write</create-object>
<remove-object>/actions/write</remove-object>
<grant-permission>/actions/write-acl</grant-permission>
<revoke-permission>/actions/write-acl</revoke-permission>
<read-permissions>/actions/read-acl</read-permissions>
<read-own-permissions>
/actions/read-current-user-privilege-set</read-own-permissions>
<lock-object>/actions/write</lock-object>
<kill-lock>/actions/unlock</kill-lock>
<read-locks>/actions/read</read-locks>
<read-revision-metadata>/actions/read</read-revision-metadata>
<create-revision-metadata>
/actions/write-properties</create-revision-metadata>
<modify-revision-metadata>
/actions/write-properties</modify-revision-metadata>
<remove-revision-metadata>
/actions/write-properties</remove-revision-metadata>
<read-revision-content>/actions/read</read-revision-content>
<create-revision-content>/actions/write-content</create-revision-content>
<modify-revision-content>/actions/write-content</modify-revision-content>
<remove-revision-content>/actions/write-content</remove-revision-content>
<bind-member>/actions/bind</bind-member>
<unbind-member>/actions/unbind</unbind-member>
<!-- Paths configuration -->
<userspath>/users</userspath>
<rolespath>/roles</rolespath>
<actionspath>/actions</actionspath>
<filespath>/files</filespath>
<parameter name="dav">true</parameter>
<parameter name="standalone">true</parameter>
<parameter name="acl_inheritance_type">path</parameter>
</configuration>
<data>
<objectnode classname="org.apache.slide.structure.SubjectNode" uri="/">
<permission action="all" subject="/roles/coach" inheritable="true"/>
<permission action="/actions/read-acl" subject="all" inheritable="true"
negative="true"/>
<permission action="/actions/write-acl" subject="all"
inheritable="true" negative="true"/>
<permission action="/actions/unlock" subject="all" inheritable="true"
negative="true"/>
<permission action="/actions/read" subject="all" inheritable="true"/>
<!-- /users -->
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/users">
<permission action="all" subject="self" inheritable="true"/>
<permission action="all" subject="unauthenticated" inheritable="true"
negative="true"/>
<!-- /users/coach represents the administrator -->
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/users/coach">
<revision>
<property namespace="http://jakarta.apache.org/slide/"
name="password">qkqcemd8</property>
</revision>
</objectnode>
<!-- /users/rival represents a non-administrator -->
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/users/rival">
<revision>
<property namespace="http://jakarta.apache.org/slide/"
name="password">wawawa</property>
</revision>
</objectnode>
</objectnode>
<!-- /roles -->
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/roles">
<permission action="all" subject="self" inheritable="true"/>
<permission action="all" subject="unauthenticated" inheritable="true"
negative="true"/>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/roles/coach">
<revision>
<property name="group-member-set"><![CDATA[<D:href xmlns:D='DAV:'>/users/coach</D:href>]]>
</property>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/roles/user">
<revision>
<property name="group-member-set"><![CDATA[<D:href xmlns:D='DAV:'>/users/coach</D:href><D:href xmlns:D='DAV:'>/users/rival</D:href>]]>
</property>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/roles/guest">
<revision>
<property name="group-member-set"><![CDATA[<D:href xmlns:D='DAV:'>/users/guest</D:href>]]>
</property>
</revision>
</objectnode>
</objectnode>
<!-- action -->
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions">
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/read">
<revision>
<property name="privilege-member-set"> <![CDATA[<D:href xmlns:D='DAV:'>/actions/read-acl</D:href> <D:href xmlns:D='DAV:'>/actions/read-current-user-privilege-set</D:href>]]>
</property>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/read-acl">
<revision>
<property name="privilege-member-set"/>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/read-current-user-privilege-set">
<revision>
<property name="privilege-member-set"/>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/write">
<revision>
<property name="privilege-member-set"> <![CDATA[<D:href xmlns:D='DAV:'>/actions/write-acl</D:href> <D:href xmlns:D='DAV:'>/actions/write-properties</D:href> <D:href xmlns:D='DAV:'>/actions/write-content</D:href>]]>
</property>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/write-acl">
<revision>
<property name="privilege-member-set"/>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/write-properties">
<revision>
<property name="privilege-member-set"/>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/write-content">
<revision>
<property name="privilege-member-set"> <![CDATA[<D:href xmlns:D='DAV:'>/actions/bind</D:href> <D:href xmlns:D='DAV:'>/actions/unbind</D:href>]]>
</property>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/bind">
<revision>
<property name="privilege-member-set"/>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/unbind">
<revision>
<property name="privilege-member-set"/>
</revision>
</objectnode>
<objectnode classname="org.apache.slide.structure.ActionNode"
uri="/actions/unlock">
<revision>
<property name="privilege-member-set"/>
</revision>
</objectnode>
</objectnode>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/files">
<permission action="all" subject="unauthenticated"
inheritable="true"/>
<permission action="/actions/write" subject="/roles/user"
inheritable="true"/>
<permission action="/actions/read-acl" subject="owner"
inheritable="true"/>
</objectnode>
<!-- DeltaV: default history and workspace paths -->
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/history">
<permission action="all" subject="/roles/coach" inheritable="true"/>
<permission action="/actions/read" subject="unauthenticated"
inheritable="true"/>
</objectnode>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/workspace">
<permission action="all" subject="/roles/coach" inheritable="true"/>
<permission action="/actions/read" subject="unauthenticated"
inheritable="true"/>
</objectnode>
<objectnode classname="org.apache.slide.structure.SubjectNode"
uri="/workingresource">
<permission action="all" subject="/roles/coach" inheritable="true"/>
<permission action="/actions/read" subject="unauthenticated"
inheritable="true"/>
</objectnode>
</objectnode>
</data>
</namespace>
<!-- DeltaV global parameters -->
<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 name="checkout-fork">forbidden</parameter>
<parameter name="checkin-fork">forbidden</parameter>
</slide><?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>RepositoryTestDS</jndi-name>
<connection-url>jdbc:mysql:///RepositoryTest</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<!-- password>impasible</password -->
</local-tx-datasource>
</datasources>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]