[jboss-svn-commits] JBL Code SVN: r37182 - in labs/jbosstm/trunk/rest-tx: quickstarts and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jun 30 10:43:23 EDT 2011


Author: mmusgrov
Date: 2011-06-30 10:43:23 -0400 (Thu, 30 Jun 2011)
New Revision: 37182

Added:
   labs/jbosstm/trunk/rest-tx/quickstarts/
   labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml
   labs/jbosstm/trunk/rest-tx/quickstarts/readme.txt
   labs/jbosstm/trunk/rest-tx/quickstarts/src/
   labs/jbosstm/trunk/rest-tx/quickstarts/src/main/
   labs/jbosstm/trunk/rest-tx/quickstarts/src/main/java/
   labs/jbosstm/trunk/rest-tx/quickstarts/src/main/java/RestTransactionExample.java
   labs/jbosstm/trunk/rest-tx/webservice/src/main/resources/
   labs/jbosstm/trunk/rest-tx/webservice/src/main/resources/META-INF/
   labs/jbosstm/trunk/rest-tx/webservice/src/main/resources/META-INF/MANIFEST.MF
Modified:
   labs/jbosstm/trunk/rest-tx/pom.xml
   labs/jbosstm/trunk/rest-tx/webservice/pom.xml
Log:
[JBTM-845] Changes to MANIFEST.MF to work with AS7 and inclusion of a qickstart

Modified: labs/jbosstm/trunk/rest-tx/pom.xml
===================================================================
--- labs/jbosstm/trunk/rest-tx/pom.xml	2011-06-30 12:23:17 UTC (rev 37181)
+++ labs/jbosstm/trunk/rest-tx/pom.xml	2011-06-30 14:43:23 UTC (rev 37182)
@@ -16,25 +16,26 @@
 		02110-1301, USA.
 		-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <parent>
-    <groupId>org.jboss.narayana</groupId>
-    <artifactId>narayana</artifactId>
-    <version>5.0.0.M1-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.jboss.narayana.rts</groupId>
-  <artifactId>rest-tx</artifactId>
-  <packaging>pom</packaging>
-  <name>RESTful Transactions</name>
-  <url>http://www.jboss.org/jbosstm</url>
-  <modules>
-    <module>tx</module>
-    <module>webservice</module>
-  </modules>
-  <properties>
-    <version.artifactId>1.0-M1-SNAPSHOT</version.artifactId>
-    <artifactId.name>rest-tx</artifactId.name>
-    <version.org.jboss.resteasy>2.0.0.GA</version.org.jboss.resteasy>
-  </properties>
+    <parent>
+        <groupId>org.jboss.narayana</groupId>
+        <artifactId>narayana</artifactId>
+        <version>5.0.0.M1-SNAPSHOT</version>
+	<relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.jboss.narayana.rts</groupId>
+    <artifactId>rest-tx</artifactId>
+    <packaging>pom</packaging>
+    <name>RESTful Transactions</name>
+    <url>http://www.jboss.org/jbosstm</url>
+    <modules>
+        <module>tx</module>
+        <module>webservice</module>
+        <module>quickstarts</module>
+    </modules>
+    <properties>
+        <version.artifactId>5.0.0.M1-SNAPSHOT</version.artifactId>
+        <artifactId.name>rest-tx</artifactId.name>
+        <version.org.jboss.resteasy>2.0.0.GA</version.org.jboss.resteasy>
+    </properties>
 </project>

Added: labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml	                        (rev 0)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/pom.xml	2011-06-30 14:43:23 UTC (rev 37182)
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	JBoss, Home of Professional Open Source Copyright 2010, Red Hat
+	Middleware LLC, and others contributors as indicated by the @authors
+	tag. All rights reserved. See the copyright.txt in the distribution
+	for a full listing of individual contributors. This copyrighted
+	material is made available to anyone wishing to use, modify, copy, or
+	redistribute it subject to the terms and conditions of the GNU Lesser
+	General Public License, v. 2.1. This program is distributed in the
+	hope that it will be useful, but WITHOUT A WARRANTY; without even the
+	implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+	PURPOSE. See the GNU Lesser General Public License for more details.
+	You should have received a copy of the GNU Lesser General Public
+	License, v.2.1 along with this distribution; if not, write to the Free
+	Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+	02110-1301, USA.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.jboss.narayana.rts</groupId>
+        <artifactId>rest-tx</artifactId>
+        <version>5.0.0.M1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>examples</artifactId>
+    <packaging>jar</packaging>
+    <name>Examples of RESTful Atomic Transactions</name>
+    <description>Provides examples of how to use transactions with web applications</description>
+    <properties>
+        <version.org.jboss.resteasy>2.0.0.GA</version.org.jboss.resteasy>
+        <version.artifactId>5.0.0.M1-SNAPSHOT</version.artifactId>
+        <artifactId.name>examples</artifactId.name>
+        <version.org.jboss.jbossas>6.0.0.20100721-M4</version.org.jboss.jbossas>
+    </properties>
+    <repositories>
+        <repository>
+            <id>jboss-public-repository-group</id>
+            <name>JBoss Public Maven Repository Group</name>
+            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
+        <!-- Jersey -->
+        <repository>
+            <id>maven2-repository.dev.java.net</id>
+            <name>Java.net Repository for Maven</name>
+            <url>http://download.java.net/maven/2/</url>
+            <layout>default</layout>
+        </repository>
+        <!-- end Jersey -->
+    </repositories>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.jboss.jbossas</groupId>
+                <artifactId>jboss-as-component-matrix</artifactId>
+                <version>6.0.0.20100721-M4</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+    <dependencies>
+
+        <dependency>
+            <groupId>org.jboss.narayana.rts</groupId>
+            <artifactId>rest-tx-api</artifactId>
+            <version>5.0.0.M1-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>exec-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>exec</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <executable>java</executable>
+                    <workingDirectory>${project.build.directory}/exec-working-directory</workingDirectory>
+                    <arguments>
+                        <argument>-classpath</argument>
+                        <classpath />
+                        <argument>RestTransactionExample</argument>
+                    </arguments>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>create_sources_jar</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                        <phase>prepare-package</phase>
+                    </execution>
+                </executions>
+                <configuration>
+                    <forceCreation>true</forceCreation>
+                    <includePom>true</includePom>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Added: labs/jbosstm/trunk/rest-tx/quickstarts/readme.txt
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/readme.txt	                        (rev 0)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/readme.txt	2011-06-30 14:43:23 UTC (rev 37182)
@@ -0,0 +1,29 @@
+OVERVIEW
+--------
+An example of how to start and end a transaction using REST style semantics.
+
+
+USAGE
+-----
+Deploy the rest-tx war (rest-tx-web-5.0.0.M1-SNAPSHOT.war) into a running AS7 (or AS6) application server listening
+for http requests on localhost (if you use a different host/port change the url in RestTransactionExample.TXN_MGR_URK).
+
+mvn compile exec:exec
+
+
+EXPECTED OUTPUT
+---------------
+transaction running: txStatus=TransactionActive
+Success
+
+
+WHAT JUST HAPPENED?
+-------------------
+We deployed a JAX-RS servlet that implements a RESTful interface to the Narayana transaction manager (TM).
+The example started a transaction by POSTing to a well known url that the JAX-RS servlet was listening on.
+The servlet looked up the TM running in the container it was deployed to and started a transaction.
+The servlet returned a URL (the transaction URL) that the example can use to control the termination of the active transaction.
+The example performed an HTTP GET request on the transaction URL to check that the transaction status was active.
+The example counted the number of running transactions (in order to check that at least one was active).
+The example performed an HTTP PUT request to the transaction URL thus terminating the transaction.
+The example counted the number of running transactions in order to verify that there was one less transaction.

