[jboss-cvs] JBossAS SVN: r110942 - in projects/jboss-jca/branches/performance/faban: services and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 17 06:50:47 EDT 2011


Author: whitingjr
Date: 2011-03-17 06:50:46 -0400 (Thu, 17 Mar 2011)
New Revision: 110942

Added:
   projects/jboss-jca/branches/performance/faban/services/
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/README
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.properties
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.xml
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/logging.properties
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/security/
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/security/driver.policy
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/services-tools.xml
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/toolsets.xml
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/lib/
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/agent.sh
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/master.sh
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/multi.sh
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/registry.sh
   projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/setenv.sh
   projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/services/
   projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/services/ironjacamar/
   projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/services/ironjacamar/IronJacamarService.java
Log:
Added IronJacamar service extension to Faban installation.

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/README
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/README	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/README	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,6 @@
+                   IronJacamarService README
+
+The IronJacamar service is an extension of a Faban service based on 
+samples in the Faban project.
+
+The service will start an IronJacamar service on the machine.
\ No newline at end of file

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.properties
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.properties	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.properties	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,8 @@
+service.shortname=IronJacamarService
+#faban.url=http://whitingjrlite.localdomain:9980/
+faban.url=http://burtha02-wireless:9980/
+#faban.url=http://sulley.lab.bos.redhat.com:9980/
+deploy.user=deployer
+deploy.password=adminadmin
+deploy.clearconfig=true
+compiler.target.version=1.6

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.xml	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/build.xml	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="IronJacamar Service" default="deploy.jar" basedir=".">
+
+  <property file="build.properties" />
+  <property environment="env" />
+  <condition property="home.isSet">
+    <not>
+      <equals arg1="${env.FABAN_HOME}" arg2="" />
+    </not>
+  </condition>
+  <fail unless="home.isSet" message="The build failed because the environment property FABAN_HOME has not been set. Set the property to the local faban installation location." />
+  <property name="src.dir" value="../../src/main/java" />
+  <property name="build.dir" value="build" />
+  <property name="classes.dir" value="${build.dir}/classes" />
+  <property name="lib.dir" value="lib" />
+  <property name="buildlib.dir" value="${build.dir}/lib" />
+  <property name="faban.libs" value="${env.FABAN_HOME}/lib" />
+  <property name="faban.classes" value="${env.FABAN_HOME}/master/webapps/faban/WEB-INF/classes" />
+
+  <!-- Extra path locations that conform to the existing way the jca project files are
+       organised. Adapts the way faban benchmark examples are organised to fit in with IronJacamar.  -->
+  <!-- Added location for libraries. -->
+  <path id="lib.path">
+    <fileset dir="../../../tools/faban">
+      <include name="*.jar" />
+    </fileset>
+  </path>
+
+  <path id="taskclasspath">
+    <fileset dir="${env.FABAN_HOME}/ant/lib" includes="*.jar" />
+    <fileset dir="${faban.libs}" includes="*.jar" />
+  </path>
+
+  <path id="classpath" location="${faban.libs}">
+    <pathelement location="${classes.dir}" />
+    <fileset dir="${lib.dir}" includes="*.jar" />
+    <fileset dir="${faban.libs}" includes="*.jar" />
+    <pathelement location="${faban.classes}" />
+    <path refid="lib.path" />
+  </path>
+
+  <taskdef name="deploy" classname="com.sun.faban.harness.util.DeployTask">
+    <classpath refid="taskclasspath" />
+  </taskdef>
+
+  <target name="init">
+    <mkdir dir="${classes.dir}" />
+    <mkdir dir="${lib.dir}" />
+  </target>
+
+  <target name="compile" depends="init" description="Compiling all source files">
+    <javac srcdir="${src.dir}" deprecation="on" target="${compiler.target.version}" destdir="${classes.dir}" debug="on">
+      <!--include name="**/*.java" /-->
+      <include name="org/jboss/jca/perf/services/ironjacamar/*.java" />
+      <classpath refid="classpath" />
+    </javac>
+  </target>
+
+  <target name="clean" description="cleanup module">
+    <delete>
+      <fileset dir="${build.dir}" includes="**/*" />
+    </delete>
+  </target>
+
+
+  <target name="service.jar" depends="compile" description="Assembles library jar with service classes">
+    <mkdir dir="${buildlib.dir}" />
+    <jar jarfile="${buildlib.dir}/${service.shortname}.jar">
+      <fileset dir="${classes.dir}" includes="**/*.class" />
+    </jar>
+  </target>
+
+  <target name="deploy.jar" depends="service.jar" description="Assembles deployment jar image for Faban harness">
+    <jar jarfile="${build.dir}/${service.shortname}.jar">
+      <metainf dir="deploy" includes="*" />
+      <fileset dir="." includes="bin/**/*, lib/**/*, resources/**/*" />
+      <fileset dir="${build.dir}" includes="lib/**/*" />
+    </jar>
+  </target>
+
+  <target name="deploy" depends="deploy.jar" description="Deploys service on the Faban harness">
+    <deploy url="${faban.url}" jar="${build.dir}/${service.shortname}.jar" user="${deploy.user}" password="${deploy.password}" clearConfig="${deploy.clearconfig}" />
+  </target>
+
+  <target name="run" depends="service.jar" description="Test runs the service outside the Faban Harness">
+    <java classname="com.sun.faban.driver.core.MasterImpl" classpathref="classpath" fork="true" failonerror="true" dir="config">
+      <jvmarg value="-XX:+DisableExplicitGC" />
+      <jvmarg value="-Djava.security.policy=security/driver.policy" />
+      <jvmarg value="-Djava.util.logging.config.file=logging.properties" />
+      <jvmarg value="-Dbenchmark.config=../deploy/toolsets.xml" />
+    </java>
+  </target>
+
+  <target name="registry" description="Starts the Faban registry">
+    <java classname="com.sun.faban.common.RegistryImpl" classpathref="classpath" fork="true" failonerror="true">
+      <jvmarg value="-XX:+DisableExplicitGC" />
+      <jvmarg value="-Djava.security.policy=security/driver.policy" />
+      <jvmarg value="-Djava.util.logging.config.file=logging.properties" />
+    </java>
+  </target>
+
+  <target name="agent" description="Start a Faban agent">
+    <!-- To start the agent, properties driver.name, driver.id, 
+             and master.host need to be declared -->
+    <java classname="com.sun.faban.driver.engine.AgentImpl" classpathref="classpath" fork="true" failonerror="true">
+      <jvmarg value="-XX:+DisableExplicitGC" />
+      <jvmarg value="-Djava.security.policy=security/driver.policy" />
+      <jvmarg value="-Djava.util.logging.config.file=logging.properties" />
+      <arg value="${driver.name}" />
+      <arg value="${driver.id}" />
+      <arg value="${master.host}" />
+    </java>
+  </target>
+
+  <target name="multi" description="Start a distributed benchmark run">
+    <parallel>
+      <antcall target="registry" />
+      <sequential>
+        <sleep seconds="2" />
+        <antcall target="agent" />
+      </sequential>
+      <sequential>
+        <sleep seconds="5" />
+        <antcall target="run" />
+      </sequential>
+    </parallel>
+  </target>
+
+</project>

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/logging.properties
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/logging.properties	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/logging.properties	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,59 @@
+############################################################
+#  	Default Logging Configuration File
+#
+# You can use a different file by specifying a filename
+# with the java.util.logging.config.file system property.  
+# For example java -Djava.util.logging.config.file=myfile
+############################################################
+
+############################################################
+#  	Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler 
+# classes.  These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers.  For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to INFO and above.
+# java.util.logging.ConsoleHandler.level = INFO
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+com.xyz.foo.level = SEVERE
+com.sun.faban.driver.core.MatrixMix.level = FINER
+com.sun.faban.common.level = FINEST
+sample.level = FINEST
+faban.test.level = FINEST

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/security/driver.policy
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/security/driver.policy	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/config/security/driver.policy	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,8 @@
+/* AUTOMATICALLY GENERATED ON Thu Dec 03 17:57:08 PST 1998*/
+/* DO NOT EDIT */
+
+grant {
+  permission java.security.AllPermission;
+  };
+
+

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/services-tools.xml
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/services-tools.xml	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/services-tools.xml	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<services-tools>
+    <service id="IronJacamarService">
+        <class>org.jboss.jca.perf.services.ironjacamar.IronJacamarService</class>
+    </service>
+</services-tools>
\ No newline at end of file

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/toolsets.xml
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/toolsets.xml	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/deploy/toolsets.xml	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<toolsets>
+    <toolset>
+        <service>IronJacamarService</service>
+        <name>default</name>
+        <includes>vmstat 10</includes>
+        <!-- includes>iostat -xn 10</includes>
+        <includes>mpstat 10</includes-->
+    </toolset>
+    <!-- toolset>
+        <service>IronJacamarService</service>
+        <name>detail</name>
+        <base>default</base>
+        <includes>cpustat</includes>
+        <includes>trapstat</includes>
+    </toolset>
+    <toolset>
+        <service>IronJacamarService</service>
+        <name>lite</name>
+        <base>default</base>
+        <excludes>iostat -xn 10</excludes>
+    </toolset-->
+</toolsets>
\ No newline at end of file

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/agent.sh
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/agent.sh	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/agent.sh	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# agent.sh Script to launch the Faban driver agent in distributed mode.
+# You'll need to launch the registry before the agent and the master
+# after launching the agent. Please check registry.sh and master.sh
+#
+
+BINDIR=`dirname $0`
+. ${BINDIR}/setenv.sh
+
+$JAVA_HOME/bin/java -Djava.security.policy=security/driver.policy \
+    -Djava.util.logging.config.file=logging.properties \
+    -Dbenchmark.config=run.xml com.sun.faban.driver.core.AgentImpl \
+    MyDriver 1 sr1-umpk-18

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/master.sh
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/master.sh	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/master.sh	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# master.sh Script to launch the master for the Faban driver sample in the
+# distributed mode. If launched alone without the registry and agents, it
+# also assumes single process mode.
+#
+# Please also check registry.sh and agent.sh for launching in distributed
+# mode.
+#
+
+BINDIR=`dirname $0`
+. ${BINDIR}/setenv.sh
+
+$JAVA_HOME/bin/java -XX:+DisableExplicitGC \
+    -Djava.security.policy=security/driver.policy \
+    -Djava.util.logging.config.file=logging.properties \
+    -Dbenchmark.config=run.xml com.sun.faban.driver.core.MasterImpl

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/multi.sh
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/multi.sh	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/multi.sh	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# multi.sh Script to launch the Faban driver sample in distributed mode on
+# a single system.
+#
+
+BINDIR=`dirname $0`
+. ${BINDIR}/setenv.sh
+
+trap kill_all 2
+
+kill_all() {
+    if [ -n "${REGISTRY_PID}" ] ; then
+        kill ${MASTER_PID} ${AGENT_PID} ${REGISTRY_PID}
+    fi
+}
+
+$JAVA_HOME/bin/java -XX:+DisableExplicitGC \
+    -Djava.security.policy=security/driver.policy \
+    -Djava.util.logging.config.file=logging.properties \
+    com.sun.faban.common.RegistryImpl &
+REGISTRY_PID="$!"
+sleep 2
+
+$JAVA_HOME/bin/java -XX:+DisableExplicitGC \
+    -Djava.security.policy=security/driver.policy \
+    -Djava.util.logging.config.file=logging.properties \
+    com.sun.faban.driver.core.AgentImpl MyDriver 1 localhost &
+AGENT_PID="$!"
+
+sleep 2
+
+$JAVA_HOME/bin/java -XX:+DisableExplicitGC \
+    -Djava.security.policy=security/driver.policy \
+    -Djava.util.logging.config.file=logging.properties \
+    -Dbenchmark.config=run.xml \
+    com.sun.faban.driver.core.MasterImpl &
+MASTER_PID="$!"
+
+
+wait ${MASTER_PID}
+kill ${AGENT_PID} ${REGISTRY_PID}

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/registry.sh
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/registry.sh	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/registry.sh	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# registry.sh Script to launch the Faban driver agent in distributed mode.
+# You'll need to launch the registry before the agents and the master
+# Please check agent.sh and master.sh
+#
+
+BINDIR=`dirname $0`
+. ${BINDIR}/setenv.sh
+
+$JAVA_HOME/bin/java -Djava.security.policy=security/driver.policy \
+    -Djava.util.logging.config.file=logging.properties \
+    -Dbenchmark.config=run.xml com.sun.faban.common.RegistryImpl

