ozeigermann 2004/07/13 07:13:16
Modified: webdavclient/connector/example/src/conf web.xml
jboss-web.xml
webdavclient build.xml
webdavclient/connector/src/java/org/apache/webdav/connector
WebDAVManagedConnectionFactory.java
WebDAVConnectionSpec.java
WebDAVManagedConnection.java
webdavclient/connector/example/src/java/connector
TestServlet.java
Log:
Added build targets for JCA jars, rar and example webapp. Stuff
compiles, but example still does not run correctly. Seems to be a problem
with the XAResource implementation.
*** WORK IN PROGRESS ***
Revision Changes Path
1.2 +2 -2 jakarta-slide/webdavclient/connector/example/src/conf/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/webdavclient/connector/example/src/conf/web.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- web.xml 12 Jul 2004 15:48:44 -0000 1.1
+++ web.xml 13 Jul 2004 14:13:16 -0000 1.2
@@ -11,8 +11,8 @@
<url-pattern>/</url-pattern>
</servlet-mapping>
<resource-ref >
- <res-ref-name>Map</res-ref-name>
-
<res-type>org.apache.commons.transaction.memory.jca.MapManagedConnectionFactory</res-type>
+ <res-ref-name>WebDAV-Connector</res-ref-name>
+ <res-type>org.apache.webdav.connector.WebDAVConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
1.2 +2 -2
jakarta-slide/webdavclient/connector/example/src/conf/jboss-web.xml
Index: jboss-web.xml
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/connector/example/src/conf/jboss-web.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jboss-web.xml 12 Jul 2004 15:48:44 -0000 1.1
+++ jboss-web.xml 13 Jul 2004 14:13:16 -0000 1.2
@@ -5,8 +5,8 @@
<!-- Resource references -->
<resource-ref>
- <res-ref-name>Map</res-ref-name>
- <jndi-name>java:Map</jndi-name>
+ <res-ref-name>WebDAV-Connector</res-ref-name>
+ <jndi-name>java:WebDAV-Connector</jndi-name>
</resource-ref>
</jboss-web>
1.14 +117 -4 jakarta-slide/webdavclient/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/webdavclient/build.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- build.xml 6 Jul 2004 19:13:22 -0000 1.13
+++ build.xml 13 Jul 2004 14:13:16 -0000 1.14
@@ -19,8 +19,12 @@
<property name="clientlib.final.name" value="${project}-webdavlib-${version}"/>
<property name="cmd.final.name" value="${project}-commandline-${version}"/>
<property name="ant.final.name" value="${project}-ant-webdav-${version}"/>
+ <property name="jca.final.name" value="${project}-jca-connector-${version}"/>
+ <property name="jca.rar.name" value="webdav-${version}.rar"/>
<property name="archive.src.name"
value="${project}-webdavclient-src-${version}"/>
<property name="archive.bin.name"
value="${project}-webdavclient-bin-${version}"/>
+ <!-- XXX / TODO: Should really be in build.properties -->
+ <property name="jboss.deploy.dir"
value="E:/Programme/jboss-3.2.3/server/default/deploy"/>
<!-- =================================================================== -->
<!-- Build Properties -->
<!-- =================================================================== -->
@@ -28,12 +32,15 @@
<property name="clientlib.build" value="${slide.build}/clientlib"/>
<property name="cmd.build" value="${slide.build}/commandline"/>
<property name="ant.build" value="${slide.build}/ant"/>
+ <property name="jca.build" value="${slide.build}/jca"/>
<property name="slide.dist" value="./dist"/>
<property name="clientlib.dist" value="${slide.dist}"/>
<property name="cmd.dist" value="${slide.dist}"/>
<property name="ant.dist" value="${slide.dist}/ant"/>
+ <property name="jca.dist" value="${slide.dist}/jca"/>
<property name="clientlib.javadoc.path" value="doc/clientjavadoc"/>
<property name="ant.javadoc.path" value="doc/antjavadoc"/>
+ <property name="jca.javadoc.path" value="doc/jcajavadoc"/>
<!-- =================================================================== -->
<!-- Dependencies Properties -->
<!-- =================================================================== -->
@@ -42,6 +49,8 @@
<property name="antlr.jar" value="lib/antlr.jar"/>
<property name="commons-logging.jar" value="lib/commons-logging.jar"/>
<property name="ant.jar" value="lib/ant.jar"/>
+ <property name="commons-transaction.jar"
value="lib/commons-transaction-0.1pre.jar"/>
+ <property name="j2ee-spec.jar" value="lib/geronimo-spec-j2ee-1.0-M1.jar"/>
<!-- =================================================================== -->
<!-- Classpaths -->
<!-- =================================================================== -->
@@ -59,6 +68,12 @@
<pathelement location="${clientlib.build}/classes"/>
<pathelement location="${ant.jar}"/>
</path>
+ <path id="jca.classpath">
+ <pathelement location="${clientlib.build}/classes"/>
+ <pathelement location="${commons-httpclient.jar}"/>
+ <pathelement location="${commons-transaction.jar}"/>
+ <pathelement location="${j2ee-spec.jar}"/>
+ </path>
<!-- =================================================================== -->
<!-- Prepare build -->
<!-- =================================================================== -->
@@ -76,13 +91,20 @@
<mkdir dir="${cmd.build}/classes"/>
</target>
<!-- =================================================================== -->
- <!-- Prepare commandline build -->
+ <!-- Prepare ant build -->
<!-- =================================================================== -->
<target name="prepare-build-ant" depends="prepare-build">
<mkdir dir="${ant.build}"/>
<mkdir dir="${ant.build}/classes"/>
</target>
<!-- =================================================================== -->
+ <!-- Prepare jca build -->
+ <!-- =================================================================== -->
+ <target name="prepare-build-jca" depends="prepare-build">
+ <mkdir dir="${jca.build}"/>
+ <mkdir dir="${jca.build}/classes"/>
+ </target>
+ <!-- =================================================================== -->
<!-- Prepare dist -->
<!-- =================================================================== -->
<target name="prepare-dist" depends="">
@@ -112,7 +134,7 @@
<!-- =================================================================== -->
<!-- Make distribution -->
<!-- =================================================================== -->
- <target name="dist" depends="dist-clientlib,dist-cmd,dist-ant"
+ <target name="dist" depends="dist-clientlib,dist-cmd,dist-ant,dist-jca"
description="Makes distribution"/>
<!-- =================================================================== -->
<!-- Clean build and distribution directories of the DAV client -->
@@ -184,10 +206,25 @@
</copy>
</target>
<!-- =================================================================== -->
+ <!-- Build WebDAV JCA connector -->
+ <!-- =================================================================== -->
+ <target name="build-jca" depends="prepare-build-jca,build-clientlib"
+ description="Build WebDAV JCA connector">
+ <echo message="Building WebDAV JCA connector"/>
+ <javac srcdir="connector/src/java" destdir="${jca.build}/classes"
+ debug="${compile.debug}" deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}" excludes="**/*Test.java">
+ <classpath refid="jca.classpath"/>
+ </javac>
+ <copy todir="${jca.build}/classes">
+ <fileset dir="connector/src/java"/>
+ </copy>
+ </target>
+ <!-- =================================================================== -->
<!-- Javadoc of the WebDAV client -->
<!-- =================================================================== -->
<target name="javadoc-clientlib" depends="prepare-build" description="Create
WebDAV client javadocs" unless="skip.javadoc">
- <property name="copyright" value=""/>
+ <property name="copyright" value="2004"/>
<javadoc sourcepath="clientlib/src/java"
destdir="${clientlib.build}/${clientlib.javadoc.path}"
doctitle="Slide ${version} WebDAV Client JavaDoc" windowtitle="Slide
WebDAV Client Javadoc"
package="true" noindex="false" author="true" version="true"
packagenames="org.apache.webdav.lib.*">
@@ -197,7 +234,7 @@
</target>
<target name="javadoc-ant" depends="prepare-build" description="Create ant
tasks javadocs" unless="skip.javadoc">
- <property name="copyright" value=""/>
+ <property name="copyright" value="2004"/>
<javadoc sourcepath="ant/src/java"
destdir="${ant.build}/${ant.javadoc.path}"
doctitle="Slide ${version} WebDAV ant tasks JavaDoc" windowtitle="Slide
WebDAV ant tasks Javadoc"
package="true" noindex="false" author="true" version="true"
packagenames="org.apache.webdav.ant.*">
@@ -205,6 +242,17 @@
<link href="http://jakarta.apache.org/commons/httpclient/apidocs/"/>
</javadoc>
</target>
+
+ <target name="javadoc-jca" depends="prepare-build" description="Create JCA
connector javadocs" unless="skip.javadoc">
+ <property name="copyright" value="2004"/>
+ <javadoc sourcepath="connector/src/java"
destdir="${jca.build}/${jca.javadoc.path}"
+ doctitle="Slide ${version} WebDAV JCA connector JavaDoc"
windowtitle="Slide WebDAV JCA connector Javadoc"
+ package="true" noindex="false" author="true" version="true"
packagenames="org.apache.webdav.connector.*">
+ <classpath refid="jca.classpath"/>
+ <link href="http://jakarta.apache.org/commons/httpclient/apidocs/"/>
+ </javadoc>
+ </target>
+
<!-- =================================================================== -->
<!-- Build a WebDAV client distribution -->
<!-- =================================================================== -->
@@ -287,6 +335,71 @@
tofile="${ant.dist}/webdav.taskdefs"/>
<copy file="ant/src/java/org/apache/webdav/ant/doc-files/tasks.htm"
tofile="${ant.dist}/ant-webdav.html"/>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build the WebDAV JCA connector distribution -->
+ <!-- =================================================================== -->
+ <target name="dist-jca" depends="build-jca,dist-clientlib"
+ description="Distribute WebDAV JCA connector">
+ <mkdir dir="${jca.dist}"/>
+ <jar jarfile="${jca.dist}/${jca.final.name}.jar"
+ basedir="${jca.build}/classes"
+ manifest="${slide.dist}/etc/MANIFEST.MF">
+ <metainf file="./LICENSE"/>
+ </jar>
+ <copy todir="${jca.dist}">
+ <fileset dir=".">
+ <include name="LICENSE"/>
+ <include name="README"/>
+ <include name="NOTICE"/>
+ </fileset>
+ <fileset file="${commons-httpclient.jar}"/>
+ <fileset file="${commons-logging.jar}"/>
+ <fileset file="${clientlib.dist}/lib/${clientlib.final.name}.jar"/>
+ <fileset file="${commons-transaction.jar}"/>
+ </copy>
+ <mkdir dir="${jca.dist}/rar"/>
+ <zip zipfile="${jca.dist}/rar/${jca.rar.name}">
+ <zipfileset dir="${basedir}">
+ <include name="LICENSE"/>
+ <include name="NOTICE"/>
+ </zipfileset>
+ <zipfileset file="${commons-httpclient.jar}"/>
+ <zipfileset file="${commons-logging.jar}"/>
+ <zipfileset file="${clientlib.dist}/lib/${clientlib.final.name}.jar"/>
+ <zipfileset file="${commons-transaction.jar}"/>
+ <zipfileset file="${jca.dist}/${jca.final.name}.jar"/>
+ <zipfileset dir="${basedir}/etc/conf/connector" prefix="META-INF"
includes="ra.xml"/>
+ </zip>
+ <copy todir="${jca.dist}/rar">
+ <fileset dir="${basedir}/etc/conf/connector/jboss"/>
+ </copy>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Build the WebDAV JCA connector example web archive -->
+ <!-- =================================================================== -->
+ <target name="jca-example-war" depends="dist-jca"
+ description="Create connector example war">
+ <javac destdir="${jca.build}/classes"
+ debug="${compile.debug}"
+ deprecation="${compile.deprecation}"
+ optimize="${compile.optimize}" >
+ <src path="${basedir}/connector/example/src/java"/>
+ <classpath refid="jca.classpath" />
+ </javac>
+ <zip zipfile="${jca.dist}/connector-example.war">
+ <zipfileset dir="${jca.build}/classes/connector"
prefix="WEB-INF/classes/connector" includes="TestServlet.class"/>
+ <zipfileset dir="${basedir}/connector/example/src/conf"
prefix="WEB-INF"/>
+ </zip>
+ </target>
+ <!-- =================================================================== -->
+ <!-- Deploy WebDAV JCA connector and example war to JBoss -->
+ <!-- =================================================================== -->
+ <target name="deploy-jca-exmaple-jboss" depends="jca-example-war"
description="Deploys connector rar and example war to JBoss">
+ <copy todir="${jboss.deploy.dir}">
+ <fileset dir="${jca.dist}/rar"/>
+ <fileset file="${jca.dist}/connector-example.war"/>
+ </copy>
</target>
<!-- =================================================================== -->
<!-- Copy all files for the src archive -->
1.2 +24 -21
jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnectionFactory.java
Index: WebDAVManagedConnectionFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnectionFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebDAVManagedConnectionFactory.java 12 Jul 2004 15:21:54 -0000 1.1
+++ WebDAVManagedConnectionFactory.java 13 Jul 2004 14:13:16 -0000 1.2
@@ -37,11 +37,10 @@
import org.apache.commons.httpclient.HttpException;
-
/**
- *
- * @version $Revision$
*
+ * @version $Revision$
+ *
*/
public class WebDAVManagedConnectionFactory implements ManagedConnectionFactory {
@@ -50,8 +49,7 @@
/**
* @see ManagedConnectionFactory#createConnectionFactory(ConnectionManager)
*/
- public Object createConnectionFactory(ConnectionManager cm)
- throws ResourceException {
+ public Object createConnectionFactory(ConnectionManager cm) throws
ResourceException {
return new WebDAVConnectionFactory(this, cm);
}
@@ -65,30 +63,35 @@
}
/**
- * @see ManagedConnectionFactory#createManagedConnection(Subject,
ConnectionRequestInfo)
+ * @see ManagedConnectionFactory#createManagedConnection(Subject,
+ * ConnectionRequestInfo)
*/
- public ManagedConnection createManagedConnection(
- Subject subject,
- ConnectionRequestInfo cxRequestInfo)
- throws ResourceException {
+ public ManagedConnection createManagedConnection(Subject subject,
ConnectionRequestInfo cxRequestInfo)
+ throws ResourceException {
try {
return new WebDAVManagedConnection(cxRequestInfo);
} catch (HttpException e) {
+ if (writer != null) {
+ writer.println("Exception: " + e);
+ e.printStackTrace(writer);
+ }
throw new ResourceException("Could not create managed connection", e);
} catch (IOException e) {
+ if (writer != null) {
+ writer.println("Exception: " + e);
+ e.printStackTrace(writer);
+ }
throw new ResourceException("Could not create managed connection", e);
}
}
/**
- * @see ManagedConnectionFactory#matchManagedConnections(Set, Subject,
ConnectionRequestInfo)
+ * @see ManagedConnectionFactory#matchManagedConnections(Set, Subject,
+ * ConnectionRequestInfo)
*/
- public ManagedConnection matchManagedConnections(
- Set connectionSet,
- Subject subject,
- ConnectionRequestInfo cxRequestInfo)
- throws ResourceException {
+ public ManagedConnection matchManagedConnections(Set connectionSet, Subject
subject,
+ ConnectionRequestInfo cxRequestInfo) throws ResourceException {
ManagedConnection match = null;
Iterator iterator = connectionSet.iterator();
@@ -124,7 +127,7 @@
}
public int hashCode() {
-
+
return 0;
}
-}
+}
\ No newline at end of file
1.2 +9 -6
jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVConnectionSpec.java
Index: WebDAVConnectionSpec.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVConnectionSpec.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebDAVConnectionSpec.java 12 Jul 2004 15:21:54 -0000 1.1
+++ WebDAVConnectionSpec.java 13 Jul 2004 14:13:16 -0000 1.2
@@ -27,6 +27,7 @@
import javax.resource.spi.ConnectionRequestInfo;
import org.apache.commons.httpclient.HttpURL;
+import org.apache.commons.httpclient.HttpsURL;
import org.apache.commons.httpclient.URIException;
/**
@@ -45,8 +46,10 @@
this.timeout = timeout;
}
- public WebDAVConnectionSpec(String host, String userName, String password, int
timeout) throws URIException {
- this(new HttpURL(userName, password, host), timeout);
+ public WebDAVConnectionSpec(String uri, String userName, String password, int
timeout) throws URIException {
+ this.httpURL = uri.startsWith("https") ? new HttpsURL(uri.toCharArray()) :
new HttpURL(uri.toCharArray());
+ this.httpURL.setUserinfo(userName, password);
+ this.timeout = timeout;
}
protected HttpURL getHttpURL() {
1.2 +6 -4
jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnection.java
Index: WebDAVManagedConnection.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/connector/src/java/org/apache/webdav/connector/WebDAVManagedConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebDAVManagedConnection.java 12 Jul 2004 15:21:54 -0000 1.1
+++ WebDAVManagedConnection.java 13 Jul 2004 14:13:16 -0000 1.2
@@ -201,7 +201,9 @@
protected void open(WebDAVConnectionSpec webDAVConnectionSpec) throws
IOException, URIException {
this.webDAVConnectionSpec = webDAVConnectionSpec;
+ System.out.println("Opening: "+webDAVConnectionSpec.getHttpURL()); // FIXME
webdavResource = new WebdavResource(webDAVConnectionSpec.getHttpURL());
+ System.out.println("Opened"); // FIXME
String owner = webDAVConnectionSpec.getHttpURL().getUser();
if (owner == null)
owner = "WebDAV Connector";
1.2 +15 -15
jakarta-slide/webdavclient/connector/example/src/java/connector/TestServlet.java
Index: TestServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/connector/example/src/java/connector/TestServlet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestServlet.java 12 Jul 2004 15:48:45 -0000 1.1
+++ TestServlet.java 13 Jul 2004 14:13:16 -0000 1.2
@@ -20,9 +20,9 @@
* Implementation of the test servlet.
*/
public class TestServlet extends HttpServlet {
- static String HOST = "http://localhost:8888/slide";
+ static String HOST = "http://localhost:8888/slide/files";
static String USER = "root";
- static String PASSWORD = "password";
+ static String PASSWORD = "root";
static int TIMEOUT = 10;
// Reference to the factory
@@ -67,29 +67,29 @@
WebDAVConnectionSpec spec = new WebDAVConnectionSpec(HOST, USER,
PASSWORD, TIMEOUT);
conn1 = (WebDAVConnection) _factory.getConnection(spec);
- conn2 = (WebDAVConnection) _factory.getConnection(spec);
+// conn2 = (WebDAVConnection) _factory.getConnection(spec);
out.println("Connection1: " + conn1 + "<br>");
System.out.println("Connection1: " + conn1);
- out.println("Connection2: " + conn2 + "<br>");
- System.out.println("Connection2: " + conn2);
+// out.println("Connection2: " + conn2 + "<br>");
+// System.out.println("Connection2: " + conn2);
WebdavResource wr1 = conn1.getWebdavResource();
- WebdavResource wr2 = conn2.getWebdavResource();
+// WebdavResource wr2 = conn2.getWebdavResource();
out.println("WR1: " + wr1 + "<br>");
System.out.println("WR1: " + wr1);
- out.println("WR2: " + wr2 + "<br>");
- System.out.println("WR2: " + wr2);
+// out.println("WR2: " + wr2 + "<br>");
+// System.out.println("WR2: " + wr2);
- wr1.putMethod(HOST+"/files/file1", "Content");
- String thisIsWhatTx1Sees =
wr1.getMethodDataAsString(HOST+"/files/file1");
- String thisIsWhatTx2Sees =
wr2.getMethodDataAsString(HOST+"/files/file1");
+ wr1.putMethod(HOST+"/file1", "Content");
+ String thisIsWhatTx1Sees = wr1.getMethodDataAsString(HOST+"/file1");
+// String thisIsWhatTx2Sees = wr2.getMethodDataAsString(HOST+"/file1");
out.println("WR1 sees " + thisIsWhatTx1Sees + "<br>");
- System.out.println("WR1 sees " + thisIsWhatTx2Sees);
- out.println("WR2 sees " + thisIsWhatTx1Sees + "<br>");
- System.out.println("WR2 sees " + thisIsWhatTx2Sees);
+ System.out.println("WR1 sees " + thisIsWhatTx1Sees);
+// out.println("WR2 sees " + thisIsWhatTx2Sees + "<br>");
+// System.out.println("WR2 sees " + thisIsWhatTx2Sees);
tx.commit();
} catch (Exception e) {
@@ -126,4 +126,4 @@
}
}
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]