Added: labs/jbosstm/trunk/rest-tx/quickstarts/src/main/java/RestTransactionExample.java
===================================================================
--- labs/jbosstm/trunk/rest-tx/quickstarts/src/main/java/RestTransactionExample.java	                        (rev 0)
+++ labs/jbosstm/trunk/rest-tx/quickstarts/src/main/java/RestTransactionExample.java	2011-06-30 14:43:23 UTC (rev 37182)
@@ -0,0 +1,36 @@
+import org.jboss.jbossts.star.util.TxSupport;
+
+public class RestTransactionExample {
+    private static final String[] hosts = {"localhost:8080"};
+    private static final String TXN_MGR_URL = "http://" + hosts[0] + "/rest-tx/tx/transaction-manager";
+
+    public static void main(String args[]) throws Exception {
+        // create a helper with the desired transaction manager resource endpoint
+        TxSupport txn = new TxSupport(TXN_MGR_URL);
+
+        // start a transaction
+        txn.startTx();
+
+        // verify that there is an active transaction
+        if (!txn.txStatus().equals(TxSupport.TX_ACTIVE))
+            throw new RuntimeException("A transaction should be active: " + txn.txStatus());
+
+        System.out.println("transaction running: " + txn.txStatus());
+
+        // see how many RESTful transactions are running (there should be at least one)
+        int txnCount = txn.txCount();
+
+        if (txn.txCount() == 0)
+            throw new RuntimeException("The transaction did not start");
+
+        // end the transaction
+        txn.commitTx();
+
+        // there should now be one fewer transactions
+        if (txn.txCount() >= txnCount)
+            throw new RuntimeException("The transaction did not complete");
+
+        System.out.println("Success");
+    }
+
+}

Modified: labs/jbosstm/trunk/rest-tx/webservice/pom.xml
===================================================================
--- labs/jbosstm/trunk/rest-tx/webservice/pom.xml	2011-06-30 12:23:17 UTC (rev 37181)
+++ labs/jbosstm/trunk/rest-tx/webservice/pom.xml	2011-06-30 14:43:23 UTC (rev 37182)
@@ -161,6 +161,15 @@
           <forkMode>always</forkMode>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <profiles>
@@ -328,7 +337,7 @@
                                      data like classes, methods, etc. EMB-41. Endorsed
                                      required for things like WS support (EMB-61)
                                      -->
-                  <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Djava.endorsed.dirs=${JBOSS_HOME}/lib/endorsed -Djboss.home=${JBOSS_HOME} -Djboss.boot.server.log.dir=${JBOSS_HOME}</argLine>
+                  <argLine>-Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djava.endorsed.dirs=${JBOSS_HOME}/lib/endorsed -Djboss.home=${JBOSS_HOME} -Djboss.boot.server.log.dir=${JBOSS_HOME}</argLine>
                 </configuration>
               </execution>
             </executions>

Added: labs/jbosstm/trunk/rest-tx/webservice/src/main/resources/META-INF/MANIFEST.MF
===================================================================
--- labs/jbosstm/trunk/rest-tx/webservice/src/main/resources/META-INF/MANIFEST.MF	                        (rev 0)
+++ labs/jbosstm/trunk/rest-tx/webservice/src/main/resources/META-INF/MANIFEST.MF	2011-06-30 14:43:23 UTC (rev 37182)
@@ -0,0 +1,2 @@
+Dependencies: org.apache.log4j,org.jboss.jts
+



More information about the jboss-svn-commits mailing list