Added: projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/setenv.sh
===================================================================
--- projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/setenv.sh	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/services/IronJacamarService/sbin/setenv.sh	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+# setenv.sh Script to be execed from all launch scripts to setup the
+# execution environment. 
+#
+
+
+# Check and set all variables...
+BINDIR=`dirname $0`
+
+if [ -n "$BINDIR" ] ; then
+    BENCH_HOME=`cd $BINDIR/.. > /dev/null 2>&1 && pwd`
+    export BENCH_HOME
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+    JAVA_HOME=/usr/dist/share/java,v1.5.0/5.x-sun4
+    export JAVA_HOME;
+fi
+
+# Guess mode for FABAN_HOME
+GUESS=""
+if [ -z "${FABAN_HOME}" ] ; then
+    # This would be the location if the sample
+    # were run from the Faban distribution.
+    FABAN_HOME=../../..
+    FABAN_HOME=`cd ${FABAN_HOME} > /dev/null 2>&1 && pwd`
+    export FABAN_HOME
+    GUESS=true;
+fi
+
+if [ ! -f "${FABAN_HOME}/lib/fabandriver.jar" ] ; then
+    if [ -n "${GUESS}" ] ; then
+      echo "FABAN_HOME variable not set, exiting."
+    else
+      echo "Sorry, did not find Faban at FABAN_HOME=${FABAN_HOME}, exiting."
+    fi
+    exit 1
+fi
+
+# Set the necessary classpaths
+CLASSPATH=${FABAN_HOME}/lib/fabancommon.jar:${FABAN_HOME}/lib/fabandriver.jar
+
+for i in ${BENCH_HOME}/lib/*.jar
+do
+    CLASSPATH=${CLASSPATH}:$i
+done
+
+CLASSPATH=${CLASSPATH}:${BENCH_HOME}/build/classes
+
+for i in ${SAMPLE_HOME}/lib/*.jar
+do
+    CLASSPATH=${CLASSPATH}:$i
+done
+
+export CLASSPATH
+
+cd ../config

Added: projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/services/ironjacamar/IronJacamarService.java
===================================================================
--- projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/services/ironjacamar/IronJacamarService.java	                        (rev 0)
+++ projects/jboss-jca/branches/performance/faban/src/main/java/org/jboss/jca/perf/services/ironjacamar/IronJacamarService.java	2011-03-17 10:50:46 UTC (rev 110942)
@@ -0,0 +1,333 @@
+ /*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2011, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt in the distribution for a
+  * full listing of individual contributors.
+  *
+  * This is free software; you can redistribute it and/or modify it
+  * under the terms of the GNU Lesser General Public License as
+  * published by the Free Software Foundation; either version 2.1 of
+  * the License, or (at your option) any later version.
+  *
+  * This software is distributed in the hope that it will be useful,
+  * but WITHOUT ANY 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 along with this software; if not, write to the Free
+  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  */
+package org.jboss.jca.perf.services.ironjacamar;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.Socket;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+import com.sun.faban.common.Command;
+import com.sun.faban.driver.ConfigurationException;
+import com.sun.faban.harness.Configure;
+import com.sun.faban.harness.Context;
+import com.sun.faban.harness.RemoteCallable;
+import com.sun.faban.harness.RunContext;
+import com.sun.faban.harness.Start;
+import com.sun.faban.harness.Stop;
+import com.sun.faban.harness.services.ClearLogs;
+import com.sun.faban.harness.services.GetLogs;
+import com.sun.faban.harness.services.ServiceContext;
+
+/**
+ * This class is responsible for starting IronJacamar on
+ * one or many machines using the Faban service infrastructure.
+ * The class starts and stops an instance of the server using 
+ * commands.
+ * @author <a href="jwhiting at redhat.com">Jeremy Whiting</a>
+ *
+ */
+public class IronJacamarService
+{
+   @Context
+   public ServiceContext sc ;
+   private Logger logger = Logger.getLogger(IronJacamarService.class.getName());
+   private List<String> jcaServers;
+   private String serverHome;
+   private String serverStartScript;
+   private String jcaCommand;
+   private String interfaceBindname;
+   private String dbConnectUrl, dbDriverClass;
+   private Long port;
+   private static final String SERVER_HOME = "serverHome";
+   private static final String RUN_SCRIPT = "runScript";
+   private static final String INTERFACE_BINDNAME = "intefaceBindname";
+   private static final String DB_CONNECT_URL = "dbConnectUrl";
+   private static final String DB_DRIVER_CLASS = "dbDriverClass";
+   private static final String LISTEN_PORT = "listenPort";
+   
+   private static final String SCRIPT_PATH = "$1%s$2%sbin$2%s$3%s";
+   private static final String COMMAND_WITH_INTERFACE_BINDING = "$1%s -b $2%s";
+   private static final String COMMAND_WITH_DB_CONNECT_URL_PROPERTY = "$1%s -Ddb-vendor.connectionURL=$2%s";
+   private static final String COMMAND_WITH_DB_DRIVER_FQCN_PROPERTY = "$1%s -Ddb-vendor.driverClass=$2%s";
+      
+   /**
+    * This method first extracts the properties from the configuration xml.
+    * Then builds the command line that will be executed on each server.
+    * @throws ConfigurationException when a required value is empty or null
+    */
+   @Configure
+   public void configure()
+      throws ConfigurationException
+   {
+      if (logger.isLoggable(Level.FINE))
+      {
+         logger.fine("Configuring IronJacamar Started");
+      }
+      //extract
+      jcaServers = Arrays.asList( this.sc.getUniqueHosts());
+      if (jcaServers.isEmpty())
+      {
+         throw new ConfigurationException("Server hosts is empty, enter a host name.");
+      }
+      this.serverHome = sc.getProperty(SERVER_HOME);
+      if (null == serverHome || "".equals(serverHome.trim()))
+      {
+         throw new ConfigurationException("Server home is undefined, enter a server path.");
+      }
+      this.serverStartScript = sc.getProperty(RUN_SCRIPT);
+      if (null == serverStartScript )
+      {
+         throw new ConfigurationException("Server home is undefined, enter a server path.");
+      }
+      else if ("".equals(serverStartScript.trim()))
+      {
+         throw new ConfigurationException("Server home is undefined, enter a server path.");
+      }
+      
+      this.dbConnectUrl  = sc.getProperty(DB_CONNECT_URL);
+      if (null == this.dbConnectUrl )
+      {
+         throw new ConfigurationException("db connect url is undefined, enter a url.");
+      }
+      else if ("".equals(this.dbConnectUrl.trim()))
+      {
+         throw new ConfigurationException("db connect url is undefined, enter a url.");
+      }
+      
+      this.dbDriverClass  = sc.getProperty(DB_DRIVER_CLASS);
+      if (null == this.dbDriverClass )
+      {
+         throw new ConfigurationException("db driver class is undefined, enter a url.");
+      }
+      else if ("".equals(this.dbDriverClass.trim()))
+      {
+         throw new ConfigurationException("db driver class is undefined, enter a url.");
+      }
+      
+      this.interfaceBindname = sc.getProperty(INTERFACE_BINDNAME);
+      // an empty value is permitted
+      
+      String portValue= sc.getProperty(LISTEN_PORT);
+      if (null == portValue )
+      {
+         throw new ConfigurationException("Listen port is undefined, enter a port number.");
+      }
+      else if ("".equals(portValue.trim()))
+      {
+         throw new ConfigurationException("Listen port is undefined, enter a port number.");
+      }
+      try
+      {
+         port = Long.valueOf(portValue);
+      }
+      catch (NumberFormatException nfe)
+      {
+         throw new ConfigurationException("Listen port is value entered was not an integer value.");
+      }
+      
+      //build command
+      String fullScriptPath = String.format(SCRIPT_PATH, this.serverHome, File.separator, this.serverStartScript);
+      if (null != this.interfaceBindname && !"".equals(this.interfaceBindname.trim()))
+      {
+         this.jcaCommand = withBindFlag(this.interfaceBindname, fullScriptPath);
+      }
+      //add required properties
+      this.jcaCommand = withDBConnectUrl(this.dbConnectUrl, this.jcaCommand);
+      this.jcaCommand = withDBDriverFQCN(this.dbDriverClass, jcaCommand);
+      if (logger.isLoggable(Level.FINE))
+      {
+         logger.fine("Configuring IronJacamar Complete.");
+      }
+   }
+   
+   
+   @Start
+   public void startup()
+   {
+      for(String host : jcaServers)
+      {
+         if (logger.isLoggable(Level.FINE))
+         {
+            logger.fine(String.format( "Starting IronJacamar on [$1%s]" , host));
+         }
+         Command command = new Command(this.jcaCommand);
+         if (logger.isLoggable(Level.FINE))
+         {
+            logger.fine("Starting IronJacamar.");
+         }
+         command.setWorkingDirectory(this.serverHome);
+         command.setSynchronous(false);
+         try
+         {
+            RunContext.exec(host, command);
+            // check it is running
+            if (!checkServerListening(host, port))
+            {
+               logger.severe(String.format( "IronJacamar server did not startup and respond to requests on [$1%s]" , host));
+            }
+            if (logger.isLoggable(Level.FINE))
+            {
+               logger.fine(String.format("Completed IronJacamar start attempt on [$1%s].", host) );
+            }
+         }
+         catch (Exception e)
+         {
+            logger.log(Level.WARNING, "Startup failure.", e);
+         }
+      }
+   }
+   
+   private static boolean checkServerListening(final String host, final Long port)
+      throws Exception 
+   {
+      Boolean returnValue = false;
+      
+      returnValue = RunContext.exec(host, new RemoteCallable<Boolean>()
+      {
+         private static final long serialVersionUID = 4268800901502329284L;
+         private static final short CHECK_COUNT = 60;
+         private static final short WAIT_MILLIS = 2000;// two seconds
+         
+         /**
+          * This annonymous inner class is used as a callable to check the IronJacamar
+          * server has completed starting up.
+          * The basis for checking is if the server is listening on a specific port.
+          * The port number and host are needed.
+          */
+         @Override
+         public Boolean call() throws Exception
+         {
+            Boolean returnValue = false;
+            /**
+             * Try checking for a listener
+             */
+            short count = 0;
+            while (count < CHECK_COUNT)
+            {
+               count += 1;
+               Socket s = null;
+               try
+               {
+                  s = new Socket(host, port.intValue());
+                  //is listening
+                  returnValue = new Boolean(true);
+                  break;
+               }
+               catch (IOException ioe)
+               {
+                  // not listening
+               }
+               finally
+               {
+                  if (null != s)
+                  {
+                     try
+                     {
+                        s.close();
+                        s = null;
+                     }
+                     catch (IOException ioe)
+                     {/* ignore this exception */ 
+                     }
+                  }
+               }
+               Thread.sleep(WAIT_MILLIS);
+            }
+            
+            return returnValue;
+         }
+      });
+      return returnValue;
+   }
+   
+   @Stop
+   public void shutdown()
+   {
+      if (logger.isLoggable(Level.FINE))
+      {
+         logger.fine("IronJacamar server is stopped.");
+      }
+   }
+   
+   @ClearLogs
+   public void clearLogs()
+   {
+      if (logger.isLoggable(Level.FINE))
+      {
+         logger.fine("IronJacamar logs have been cleared.");
+      }
+   }
+   
+   @GetLogs
+   public void xpfeLogs()
+   {
+      if (logger.isLoggable(Level.FINE))
+      {
+         logger.fine("IronJacamar logs are being retrieved.");
+      }
+   }
+   
+   /**
+    * This method adds a bind variable to the command line
+    * @param bindValue
+    * @param command
+    * @return
+    */
+   private String withBindFlag(String bindValue, String command)
+   {
+      String returnValue = command;
+      if (null != bindValue && !"".equals(bindValue.trim()))
+      {
+         returnValue = String.format(COMMAND_WITH_INTERFACE_BINDING, command, bindValue);
+      }
+      return returnValue;
+   }
+   
+   /**
+    * This method adds a property to the command line defining the connect url
+    * @param url
+    * @param command
+    * @return
+    */
+   private String withDBConnectUrl(String url, String command)
+   {
+      return String.format(COMMAND_WITH_DB_CONNECT_URL_PROPERTY, command, url);
+   }
+   
+   /**
+    * This method adds a property to the command line defining the driver class name
+    * @param url
+    * @param command
+    * @return
+    */
+   private String withDBDriverFQCN(String fqcn, String command)
+   {
+      return String.format(COMMAND_WITH_DB_DRIVER_FQCN_PROPERTY, command, fqcn);
+   }
+   
+   
+}



More information about the jboss-cvs-commits mailing list