[jboss-svn-commits] JBL Code SVN: r26407 - in labs/jbosstm/workspace/resttx: demo and 12 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed May 6 16:57:49 EDT 2009
Author: mmusgrov
Date: 2009-05-06 16:57:49 -0400 (Wed, 06 May 2009)
New Revision: 26407
Added:
labs/jbosstm/workspace/resttx/demo/
labs/jbosstm/workspace/resttx/demo/Demo.iml
labs/jbosstm/workspace/resttx/demo/RESTDemo-compile
labs/jbosstm/workspace/resttx/demo/RESTDemo-shell
labs/jbosstm/workspace/resttx/demo/build.xml
labs/jbosstm/workspace/resttx/demo/demo.ipr
labs/jbosstm/workspace/resttx/demo/demo.iws
labs/jbosstm/workspace/resttx/demo/go
labs/jbosstm/workspace/resttx/demo/pom.xml
labs/jbosstm/workspace/resttx/demo/scripts/
labs/jbosstm/workspace/resttx/demo/scripts/qp.py
labs/jbosstm/workspace/resttx/demo/scripts/server.py
labs/jbosstm/workspace/resttx/demo/scripts/simplejson/
labs/jbosstm/workspace/resttx/demo/scripts/simplejson/__init__.py
labs/jbosstm/workspace/resttx/demo/scripts/simplejson/decoder.py
labs/jbosstm/workspace/resttx/demo/scripts/simplejson/encoder.py
labs/jbosstm/workspace/resttx/demo/scripts/simplejson/ordered_dict.py
labs/jbosstm/workspace/resttx/demo/scripts/simplejson/scanner.py
labs/jbosstm/workspace/resttx/demo/scripts/simplejson/tool.py
labs/jbosstm/workspace/resttx/demo/scripts/tx.py
labs/jbosstm/workspace/resttx/demo/src/
labs/jbosstm/workspace/resttx/demo/src/org/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/TxDemo.gwt.xml
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java-
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxService.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxServiceAsync.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/BookingData.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ListBoxWidgetBinding.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Restaurant.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ServicePanel.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/StatusPanel.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Taxi.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Theatre.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/WidgetBinding.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.css
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.html
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/images/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxHelper.java
labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxServiceImpl.java
Log:
Include a demo
Added: labs/jbosstm/workspace/resttx/demo/Demo.iml
===================================================================
--- labs/jbosstm/workspace/resttx/demo/Demo.iml (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/Demo.iml 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module relativePaths="true" type="JAVA_MODULE" version="4">
+ <component name="FacetManager">
+ <facet type="gwt" name="GWT">
+ <configuration>
+ <setting name="gwtSdkUrl" value="file:///usr/local/gwt-linux-1.5.3" />
+ <setting name="gwtScriptOutputStyle" value="DETAILED" />
+ <setting name="runGwtCompilerOnMake" value="true" />
+ <setting name="compilerMaxHeapSize" value="128" />
+ <packaging>
+ <module name="org.jboss.jbossts.rts.demo.TxDemo" path="/org.jboss.jbossts.rts.demo.TxDemo" />
+ </packaging>
+ </configuration>
+ </facet>
+ </component>
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar:///usr/local/gwt-linux-1.5.3/gwt-dev-linux.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar:///usr/local/gwt-linux-1.5.3/gwt-user.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar:///usr/local/gwt-linux-1.5.3/gwt-servlet.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$APPLICATION_HOME_DIR$/lib/javaee.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib/commons-httpclient-3.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib/rest-tx-api-1.0-M1-SNAPSHOT.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="file://$MODULE_DIR$/../tx/src/main/java" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib/commons-codec-1.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib/jbossjts-4.4.0.GA.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib/log4j-1.2.12.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib/resteasy-jaxrs-1.0-RC1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib/jbossts-common-4.4.0.GA.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntryProperties />
+ </component>
+</module>
+
Added: labs/jbosstm/workspace/resttx/demo/RESTDemo-compile
===================================================================
--- labs/jbosstm/workspace/resttx/demo/RESTDemo-compile (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/RESTDemo-compile 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+APPDIR=`dirname $0`;
+GWTHOME=/usr/local/gwt-linux-1.5.3
+java -Xmx256M -cp "$APPDIR/src:$APPDIR/bin:${GWTHOME}/gwt-linux-1.5.3/gwt-user.jar:${GWTHOME}/gwt-dev-linux.jar" com.google.gwt.dev.GWTCompiler -out "$APPDIR/www" "$@" org.jboss.jbossts.rts.demo.TxDemo;
Property changes on: labs/jbosstm/workspace/resttx/demo/RESTDemo-compile
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbosstm/workspace/resttx/demo/RESTDemo-shell
===================================================================
--- labs/jbosstm/workspace/resttx/demo/RESTDemo-shell (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/RESTDemo-shell 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+APPDIR=`dirname $0`;
+
+#GWTHOME=target/dependencies/
+#GWTVER=-1.5.3
+GWTHOME=/usr/local/gwt-linux-1.5.3
+GWTVER=
+
+GWTDEV=target/dependencies/gwt-dev-1.5.3-linux.jar
+GWTUSR=target/dependencies/gwt-user-1.5.3.jar
+#GWTDEV=/usr/local/gwt-linux-1.5.3/gwt-user
+#GWTUSR=/usr/local/gwt-linux-1.5.3/gwt-dev-linux
+
+RESTTX=../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib
+TXAPI_JAR=${RESTTX}/rest-tx-api-1.0-M1-SNAPSHOT.jar
+HTTPC_JAR=${RESTTX}/commons-httpclient-3.1.jar
+LOG_JAR=${RESTTX}/log4j-1.2.12.jar
+CODEC_JAR=${RESTTX}/commons-codec-1.2.jar
+
+#JAXRS_JAR=${RESTTX}/resteasy-jaxrs-1.0-RC1.jar
+
+java -Xmx256M -cp "$APPDIR/src:$APPDIR/build:${GWTHOME}/gwt-user${GWTVER}.jar:${GWTHOME}/gwt-dev${GWTVER}-linux.jar:${TXAPI_JAR}:${HTTPC_JAR}:${LOG_JAR}:${CODEC_JAR}" com.google.gwt.dev.GWTShell -out "$APPDIR/www" "$@" org.jboss.jbossts.rts.demo.TxDemo/TxDemo.html;
Property changes on: labs/jbosstm/workspace/resttx/demo/RESTDemo-shell
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbosstm/workspace/resttx/demo/build.xml
===================================================================
--- labs/jbosstm/workspace/resttx/demo/build.xml (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/build.xml 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source Copyright 2009, 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 name="REST-tx-demo" default="run" basedir=".">
+ <description>
+ build the server side of the GWT demo (proxies coordinator requests) and start an external recovery manager
+ </description>
+ <property name="src" location="src"/>
+ <property name="build" location="build"/>
+
+ <property name="resttx.lib.dir" value="${basedir}/../webservice/target/rest-tx-web-1.0-M1-SNAPSHOT/WEB-INF/lib"/>
+ <property name="xgwt.dir" location="${basedir}/target/dependencies/"/>
+ <property name="xgwt.ver" location="-1.5.3"/>
+ <property name="gwt.dir" location="/usr/local/gwt-linux-1.5.3/"/>
+ <property name="gwt.ver" location=""/>
+ <property name="main.class" value="com.google.gwt.dev.GWTShell"/>
+
+ <property name="html.page" value="org.jboss.jbossts.rts.demo.TxDemo/TxDemo.html"/>
+
+<!--
+ <fileset dir="${gwt.dir}">
+ <include name="gwt-dev${gwt.ver}-linux.jar"/>
+ <include name="gwt-user${gwt.ver}.jar"/>
+ </fileset>
+ -->
+ <path id="classpath">
+ <pathelement location="${build}"/>
+ <pathelement location="${src}"/>
+
+ <fileset dir="${gwt.dir}">
+ <include name="gwt-dev-linux.jar"/>
+ <include name="gwt-user.jar"/>
+ </fileset>
+
+ <fileset dir="${resttx.lib.dir}">
+ <include name="rest-tx-api-1.0-M1-SNAPSHOT.jar"/>
+ <include name="resteasy-jaxrs-1.0-RC1.jar"/>
+ <include name="commons-httpclient-3.1.jar"/>
+ <include name="log4j-1.2.12.jar"/>
+ <include name="commons-codec-1.2.jar"/>
+ </fileset>
+ </path>
+
+ <target name="init">
+ <mkdir dir="${build}"/>
+ <mkdir dir="scripts/tmp"/>
+ </target>
+
+ <target name="compile" depends="init" >
+ <javac srcdir="${src}" destdir="${build}">
+ <classpath refid="classpath"/>
+ </javac>
+ </target>
+
+ <target name="run" depends="compile">
+ <java classname="${main.class}" fork="yes" dir=".">
+ <classpath refid="classpath"/>
+ <jvmarg value="-Xmx256M"/>
+ <arg value="-out" />
+ <arg value="www" />
+ <arg value="${html.page}" />
+ </java>
+ </target>
+
+ <target name="clean" >
+ <delete dir="${build}"/>
+ <delete dir="tomcat"/>
+ <delete dir="www"/>
+ <delete dir="out"/>
+ <delete dir="target"/>
+ <delete dir="scripts/tmp"/>
+ <delete>
+ <fileset dir="scripts" includes="**/*.pyc"/>
+ </delete>
+ </target>
+</project>
Added: labs/jbosstm/workspace/resttx/demo/demo.ipr
===================================================================
--- labs/jbosstm/workspace/resttx/demo/demo.ipr (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/demo.ipr 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,273 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project relativePaths="false" version="4">
+ <component name="AntConfiguration">
+ <defaultAnt bundledAnt="true" />
+ </component>
+ <component name="BuildJarProjectSettings">
+ <option name="BUILD_JARS_ON_MAKE" value="false" />
+ </component>
+ <component name="CodeStyleProjectProfileManger">
+ <option name="PROJECT_PROFILE" />
+ <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+ </component>
+ <component name="CodeStyleSettingsManager">
+ <option name="PER_PROJECT_SETTINGS" />
+ <option name="USE_PER_PROJECT_SETTINGS" value="false" />
+ </component>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac" />
+ <option name="DEPLOY_AFTER_MAKE" value="0" />
+ <resourceExtensions>
+ <entry name=".+\.(properties|xml|html|dtd|tld)" />
+ <entry name=".+\.(gif|png|jpeg|jpg)" />
+ </resourceExtensions>
+ <wildcardResourcePatterns>
+ <entry name="?*.properties" />
+ <entry name="?*.xml" />
+ <entry name="?*.gif" />
+ <entry name="?*.png" />
+ <entry name="?*.jpeg" />
+ <entry name="?*.jpg" />
+ <entry name="?*.html" />
+ <entry name="?*.dtd" />
+ <entry name="?*.tld" />
+ </wildcardResourcePatterns>
+ </component>
+ <component name="CppTools.Loader" reportImplicitCastToBool="false" version="1" />
+ <component name="DependenciesAnalyzeManager">
+ <option name="myForwardDirection" value="false" />
+ </component>
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
+ <component name="EclipseCompilerSettings">
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="true" />
+ <option name="DEPRECATION" value="false" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ </component>
+ <component name="EclipseEmbeddedCompilerSettings">
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="true" />
+ <option name="DEPRECATION" value="false" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ </component>
+ <component name="EntryPointsManager">
+ <entry_points version="2.0" />
+ </component>
+ <component name="FacetAutodetectingManager">
+ <autodetection-disabled>
+ <facet-type id="web">
+ <modules>
+ <module name="Demo">
+ <files>
+ <file url="file://$PROJECT_DIR$/tomcat/conf/web.xml" />
+ <file url="file://$PROJECT_DIR$/tomcat/webapps/ROOT/WEB-INF/web.xml" />
+ </files>
+ </module>
+ </modules>
+ </facet-type>
+ </autodetection-disabled>
+ </component>
+ <component name="IdProvider" IDEtalkID="3ADD3A71D4ED4170C5A947B58B847444" />
+ <component name="InspectionProjectProfileManager">
+ <option name="PROJECT_PROFILE" value="Project Default" />
+ <option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
+ <scopes />
+ <profiles>
+ <profile version="1.0" is_locked="false">
+ <option name="myName" value="Project Default" />
+ <option name="myLocal" value="false" />
+ <inspection_tool class="EmptyCatchBlock" level="WARNING" enabled="false">
+ <option name="m_includeComments" value="true" />
+ <option name="m_ignoreTestCases" value="true" />
+ <option name="m_ignoreIgnoreParameter" value="true" />
+ </inspection_tool>
+ </profile>
+ </profiles>
+ <list size="0" />
+ </component>
+ <component name="JavacSettings">
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="DEPRECATION" value="true" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ <option name="MAXIMUM_HEAP_SIZE" value="128" />
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="OPTION_SCOPE" value="protected" />
+ <option name="OPTION_HIERARCHY" value="true" />
+ <option name="OPTION_NAVIGATOR" value="true" />
+ <option name="OPTION_INDEX" value="true" />
+ <option name="OPTION_SEPARATE_INDEX" value="true" />
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
+ <option name="OPTION_DEPRECATED_LIST" value="true" />
+ <option name="OTHER_OPTIONS" value="" />
+ <option name="HEAP_SIZE" />
+ <option name="LOCALE" />
+ <option name="OPEN_IN_BROWSER" value="true" />
+ </component>
+ <component name="JikesSettings">
+ <option name="JIKES_PATH" value="" />
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="DEPRECATION" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="IS_EMACS_ERRORS_MODE" value="true" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ </component>
+ <component name="Palette2">
+ <group name="Swing">
+ <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
+ </item>
+ <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
+ <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
+ <initial-values>
+ <property name="text" value="Button" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="RadioButton" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="CheckBox" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
+ <initial-values>
+ <property name="text" value="Label" />
+ </initial-values>
+ </item>
+ <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
+ <preferred-size width="150" height="-1" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
+ <preferred-size width="150" height="50" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
+ <preferred-size width="200" height="200" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
+ </item>
+ <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
+ </item>
+ <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
+ <preferred-size width="-1" height="20" />
+ </default-constraints>
+ </item>
+ <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
+ <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
+ </item>
+ <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
+ <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
+ </item>
+ </group>
+ </component>
+ <component name="ProjectFileVersion" converted="true" />
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/Demo.iml" filepath="$PROJECT_DIR$/Demo.iml" />
+ </modules>
+ </component>
+ <component name="ProjectRootManager" version="2" assert-keyword="true" jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK">
+ <output url="file://$PROJECT_DIR$/out" />
+ </component>
+ <component name="ResourceManagerContainer">
+ <option name="myResourceBundles">
+ <value>
+ <list size="0" />
+ </value>
+ </option>
+ </component>
+ <component name="RmicSettings">
+ <option name="IS_EANABLED" value="false" />
+ <option name="DEBUGGING_INFO" value="true" />
+ <option name="GENERATE_NO_WARNINGS" value="false" />
+ <option name="GENERATE_IIOP_STUBS" value="false" />
+ <option name="ADDITIONAL_OPTIONS_STRING" value="" />
+ </component>
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="" />
+ </component>
+ <component name="WebServicesPlugin" addRequiredLibraries="true" />
+</project>
+
Added: labs/jbosstm/workspace/resttx/demo/demo.iws
===================================================================
--- labs/jbosstm/workspace/resttx/demo/demo.iws (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/demo.iws 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,727 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project relativePaths="false" version="4">
+ <component name="CCaseConfig">
+ <option name="checkoutReserved" value="false" />
+ <option name="markExternalChangeAsUpToDate" value="true" />
+ <option name="checkInUseHijack" value="true" />
+ <option name="useUcmModel" value="true" />
+ <option name="isOffline" value="false" />
+ <option name="synchOutside" value="false" />
+ <option name="isHistoryResticted" value="true" />
+ <option name="useIdenticalSwitch" value="true" />
+ <option name="synchActivitiesOnRefresh" value="true" />
+ <option name="lastScr" value="" />
+ <option name="scrTextFileName" value="" />
+ <option name="historyRevisionsNumber" value="4" />
+ </component>
+ <component name="ChangeListManager">
+ <list default="true" name="Default" comment="" />
+ <ignored path="demo.iws" />
+ <ignored path=".idea/workspace.xml" />
+ </component>
+ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
+ <component name="Commander">
+ <leftPanel />
+ <rightPanel />
+ <splitter proportion="0.5" />
+ </component>
+ <component name="CreatePatchCommitExecutor">
+ <option name="PATCH_PATH" value="" />
+ <option name="REVERSE_PATCH" value="false" />
+ </component>
+ <component name="DaemonCodeAnalyzer">
+ <disable_hints />
+ </component>
+ <component name="DebuggerManager">
+ <line_breakpoints>
+ <breakpoint url="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/server/TxServiceImpl.java" line="15" class="org.jboss.jbossts.rts.demo.server.TxServiceImpl" package="org.jboss.jbossts.rts.demo.server">
+ <option name="ENABLED" value="true" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
+ <breakpoint url="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/server/TxHelper.java" line="53" class="org.jboss.jbossts.rts.demo.server.TxHelper" package="org.jboss.jbossts.rts.demo.server">
+ <option name="ENABLED" value="true" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
+ </line_breakpoints>
+ <breakpoint_any>
+ <breakpoint>
+ <option name="NOTIFY_CAUGHT" value="true" />
+ <option name="NOTIFY_UNCAUGHT" value="true" />
+ <option name="ENABLED" value="false" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
+ <breakpoint>
+ <option name="NOTIFY_CAUGHT" value="true" />
+ <option name="NOTIFY_UNCAUGHT" value="true" />
+ <option name="ENABLED" value="false" />
+ <option name="LOG_ENABLED" value="false" />
+ <option name="LOG_EXPRESSION_ENABLED" value="false" />
+ <option name="SUSPEND_POLICY" value="SuspendAll" />
+ <option name="COUNT_FILTER_ENABLED" value="false" />
+ <option name="COUNT_FILTER" value="0" />
+ <option name="CONDITION_ENABLED" value="false" />
+ <option name="CLASS_FILTERS_ENABLED" value="false" />
+ <option name="INSTANCE_FILTERS_ENABLED" value="false" />
+ <option name="CONDITION" value="" />
+ <option name="LOG_MESSAGE" value="" />
+ </breakpoint>
+ </breakpoint_any>
+ <breakpoint_rules />
+ <ui_properties />
+ </component>
+ <component name="ErrorTreeViewConfiguration">
+ <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+ <option name="HIDE_WARNINGS" value="false" />
+ </component>
+ <component name="FavoritesManager">
+ <favorites_list name="demo" />
+ </component>
+ <component name="FileEditorManager">
+ <leaf>
+ <file leaf-file-name="TxDemo.css" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/public/TxDemo.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="29" column="26" selection-start="472" selection-end="472" vertical-scroll-proportion="0.18978103">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="TxHelper.java" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/server/TxHelper.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="53" column="0" selection-start="1821" selection-end="1821" vertical-scroll-proportion="0.018248174">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="TxServiceImpl.java" pinned="false" current="true" current-in-tab="true">
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/server/TxServiceImpl.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="23" column="6" selection-start="605" selection-end="605" vertical-scroll-proportion="0.26277372">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ </leaf>
+ </component>
+ <component name="FindManager">
+ <FindUsagesManager>
+ <setting name="OPEN_NEW_TAB" value="false" />
+ </FindUsagesManager>
+ </component>
+ <component name="HierarchyBrowserManager">
+ <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+ <option name="SORT_ALPHABETICALLY" value="false" />
+ <option name="HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED" value="false" />
+ </component>
+ <component name="ModuleEditorState">
+ <option name="LAST_EDITED_MODULE_NAME" />
+ <option name="LAST_EDITED_TAB_NAME" />
+ </component>
+ <component name="ProjectLevelVcsManager">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <OptionsSetting value="true" id="Undo Check Out" />
+ <OptionsSetting value="true" id="Get Latest Version" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+ <component name="ProjectPane">
+ <subPane>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Libraries" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.LibraryGroupNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/server" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/public" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="Demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="PsiDirectory:$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/service" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ </subPane>
+ </component>
+ <component name="ProjectReloadState">
+ <option name="STATE" value="0" />
+ </component>
+ <component name="ProjectView">
+ <navigator currentView="ProjectPane" proportions="0.16666667" version="1" splitterProportion="0.5">
+ <flattenPackages />
+ <showMembers />
+ <showModules />
+ <showLibraryContents />
+ <hideEmptyPackages />
+ <abbreviatePackageNames />
+ <showStructure ProjectPane="false" />
+ <autoscrollToSource ProjectPane="true" />
+ <autoscrollFromSource ProjectPane="true" />
+ <sortByType />
+ </navigator>
+ </component>
+ <component name="PropertiesComponent">
+ <property name="GoToFile.includeJavaFiles" value="false" />
+ <property name="GoToClass.toSaveIncludeLibraries" value="false" />
+ <property name="RunManagerConfig.showSettingsBeforeRunnig" value="false" />
+ <property name="MemberChooser.sorted" value="false" />
+ <property name="MemberChooser.showClasses" value="true" />
+ <property name="TEMP_MODULE_EXPLODED_DIR_FOR_Demo/web/Web" value="/tmp/webExplodedDir8662tmp" />
+ <property name="GoToClass.includeLibraries" value="false" />
+ <property name="MemberChooser.copyJavadoc" value="false" />
+ </component>
+ <component name="RecentsManager">
+ <key name="CreateClassDialog.RecentsKey">
+ <recent name="org.jboss.jbossts.rts.demo.server" />
+ </key>
+ </component>
+ <component name="RunManager" selected="GWT Configuration.Unnamed">
+ <configuration default="true" type="GWT.ConfigurationType" factoryName="GWT Configuration">
+ <module name="" />
+ <option name="VM_PARAMETERS" value="" />
+ <option name="SHELL_PARAMETERS" value="" />
+ <option name="RUN_PAGE" value="" />
+ <method>
+ <option name="Make" value="false" />
+ </method>
+ </configuration>
+ <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
+ <option name="MAIN_CLASS_NAME" />
+ <option name="VM_PARAMETERS" />
+ <option name="PROGRAM_PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="ENABLE_SWING_INSPECTOR" value="false" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <module name="" />
+ <envs />
+ </configuration>
+ <configuration default="true" type="Remote" factoryName="Remote">
+ <option name="USE_SOCKET_TRANSPORT" value="true" />
+ <option name="SERVER_MODE" value="false" />
+ <option name="SHMEM_ADDRESS" value="javadebug" />
+ <option name="HOST" value="localhost" />
+ <option name="PORT" value="5005" />
+ </configuration>
+ <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+ <module name="" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="TEST_OBJECT" value="class" />
+ <option name="VM_PARAMETERS" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <option name="ADDITIONAL_CLASS_PATH" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="wholeProject" />
+ </option>
+ <envs />
+ <method>
+ <option name="Make" value="true" />
+ </method>
+ </configuration>
+ <configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
+ <module name="" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ <option name="SUITE_NAME" />
+ <option name="PACKAGE_NAME" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="METHOD_NAME" />
+ <option name="GROUP_NAME" />
+ <option name="TEST_OBJECT" value="CLASS" />
+ <option name="VM_PARAMETERS" />
+ <option name="PARAMETERS" />
+ <option name="WORKING_DIRECTORY" />
+ <option name="OUTPUT_DIRECTORY" />
+ <option name="ANNOTATION_TYPE" />
+ <option name="ENV_VARIABLES" />
+ <option name="PASS_PARENT_ENVS" value="true" />
+ <option name="ADDITIONAL_CLASS_PATH" />
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="wholeProject" />
+ </option>
+ <option name="PROPERTIES_FILE" />
+ <envs />
+ <properties />
+ <listeners />
+ <method>
+ <option name="Make" value="true" />
+ </method>
+ </configuration>
+ <configuration default="true" type="Applet" factoryName="Applet">
+ <module name="" />
+ <option name="MAIN_CLASS_NAME" />
+ <option name="HTML_FILE_NAME" />
+ <option name="HTML_USED" value="false" />
+ <option name="WIDTH" value="400" />
+ <option name="HEIGHT" value="300" />
+ <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
+ <option name="VM_PARAMETERS" />
+ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+ <option name="ALTERNATIVE_JRE_PATH" />
+ </configuration>
+ <configuration default="false" name="Unnamed" type="GWT.ConfigurationType" factoryName="GWT Configuration">
+ <module name="Demo" />
+ <option name="VM_PARAMETERS" value="-Xmx512M" />
+ <option name="SHELL_PARAMETERS" value="" />
+ <option name="RUN_PAGE" value="org.jboss.jbossts.rts.demo.TxDemo/TxDemo.html" />
+ <RunnerSettings RunnerId="Debug">
+ <option name="DEBUG_PORT" value="54325" />
+ <option name="TRANSPORT" value="0" />
+ <option name="LOCAL" value="true" />
+ </RunnerSettings>
+ <RunnerSettings RunnerId="JProfiler">
+ <option name="WINDOW" value="false" />
+ <option name="JVMPI" value="false" />
+ <option name="INTERPRETED" value="false" />
+ </RunnerSettings>
+ <RunnerSettings RunnerId="Run" />
+ <ConfigurationWrapper RunnerId="Debug" />
+ <ConfigurationWrapper RunnerId="Run" />
+ <method>
+ <option name="Make" value="false" />
+ </method>
+ </configuration>
+ <list size="1">
+ <item index="0" class="java.lang.String" itemvalue="GWT Configuration.Unnamed" />
+ </list>
+ <configuration name="<template>" type="WebApp" default="true" selected="false">
+ <Host>localhost</Host>
+ <Port>5050</Port>
+ </configuration>
+ </component>
+ <component name="StarteamConfiguration">
+ <option name="SERVER" value="" />
+ <option name="PORT" value="49201" />
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="PROJECT" value="" />
+ <option name="VIEW" value="" />
+ <option name="ALTERNATIVE_WORKING_PATH" value="" />
+ <option name="LOCK_ON_CHECKOUT" value="false" />
+ <option name="UNLOCK_ON_CHECKIN" value="false" />
+ </component>
+ <component name="StructureViewFactory">
+ <option name="AUTOSCROLL_MODE" value="true" />
+ <option name="AUTOSCROLL_FROM_SOURCE" value="false" />
+ <option name="ACTIVE_ACTIONS" value="" />
+ </component>
+ <component name="SvnConfiguration">
+ <option name="USER" value="" />
+ <option name="PASSWORD" value="" />
+ <option name="LAST_MERGED_REVISION" />
+ <option name="UPDATE_RUN_STATUS" value="false" />
+ <option name="UPDATE_RECURSIVELY" value="true" />
+ <option name="MERGE_DRY_RUN" value="false" />
+ </component>
+ <component name="TodoView" selected-index="0">
+ <todo-panel id="selected-file">
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="true" />
+ </todo-panel>
+ <todo-panel id="all">
+ <are-packages-shown value="true" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="true" />
+ </todo-panel>
+ <todo-panel id="default-changelist">
+ <are-packages-shown value="false" />
+ <are-modules-shown value="false" />
+ <flatten-packages value="false" />
+ <is-autoscroll-to-source value="false" />
+ </todo-panel>
+ </component>
+ <component name="ToolWindowManager">
+ <frame x="0" y="25" width="1680" height="1000" extended-state="0" />
+ <editor active="false" />
+ <layout>
+ <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+ <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+ <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3280318" order="1" />
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.44665885" order="3" />
+ <window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+ <window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32942554" order="8" />
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="7" />
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="1" />
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="0" />
+ <window_info id="Maven projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+ <window_info id="JProfiler" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+ <window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+ <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.216" order="0" />
+ <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="6" />
+ <window_info id="Duplicates" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32942554" order="2" />
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="5" />
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="0" />
+ <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
+ <window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="4" />
+ </layout>
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="OFFER_MOVE_TO_ANOTHER_CHANGELIST_ON_PARTIAL_COMMIT" value="true" />
+ <option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="true" />
+ <option name="PERFORM_UPDATE_IN_BACKGROUND" value="false" />
+ <option name="PERFORM_COMMIT_IN_BACKGROUND" value="false" />
+ <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
+ <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
+ <option name="LAST_COMMIT_MESSAGE" />
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
+ <option name="ACTIVE_VCS_NAME" />
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false" />
+ <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
+ </component>
+ <component name="VssConfiguration">
+ <option name="CLIENT_PATH" value="" />
+ <option name="SRCSAFEINI_PATH" value="" />
+ <option name="USER_NAME" value="" />
+ <option name="PWD" value="" />
+ <CheckoutOptions>
+ <option name="COMMENT" value="" />
+ <option name="DO_NOT_GET_LATEST_VERSION" value="false" />
+ <option name="REPLACE_WRITABLE" value="false" />
+ <option name="RECURSIVE" value="false" />
+ </CheckoutOptions>
+ <CheckinOptions>
+ <option name="COMMENT" value="" />
+ <option name="KEEP_CHECKED_OUT" value="false" />
+ <option name="RECURSIVE" value="false" />
+ </CheckinOptions>
+ <AddOptions>
+ <option name="STORE_ONLY_LATEST_VERSION" value="false" />
+ <option name="CHECK_OUT_IMMEDIATELY" value="false" />
+ </AddOptions>
+ <UndocheckoutOptions>
+ <option name="MAKE_WRITABLE" value="false" />
+ <option name="REPLACE_LOCAL_COPY" value="2" />
+ <option name="RECURSIVE" value="false" />
+ </UndocheckoutOptions>
+ <GetOptions>
+ <option name="REPLACE_WRITABLE" value="0" />
+ <option name="MAKE_WRITABLE" value="false" />
+ <option name="ANSWER_NEGATIVELY" value="false" />
+ <option name="ANSWER_POSITIVELY" value="false" />
+ <option name="RECURSIVE" value="false" />
+ <option name="VERSION" />
+ </GetOptions>
+ </component>
+ <component name="antWorkspaceConfiguration">
+ <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
+ <option name="FILTER_TARGETS" value="false" />
+ </component>
+ <component name="editorHistoryManager">
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/service/Restaurant.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="10" column="13" selection-start="353" selection-end="353" vertical-scroll-proportion="0.29069766">
+ <folding>
+ <element signature="imports" expanded="true" />
+ </folding>
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/service/StatusPanel.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="5" column="13" selection-start="161" selection-end="161" vertical-scroll-proportion="0.11627907">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/service/Taxi.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="9" column="13" selection-start="352" selection-end="352" vertical-scroll-proportion="0.11627907">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/service/Theatre.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="9" column="13" selection-start="352" selection-end="352" vertical-scroll-proportion="0.14563107">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/service/BookingData.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="4" column="6" selection-start="111" selection-end="111" vertical-scroll-proportion="0.06269593">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/service/ServicePanel.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="18" column="79" selection-start="656" selection-end="656" vertical-scroll-proportion="0.015673982">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="518" column="17" selection-start="18527" selection-end="18527" vertical-scroll-proportion="0.015673982">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/TxService.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="4" column="17" selection-start="115" selection-end="115" vertical-scroll-proportion="0.06269593">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/TxDemo.gwt.xml">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="23" column="31" selection-start="1078" selection-end="1089" vertical-scroll-proportion="0.36780384">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/client/TxServiceAsync.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="4" column="17" selection-start="115" selection-end="115" vertical-scroll-proportion="0.06269593">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/public/TxDemo.html">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="22" column="95" selection-start="1095" selection-end="1095" vertical-scroll-proportion="0.3618421">
+ <folding />
+ </state>
+ </provider>
+ <provider editor-type-id="HtmlPreview">
+ <state />
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/build.xml">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="10" column="38" selection-start="439" selection-end="439" vertical-scroll-proportion="0.015991472">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/public/TxDemo.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="29" column="26" selection-start="472" selection-end="472" vertical-scroll-proportion="0.18978103">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/server/TxHelper.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="53" column="0" selection-start="1821" selection-end="1821" vertical-scroll-proportion="0.018248174">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/src/org/jboss/jbossts/rts/demo/server/TxServiceImpl.java">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="23" column="6" selection-start="605" selection-end="605" vertical-scroll-proportion="0.26277372">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </component>
+</project>
+
Added: labs/jbosstm/workspace/resttx/demo/go
===================================================================
--- labs/jbosstm/workspace/resttx/demo/go (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/go 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#Don't forget to build the GWT server side (using ant compile)
+#Make sure build.xml points to the correct GWT location
+#Everything else build automatically on demand
+
+(cd ../webservice; xterm -geom 132x40 -leftbar -sb -sl 2000 -title Coordinator -e ./go&)
+(cd ..; xterm -geom 132x40 -leftbar -sb -sl 2000 -title RecoveryManager -e ./recovery&)
+
+sleep 2
+
+(cd scripts; xterm -geom 132x40 -leftbar -sb -sl 2000 -title Theatre -e python server.py port=8000&)
+(cd scripts; xterm -geom 132x40 -leftbar -sb -sl 2000 -title Restaurant -e python server.py port=8001&)
+(cd scripts; xterm -geom 132x40 -leftbar -sb -sl 2000 -title Taxi -e python server.py port=8002&)
+
+./RESTDemo-shell &
Property changes on: labs/jbosstm/workspace/resttx/demo/go
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbosstm/workspace/resttx/demo/pom.xml
===================================================================
--- labs/jbosstm/workspace/resttx/demo/pom.xml (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/pom.xml 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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">
+ <!--
+ GWT-Maven example POM without google.webtoolkit.home SET (GWT as deps)
+ -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.jbossts.rts</groupId>
+ <artifactId>rest-tx-demo</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>RESTful Transactions Demo</name>
+
+ <!-- include the GWT-Maven repo as plugin, and as standard -->
+ <pluginRepositories>
+ <pluginRepository>
+ <id>gwt-maven</id>
+ <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <repositories>
+ <repository>
+ <id>gwt-maven</id>
+ <url>
+ http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/
+ </url>
+ </repository>
+ </repositories>
+
+ <!-- convenience to define GWT version in one place -->
+ <properties>
+ <gwtVersion>1.5.3</gwtVersion>
+ </properties>
+
+ <dependencies>
+ <!-- GWT deps (from central repo) -->
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${gwtVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${gwtVersion}</version>
+ <classifier>${platform}</classifier>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- profiles (with activation per platform) -->
+ <profiles>
+ <profile>
+ <id>gwt-dev-windows</id>
+ <properties>
+ <platform>windows</platform>
+ </properties>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <os>
+ <family>windows</family>
+ </os>
+ </activation>
+ </profile>
+ <profile>
+ <id>gwt-dev-mac</id>
+ <properties>
+ <platform>mac</platform>
+ </properties>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <os>
+ <family>mac</family>
+ </os>
+ </activation>
+ </profile>
+ <profile>
+ <id>gwt-dev-linux</id>
+ <properties>
+ <platform>linux</platform>
+ </properties>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <os>
+ <name>linux</name>
+ </os>
+ </activation>
+ </profile>
+ </profiles>
+</project>
Added: labs/jbosstm/workspace/resttx/demo/scripts/qp.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/qp.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/qp.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,221 @@
+#!/usr/bin/python
+"""
+QuickPut 1.5 - http://infomesh.net/2001/QuickPut/
+
+This is a program that enables one to load files onto a server using
+the HTTP PUT method. It supports basic and digest authentication.
+
+Usage: QuickPut [ --help ] [ --v ] file http_uri [ uname pswd ]
+
+ --help - Prints this message out
+ --v - Turns on "verbose" mode
+
+"file" is the local file to upload, and "http_uri" is the target.
+"uname" and "pswd" are optional authentication details.
+"""
+
+__author__ = 'Sean B. Palmer'
+__license__ = 'Copyright (C) 2001 Sean B. Palmer. GNU GPL 2'
+__version__ = '1.5'
+__cvsid__ = '$Id$'
+
+import sys, string, re, os, base64, md5, sha, time
+import httplib, urlparse, urllib, urllib2
+
+UAID = 'QuickPut/'+__version__+' (http://infomesh.net/2001/QuickPut/)'
+if ('-v' in sys.argv) or ('--v' in sys.argv): VERBOSE = 1
+else: VERBOSE = 0
+
+def perr(s):
+ """The standard error printing function.
+ Can go to STDERR, STDOUT, or both."""
+ if VERBOSE:
+ sys.stderr.write(s.strip()+'\n\n')
+ print s.strip()+'\n'
+
+def precondition(uri, auth=None):
+ """HEAD a resource, and return the code
+ Could be extended to get the ETag, etc."""
+ perr('Sending HEAD request to: '+uri)
+ u = urlparse.urlparse(uri)
+ n, p = u[1], u[2]
+ if '@' in n: sys.exit(0)
+ h = httplib.HTTP(n)
+ h.putrequest('HEAD', p)
+ if auth:
+ perr('Auth: '+str(auth))
+ if 'type' in auth.keys():
+ if auth['type'] == 'Basic': authtobasic(auth, h)
+ elif auth['type'] == 'Digest': authtodigest(auth, h, uri, 'HEAD')
+ h.putheader('Accept', '*/*')
+ h.putheader('Accept-Encoding', '*,deflate')
+ h.putheader('TE', 'trailers,deflate')
+ h.putheader('User-Agent', UAID)
+ h.putheader('Connection', 'TE,Keep-Alive')
+ h.endheaders()
+ errcode, errmsg, headers = h.getreply()
+ h.close()
+ perr('HEAD response code: '+str(errcode)+'\nResponse headers: '+str(headers))
+ if auth:
+ if ('type' in auth.keys()) and (errcode == 401):
+ perr('Authorization failed!\n'+'Auth: '+headers['www-authenticate'])
+ sys.exit(0) # Stops it from contunually looping
+ return errcode, errmsg, headers
+
+def put(fn, uri, auth=None):
+ errcode, errmsg, headers = precondition(uri, auth=auth)
+ if errcode in (301, 302):
+ if not auth: put(fn, headers['Location'])
+ else: put(fn, headers['Location'], auth=auth)
+ elif errcode == 401:
+ wwwauth = headers['www-authenticate']
+ match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', wwwauth)
+ scheme, realm = match.groups()
+ if scheme.lower() == 'basic':
+ perr('HTTP Basic authentication spotted')
+ if not auth:
+ perr('No authentication details given!')
+ sys.exit(0) # Stops it from contunually looping
+ auth['type'] = 'Basic'
+ put(fn, uri, auth=auth)
+ elif scheme.lower() == 'digest':
+ # 2001-07-19 14:08:03 <DanC_tst> pls support digest auth as well as
+ # basic. Don't encourage users to send their passwords in the clear.
+ perr('HTTP Digest authentication spotted')
+ if not auth:
+ perr('No authentication details given!')
+ sys.exit(0)
+ auth['type'], auth['data'] = 'Digest', wwwauth
+ put(fn, uri, auth=auth)
+ elif errcode in (200, 204, 206, 404): putdata(fn, uri, auth=auth)
+ else: perr('Got error code: '+str(errcode)) # e.g. 403, 501
+
+# Basic Authentication
+
+def authtobasic(auth, h):
+ """Converts basic auth data into an HTTP header."""
+ userpass = auth['uname']+':'+auth['pswd']
+ userpass = base64.encodestring(urllib.unquote(userpass)).strip()
+ h.putheader('Authorization', 'Basic '+userpass)
+ perr('Authorization: Basic '+userpass)
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+#
+# D I G E S T A U T H E N T I C A T I O N S T U F F
+# These functions are based on the stuff in urllib2
+#
+
+def authtodigest(auth, h, uri, method):
+ user, pw, a = auth['uname'], auth['pswd'], auth['data']
+ x = http_digest_auth(a, uri, user, pw, method)
+ h.putheader('Authorization', x)
+ perr('Authorization: '+x)
+
+def http_digest_auth(a, uri, user, pw, method):
+ token, challenge = a.split(' ', 1)
+ chal = urllib2.parse_keqv_list(urllib2.parse_http_list(challenge))
+ a = get_authorization(chal, uri, user, pw, method)
+ if a: return 'Digest %s' % a
+
+def get_authorization(chal, uri, user, pw, method):
+ try:
+ realm, nonce = chal['realm'], chal['nonce']
+ algorithm, opaque = chal.get('algorithm', 'MD5'), chal.get('opaque', None)
+ except KeyError: return None
+ H, KD = get_algorithm_impls(algorithm)
+ if H is None: return None
+ A1, A2 = "%s:%s:%s" % (user, realm, pw), "%s:%s" % (method, uri)
+ respdig = KD(H(A1), "%s:%s" % (nonce, H(A2)))
+ base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \
+ 'response="%s"' % (user, realm, nonce, uri, respdig)
+ if opaque: base = base + ', opaque="%s"' % opaque
+ if algorithm != 'MD5': base = base + ', algorithm="%s"' % algorithm
+ return base
+
+def get_algorithm_impls(algorithm):
+ if algorithm == 'MD5':
+ H = lambda x, e=urllib2.encode_digest:e(md5.new(x).digest())
+ elif algorithm == 'SHA':
+ H = lambda x, e=urllib2.encode_digest:e(sha.new(x).digest())
+ KD = lambda s, d, H=H: H("%s:%s" % (s, d))
+ return H, KD
+
+#
+# End of Digest Authentication functions
+#
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+
+def putdata(fn, uri, auth=None):
+ f, u = open(fn, 'r'), urlparse.urlparse(uri)
+ b = f.read()
+ s = str(len(b))
+ n, p = u[1], u[2]
+ perr('PUTing to: '+uri+'\nData: Content-Length: '+s+', Snippet: "'+b[:35]+'"')
+ h = httplib.HTTP(n)
+ h.putrequest('PUT', p)
+ h.putheader('Accept', '*/*')
+ h.putheader('Allow', 'PUT')
+ if auth:
+ if 'type' in auth.keys():
+ if auth['type'] == 'Basic': authtobasic(auth, h)
+ elif auth['type'] == 'Digest': authtodigest(auth, h, uri, 'PUT')
+ h.putheader('Accept-Encoding', '*,deflate')
+ h.putheader('Expect', '100-continue')
+ h.putheader('User-Agent', UAID)
+ h.putheader('Connection', 'Keep-Alive')
+ h.putheader('Content-Type', 'text/html')
+ h.putheader('Content-Length', s)
+ h.endheaders()
+ h.send(b)
+ perr('Getting reply...')
+ errcode, errmsg, headers = h.getreply()
+ # body = h.getfile().read(500)
+ perr('Got reply')
+ h.close()
+ if errcode in (301, 302):
+ perr('PUT data error code was '+str(errcode))
+ if not auth: put(fn, headers['Location'])
+ else: put(fn, headers['Location'], auth=auth)
+ elif errcode == 401:
+ perr('Authorization failed!\n'+'Auth: '+headers['www-authenticate'])
+ sys.exit(0) # Stops it from continually looping
+ else:
+ perr('Done: '+str(errcode)+': '+str(errmsg)+'\n'+str(headers))
+ if errcode in (200, 201, 204):
+ sys.stderr.write('PUT succeeded!')
+ # perr(body)
+ elif errcode == 405: sys.stderr.write('PUT failed!')
+ elif errcode == 404: perr('PUT failed: 404!')
+
+# Utility functions
+
+def prompt():
+ """Prompts for the file name and URI to PUT to."""
+ sys.stderr.write('Enter the name of the file you want to HTTP PUT: \n')
+ fn = raw_input()
+ sys.stderr.write('Enter the URI to HTTP PUT to: \n')
+ uri = raw_input()
+ if uri[-1] == '/':
+ sys.stderr.write('URI ends with a "/"; please enter a file name: \n')
+ urifn = raw_input()
+ uri = uri+urifn
+ sys.stderr.write('Thank you. Saving to: '+uri+'\n')
+ put(fn, uri)
+
+def help():
+ print string.strip(__doc__)
+ sys.exit(0)
+
+def run():
+ HelpFlags, argv = ('-help', '--help'), sys.argv[:]
+ for x in sys.argv:
+ if x in HelpFlags: help()
+ if x[0] == '-': argv.remove(x)
+ s = len(argv)-1
+ # perr(str(argv)+' '+str(VERBOSE))
+ if s == 2: put(argv[1], argv[2])
+ elif s == 4: put(argv[1], argv[2], auth={'uname': argv[3], 'pswd': argv[4]})
+ else: help()
+
+if __name__=="__main__":
+ run()
Added: labs/jbosstm/workspace/resttx/demo/scripts/server.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/server.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/server.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,54 @@
+#!/usr/bin/env python2.4
+
+"""
+JBoss, Home of Professional Open Source Copyright 2008, 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.
+"""
+
+import BaseHTTPServer
+import SimpleHTTPServer
+import sys
+
+from tx import get_handler
+from tx import post_handler
+
+port = 8000
+
+for arg in sys.argv:
+ nvp = arg.split('=')
+ if nvp[0] == 'port':
+ port = int(nvp[1])
+
+class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+
+ def do_POST(self):
+ clen = self.headers.getheader('content-length')
+ if clen:
+ post_handler(self, port)
+ else:
+ print 'POST ERROR: missing content-length'
+
+ self.connection.shutdown(1)
+ return
+
+ def do_GET(self):
+ get_handler(self, port)
+
+ self.connection.shutdown(1)
+ return
+
+print 'listening on port ', str(port)
+server = BaseHTTPServer.HTTPServer(('', port), MyHandler)
+server.serve_forever()
Added: labs/jbosstm/workspace/resttx/demo/scripts/simplejson/__init__.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/simplejson/__init__.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/simplejson/__init__.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,363 @@
+r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
+JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
+interchange format.
+
+:mod:`simplejson` exposes an API familiar to users of the standard library
+:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
+version of the :mod:`json` library contained in Python 2.6, but maintains
+compatibility with Python 2.4 and Python 2.5 and (currently) has
+significant performance advantages, even without using the optional C
+extension for speedups.
+
+Encoding basic Python object hierarchies::
+
+ >>> import simplejson as json
+ >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
+ '["foo", {"bar": ["baz", null, 1.0, 2]}]'
+ >>> print json.dumps("\"foo\bar")
+ "\"foo\bar"
+ >>> print json.dumps(u'\u1234')
+ "\u1234"
+ >>> print json.dumps('\\')
+ "\\"
+ >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
+ {"a": 0, "b": 0, "c": 0}
+ >>> from StringIO import StringIO
+ >>> io = StringIO()
+ >>> json.dump(['streaming API'], io)
+ >>> io.getvalue()
+ '["streaming API"]'
+
+Compact encoding::
+
+ >>> import simplejson as json
+ >>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
+ '[1,2,3,{"4":5,"6":7}]'
+
+Pretty printing::
+
+ >>> import simplejson as json
+ >>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)
+ >>> print '\n'.join([l.rstrip() for l in s.splitlines()])
+ {
+ "4": 5,
+ "6": 7
+ }
+
+Decoding JSON::
+
+ >>> import simplejson as json
+ >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
+ >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
+ True
+ >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
+ True
+ >>> from StringIO import StringIO
+ >>> io = StringIO('["streaming API"]')
+ >>> json.load(io)[0] == 'streaming API'
+ True
+
+Specializing JSON object decoding::
+
+ >>> import simplejson as json
+ >>> def as_complex(dct):
+ ... if '__complex__' in dct:
+ ... return complex(dct['real'], dct['imag'])
+ ... return dct
+ ...
+ >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
+ ... object_hook=as_complex)
+ (1+2j)
+ >>> from decimal import Decimal
+ >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1')
+ True
+
+Specializing JSON object encoding::
+
+ >>> import simplejson as json
+ >>> def encode_complex(obj):
+ ... if isinstance(obj, complex):
+ ... return [obj.real, obj.imag]
+ ... raise TypeError(repr(o) + " is not JSON serializable")
+ ...
+ >>> json.dumps(2 + 1j, default=encode_complex)
+ '[2.0, 1.0]'
+ >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
+ '[2.0, 1.0]'
+ >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
+ '[2.0, 1.0]'
+
+
+Using simplejson.tool from the shell to validate and pretty-print::
+
+ $ echo '{"json":"obj"}' | python -m simplejson.tool
+ {
+ "json": "obj"
+ }
+ $ echo '{ 1.2:3.4}' | python -m simplejson.tool
+ Expecting property name: line 1 column 2 (char 2)
+"""
+__version__ = '2.1.0'
+__all__ = [
+ 'dump', 'dumps', 'load', 'loads',
+ 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
+ 'OrderedDict',
+]
+
+__author__ = 'Bob Ippolito <bob at redivi.com>'
+
+from decoder import JSONDecoder, JSONDecodeError
+from encoder import JSONEncoder
+try:
+ from collections import OrderedDict
+except ImportError:
+ from ordered_dict import OrderedDict
+
+_default_encoder = JSONEncoder(
+ skipkeys=False,
+ ensure_ascii=True,
+ check_circular=True,
+ allow_nan=True,
+ indent=None,
+ separators=None,
+ encoding='utf-8',
+ default=None,
+)
+
+def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
+ allow_nan=True, cls=None, indent=None, separators=None,
+ encoding='utf-8', default=None, **kw):
+ """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
+ ``.write()``-supporting file-like object).
+
+ If ``skipkeys`` is true then ``dict`` keys that are not basic types
+ (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
+ will be skipped instead of raising a ``TypeError``.
+
+ If ``ensure_ascii`` is false, then the some chunks written to ``fp``
+ may be ``unicode`` instances, subject to normal Python ``str`` to
+ ``unicode`` coercion rules. Unless ``fp.write()`` explicitly
+ understands ``unicode`` (as in ``codecs.getwriter()``) this is likely
+ to cause an error.
+
+ If ``check_circular`` is false, then the circular reference check
+ for container types will be skipped and a circular reference will
+ result in an ``OverflowError`` (or worse).
+
+ If ``allow_nan`` is false, then it will be a ``ValueError`` to
+ serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
+ in strict compliance of the JSON specification, instead of using the
+ JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
+
+ If ``indent`` is a non-negative integer, then JSON array elements and
+ object members will be pretty-printed with that indent level. An indent
+ level of 0 will only insert newlines. ``None`` is the most compact
+ representation.
+
+ If ``separators`` is an ``(item_separator, dict_separator)`` tuple
+ then it will be used instead of the default ``(', ', ': ')`` separators.
+ ``(',', ':')`` is the most compact JSON representation.
+
+ ``encoding`` is the character encoding for str instances, default is UTF-8.
+
+ ``default(obj)`` is a function that should return a serializable version
+ of obj or raise TypeError. The default simply raises TypeError.
+
+ To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
+ ``.default()`` method to serialize additional types), specify it with
+ the ``cls`` kwarg.
+
+ """
+ # cached encoder
+ if (not skipkeys and ensure_ascii and
+ check_circular and allow_nan and
+ cls is None and indent is None and separators is None and
+ encoding == 'utf-8' and default is None and not kw):
+ iterable = _default_encoder.iterencode(obj)
+ else:
+ if cls is None:
+ cls = JSONEncoder
+ iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
+ check_circular=check_circular, allow_nan=allow_nan, indent=indent,
+ separators=separators, encoding=encoding,
+ default=default, **kw).iterencode(obj)
+ # could accelerate with writelines in some versions of Python, at
+ # a debuggability cost
+ for chunk in iterable:
+ fp.write(chunk)
+
+
+def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
+ allow_nan=True, cls=None, indent=None, separators=None,
+ encoding='utf-8', default=None, **kw):
+ """Serialize ``obj`` to a JSON formatted ``str``.
+
+ If ``skipkeys`` is false then ``dict`` keys that are not basic types
+ (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
+ will be skipped instead of raising a ``TypeError``.
+
+ If ``ensure_ascii`` is false, then the return value will be a
+ ``unicode`` instance subject to normal Python ``str`` to ``unicode``
+ coercion rules instead of being escaped to an ASCII ``str``.
+
+ If ``check_circular`` is false, then the circular reference check
+ for container types will be skipped and a circular reference will
+ result in an ``OverflowError`` (or worse).
+
+ If ``allow_nan`` is false, then it will be a ``ValueError`` to
+ serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
+ strict compliance of the JSON specification, instead of using the
+ JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
+
+ If ``indent`` is a non-negative integer, then JSON array elements and
+ object members will be pretty-printed with that indent level. An indent
+ level of 0 will only insert newlines. ``None`` is the most compact
+ representation.
+
+ If ``separators`` is an ``(item_separator, dict_separator)`` tuple
+ then it will be used instead of the default ``(', ', ': ')`` separators.
+ ``(',', ':')`` is the most compact JSON representation.
+
+ ``encoding`` is the character encoding for str instances, default is UTF-8.
+
+ ``default(obj)`` is a function that should return a serializable version
+ of obj or raise TypeError. The default simply raises TypeError.
+
+ To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
+ ``.default()`` method to serialize additional types), specify it with
+ the ``cls`` kwarg.
+
+ """
+ # cached encoder
+ if (not skipkeys and ensure_ascii and
+ check_circular and allow_nan and
+ cls is None and indent is None and separators is None and
+ encoding == 'utf-8' and default is None and not kw):
+ return _default_encoder.encode(obj)
+ if cls is None:
+ cls = JSONEncoder
+ return cls(
+ skipkeys=skipkeys, ensure_ascii=ensure_ascii,
+ check_circular=check_circular, allow_nan=allow_nan, indent=indent,
+ separators=separators, encoding=encoding, default=default,
+ **kw).encode(obj)
+
+
+_default_decoder = JSONDecoder(encoding=None, object_hook=None,
+ object_pairs_hook=None)
+
+
+def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
+ """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
+ a JSON document) to a Python object.
+
+ *encoding* determines the encoding used to interpret any
+ :class:`str` objects decoded by this instance (``'utf-8'`` by
+ default). It has no effect when decoding :class:`unicode` objects.
+
+ Note that currently only encodings that are a superset of ASCII work,
+ strings of other encodings should be passed in as :class:`unicode`.
+
+ *object_hook*, if specified, will be called with the result of every
+ JSON object decoded and its return value will be used in place of the
+ given :class:`dict`. This can be used to provide custom
+ deserializations (e.g. to support JSON-RPC class hinting).
+
+ *object_pairs_hook* is an optional function that will be called with
+ the result of any object literal decode with an ordered list of pairs.
+ The return value of *object_pairs_hook* will be used instead of the
+ :class:`dict`. This feature can be used to implement custom decoders
+ that rely on the order that the key and value pairs are decoded (for
+ example, :func:`collections.OrderedDict` will remember the order of
+ insertion). If *object_hook* is also defined, the *object_pairs_hook*
+ takes priority.
+
+ *parse_float*, if specified, will be called with the string of every
+ JSON float to be decoded. By default, this is equivalent to
+ ``float(num_str)``. This can be used to use another datatype or parser
+ for JSON floats (e.g. :class:`decimal.Decimal`).
+
+ *parse_int*, if specified, will be called with the string of every
+ JSON int to be decoded. By default, this is equivalent to
+ ``int(num_str)``. This can be used to use another datatype or parser
+ for JSON integers (e.g. :class:`float`).
+
+ *parse_constant*, if specified, will be called with one of the
+ following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
+ can be used to raise an exception if invalid JSON numbers are
+ encountered.
+
+ To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
+ kwarg.
+
+ """
+ return loads(fp.read(),
+ encoding=encoding, cls=cls, object_hook=object_hook,
+ parse_float=parse_float, parse_int=parse_int,
+ parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,
+ **kw)
+
+
+def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
+ """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
+ document) to a Python object.
+
+ *encoding* determines the encoding used to interpret any
+ :class:`str` objects decoded by this instance (``'utf-8'`` by
+ default). It has no effect when decoding :class:`unicode` objects.
+
+ Note that currently only encodings that are a superset of ASCII work,
+ strings of other encodings should be passed in as :class:`unicode`.
+
+ *object_hook*, if specified, will be called with the result of every
+ JSON object decoded and its return value will be used in place of the
+ given :class:`dict`. This can be used to provide custom
+ deserializations (e.g. to support JSON-RPC class hinting).
+
+ *object_pairs_hook* is an optional function that will be called with
+ the result of any object literal decode with an ordered list of pairs.
+ The return value of *object_pairs_hook* will be used instead of the
+ :class:`dict`. This feature can be used to implement custom decoders
+ that rely on the order that the key and value pairs are decoded (for
+ example, :func:`collections.OrderedDict` will remember the order of
+ insertion). If *object_hook* is also defined, the *object_pairs_hook*
+ takes priority.
+
+ *parse_float*, if specified, will be called with the string of every
+ JSON float to be decoded. By default, this is equivalent to
+ ``float(num_str)``. This can be used to use another datatype or parser
+ for JSON floats (e.g. :class:`decimal.Decimal`).
+
+ *parse_int*, if specified, will be called with the string of every
+ JSON int to be decoded. By default, this is equivalent to
+ ``int(num_str)``. This can be used to use another datatype or parser
+ for JSON integers (e.g. :class:`float`).
+
+ *parse_constant*, if specified, will be called with one of the
+ following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
+ can be used to raise an exception if invalid JSON numbers are
+ encountered.
+
+ To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
+ kwarg.
+
+ """
+ if (cls is None and encoding is None and object_hook is None and
+ parse_int is None and parse_float is None and
+ parse_constant is None and object_pairs_hook is None and not kw):
+ return _default_decoder.decode(s)
+ if cls is None:
+ cls = JSONDecoder
+ if object_hook is not None:
+ kw['object_hook'] = object_hook
+ if object_pairs_hook is not None:
+ kw['object_pairs_hook'] = object_pairs_hook
+ if parse_float is not None:
+ kw['parse_float'] = parse_float
+ if parse_int is not None:
+ kw['parse_int'] = parse_int
+ if parse_constant is not None:
+ kw['parse_constant'] = parse_constant
+ return cls(encoding=encoding, **kw).decode(s)
Added: labs/jbosstm/workspace/resttx/demo/scripts/simplejson/decoder.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/simplejson/decoder.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/simplejson/decoder.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,405 @@
+"""Implementation of JSONDecoder
+"""
+import re
+import sys
+import struct
+
+from simplejson.scanner import make_scanner
+try:
+ from simplejson._speedups import scanstring as c_scanstring
+except ImportError:
+ c_scanstring = None
+
+__all__ = ['JSONDecoder']
+
+FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
+
+def _floatconstants():
+ _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
+ # The struct module in Python 2.4 would get frexp() out of range here
+ # when an endian is specified in the format string. Fixed in Python 2.5+
+ if sys.byteorder != 'big':
+ _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]
+ nan, inf = struct.unpack('dd', _BYTES)
+ return nan, inf, -inf
+
+NaN, PosInf, NegInf = _floatconstants()
+
+
+class JSONDecodeError(ValueError):
+ """Subclass of ValueError with the following additional properties:
+
+ msg: The unformatted error message
+ doc: The JSON document being parsed
+ pos: The start index of doc where parsing failed
+ end: The end index of doc where parsing failed (may be None)
+ lineno: The line corresponding to pos
+ colno: The column corresponding to pos
+ endlineno: The line corresponding to end (may be None)
+ endcolno: The column corresponding to end (may be None)
+
+ """
+ def __init__(self, msg, doc, pos, end=None):
+ ValueError.__init__(self, errmsg(msg, doc, pos, end=end))
+ self.msg = msg
+ self.doc = doc
+ self.pos = pos
+ self.end = end
+ self.lineno, self.colno = linecol(doc, pos)
+ if end is not None:
+ self.endlineno, self.endcolno = linecol(doc, pos)
+ else:
+ self.endlineno, self.endcolno = None, None
+
+
+def linecol(doc, pos):
+ lineno = doc.count('\n', 0, pos) + 1
+ if lineno == 1:
+ colno = pos
+ else:
+ colno = pos - doc.rindex('\n', 0, pos)
+ return lineno, colno
+
+
+def errmsg(msg, doc, pos, end=None):
+ # Note that this function is called from _speedups
+ lineno, colno = linecol(doc, pos)
+ if end is None:
+ #fmt = '{0}: line {1} column {2} (char {3})'
+ #return fmt.format(msg, lineno, colno, pos)
+ fmt = '%s: line %d column %d (char %d)'
+ return fmt % (msg, lineno, colno, pos)
+ endlineno, endcolno = linecol(doc, end)
+ #fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})'
+ #return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end)
+ fmt = '%s: line %d column %d - line %d column %d (char %d - %d)'
+ return fmt % (msg, lineno, colno, endlineno, endcolno, pos, end)
+
+
+_CONSTANTS = {
+ '-Infinity': NegInf,
+ 'Infinity': PosInf,
+ 'NaN': NaN,
+}
+
+STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS)
+BACKSLASH = {
+ '"': u'"', '\\': u'\\', '/': u'/',
+ 'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t',
+}
+
+DEFAULT_ENCODING = "utf-8"
+
+def py_scanstring(s, end, encoding=None, strict=True,
+ _b=BACKSLASH, _m=STRINGCHUNK.match):
+ """Scan the string s for a JSON string. End is the index of the
+ character in s after the quote that started the JSON string.
+ Unescapes all valid JSON string escape sequences and raises ValueError
+ on attempt to decode an invalid string. If strict is False then literal
+ control characters are allowed in the string.
+
+ Returns a tuple of the decoded string and the index of the character in s
+ after the end quote."""
+ if encoding is None:
+ encoding = DEFAULT_ENCODING
+ chunks = []
+ _append = chunks.append
+ begin = end - 1
+ while 1:
+ chunk = _m(s, end)
+ if chunk is None:
+ raise JSONDecodeError(
+ "Unterminated string starting at", s, begin)
+ end = chunk.end()
+ content, terminator = chunk.groups()
+ # Content is contains zero or more unescaped string characters
+ if content:
+ if not isinstance(content, unicode):
+ content = unicode(content, encoding)
+ _append(content)
+ # Terminator is the end of string, a literal control character,
+ # or a backslash denoting that an escape sequence follows
+ if terminator == '"':
+ break
+ elif terminator != '\\':
+ if strict:
+ msg = "Invalid control character %r at" % (terminator,)
+ #msg = "Invalid control character {0!r} at".format(terminator)
+ raise JSONDecodeError(msg, s, end)
+ else:
+ _append(terminator)
+ continue
+ try:
+ esc = s[end]
+ except IndexError:
+ raise JSONDecodeError(
+ "Unterminated string starting at", s, begin)
+ # If not a unicode escape sequence, must be in the lookup table
+ if esc != 'u':
+ try:
+ char = _b[esc]
+ except KeyError:
+ msg = "Invalid \\escape: " + repr(esc)
+ raise JSONDecodeError(msg, s, end)
+ end += 1
+ else:
+ # Unicode escape sequence
+ esc = s[end + 1:end + 5]
+ next_end = end + 5
+ if len(esc) != 4:
+ msg = "Invalid \\uXXXX escape"
+ raise JSONDecodeError(msg, s, end)
+ uni = int(esc, 16)
+ # Check for surrogate pair on UCS-4 systems
+ if 0xd800 <= uni <= 0xdbff and sys.maxunicode > 65535:
+ msg = "Invalid \\uXXXX\\uXXXX surrogate pair"
+ if not s[end + 5:end + 7] == '\\u':
+ raise JSONDecodeError(msg, s, end)
+ esc2 = s[end + 7:end + 11]
+ if len(esc2) != 4:
+ raise JSONDecodeError(msg, s, end)
+ uni2 = int(esc2, 16)
+ uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00))
+ next_end += 6
+ char = unichr(uni)
+ end = next_end
+ # Append the unescaped character
+ _append(char)
+ return u''.join(chunks), end
+
+
+# Use speedup if available
+scanstring = c_scanstring or py_scanstring
+
+WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS)
+WHITESPACE_STR = ' \t\n\r'
+
+def JSONObject((s, end), encoding, strict, scan_once, object_hook,
+ object_pairs_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
+ pairs = []
+ # Use a slice to prevent IndexError from being raised, the following
+ # check will raise a more specific ValueError if the string is empty
+ nextchar = s[end:end + 1]
+ # Normally we expect nextchar == '"'
+ if nextchar != '"':
+ if nextchar in _ws:
+ end = _w(s, end).end()
+ nextchar = s[end:end + 1]
+ # Trivial empty object
+ if nextchar == '}':
+ return pairs, end + 1
+ elif nextchar != '"':
+ raise JSONDecodeError("Expecting property name", s, end)
+ end += 1
+ while True:
+ key, end = scanstring(s, end, encoding, strict)
+
+ # To skip some function call overhead we optimize the fast paths where
+ # the JSON key separator is ": " or just ":".
+ if s[end:end + 1] != ':':
+ end = _w(s, end).end()
+ if s[end:end + 1] != ':':
+ raise JSONDecodeError("Expecting : delimiter", s, end)
+
+ end += 1
+
+ try:
+ if s[end] in _ws:
+ end += 1
+ if s[end] in _ws:
+ end = _w(s, end + 1).end()
+ except IndexError:
+ pass
+
+ try:
+ value, end = scan_once(s, end)
+ except StopIteration:
+ raise JSONDecodeError("Expecting object", s, end)
+ pairs.append((key, value))
+
+ try:
+ nextchar = s[end]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end]
+ except IndexError:
+ nextchar = ''
+ end += 1
+
+ if nextchar == '}':
+ break
+ elif nextchar != ',':
+ raise JSONDecodeError("Expecting , delimiter", s, end - 1)
+
+ try:
+ nextchar = s[end]
+ if nextchar in _ws:
+ end += 1
+ nextchar = s[end]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end]
+ except IndexError:
+ nextchar = ''
+
+ end += 1
+ if nextchar != '"':
+ raise JSONDecodeError("Expecting property name", s, end - 1)
+
+ if object_pairs_hook is not None:
+ result = object_pairs_hook(pairs)
+ return result, end
+ pairs = dict(pairs)
+ if object_hook is not None:
+ pairs = object_hook(pairs)
+ return pairs, end
+
+def JSONArray((s, end), scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
+ values = []
+ nextchar = s[end:end + 1]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end:end + 1]
+ # Look-ahead for trivial empty array
+ if nextchar == ']':
+ return values, end + 1
+ _append = values.append
+ while True:
+ try:
+ value, end = scan_once(s, end)
+ except StopIteration:
+ raise JSONDecodeError("Expecting object", s, end)
+ _append(value)
+ nextchar = s[end:end + 1]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end:end + 1]
+ end += 1
+ if nextchar == ']':
+ break
+ elif nextchar != ',':
+ raise JSONDecodeError("Expecting , delimiter", s, end)
+
+ try:
+ if s[end] in _ws:
+ end += 1
+ if s[end] in _ws:
+ end = _w(s, end + 1).end()
+ except IndexError:
+ pass
+
+ return values, end
+
+class JSONDecoder(object):
+ """Simple JSON <http://json.org> decoder
+
+ Performs the following translations in decoding by default:
+
+ +---------------+-------------------+
+ | JSON | Python |
+ +===============+===================+
+ | object | dict |
+ +---------------+-------------------+
+ | array | list |
+ +---------------+-------------------+
+ | string | unicode |
+ +---------------+-------------------+
+ | number (int) | int, long |
+ +---------------+-------------------+
+ | number (real) | float |
+ +---------------+-------------------+
+ | true | True |
+ +---------------+-------------------+
+ | false | False |
+ +---------------+-------------------+
+ | null | None |
+ +---------------+-------------------+
+
+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as
+ their corresponding ``float`` values, which is outside the JSON spec.
+
+ """
+
+ def __init__(self, encoding=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, strict=True,
+ object_pairs_hook=None):
+ """
+ *encoding* determines the encoding used to interpret any
+ :class:`str` objects decoded by this instance (``'utf-8'`` by
+ default). It has no effect when decoding :class:`unicode` objects.
+
+ Note that currently only encodings that are a superset of ASCII work,
+ strings of other encodings should be passed in as :class:`unicode`.
+
+ *object_hook*, if specified, will be called with the result of every
+ JSON object decoded and its return value will be used in place of the
+ given :class:`dict`. This can be used to provide custom
+ deserializations (e.g. to support JSON-RPC class hinting).
+
+ *object_pairs_hook* is an optional function that will be called with
+ the result of any object literal decode with an ordered list of pairs.
+ The return value of *object_pairs_hook* will be used instead of the
+ :class:`dict`. This feature can be used to implement custom decoders
+ that rely on the order that the key and value pairs are decoded (for
+ example, :func:`collections.OrderedDict` will remember the order of
+ insertion). If *object_hook* is also defined, the *object_pairs_hook*
+ takes priority.
+
+ *parse_float*, if specified, will be called with the string of every
+ JSON float to be decoded. By default, this is equivalent to
+ ``float(num_str)``. This can be used to use another datatype or parser
+ for JSON floats (e.g. :class:`decimal.Decimal`).
+
+ *parse_int*, if specified, will be called with the string of every
+ JSON int to be decoded. By default, this is equivalent to
+ ``int(num_str)``. This can be used to use another datatype or parser
+ for JSON integers (e.g. :class:`float`).
+
+ *parse_constant*, if specified, will be called with one of the
+ following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
+ can be used to raise an exception if invalid JSON numbers are
+ encountered.
+
+ *strict* controls the parser's behavior when it encounters an
+ invalid control character in a string. The default setting of
+ ``True`` means that unescaped control characters are parse errors, if
+ ``False`` then control characters will be allowed in strings.
+
+ """
+ self.encoding = encoding
+ self.object_hook = object_hook
+ self.object_pairs_hook = object_pairs_hook
+ self.parse_float = parse_float or float
+ self.parse_int = parse_int or int
+ self.parse_constant = parse_constant or _CONSTANTS.__getitem__
+ self.strict = strict
+ self.parse_object = JSONObject
+ self.parse_array = JSONArray
+ self.parse_string = scanstring
+ self.scan_once = make_scanner(self)
+
+ def decode(self, s, _w=WHITESPACE.match):
+ """Return the Python representation of ``s`` (a ``str`` or ``unicode``
+ instance containing a JSON document)
+
+ """
+ obj, end = self.raw_decode(s, idx=_w(s, 0).end())
+ end = _w(s, end).end()
+ if end != len(s):
+ raise JSONDecodeError("Extra data", s, end, len(s))
+ return obj
+
+ def raw_decode(self, s, idx=0):
+ """Decode a JSON document from ``s`` (a ``str`` or ``unicode``
+ beginning with a JSON document) and return a 2-tuple of the Python
+ representation and the index in ``s`` where the document ended.
+
+ This can be used to decode a JSON document from a string that may
+ have extraneous data at the end.
+
+ """
+ try:
+ obj, end = self.scan_once(s, idx)
+ except StopIteration:
+ raise JSONDecodeError("No JSON object could be decoded", s, idx)
+ return obj, end
Added: labs/jbosstm/workspace/resttx/demo/scripts/simplejson/encoder.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/simplejson/encoder.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/simplejson/encoder.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,451 @@
+"""Implementation of JSONEncoder
+"""
+import re
+
+try:
+ from simplejson._speedups import encode_basestring_ascii as \
+ c_encode_basestring_ascii
+except ImportError:
+ c_encode_basestring_ascii = None
+try:
+ from simplejson._speedups import make_encoder as c_make_encoder
+except ImportError:
+ c_make_encoder = None
+
+from simplejson.decoder import PosInf
+
+ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
+ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
+HAS_UTF8 = re.compile(r'[\x80-\xff]')
+ESCAPE_DCT = {
+ '\\': '\\\\',
+ '"': '\\"',
+ '\b': '\\b',
+ '\f': '\\f',
+ '\n': '\\n',
+ '\r': '\\r',
+ '\t': '\\t',
+}
+for i in range(0x20):
+ #ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
+ ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
+
+FLOAT_REPR = repr
+
+def encode_basestring(s):
+ """Return a JSON representation of a Python string
+
+ """
+ if isinstance(s, str) and HAS_UTF8.search(s) is not None:
+ s = s.decode('utf-8')
+ def replace(match):
+ return ESCAPE_DCT[match.group(0)]
+ return u'"' + ESCAPE.sub(replace, s) + u'"'
+
+
+def py_encode_basestring_ascii(s):
+ """Return an ASCII-only JSON representation of a Python string
+
+ """
+ if isinstance(s, str) and HAS_UTF8.search(s) is not None:
+ s = s.decode('utf-8')
+ def replace(match):
+ s = match.group(0)
+ try:
+ return ESCAPE_DCT[s]
+ except KeyError:
+ n = ord(s)
+ if n < 0x10000:
+ #return '\\u{0:04x}'.format(n)
+ return '\\u%04x' % (n,)
+ else:
+ # surrogate pair
+ n -= 0x10000
+ s1 = 0xd800 | ((n >> 10) & 0x3ff)
+ s2 = 0xdc00 | (n & 0x3ff)
+ #return '\\u{0:04x}\\u{1:04x}'.format(s1, s2)
+ return '\\u%04x\\u%04x' % (s1, s2)
+ return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'
+
+
+encode_basestring_ascii = (
+ c_encode_basestring_ascii or py_encode_basestring_ascii)
+
+class JSONEncoder(object):
+ """Extensible JSON <http://json.org> encoder for Python data structures.
+
+ Supports the following objects and types by default:
+
+ +-------------------+---------------+
+ | Python | JSON |
+ +===================+===============+
+ | dict | object |
+ +-------------------+---------------+
+ | list, tuple | array |
+ +-------------------+---------------+
+ | str, unicode | string |
+ +-------------------+---------------+
+ | int, long, float | number |
+ +-------------------+---------------+
+ | True | true |
+ +-------------------+---------------+
+ | False | false |
+ +-------------------+---------------+
+ | None | null |
+ +-------------------+---------------+
+
+ To extend this to recognize other objects, subclass and implement a
+ ``.default()`` method with another method that returns a serializable
+ object for ``o`` if possible, otherwise it should call the superclass
+ implementation (to raise ``TypeError``).
+
+ """
+ item_separator = ', '
+ key_separator = ': '
+ def __init__(self, skipkeys=False, ensure_ascii=True,
+ check_circular=True, allow_nan=True, sort_keys=False,
+ indent=None, separators=None, encoding='utf-8', default=None):
+ """Constructor for JSONEncoder, with sensible defaults.
+
+ If skipkeys is false, then it is a TypeError to attempt
+ encoding of keys that are not str, int, long, float or None. If
+ skipkeys is True, such items are simply skipped.
+
+ If ensure_ascii is true, the output is guaranteed to be str
+ objects with all incoming unicode characters escaped. If
+ ensure_ascii is false, the output will be unicode object.
+
+ If check_circular is true, then lists, dicts, and custom encoded
+ objects will be checked for circular references during encoding to
+ prevent an infinite recursion (which would cause an OverflowError).
+ Otherwise, no such check takes place.
+
+ If allow_nan is true, then NaN, Infinity, and -Infinity will be
+ encoded as such. This behavior is not JSON specification compliant,
+ but is consistent with most JavaScript based encoders and decoders.
+ Otherwise, it will be a ValueError to encode such floats.
+
+ If sort_keys is true, then the output of dictionaries will be
+ sorted by key; this is useful for regression tests to ensure
+ that JSON serializations can be compared on a day-to-day basis.
+
+ If indent is a non-negative integer, then JSON array
+ elements and object members will be pretty-printed with that
+ indent level. An indent level of 0 will only insert newlines.
+ None is the most compact representation.
+
+ If specified, separators should be a (item_separator, key_separator)
+ tuple. The default is (', ', ': '). To get the most compact JSON
+ representation you should specify (',', ':') to eliminate whitespace.
+
+ If specified, default is a function that gets called for objects
+ that can't otherwise be serialized. It should return a JSON encodable
+ version of the object or raise a ``TypeError``.
+
+ If encoding is not None, then all input strings will be
+ transformed into unicode using that encoding prior to JSON-encoding.
+ The default is UTF-8.
+
+ """
+
+ self.skipkeys = skipkeys
+ self.ensure_ascii = ensure_ascii
+ self.check_circular = check_circular
+ self.allow_nan = allow_nan
+ self.sort_keys = sort_keys
+ self.indent = indent
+ if separators is not None:
+ self.item_separator, self.key_separator = separators
+ if default is not None:
+ self.default = default
+ self.encoding = encoding
+
+ def default(self, o):
+ """Implement this method in a subclass such that it returns
+ a serializable object for ``o``, or calls the base implementation
+ (to raise a ``TypeError``).
+
+ For example, to support arbitrary iterators, you could
+ implement default like this::
+
+ def default(self, o):
+ try:
+ iterable = iter(o)
+ except TypeError:
+ pass
+ else:
+ return list(iterable)
+ return JSONEncoder.default(self, o)
+
+ """
+ raise TypeError(repr(o) + " is not JSON serializable")
+
+ def encode(self, o):
+ """Return a JSON string representation of a Python data structure.
+
+ >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
+ '{"foo": ["bar", "baz"]}'
+
+ """
+ # This is for extremely simple cases and benchmarks.
+ if isinstance(o, basestring):
+ if isinstance(o, str):
+ _encoding = self.encoding
+ if (_encoding is not None
+ and not (_encoding == 'utf-8')):
+ o = o.decode(_encoding)
+ if self.ensure_ascii:
+ return encode_basestring_ascii(o)
+ else:
+ return encode_basestring(o)
+ # This doesn't pass the iterator directly to ''.join() because the
+ # exceptions aren't as detailed. The list call should be roughly
+ # equivalent to the PySequence_Fast that ''.join() would do.
+ chunks = self.iterencode(o, _one_shot=True)
+ if not isinstance(chunks, (list, tuple)):
+ chunks = list(chunks)
+ if self.ensure_ascii:
+ return ''.join(chunks)
+ else:
+ return u''.join(chunks)
+
+ def iterencode(self, o, _one_shot=False):
+ """Encode the given object and yield each string
+ representation as available.
+
+ For example::
+
+ for chunk in JSONEncoder().iterencode(bigobject):
+ mysocket.write(chunk)
+
+ """
+ if self.check_circular:
+ markers = {}
+ else:
+ markers = None
+ if self.ensure_ascii:
+ _encoder = encode_basestring_ascii
+ else:
+ _encoder = encode_basestring
+ if self.encoding != 'utf-8':
+ def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):
+ if isinstance(o, str):
+ o = o.decode(_encoding)
+ return _orig_encoder(o)
+
+ def floatstr(o, allow_nan=self.allow_nan,
+ _repr=FLOAT_REPR, _inf=PosInf, _neginf=-PosInf):
+ # Check for specials. Note that this type of test is processor
+ # and/or platform-specific, so do tests which don't depend on
+ # the internals.
+
+ if o != o:
+ text = 'NaN'
+ elif o == _inf:
+ text = 'Infinity'
+ elif o == _neginf:
+ text = '-Infinity'
+ else:
+ return _repr(o)
+
+ if not allow_nan:
+ raise ValueError(
+ "Out of range float values are not JSON compliant: " +
+ repr(o))
+
+ return text
+
+
+ if (_one_shot and c_make_encoder is not None
+ and not self.indent and not self.sort_keys):
+ _iterencode = c_make_encoder(
+ markers, self.default, _encoder, self.indent,
+ self.key_separator, self.item_separator, self.sort_keys,
+ self.skipkeys, self.allow_nan)
+ else:
+ _iterencode = _make_iterencode(
+ markers, self.default, _encoder, self.indent, floatstr,
+ self.key_separator, self.item_separator, self.sort_keys,
+ self.skipkeys, _one_shot)
+ return _iterencode(o, 0)
+
+def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
+ _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
+ ## HACK: hand-optimized bytecode; turn globals into locals
+ False=False,
+ True=True,
+ ValueError=ValueError,
+ basestring=basestring,
+ dict=dict,
+ float=float,
+ id=id,
+ int=int,
+ isinstance=isinstance,
+ list=list,
+ long=long,
+ str=str,
+ tuple=tuple,
+ ):
+
+ def _iterencode_list(lst, _current_indent_level):
+ if not lst:
+ yield '[]'
+ return
+ if markers is not None:
+ markerid = id(lst)
+ if markerid in markers:
+ raise ValueError("Circular reference detected")
+ markers[markerid] = lst
+ buf = '['
+ if _indent is not None:
+ _current_indent_level += 1
+ newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
+ separator = _item_separator + newline_indent
+ buf += newline_indent
+ else:
+ newline_indent = None
+ separator = _item_separator
+ first = True
+ for value in lst:
+ if first:
+ first = False
+ else:
+ buf = separator
+ if isinstance(value, basestring):
+ yield buf + _encoder(value)
+ elif value is None:
+ yield buf + 'null'
+ elif value is True:
+ yield buf + 'true'
+ elif value is False:
+ yield buf + 'false'
+ elif isinstance(value, (int, long)):
+ yield buf + str(value)
+ elif isinstance(value, float):
+ yield buf + _floatstr(value)
+ else:
+ yield buf
+ if isinstance(value, (list, tuple)):
+ chunks = _iterencode_list(value, _current_indent_level)
+ elif isinstance(value, dict):
+ chunks = _iterencode_dict(value, _current_indent_level)
+ else:
+ chunks = _iterencode(value, _current_indent_level)
+ for chunk in chunks:
+ yield chunk
+ if newline_indent is not None:
+ _current_indent_level -= 1
+ yield '\n' + (' ' * (_indent * _current_indent_level))
+ yield ']'
+ if markers is not None:
+ del markers[markerid]
+
+ def _iterencode_dict(dct, _current_indent_level):
+ if not dct:
+ yield '{}'
+ return
+ if markers is not None:
+ markerid = id(dct)
+ if markerid in markers:
+ raise ValueError("Circular reference detected")
+ markers[markerid] = dct
+ yield '{'
+ if _indent is not None:
+ _current_indent_level += 1
+ newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
+ item_separator = _item_separator + newline_indent
+ yield newline_indent
+ else:
+ newline_indent = None
+ item_separator = _item_separator
+ first = True
+ if _sort_keys:
+ items = dct.items()
+ items.sort(key=lambda kv: kv[0])
+ else:
+ items = dct.iteritems()
+ for key, value in items:
+ if isinstance(key, basestring):
+ pass
+ # JavaScript is weakly typed for these, so it makes sense to
+ # also allow them. Many encoders seem to do something like this.
+ elif isinstance(key, float):
+ key = _floatstr(key)
+ elif key is True:
+ key = 'true'
+ elif key is False:
+ key = 'false'
+ elif key is None:
+ key = 'null'
+ elif isinstance(key, (int, long)):
+ key = str(key)
+ elif _skipkeys:
+ continue
+ else:
+ raise TypeError("key " + repr(key) + " is not a string")
+ if first:
+ first = False
+ else:
+ yield item_separator
+ yield _encoder(key)
+ yield _key_separator
+ if isinstance(value, basestring):
+ yield _encoder(value)
+ elif value is None:
+ yield 'null'
+ elif value is True:
+ yield 'true'
+ elif value is False:
+ yield 'false'
+ elif isinstance(value, (int, long)):
+ yield str(value)
+ elif isinstance(value, float):
+ yield _floatstr(value)
+ else:
+ if isinstance(value, (list, tuple)):
+ chunks = _iterencode_list(value, _current_indent_level)
+ elif isinstance(value, dict):
+ chunks = _iterencode_dict(value, _current_indent_level)
+ else:
+ chunks = _iterencode(value, _current_indent_level)
+ for chunk in chunks:
+ yield chunk
+ if newline_indent is not None:
+ _current_indent_level -= 1
+ yield '\n' + (' ' * (_indent * _current_indent_level))
+ yield '}'
+ if markers is not None:
+ del markers[markerid]
+
+ def _iterencode(o, _current_indent_level):
+ if isinstance(o, basestring):
+ yield _encoder(o)
+ elif o is None:
+ yield 'null'
+ elif o is True:
+ yield 'true'
+ elif o is False:
+ yield 'false'
+ elif isinstance(o, (int, long)):
+ yield str(o)
+ elif isinstance(o, float):
+ yield _floatstr(o)
+ elif isinstance(o, (list, tuple)):
+ for chunk in _iterencode_list(o, _current_indent_level):
+ yield chunk
+ elif isinstance(o, dict):
+ for chunk in _iterencode_dict(o, _current_indent_level):
+ yield chunk
+ else:
+ if markers is not None:
+ markerid = id(o)
+ if markerid in markers:
+ raise ValueError("Circular reference detected")
+ markers[markerid] = o
+ o = _default(o)
+ for chunk in _iterencode(o, _current_indent_level):
+ yield chunk
+ if markers is not None:
+ del markers[markerid]
+
+ return _iterencode
Added: labs/jbosstm/workspace/resttx/demo/scripts/simplejson/ordered_dict.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/simplejson/ordered_dict.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/simplejson/ordered_dict.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,103 @@
+"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger
+
+http://code.activestate.com/recipes/576693/
+
+"""
+from UserDict import DictMixin
+
+class OrderedDict(dict, DictMixin):
+
+ def __init__(self, *args, **kwds):
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ try:
+ self.__end
+ except AttributeError:
+ self.clear()
+ self.update(*args, **kwds)
+
+ def clear(self):
+ self.__end = end = []
+ end += [None, end, end] # sentinel node for doubly linked list
+ self.__map = {} # key --> [key, prev, next]
+ dict.clear(self)
+
+ def __setitem__(self, key, value):
+ if key not in self:
+ end = self.__end
+ curr = end[1]
+ curr[2] = end[1] = self.__map[key] = [key, curr, end]
+ dict.__setitem__(self, key, value)
+
+ def __delitem__(self, key):
+ dict.__delitem__(self, key)
+ key, prev, next = self.__map.pop(key)
+ prev[2] = next
+ next[1] = prev
+
+ def __iter__(self):
+ end = self.__end
+ curr = end[2]
+ while curr is not end:
+ yield curr[0]
+ curr = curr[2]
+
+ def __reversed__(self):
+ end = self.__end
+ curr = end[1]
+ while curr is not end:
+ yield curr[0]
+ curr = curr[1]
+
+ def popitem(self, last=True):
+ if not self:
+ raise KeyError('dictionary is empty')
+ key = reversed(self).next() if last else iter(self).next()
+ value = self.pop(key)
+ return key, value
+
+ def __reduce__(self):
+ items = [[k, self[k]] for k in self]
+ tmp = self.__map, self.__end
+ del self.__map, self.__end
+ inst_dict = vars(self).copy()
+ self.__map, self.__end = tmp
+ if inst_dict:
+ return (self.__class__, (items,), inst_dict)
+ return self.__class__, (items,)
+
+ def keys(self):
+ return list(self)
+
+ setdefault = DictMixin.setdefault
+ update = DictMixin.update
+ pop = DictMixin.pop
+ values = DictMixin.values
+ items = DictMixin.items
+ iterkeys = DictMixin.iterkeys
+ itervalues = DictMixin.itervalues
+ iteritems = DictMixin.iteritems
+
+ def __repr__(self):
+ if not self:
+ return '%s()' % (self.__class__.__name__,)
+ return '%s(%r)' % (self.__class__.__name__, self.items())
+
+ def copy(self):
+ return self.__class__(self)
+
+ @classmethod
+ def fromkeys(cls, iterable, value=None):
+ d = cls()
+ for key in iterable:
+ d[key] = value
+ return d
+
+ def __eq__(self, other):
+ if isinstance(other, OrderedDict):
+ return len(self)==len(other) and \
+ all(p==q for p, q in zip(self.items(), other.items()))
+ return dict.__eq__(self, other)
+
+ def __ne__(self, other):
+ return not self == other
Added: labs/jbosstm/workspace/resttx/demo/scripts/simplejson/scanner.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/simplejson/scanner.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/simplejson/scanner.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,67 @@
+"""JSON token scanner
+"""
+import re
+try:
+ from simplejson._speedups import make_scanner as c_make_scanner
+except ImportError:
+ c_make_scanner = None
+
+__all__ = ['make_scanner']
+
+NUMBER_RE = re.compile(
+ r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
+ (re.VERBOSE | re.MULTILINE | re.DOTALL))
+
+def py_make_scanner(context):
+ parse_object = context.parse_object
+ parse_array = context.parse_array
+ parse_string = context.parse_string
+ match_number = NUMBER_RE.match
+ encoding = context.encoding
+ strict = context.strict
+ parse_float = context.parse_float
+ parse_int = context.parse_int
+ parse_constant = context.parse_constant
+ object_hook = context.object_hook
+ object_pairs_hook = context.object_pairs_hook
+
+ def _scan_once(string, idx):
+ try:
+ nextchar = string[idx]
+ except IndexError:
+ raise StopIteration
+
+ if nextchar == '"':
+ return parse_string(string, idx + 1, encoding, strict)
+ elif nextchar == '{':
+ return parse_object((string, idx + 1), encoding, strict,
+ _scan_once, object_hook, object_pairs_hook)
+ elif nextchar == '[':
+ return parse_array((string, idx + 1), _scan_once)
+ elif nextchar == 'n' and string[idx:idx + 4] == 'null':
+ return None, idx + 4
+ elif nextchar == 't' and string[idx:idx + 4] == 'true':
+ return True, idx + 4
+ elif nextchar == 'f' and string[idx:idx + 5] == 'false':
+ return False, idx + 5
+
+ m = match_number(string, idx)
+ if m is not None:
+ integer, frac, exp = m.groups()
+ if frac or exp:
+ res = parse_float(integer + (frac or '') + (exp or ''))
+ else:
+ res = parse_int(integer)
+ return res, m.end()
+ elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
+ return parse_constant('NaN'), idx + 3
+ elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
+ return parse_constant('Infinity'), idx + 8
+ elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
+ return parse_constant('-Infinity'), idx + 9
+ else:
+ raise StopIteration
+
+ return _scan_once
+
+make_scanner = c_make_scanner or py_make_scanner
Added: labs/jbosstm/workspace/resttx/demo/scripts/simplejson/tool.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/simplejson/tool.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/simplejson/tool.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,37 @@
+r"""Command-line tool to validate and pretty-print JSON
+
+Usage::
+
+ $ echo '{"json":"obj"}' | python -m simplejson.tool
+ {
+ "json": "obj"
+ }
+ $ echo '{ 1.2:3.4}' | python -m simplejson.tool
+ Expecting property name: line 1 column 2 (char 2)
+
+"""
+import sys
+import simplejson as json
+
+def main():
+ if len(sys.argv) == 1:
+ infile = sys.stdin
+ outfile = sys.stdout
+ elif len(sys.argv) == 2:
+ infile = open(sys.argv[1], 'rb')
+ outfile = sys.stdout
+ elif len(sys.argv) == 3:
+ infile = open(sys.argv[1], 'rb')
+ outfile = open(sys.argv[2], 'wb')
+ else:
+ raise SystemExit(sys.argv[0] + " [infile [outfile]]")
+ try:
+ obj = json.load(infile, object_pairs_hook=json.OrderedDict)
+ except ValueError, e:
+ raise SystemExit(e)
+ json.dump(obj, outfile, sort_keys=True, indent=4)
+ outfile.write('\n')
+
+
+if __name__ == '__main__':
+ main()
Added: labs/jbosstm/workspace/resttx/demo/scripts/tx.py
===================================================================
--- labs/jbosstm/workspace/resttx/demo/scripts/tx.py (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/scripts/tx.py 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,252 @@
+#!/usr/bin/env python
+
+"""
+JBoss, Home of Professional Open Source Copyright 2008, 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.
+"""
+
+import cPickle
+import sys
+import simplejson as json
+import qp
+import urlparse
+
+class TxHandler():
+ def __init__(self, path):
+ query = path.strip('/').split('?')
+ tokens = query[0].split('/')
+# print 'striped tok0=' + tokens[0]
+ self.code = 400
+ self.service = ''
+ self.status = 'active'
+ self.method = 'status'
+ self.methods = { 'prepare' : self.do_prepare,
+ 'commit' : self.do_commit,
+ 'rollback' : self.do_rollback,
+ 'forget' : self.do_forget,
+ 'status' : self.do_status}
+
+ #tokens = path.strip('/').split('/')
+
+ if len(tokens) > 2 and tokens[0] == 'participant':
+ self.service = tokens[1]
+ self.txid = tokens[2]
+ if len(tokens) > 3:
+ self.method = tokens[3]
+
+ print self.service, ' txId: ', self.txid, ' method: ', self.method
+
+ def process(self):
+ print 'process: method=' + self.method + ' txid=' + self.txid
+ if self.method in self.methods:
+ self.code = 201
+ self.methods[self.method](self.txid)
+
+ def do_commit(self, txid):
+ print 'do_commit'
+ self.status = 'commit_ok'
+
+ def do_rollback(self, txid):
+ print 'do_rollback'
+ self.status = 'rollback_ok'
+
+ def do_prepare(self, txid):
+ print 'do_prepare'
+ self.status = 'prepare_ok'
+
+ def do_forget(self, txid):
+ print 'do_forget'
+ self.status = 'forget_ok'
+
+ def do_status(self, txid):
+ print 'do_status'
+ self.status = 'status_ok'
+
+class Work:
+ 'Common base class for all work'
+ count = 0
+
+ def __init__(self, name, status):
+ self.props = {}
+ self.props['name'] = name
+ self.props['status'] = status
+ self.name = name
+ self.status = status
+ Work.count += 1
+
+ def update(self, updates):
+ self.props.update(updates)
+
+ def get(self):
+ return self.props
+
+ def displayCount(self):
+ print "Total Work %d" % Work.count
+
+ def displayWork(self):
+ print self.props
+ #print "Name : ", self.name, ", Status: ", self.status
+
+ def __str__( self ) :
+ return "(" + str( self.name ) + ", " + \
+ str( self.status ) + ")"
+
+#work = {'Taxi': Work('Taxi', 'New'), 'Theatre': Work('Theatre', 'New'), 'Restaurant': Work('Restaurant', 'New')};
+
+def start_branch(service, txId, port):
+ tokens = txId.split('/')
+ tx = tokens[len(tokens) - 1]
+ purl = 'http://localhost:' + str(port) + '/participant/' + service + '/'+ tx
+ print 'enlisting url ', purl
+ try:
+ f = open('tmp/' + tx, 'w')
+ f.write(purl)
+ f.close()
+ qp.put('tmp/' + tx, txId)
+ return purl
+ except IOError, arg:
+ return None
+ except:
+ return None
+
+
+def get_work(service, tx):
+ fn = 'tmp/work.' + tx
+ try:
+ FILE = open(fn, 'r')
+ work = cPickle.load(FILE)
+ FILE.close()
+ except IOError, arg:
+ print 'file open error ', arg
+
+ return work
+
+def post_handler(self, port):
+ print 'POST request path=' + self.path
+ res = TxHandler(self.path)
+ work = get_work(res.service, res.txid)
+ if work is None:
+ print 'POST ERROR: no such transactional work'
+ return
+
+ res.process()
+ status = {}
+ status['status'] = res.status
+ service = work[res.service]
+ service.update(status)
+
+# print 'POST tx status: ', res.status, ' props: ', service.props
+ FILE = open('tmp/work.' + res.txid, 'w')
+ cPickle.dump(work, FILE)
+ FILE.close()
+
+ self.send_response(res.code)
+ self.send_header('location', 'http://localhost:' + str(port) + '/participant/' + res.service + '/' + res.txid + '/' + res.status)
+ self.send_header('Content-Type', 'text/javascript')
+ self.send_header('Content-Length', 0)
+
+ self.end_headers()
+
+
+def get_handler(self, port):
+ path = urlparse.urlparse(self.path)
+ args = dict([param.split('=') for param in path.query.split('&')])
+
+ if 'txId' not in args:
+ return []
+ txId = args['txId']
+ tokens = txId.split('/')
+ tx = tokens[len(tokens) - 1]
+ fn = 'tmp/work.' + tx
+
+ if 'service' not in args:
+ print 'Missing service name'
+ return []
+
+ try:
+ FILE = open(fn, 'r')
+ work = cPickle.load(FILE)
+ FILE.close()
+ except IOError, arg:
+ print 'file open error ', arg, ' args: ', args
+ work = {'Taxi': Work('Taxi', 'New'), 'Theatre': Work('Theatre', 'New'), 'Restaurant': Work('Restaurant', 'New')};
+
+ if args['service'] not in work:
+ print 'Unsupported service ', args['service']
+ return []
+
+ service = work[args['service']]
+# print 'updating ', service.get(), ' args ', args
+ service.update(args)
+
+ if not 'url' in service.get():
+ url = start_branch(args['service'], txId, port)
+ if url is None:
+ return json.dumps({'status':'Invalid id'})
+ service.update({'url':url})
+
+ if len(service.props) > 2 and not 'status' in service.props:
+ service.update({'status':'Modified'})
+ FILE = open('tmp/work.' + tx, 'w')
+ cPickle.dump(work, FILE)
+ FILE.close()
+# print 'persisted ', json.dumps(service.get())
+
+ resp = '['
+ resp += ''.join(json.dumps(service.get()))
+ resp += ']'
+
+ if 'callback' in args:
+ resp = ('%s(%s);' % (args['callback'], resp))
+
+ self.send_response(200)
+ self.send_header('Content-Type', 'text/javascript')
+ self.send_header('Content-Length', len(resp))
+ self.send_header('Expires', '-1')
+ self.send_header('Cache-Control', 'no-cache')
+ self.send_header('Pragma', 'no-cache')
+ self.end_headers()
+
+ self.wfile.write(resp)
+ self.wfile.flush()
+
+def test1(args):
+ mods1 = {}
+ for arg in args:
+ print arg
+ nvp = arg.split('=')
+ mods1[nvp[0]] = nvp[1];
+# print mods1
+ mods1 = get_handler(mods1, 8001)
+ print mods1
+
+def test2():
+ FILE = open("work.txt", 'w')
+ service = work['Taxi']
+ service.update({'required':'yes'})
+ cPickle.dump(work, FILE)
+ FILE.close()
+
+ print 'reading back ', service.get()
+ FILE = open("work.txt", 'r')
+ work = cPickle.load(FILE)
+ service = work['Taxi']
+ FILE.close()
+ print 'read back ', service.get()
+
+if __name__ == "__main__":
+# clear; python tx.py service=Taxi txId=tx01 type=seat
+ sys.argv.pop(0)
+ test1(sys.argv)
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/TxDemo.gwt.xml
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/TxDemo.gwt.xml (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/TxDemo.gwt.xml 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,24 @@
+<module>
+
+ <!-- Inherit the core Web Toolkit stuff. -->
+ <inherits name='com.google.gwt.user.User'/>
+
+ <!-- Inherit the default GWT style sheet. You can change -->
+ <!-- the theme of your GWT application by uncommenting -->
+ <!-- any one of the following lines. -->
+ <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
+ <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
+ <inherits name='com.google.gwt.user.theme.dark.Dark'/>
+
+ <!-- Other module inherits -->
+ <inherits name='com.google.gwt.http.HTTP'/>
+
+
+ <!-- Specify the app entry point class. -->
+ <entry-point class='org.jboss.jbossts.rts.demo.client.RESTDemoApp'/>
+
+ <!-- Specify the application specific style sheet. -->
+ <stylesheet src='TxDemo.css' />
+
+ <servlet path='/TxDemo' class='org.jboss.jbossts.rts.demo.server.TxServiceImpl'/>
+</module>
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,261 @@
+package org.jboss.jbossts.rts.demo.client;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ListBox;
+
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.KeyboardListener;
+
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.TabPanel;
+import com.google.gwt.user.client.ui.RootPanel;
+
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+//JRE Emulation
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+
+//Demo classes
+import org.jboss.jbossts.rts.demo.client.service.Restaurant;
+import org.jboss.jbossts.rts.demo.client.service.StatusPanel;
+import org.jboss.jbossts.rts.demo.client.service.Taxi;
+import org.jboss.jbossts.rts.demo.client.service.Theatre;
+import org.jboss.jbossts.rts.demo.client.service.ServicePanel;
+
+// based on a GWT tutorial:
+// http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication.html#DevGuideRPCDeployment
+// http://code.google.com/webtoolkit/tutorials/1.5/JSON.html
+
+public class RESTDemoApp implements EntryPoint
+{
+ private static final String THEATRE_URL = "http://localhost:8000/";
+ private static final String RESTAURANT_URL = "http://localhost:8001/";
+ private static final String TAXI_URL = "http://localhost:8002/";
+
+ private static final String[] faultNames = {"none", "abort_halt", "prepare_halt",
+ "commit_halt", "commit_suspend", "h_commit", "h_rollback", "h_hazard", "h_mixed"};
+
+ private StatusPanel statusPanel = new StatusPanel(0, "", 0, false);
+ private Panel controlPanel;
+ private Panel bookingPanel;
+ private ListBox faults;
+ private TextBox txTb;
+
+ private ServicePanel[] services = {
+ new Theatre(THEATRE_URL, statusPanel),
+ new Restaurant(RESTAURANT_URL, statusPanel),
+ new Taxi(TAXI_URL, statusPanel)
+ };
+
+ /**
+ * Entry point method.
+ */
+ public void onModuleLoad()
+ {
+ Panel app = new VerticalPanel();
+
+ app.add(getStatusPanel());
+ app.add(getControlPanel());
+ app.add(getBookingPanel());
+
+ RootPanel.get("app-frame").add(app);
+ }
+
+ private Panel getStatusPanel()
+ {
+ return statusPanel;
+ }
+
+ private Panel getControlPanel()
+ {
+ final Button startButton = new Button("Book a Trip");
+ final Button checkButton = new Button("Trip Status");
+
+ txTb = new TextBox();
+ controlPanel = new HorizontalPanel();
+ controlPanel.setVisible(true);
+ controlPanel.add(startButton);
+ controlPanel.add(checkButton);
+ controlPanel.add(txTb);
+
+ startButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ controlPanel.setVisible(false);
+ bookingPanel.setVisible(true);
+
+ for (ServicePanel service : services)
+ service.reset();
+
+ faults.setSelectedIndex(0);
+ statusPanel.clearStatus("Starting");
+ startTx();
+ }
+ });
+
+ checkButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ showTx(services, txTb.getText());
+ }
+ });
+
+ txTb.addKeyboardListener(new KeyboardListener() {
+ public void onKeyDown(Widget widget, char c, int i) {}
+ public void onKeyUp(Widget widget, char c, int i) { }
+ public void onKeyPress(Widget sender, char keyCode, int modifiers) {
+ if (keyCode == KeyboardListener.KEY_ENTER) {
+ showTx(services, txTb.getText());
+ }
+ }
+ });
+
+ return controlPanel;
+ }
+
+ private Panel getBookingPanel()
+ {
+ final Button confirmButton = new Button("Confirm Booking");
+ final Button abortButton = new Button("Cancel Booking");
+ final HorizontalPanel faultPanel = new HorizontalPanel();
+ HorizontalPanel panel = new HorizontalPanel();
+ TabPanel tabPanel = new TabPanel();
+
+ bookingPanel = new VerticalPanel();
+ tabPanel.setWidth("500px");
+ bookingPanel.setVisible(false);
+
+ for (ServicePanel service : services)
+ tabPanel.add(service, service.getName());
+
+ confirmButton.addStyleDependentName("tx");
+ panel.add(confirmButton);
+ abortButton.addStyleDependentName("tx");
+ panel.add(abortButton);
+
+ faults = ServicePanel.createListBox(true, "dropdown", 0, faultNames);
+ faults.addStyleDependentName("tx");
+ faults.setSelectedIndex(0);
+ panel.add(faults);
+ faultPanel.add(new Label("Add Fault"));
+ faultPanel.add(faults);
+ panel.add(faultPanel);
+
+ bookingPanel.add(panel);
+ bookingPanel.add(tabPanel);
+
+ confirmButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ controlPanel.setVisible(true);
+ bookingPanel.setVisible(false);
+ statusPanel.setStatus("Confirming");
+ endTx(true);
+ }
+ });
+
+ abortButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ controlPanel.setVisible(true);
+ bookingPanel.setVisible(false);
+ statusPanel.setStatus("Cancelling");
+ endTx(false);
+ }
+ });
+
+ return bookingPanel;
+ }
+
+ private static TxServiceAsync app = null;
+ private TxServiceAsync getServiceInstance()
+ {
+ if (app == null) {
+ app = (TxServiceAsync) GWT.create(TxService.class);
+ ((ServiceDefTarget) app).setServiceEntryPoint(GWT.getModuleBaseURL() + "TxDemo");
+ }
+
+ return app;
+ }
+
+ private void showTx(ServicePanel[] services, String txId)
+ {
+ statusPanel.setTxId(txId);
+ for (ServicePanel service : services)
+ service.refresh();
+ }
+
+ // start a transaction via RPC
+ private void startTx() {
+ // Create a callback object to retrieve the response
+ AsyncCallback<String> callback = new AsyncCallback<String>() {
+ public void onFailure(Throwable e) {
+ String msg = "Start booking error: " + e.getMessage();
+ statusPanel.clearStatus(msg);
+ }
+
+ public void onSuccess(String txid) {
+ statusPanel.setStatus("In progress");
+ statusPanel.setTxId(txid);
+ txTb.setText(statusPanel.getId());
+ }
+ };
+
+ txTb.setText("");
+ getServiceInstance().startTx("clientId", callback);
+ }
+
+ // end a transaction via RPC
+ private void endTx(final boolean commit) {
+ AsyncCallback<String> callback = new AsyncCallback<String>() {
+ public void onFailure(Throwable e) {
+ String msg = (commit ? "Confirm" : "Cancel") + " booking error: " + e.getMessage();
+ statusPanel.setStatus(msg);
+ }
+
+ public void onSuccess(String result) {
+ String msg = (commit ? "Confirmed" : "Canceled");
+ statusPanel.setStatus(msg);
+ txTb.setText(statusPanel.getId());
+ showTx(services, txTb.getText());
+ }
+ };
+
+ String fault = faults.getItemText(faults.getSelectedIndex());
+
+ if (commit)
+ getServiceInstance().endTx(statusPanel.getTxId(), "fault=" + fault, callback);
+ else
+ getServiceInstance().rollbackTx(statusPanel.getTxId(), "fault=" + fault, callback);
+
+ startTimer();
+ }
+
+ private Timer startTimer()
+ {
+ Timer statusTimer = new Timer() {
+ @Override
+ public void run() {
+ if (statusPanel.is_complete())
+ cancel();
+ else
+ for (ServicePanel service : services)
+ if (statusPanel.is_in_progress(service.getName()))
+ service.refresh();
+ }
+ };
+
+ statusTimer.scheduleRepeating(10000);
+
+ return statusTimer;
+ }
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java-
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java- (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/RESTDemoApp.java- 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,271 @@
+package org.jboss.jbossts.rts.demo.client;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ListBox;
+
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.RootPanel;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.TabPanel;
+import com.google.gwt.user.client.ui.KeyboardListener;
+
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.user.client.Random;
+
+import com.google.gwt.user.client.Timer;
+
+import com.google.gwt.user.client.Window;
+import com.google.gwt.core.client.EntryPoint;
+
+import com.google.gwt.user.client.rpc.ServiceDefTarget;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+
+import com.google.gwt.core.client.GWT;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import com.google.gwt.core.client.JsArray;
+import com.google.gwt.http.client.URL;
+
+// making client side HTTP requests
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+
+//JSNI
+import com.google.gwt.core.client.JavaScriptObject;
+import org.jboss.jbossts.rts.demo.client.service.Restaurant;
+import org.jboss.jbossts.rts.demo.client.service.StatusPanel;
+import org.jboss.jbossts.rts.demo.client.service.Taxi;
+import org.jboss.jbossts.rts.demo.client.service.Theatre;
+import org.jboss.jbossts.rts.demo.client.service.ServicePanel;
+
+// based on a GWT tutorial:
+// http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication.html#DevGuideRPCDeployment
+// http://code.google.com/webtoolkit/tutorials/1.5/JSON.html
+
+public class RESTDemoApp implements EntryPoint
+{
+ private static final String THEATRE_URL = "http://localhost:8000/";
+ private static final String RESTAURANT_URL = "http://localhost:8001/";
+ private static final String TAXI_URL = "http://localhost:8002/";
+
+ private static final String[] faultNames = {"none", "abort_halt", "prepare_halt",
+ "commit_halt", "commit_suspend", "h_commit", "h_rollback", "h_hazard", "h_mixed"};
+
+ private String currentTx;
+
+ private StatusPanel summary = new StatusPanel(0, "", 0, false);
+ private ServicePanel[] services = {
+ new Theatre(THEATRE_URL, summary),
+ new Restaurant(RESTAURANT_URL, summary),
+ new Taxi(TAXI_URL, summary)};
+
+ private VerticalPanel outerPanel = new VerticalPanel();
+
+ private TabPanel tabPanel = new TabPanel();
+ private ListBox faults;
+
+ private Label errorMsgLabel = new Label();
+
+ /**
+ * Entry point method.
+ */
+ public void onModuleLoad() {
+
+ errorMsgLabel.setStyleName("errorMessage");
+ errorMsgLabel.setVisible(false);
+
+ outerPanel.add(summary);
+ outerPanel.add(errorMsgLabel);
+ outerPanel.add(createButtonPanel());
+ outerPanel.add(tabPanel);
+ tabPanel.setVisible(false);
+ tabPanel.setWidth("500px");
+ tabPanel.setHeight("500px");
+ for (ServicePanel service : services)
+ tabPanel.add(service, service.getName());
+
+ // Associate the Main panel with the HTML host page.
+ RootPanel.get("outer-frame").add(outerPanel);
+ }
+
+ private Panel createButtonPanel()
+ {
+ final Button startButton = new Button("Book a Trip");
+ final Button checkButton = new Button("Check Status");
+ final Button confirmButton = new Button("Confirm Booking");
+ final Button abortButton = new Button("Cancel Booking");
+ final HorizontalPanel faultPanel = new HorizontalPanel();
+ final TextBox txTb = new TextBox();
+
+ HorizontalPanel panel = new HorizontalPanel();
+ Button[] buttons = {confirmButton, abortButton};
+ Label faultLabel = new Label("Add Fault");
+
+ for (Button b : buttons) {
+ b.addStyleDependentName("tx");
+ b.setVisible(false);
+ panel.add(b);
+ }
+
+ txTb.setVisible(true);
+ txTb.setFocus(true);
+ panel.add(txTb);
+ panel.add(checkButton);
+ panel.add(startButton);
+
+ faults = ServicePanel.getListBox(true, "dropdown", faultNames);
+ faults.addStyleDependentName("tx");
+ faults.setSelectedIndex(0);
+
+ //faultLabel.setStyleName("errorMessage");
+ faultPanel.setVisible(false);
+
+ faultPanel.add(faultLabel);
+ faultPanel.add(faults);
+ panel.add(faultPanel);
+
+ startButton.setVisible(true);
+ checkButton.setVisible(true);
+ checkButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ showTx(txTb.getText());
+ }
+ });
+
+ startButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ tabPanel.setVisible(true);
+ txTb.setVisible(false);
+ txTb.setText("");
+ startButton.setVisible(false);
+ checkButton.setVisible(false);
+ confirmButton.setVisible(true);
+ abortButton.setVisible(true);
+ faultPanel.setVisible(true);
+ summary.clearStatus("New Booking");
+ for (ServicePanel service : services)
+ service.reset();
+ startTx();
+ }
+ });
+
+ confirmButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ txTb.setVisible(true);
+ txTb.setText(summary.getId());
+ tabPanel.setVisible(false);
+ startButton.setVisible(true);
+ checkButton.setVisible(true);
+ confirmButton.setVisible(false);
+ abortButton.setVisible(false);
+ faultPanel.setVisible(false);
+ summary.setStatus("Confirming");
+ endTx(true);
+ }
+ });
+
+ abortButton.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ txTb.setVisible(true);
+ txTb.setText(summary.getId());
+ tabPanel.setVisible(false);
+ startButton.setVisible(true);
+ checkButton.setVisible(true);
+ confirmButton.setVisible(false);
+ abortButton.setVisible(false);
+ faultPanel.setVisible(false);
+ summary.setStatus("Cancelling");
+ endTx(false);
+ }
+ });
+
+ txTb.addKeyboardListener(new KeyboardListener() {
+ public void onKeyDown(Widget widget, char c, int i) {}
+ public void onKeyUp(Widget widget, char c, int i) { }
+ public void onKeyPress(Widget sender, char keyCode, int modifiers) {
+ if (keyCode == KeyboardListener.KEY_ENTER) {
+ showTx(txTb.getText());
+ }
+ }
+ });
+
+ return panel;
+ }
+
+ private static TxServiceAsync app = null;
+ private TxServiceAsync getServiceInstance()
+ {
+ if (app == null) {
+ app = (TxServiceAsync) GWT.create(TxService.class);
+ ((ServiceDefTarget) app).setServiceEntryPoint(GWT.getModuleBaseURL() + "TxDemo");
+ }
+
+ return app;
+ }
+
+ private void showTx(String txId)
+ {
+ summary.setTxId(txId);
+ for (ServicePanel service : services)
+ service.refresh();
+ }
+
+ // start a transaction via RPC
+ private void startTx() {
+ // Set up the callback object.
+ AsyncCallback<String> callback = new AsyncCallback<String>() {
+ public void onFailure(Throwable e) {
+ errorMsgLabel.setText("Error: " + e.getMessage());
+ errorMsgLabel.setVisible(true);
+ summary.clearStatus("Unable to start a new booking");
+ }
+
+ public void onSuccess(String txid) {
+ currentTx = txid;
+ summary.clearStatus("In progress");
+ summary.setTxId(currentTx);
+ }
+ };
+
+ getServiceInstance().startTx("clientId", callback);
+ }
+
+ // end a transaction via RPC
+ private void endTx(final boolean commit) {
+ // Set up the callback object.
+ AsyncCallback<String> callback = new AsyncCallback<String>() {
+ public void onFailure(Throwable e) {
+ String msg = (commit ? "Confirm" : "Cancel") + " booking error: " + e.getMessage();
+ errorMsgLabel.setText(msg);
+ errorMsgLabel.setVisible(true);
+ summary.setStatus(msg);
+ }
+
+ public void onSuccess(String result) {
+ String msg = (commit ? "Confirmed" : "Canceled");
+ summary.setStatus(msg);
+ }
+ };
+
+ String fault = faults.getItemText(faults.getSelectedIndex());
+
+ if (commit)
+ getServiceInstance().endTx(currentTx, "fault=" + fault, callback);
+ else
+ getServiceInstance().rollbackTx(currentTx, "fault=" + fault, callback);
+ }
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxService.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxService.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxService.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,10 @@
+package org.jboss.jbossts.rts.demo.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+public interface TxService extends RemoteService
+{
+ String startTx(String msg);
+ String endTx(String tx, String fault);
+ String rollbackTx(String tx, String fault);
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxServiceAsync.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxServiceAsync.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/TxServiceAsync.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,10 @@
+package org.jboss.jbossts.rts.demo.client;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+public interface TxServiceAsync
+{
+ void startTx(String msg, AsyncCallback async);
+ void rollbackTx(String msg, String fault, AsyncCallback async);
+ void endTx(String tx, String fault, AsyncCallback async);
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/BookingData.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/BookingData.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/BookingData.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,48 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+class BookingData extends JavaScriptObject {
+ // Overlay types always have protected, zero argument constructors.
+ protected BookingData() {}
+
+ // JSNI methods to retrieve booking data.
+ public final native String getService() /*-{ return this.service; }-*/;
+ public final native String getPeople() /*-{ return this.people; }-*/;
+ public final native String getDiners() /*-{ return this.diners; }-*/;
+ public final native String getSeats() /*-{ return this.seats; }-*/;
+ public final native String getSeatType() /*-{ return this.seatType; }-*/;
+ public final native String getTaxi() /*-{ return this.taxi; }-*/;
+ public final native String getTxId() /*-{ return this.txId; }-*/;
+ public final native String getStatus() /*-{ return this.status; }-*/;
+
+ // update UI
+ public final void updateWidgets(java.util.Map<String, WidgetBinding> widgets)
+ {
+ if (widgets.containsKey("seatType"))
+ widgets.get("seatType").setValue(getSeatType());
+ if (widgets.containsKey("seats"))
+ widgets.get("seats").setValue(getSeats());
+ if (widgets.containsKey("people"))
+ widgets.get("people").setValue(getPeople());
+ if (widgets.containsKey("taxi"))
+ widgets.get("taxi").setValue(getTaxi());
+ if (widgets.containsKey("txId"))
+ widgets.get("txId").setValue(getTxId());
+ if (widgets.containsKey("status"))
+ widgets.get("status").setValue(getStatus());
+ }
+
+ public final StringBuilder toString(StringBuilder s)
+ {
+ return s
+ .append(getService())
+ .append(",p=").append(getPeople())
+ .append(",d=").append(getDiners())
+ .append(",s=").append(getSeats())
+ .append(",st=").append(getSeatType())
+ .append(",t=").append(getTaxi())
+ .append(",tx=").append(getTxId())
+ .append(",txs=").append(getStatus());
+ }
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ListBoxWidgetBinding.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ListBoxWidgetBinding.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ListBoxWidgetBinding.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,36 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+import com.google.gwt.user.client.ui.ListBox;
+
+public class ListBoxWidgetBinding extends WidgetBinding
+{
+ private ListBox lb;
+ private int defIndex;
+
+ public ListBoxWidgetBinding(ListBox lb, int defIndex) {
+ super("");
+ this.lb = lb;
+ this.defIndex = defIndex;
+ reset();
+ }
+
+ public void reset()
+ {
+ lb.setSelectedIndex(defIndex);
+ }
+
+ public String getValue() {
+ int i = lb.getSelectedIndex();
+
+ return (i != -1 ? lb.getItemText(i) : super.getValue());
+ }
+
+ public void setValue(String value) {
+ for (int i = 0; i < lb.getItemCount(); i++) {
+ if (lb.getItemText(i).equals(value)) {
+ lb.setSelectedIndex(i);
+ onSuccess(value);
+ }
+ }
+ }
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Restaurant.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Restaurant.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Restaurant.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,33 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.Button;
+
+
+public class Restaurant extends ServicePanel
+{
+ static private String[] diners = {"0","1","2","3","4","5","6","7","8","9"};
+
+ public Restaurant(String serviceUrl, final StatusPanel summary)
+ {
+ super("Restaurant", "Restuarant Service - Booking Form", serviceUrl, summary);
+
+ ListBox dinersLb = createListBox(true, "dropdown", 2, diners);
+
+ add(new Label("Table for"));
+ add(dinersLb);
+ add(new Label("people"));
+ fini();
+
+ addWidgetBinding("status", new WidgetBinding("Unknown") {
+ public void onSuccess(String value) {summary.updateRestaurantStatus(value);}
+ });
+ addWidgetBinding("people", new ListBoxWidgetBinding(dinersLb, 2) {
+ public void onSuccess(String value) {summary.updateRestaurant(Integer.valueOf(value));}
+ });
+ }
+}
Property changes on: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Restaurant.java
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ServicePanel.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ServicePanel.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/ServicePanel.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,240 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+
+// making client side HTTP requests
+import com.google.gwt.http.client.URL;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.RequestBuilder;
+import com.google.gwt.http.client.RequestCallback;
+import com.google.gwt.http.client.RequestException;
+import com.google.gwt.http.client.Response;
+
+//JSNI
+import com.google.gwt.core.client.JavaScriptObject;
+
+import com.google.gwt.core.client.JsArray;
+
+import java.util.Map;
+import java.util.HashMap;
+
+public class ServicePanel extends VerticalPanel
+{
+ private String svcUrl;
+ private String name;
+ private Label siteUrl = new Label();
+ private Label status = new Label();
+ private Panel panel = new HorizontalPanel();
+ private Map<String, WidgetBinding> widgets = new HashMap<String, WidgetBinding> ();
+
+ protected StatusPanel summary;
+
+ private static int jsonRequestId = 0;
+
+ public ServicePanel(String name, String title, String svcUrl, StatusPanel summary)
+ {
+ this.name = name;
+ this.svcUrl = svcUrl;
+ this.summary = summary;
+
+ Label titleLabel = new Label(title);
+ titleLabel.addStyleName("h2");
+ super.add(titleLabel);
+ super.add(panel);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void add(Widget child)
+ {
+ panel.add(child);
+ }
+
+ protected void addWidgetBinding(String property, WidgetBinding widget)
+ {
+ widgets.put(property, widget);
+ }
+
+ protected void fini()
+ {
+ addButtons(panel);
+
+ siteUrl.setText("External URL: " + svcUrl);
+ siteUrl.addStyleName("message");
+ status.addStyleName("message");
+ super.add(siteUrl);
+ super.add(status);
+ }
+
+ protected void addButtons(Panel panel)
+ {
+ Button confirm = new Button("Modify Booking");
+ Button refresh = new Button("Refresh");
+
+ panel.add(confirm);
+// panel.add(refresh);
+
+ confirm.addStyleDependentName("update");
+ confirm.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ update();
+ }
+ });
+ refresh.addStyleDependentName("update");
+ refresh.addClickListener(new ClickListener() {
+ public void onClick(Widget event) {
+ refresh();
+ }
+ });
+ }
+
+ protected void update()
+ {
+ StringBuilder q = new StringBuilder("?txId=");
+
+ q.append(summary.getTxId());
+ q.append("&service=");
+ q.append(name);
+
+ for (Map.Entry<String, WidgetBinding> binding : widgets.entrySet())
+ {
+ String name = binding.getKey();
+ String value = binding.getValue().getValue();
+
+ if (value != null && !name.equals("status")) {
+ q.append("&").append(binding.getKey()).append("=").append(value);
+ }
+ }
+
+ //com.google.gwt.user.client.Window.alert(q.toString());
+ sendRequest(q.toString());
+ }
+
+ public void refresh()
+ {
+ reset();
+
+ StringBuilder q = new StringBuilder("?txId=");
+
+ q.append(summary.getTxId());
+ q.append("&service=");
+ q.append(name);
+
+ sendRequest(q.toString());
+ }
+
+ public void reset()
+ {
+ for (WidgetBinding binding : widgets.values()) {
+ binding.reset();
+ binding.onSuccess(binding.getValue());
+ }
+ }
+
+ private void displayStatus(String msg)
+ {
+ status.setText(msg);
+ }
+
+ private void displayError(String msg)
+ {
+ status.setText(msg);
+ }
+
+ private static synchronized int nextId() { return jsonRequestId++; }
+
+ protected void sendRequest(final String url)
+ {
+ String u = URL.encode(svcUrl + url) + "&callback=";
+ getJson(nextId(), u, this);
+ }
+
+ public native static void getJson(int requestId, String url, ServicePanel handler) /*-{
+ var callback = "callback" + requestId;
+
+ // [1] Create a script element.
+ var script = document.createElement("script");
+ script.setAttribute("src", url+callback);
+ script.setAttribute("type", "text/javascript");
+
+ // [2] Define the callback function on the window object.
+ window[callback] = function(jsonObj) {
+ // [3]
+ handler. at org.jboss.jbossts.rts.demo.client.service.ServicePanel::handleJsonResponse(Lcom/google/gwt/core/client/JavaScriptObject;)(jsonObj);
+ window[callback + "done"] = true;
+ }
+
+ // [4] JSON download has 1-second timeout.
+ setTimeout(function() {
+ if (!window[callback + "done"]) {
+ handler. at org.jboss.jbossts.rts.demo.client.service.ServicePanel::handleJsonResponse(Lcom/google/gwt/core/client/JavaScriptObject;)(null);
+ }
+
+ // [5] Cleanup. Remove script and callback elements.
+ document.body.removeChild(script);
+ delete window[callback];
+ delete window[callback + "done"];
+ }, 1000);
+
+ // [6] Attach the script element to the document body.
+ document.body.appendChild(script);
+}-*/;
+
+ public void handleJsonResponse(JavaScriptObject jso) {
+ if (jso == null) {
+ displayError("Error retrieving JSON");
+ //com.google.gwt.user.client.Window.alert("no JSON response");
+ } else {
+ JsArray<BookingData> data = asArrayOfBookingData(jso);
+ StringBuilder s = new StringBuilder();
+ try {
+ for (int i = 0; i < data.length(); i++) {
+ BookingData bd = data.get(i);
+ bd.toString(s);
+ bd.updateWidgets(widgets);
+ }
+ } catch (Throwable t) {
+ //com.google.gwt.user.client.Window.alert("overlay error: " + t.getMessage());
+ displayError("JSON overylay error: " + t.getMessage());
+ }
+
+ displayStatus(s.toString());
+ summary.update();
+ }
+ }
+
+ // JSON string to JavaScript
+ private final native JsArray<BookingData> asArrayOfBookingData(JavaScriptObject jso) /*-{
+ return jso;
+ }-*/;
+
+ public static ListBox createListBox(boolean dropdown, String style, int selectedIndex, String[] items)
+ {
+ ListBox widget = new ListBox();
+
+ if (style != null)
+ widget.addStyleName(style);
+ for (int i = 0; i < items.length; i++)
+ widget.addItem(items[i]);
+
+ if(!dropdown)
+ widget.setVisibleItemCount(3);
+
+ if (selectedIndex >= 0)
+ widget.setSelectedIndex(selectedIndex);
+
+ return widget;
+ }
+
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/StatusPanel.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/StatusPanel.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/StatusPanel.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,209 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.HTML;
+
+public class StatusPanel extends VerticalPanel
+{
+ private String STATUS_PATERN = ""
++ "<h2>Booking Status: <b style=\"color:#fff\">#STATUS</b></h2>\n"
++ "<b>Booking Id</b>: #ID<br>\n"
++ "<b>Theatre</b>: #SEATS seats in the #TYPE (Status: <b style=\"color:#fff\">#THEATRE_STATUS</b>)<br>\n"
++ "<b>Restaurant</b>: table for #DINERS people (Status: <b style=\"color:fff\">#RESTAURANT_STATUS</b>)<br>\n"
++ "<b>Taxi</b>: #TAXI (Status: <b style=\"color:fff\">#TAXI_STATUS</b>)\n";
+ private HTML STATUS_HTML = new HTML();
+
+ private int seats = 0;
+ private String seatType = "Stalls";
+ private int diners = 0;
+ private boolean taxi = false;
+ private String txId;
+ private String status = "";
+ private String id = "";
+ private String theatreStatus = "Unknown";
+ private String restaurantStatus = "Unknown";
+ private String taxiStatus = "Unknown";
+
+ public StatusPanel(int seats, String seatType, int diners, boolean taxi)
+ {
+ add(STATUS_HTML);
+ addStyleName("addPanel");
+ setVisible(true);
+ }
+
+ private void updateStatus()
+ {
+ STATUS_HTML.setHTML(STATUS_PATERN
+ .replace("#THEATRE_STATUS", theatreStatus)
+ .replace("#RESTAURANT_STATUS", restaurantStatus)
+ .replace("#TAXI_STATUS", taxiStatus)
+ .replace("#ID", id)
+ .replace("#SEATS", String.valueOf(seats))
+ .replace("#TYPE", seatType)
+ .replace("#DINERS", String.valueOf(diners))
+ .replace("#TAXI", taxi ? "required" : " not required")
+ .replace("#STATUS", status));
+ }
+
+ private void reset()
+ {
+ seats = 0;
+ seatType = "";
+ diners = 0;
+ taxi = false;
+ status = "";
+ theatreStatus = "Unknown";
+ restaurantStatus = "Unknown";
+ taxiStatus = "Unknown";
+ }
+
+ public void setStatus(String status)
+ {
+ if (status != null)
+ this.status = status;
+
+ updateStatus();
+ }
+
+ public void clearStatus(boolean isComplete)
+ {
+ reset();
+ setStatus(isComplete ? "Confirmed" : "Cancelled");
+ }
+
+ public void clearStatus(String status)
+ {
+ reset();
+ setStatus(status);
+ }
+
+ private boolean in_same_state(String state)
+ {
+ return (theatreStatus.equals(state) &&
+ restaurantStatus.equals(state) &&
+ taxiStatus.equals(state));
+ }
+
+ private boolean any_in_state(String state)
+ {
+ return (theatreStatus.equals(state) ||
+ restaurantStatus.equals(state) ||
+ taxiStatus.equals(state));
+ }
+
+ public boolean is_complete()
+ {
+ return "Booked".equals(status) || "Cancelled".equals(status);
+ }
+
+ public String getStatus(String service)
+ {
+ if (service.equals(theatreStatus))
+ return theatreStatus;
+ else if (service.equals(restaurantStatus))
+ return restaurantStatus;
+ else if (service.equals(taxiStatus))
+ return taxiStatus;
+
+ return "Unknown";
+ }
+ public boolean is_complete(String service)
+ {
+ String stat = getStatus(service);;
+
+ return "commit_ok".equals(stat) || "rollback_ok".equals(stat);
+ }
+
+ public boolean is_in_progress(String service)
+ {
+ String stat = getStatus(service);;
+
+ return "prepare_ok".equals(status) || "Cancelling".equals(status);
+ }
+
+ public void update()
+ {
+ if (in_same_state("commit_ok"))
+ setStatus("Booked");
+ else if (in_same_state("rollback_ok"))
+ setStatus("Cancelled");
+ else if (any_in_state("rollback_ok"))
+ setStatus("Partially Cancelled");
+ else if (any_in_state("commit_ok"))
+ setStatus("Partially Booked");
+ else if (any_in_state("prepare_ok"))
+ setStatus("Confirming");
+ else if (any_in_state("New"))
+ setStatus("Unconfirmed");
+ else
+ setStatus("Taxi: " + taxiStatus + " Theatre: " + theatreStatus + " Restaurant: " + restaurantStatus);
+ }
+
+ public void updateTheatre(int seats, String seatType)
+ {
+ this.seats = seats;
+ this.seatType = seatType;
+ setStatus("Unconfirmed");
+ }
+
+ public void updateTheatre(int seats)
+ {
+ this.seats = seats;
+ setStatus("Unconfirmed");
+ }
+
+ public void updateTheatre(String seatType)
+ {
+ this.seatType = seatType;
+ setStatus("Unconfirmed");
+ }
+
+ public void updateTheatreStatus(String status)
+ {
+ this.theatreStatus = status;
+ setStatus("Unconfirmed");
+ }
+
+ public void updateRestaurant(int diners)
+ {
+ this.diners = diners;
+ setStatus("Unconfirmed");
+ }
+
+ public void updateRestaurantStatus(String status)
+ {
+ this.restaurantStatus = status;
+ setStatus("Unconfirmed");
+ }
+
+ public void updateTaxi(boolean required)
+ {
+ this.taxi = required;
+ setStatus("Unconfirmed");
+ }
+
+ public void updateTaxiStatus(String status)
+ {
+ this.taxiStatus = status;
+ setStatus("Unconfirmed");
+ }
+
+ public String getTxId()
+ {
+ return txId;
+ }
+
+ public String getId()
+ {
+ id = txId.substring(txId.lastIndexOf('/') + 1);
+ return id;
+ }
+
+ public void setTxId(String txId)
+ {
+ this.txId = txId;
+ this.id = txId.substring(txId.lastIndexOf('/') + 1);
+
+ updateStatus();
+ }
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Taxi.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Taxi.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Taxi.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,32 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.Button;
+
+public class Taxi extends ServicePanel
+{
+ static private String[] yesno = {"No", "Yes"};
+
+ public Taxi(String serviceUrl, final StatusPanel summary)
+ {
+ super("Taxi", "Taxi Service - Booking Form", serviceUrl, summary);
+
+ ListBox taxiLb = createListBox(true, "dropdown", 1, yesno);
+
+ add(new Label("Book a taxi?"));
+ add(taxiLb);
+ fini();
+
+ addWidgetBinding("status", new WidgetBinding("Unknown") {
+ public void onSuccess(String value) {summary.updateTaxiStatus(value);}
+ });
+ addWidgetBinding("taxi", new ListBoxWidgetBinding(taxiLb, 1) {
+ public void onSuccess(String value) {summary.updateTaxi("Yes".equals(value));}
+ });
+
+ }
+}
Property changes on: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Taxi.java
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Theatre.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Theatre.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Theatre.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,38 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.Button;
+
+public class Theatre extends ServicePanel
+{
+ static private String[] seats = {"0","1","2","3","4","5","6","7","8","9"};
+ static private String[] type = {"Circle", "Stalls", "Balcony"};
+
+ public Theatre(String serviceUrl, final StatusPanel summary)
+ {
+ super("Theatre", "Theatre Service - Booking Form", serviceUrl, summary);
+
+ ListBox seatsLb = createListBox(true, "dropdown", 2, seats);
+ ListBox seatTypeLb = createListBox(true, "dropdown", 1, type);
+
+ add(new Label("Book"));
+ add(seatsLb);
+ add(new Label("seats in the"));
+ add(seatTypeLb);
+ fini();
+
+ addWidgetBinding("status", new WidgetBinding("Unknown") {
+ public void onSuccess(String value) {summary.updateTheatreStatus(value);}
+ });
+ addWidgetBinding("seatType", new ListBoxWidgetBinding(seatTypeLb, 1) {
+ public void onSuccess(String value) {summary.updateTheatre(value);}
+ });
+ addWidgetBinding("seats", new ListBoxWidgetBinding(seatsLb, 2) {
+ public void onSuccess(String value) {summary.updateTheatre(Integer.valueOf(value));}
+ });
+ }
+}
Property changes on: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/Theatre.java
___________________________________________________________________
Name: svn:executable
+ *
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/WidgetBinding.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/WidgetBinding.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/client/service/WidgetBinding.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,12 @@
+package org.jboss.jbossts.rts.demo.client.service;
+
+public class WidgetBinding
+{
+ private String defValue;
+
+ public WidgetBinding(String defValue) {this.defValue = defValue;}
+ public void onSuccess(String value) {}
+ public void setValue(String value) {onSuccess(value);}
+ public String getValue() {return defValue;}
+ public void reset() {}
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.css
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.css (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.css 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,69 @@
+/** Add css rules here for your application. */
+
+
+/** Example rules used by the template application (remove for your app) */
+.pc-template-btn {
+ display: block;
+ font-size: 16pt
+}
+
+#pc-template-img {
+ margin-top: 20px;
+}
+
+body {
+ padding: 10px;
+}
+
+.gwt-Button-remove {
+ width: 50px;
+}
+
+/* transaction start/stop button */
+.gwt-Button-tx {
+ margin: 10px 10px 15px 0px;
+}
+
+/* booking update buttons */
+.gwt-Button-update {
+ margin: 0px 10px 0px 10px;
+}
+
+/* Dynamic color changes for the Change field */
+.noChange {
+ color: black;
+}
+
+.positiveChange {
+ color: green;
+}
+
+.negativeChange {
+ color: red;
+}
+
+.errorMessage {
+ color: red;
+}
+
+/* form items */
+.dropdown {
+ border: 2px solid none;
+ padding: 2px; :
+ margin-left:6px;
+ margin-right:6px;
+ margin-bottom:6px;
+}
+
+.h2 {
+ font : italic normal 1.4em georgia, sans-serif;
+ letter-spacing : 1px;
+ margin-bottom : 12px;
+ color : #7d775c;
+}
+
+.message {
+ margin-top:12px;
+ background-color: #5b553a;
+ border: 1px solid #b8d3e5;
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.html
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.html (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/public/TxDemo.html 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<!-- The HTML 4.01 Transitional DOCTYPE declaration-->
+<!-- above set at the top of the file will set -->
+<!-- the browser's rendering engine into -->
+<!-- "Quirks Mode". Replacing this declaration -->
+<!-- with a "Standards Mode" doctype is supported, -->
+<!-- but may lead to some differences in layout. -->
+
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+
+ <!-- -->
+ <!-- Any title is fine -->
+ <!-- -->
+ <title>RESTful Transaction Service Demo: Application Client</title>
+
+ <!-- -->
+ <!-- This script loads your compiled module. -->
+ <!-- If you add any GWT meta tags, they must -->
+ <!-- be added before this line. -->
+ <!-- -->
+ <script type="text/javascript" language="javascript" src="org.jboss.jbossts.rts.demo.TxDemo.nocache.js"></script>
+ </head>
+
+ <!-- -->
+ <!-- The body can have arbitrary html, or -->
+ <!-- you can leave the body empty if you want -->
+ <!-- to create a completely dynamic UI. -->
+ <!-- -->
+ <body>
+
+ <h1>RESTful Transaction Service Demo Application Client</h1>
+<!--
+ <img src="images/jbosscorp_logo.png" width="249" height="78"/>
+-->
+
+ <div id="app-frame"></div>
+
+ <!-- OPTIONAL: include this if you want history support -->
+ <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
+ </body>
+</html>
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxHelper.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxHelper.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxHelper.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * 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.
+ *
+ * (C) 2009
+ * @author JBoss Inc.
+ */
+package org.jboss.jbossts.rts.demo.server;
+
+import org.jboss.resteasy.util.HttpResponseCodes;
+import org.jboss.jbossts.rts.util.TxUtil;
+import org.jboss.jbossts.rts.provider.HttpResponseException;
+
+import java.io.IOException;
+
+/**
+ * TODO
+ */
+public class TxHelper
+{
+ private static String[] HOSTS = {"localhost", "172.16.130.129"};
+ private static int[] PORTS = {9099, 8080}; //TxUtil.getIntProperty("PORT", "9096");
+
+ static
+ {
+ //TxUtil.setEndpoint("172.16.130.129", PORT, "");
+ //TxUtil.setEndpoint("localhost", PORT, "");
+ TxUtil.setHost(HOSTS[0]);
+ TxUtil.setPort(PORTS[0]);
+
+ }
+
+ public static void assertTrue(String message, boolean ok)
+ {
+ if (!ok)
+ System.err.println(message);
+ }
+
+ public static String startTx(long timeout, boolean fail) throws IOException
+ {
+ String tx = null;
+
+ try {
+ String query = "clientId=12345" + (timeout == 0 ? "" : "&timeout=" + timeout);
+
+ tx = TxUtil.doPost(new int[] {HttpResponseCodes.SC_CREATED}, TxUtil.txURI + "/begin?" + query);
+// log.trace("Started tx: " + tx);
+ if (fail)
+ assertTrue("start tx should have failed", false);
+ } catch (HttpResponseException e) {
+ if (!fail)
+ assertTrue(e.getMessage(), false);
+ }
+
+ return tx;
+ }
+
+ public static String modifyResource(String tx, String pid, String name, String value)
+ {
+ try {
+ return TxUtil.doPost(new int[] {HttpResponseCodes.SC_OK}, TxUtil.getBaseURI() + "participant/work/" + pid,
+ "name=" + name, "value=" + value, "context=" + tx);
+ } catch (HttpResponseException e) {
+ assertTrue(e.getMessage(), false);
+ return null;
+ }
+ }
+
+ public static String getResource(String tx, String pid, String name)
+ {
+ try {
+ return TxUtil.doGet(new int[] {HttpResponseCodes.SC_OK}, TxUtil.getBaseURI() + "participant/work/" + pid,
+ "name=" + name, "context=" + tx);
+ } catch (HttpResponseException e) {
+ assertTrue(e.getMessage(), false);
+ return null;
+ }
+ }
+
+ public static void terminateTx(String tx, String how, boolean fail, String ... args)
+ {
+ try {
+ TxUtil.doPut(new int[] {HttpResponseCodes.SC_OK}, tx + "/" + how, "", args);
+ if (fail)
+ assertTrue("commit should not have succeeded", false);
+ } catch (HttpResponseException e) {
+ if (!fail)
+ assertTrue(e.getMessage(), false);
+ }
+ }
+
+ public static void commitTx(String tx, boolean fail, String ... args)
+ {
+ terminateTx(tx, "commit", fail, args);
+ }
+
+ public static void rollbackTx(String tx, boolean fail, String ... args)
+ {
+ terminateTx(tx, "rollback", fail, args);
+ }
+}
Added: labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxServiceImpl.java
===================================================================
--- labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxServiceImpl.java (rev 0)
+++ labs/jbosstm/workspace/resttx/demo/src/org/jboss/jbossts/rts/demo/server/TxServiceImpl.java 2009-05-06 20:57:49 UTC (rev 26407)
@@ -0,0 +1,59 @@
+package org.jboss.jbossts.rts.demo.server;
+
+import org.jboss.jbossts.rts.demo.client.TxService;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+import java.io.IOException;
+
+public class TxServiceImpl extends RemoteServiceServlet implements TxService
+{
+ public String startTx(String msg)
+ {
+ try
+ {
+ System.out.println("TxServiceImpl.startTx " + msg);
+ return TxHelper.startTx(0, false);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ return e.getMessage();
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ return e.getMessage();
+ }
+ }
+
+ public String endTx(String tx, String fault)
+ {
+ try
+ {
+ System.out.println("TxServiceImpl.endTx: " + tx + " arg: " + fault);
+ TxHelper.commitTx(tx, false, fault);
+ return "commit ok";
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ return e.getMessage();
+ }
+ }
+
+ public String rollbackTx(String tx, String fault)
+ {
+ try
+ {
+ System.out.println("TxServiceImpl.endTx: " + tx + " arg: " + fault);
+ TxHelper.rollbackTx(tx, false, fault);
+ return "rollback ok";
+ }
+ catch (Throwable e)
+ {
+ e.printStackTrace();
+ return e.getMessage();
+ }
+ }
+}
More information about the jboss-svn-commits
mailing list