[jboss-cvs] JBossAS SVN: r107143 - in projects/jboss-jca/branches/performance: extensions and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jul 28 07:50:03 EDT 2010


Author: jeff.zhang
Date: 2010-07-28 07:50:01 -0400 (Wed, 28 Jul 2010)
New Revision: 107143

Added:
   projects/jboss-jca/branches/performance/extensions/
   projects/jboss-jca/branches/performance/extensions/.classpath
   projects/jboss-jca/branches/performance/extensions/.project
   projects/jboss-jca/branches/performance/extensions/build.xml
   projects/jboss-jca/branches/performance/extensions/src/
   projects/jboss-jca/branches/performance/extensions/src/main/
   projects/jboss-jca/branches/performance/extensions/src/main/java/
   projects/jboss-jca/branches/performance/extensions/src/main/java/org/
   projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/
   projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/
   projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/
   projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/
   projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtLoggingOutputStream.java
   projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtWriterOutputStream.java
   projects/jboss-jca/branches/performance/extensions/src/main/resources/
   projects/jboss-jca/branches/performance/extensions/src/main/resources/stdio.xml
Log:
[JBJCA-388] extend printstream to get performance data for sjc container

Added: projects/jboss-jca/branches/performance/extensions/.classpath
===================================================================
--- projects/jboss-jca/branches/performance/extensions/.classpath	                        (rev 0)
+++ projects/jboss-jca/branches/performance/extensions/.classpath	2010-07-28 11:50:01 UTC (rev 107143)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/jboss-jca-api"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/jboss-jca-common"/>
+	<classpathentry kind="output" path="eclipse-target/classes"/>
+	<classpathentry kind="var" path="JBJCA_LIB/common/jboss-stdio.jar"/>
+</classpath>

Added: projects/jboss-jca/branches/performance/extensions/.project
===================================================================
--- projects/jboss-jca/branches/performance/extensions/.project	                        (rev 0)
+++ projects/jboss-jca/branches/performance/extensions/.project	2010-07-28 11:50:01 UTC (rev 107143)
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>jboss-jca-performance-extensions</name>
+  <comment>JBoss JCA performance extensions module</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>

Added: projects/jboss-jca/branches/performance/extensions/build.xml
===================================================================
--- projects/jboss-jca/branches/performance/extensions/build.xml	                        (rev 0)
+++ projects/jboss-jca/branches/performance/extensions/build.xml	2010-07-28 11:50:01 UTC (rev 107143)
@@ -0,0 +1,106 @@
+<!--
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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-performance-extensions" 
+         default="jars" 
+         xmlns:ivy="antlib:org.apache.ivy.ant">
+
+  <!-- ================================= 
+       Properties              
+       ================================= -->
+  <property name="build.rars.dir" value="${build.dir}/rars" />
+
+  <!-- ================================= 
+       Target: compile
+       ================================= -->
+  <target name="compile">
+    <mkdir dir="${build.rars.dir}" />
+    <mkdir dir="${build.rars.dir}/impl" />
+
+    <javac srcdir="src/main"
+           destdir="${build.rars.dir}/impl"
+           classpathref="lib.path.id"
+           debug="${javac.debug}"
+           deprecation="${javac.deprecation}"
+           optimize="${javac.optimize}">
+      <compilerarg value="-Xlint"/>
+    </javac> 
+  </target>
+
+  <!-- ================================= 
+       Target: jars 
+       ================================= -->
+  <target name="jars" depends="compile">
+    <mkdir dir="${build.rars.dir}/jars" />
+
+    <!-- rars -->
+    <mkdir dir="${build.rars.dir}/jars/exts" />
+
+    <copy todir="${build.rars.dir}/jars/exts">
+      <fileset dir="${build.rars.dir}/impl"
+               includes="**"/>
+    </copy>
+
+    <jar destfile="${target.dir}/ironjacamar-performance-ext.jar"
+         basedir="${build.rars.dir}/jars/exts">
+      <manifest>
+        <attribute name="Implementation-Title" value="IronJacamar Deployers (Fungal)"/>
+        <attribute name="Implementation-Vendor" value="The IronJacamar project (http://www.jboss.org/ironjacamar)"/>
+        <attribute name="Implementation-Vendor-Id" value="org.jboss"/>
+      </manifest>
+    </jar>
+
+    <copy todir="${jbjca.home}/config/bootstrap" overwrite="true">
+      <fileset dir="src/main/resources/" includes="stdio.xml"/>
+          <filterset>
+          	<filter token="JBJCA_DATA" value="${root.dir}/jbjca.txt"/>
+          </filterset>
+    </copy>
+    <copy todir="${jbjca.home}/lib" overwrite="true">
+      <fileset dir="${target.dir}" includes="ironjacamar-performance-ext.jar"/>
+    </copy>
+  </target>
+
+  <!-- ================================= 
+       Target: docs
+       ================================= -->
+  <target name="docs" depends="compile">
+    <mkdir dir="${target.dir}/docs/performance"/>
+    <javadoc packagenames="org.*"
+             sourcepath="src/main/java"
+             destdir="${target.dir}/docs/performance"
+             author="true"
+             version="true"
+             windowtitle="JBoss JCA performance"
+             doctitle="JBoss JCA performance"
+             use="true"
+             additionalparam="-author -version"
+             classpath="${build.rars.dir}/impl"
+             classpathref="lib.path.id"
+             bottom="Copyright &#169; 2008-2009 Red Hat Middleware LLC (http://www.jboss.com/)">
+      <link offline="true" href="http://java.sun.com/j2se/5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
+    </javadoc>
+    <copy todir="${target.dir}/docs/performance" overwrite="true">
+      <fileset dir="${tools.dir}/api"/>
+    </copy>
+  </target>
+
+</project>

Added: projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtLoggingOutputStream.java
===================================================================
--- projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtLoggingOutputStream.java	                        (rev 0)
+++ projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtLoggingOutputStream.java	2010-07-28 11:50:01 UTC (rev 107143)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.
+ */
+package org.jboss.jca.performance.ext;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.jboss.stdio.LoggingWriter;
+/**
+ * ExtLoggingOutputStream
+ *
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class ExtLoggingOutputStream extends ExtWriterOutputStream
+{
+   /**
+    * Construct a new instance.
+    *
+    * @param category the log category to use
+    * @param levelName the name of the level at which to log messages
+    */
+   public ExtLoggingOutputStream(final String category, final String levelName) {
+       this(category, Level.parse(levelName));
+   }
+
+   /**
+    * Construct a new instance.
+    *
+    * @param category the log category to use
+    * @param level the level at which to log messages
+    */
+   public ExtLoggingOutputStream(final String category, final Level level) {
+       this(Logger.getLogger(category), level);
+   }
+
+   /**
+    * Construct a new instance.
+    *
+    * @param log the logger to use
+    * @param level the level at which to log messages
+    */
+   public ExtLoggingOutputStream(final Logger log, final Level level) {
+       super(new LoggingWriter(log, level));
+   }
+
+}

Added: projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtWriterOutputStream.java
===================================================================
--- projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtWriterOutputStream.java	                        (rev 0)
+++ projects/jboss-jca/branches/performance/extensions/src/main/java/org/jboss/jca/performance/ext/ExtWriterOutputStream.java	2010-07-28 11:50:01 UTC (rev 107143)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.
+ */
+package org.jboss.jca.performance.ext;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+import org.jboss.stdio.WriterOutputStream;
+
+/**
+ * ExtWriterOutputStream
+ *
+ * @author Jeff Zhang
+ * @version $Revision: $
+ */
+public class ExtWriterOutputStream extends WriterOutputStream
+{
+   /** output data filename */
+   private String dataFile;
+   
+   /** file to output data */
+   private FileWriter data = null;
+   
+   /**
+    * Create a new ExtWriterOutputStream.
+    * 
+    * @param writer
+    */
+   public ExtWriterOutputStream(Writer writer)
+   {
+      super(writer);
+   }
+
+   /**
+    * Writes a portion of an array of characters.
+    *
+    * @param  cbuf  Buffer of characters
+    * @param  off   Offset from which to start writing characters
+    * @param  len   Number of characters to write
+    *
+    * @exception  IOException  If an I/O error occurs
+    */
+   @Override
+   public void write(byte[] b, int off, int len) throws IOException
+   {
+      super.write(b, off, len);
+
+      if (b[0] == '@')
+      {
+         if (b[2] == 'W' && b[3] == 'A')
+            return;
+         String str = new String(b, off, len);
+         System.out.println();
+
+         if (data == null)
+         {
+            if (dataFile != null && !dataFile.equals(""))
+            {
+               data = new FileWriter(dataFile);
+            }
+            
+            if (data == null)
+               throw new IOException("Can't create file" + dataFile);
+         }
+
+         data.write(str, off + 2, len - 2);
+         data.write('\n');
+         data.flush();
+
+      }
+   }
+
+   /**
+    * close
+    *
+    * @exception  IOException  If an I/O error occurs
+    */
+   @Override
+   public void close() throws IOException
+   {
+      super.close();
+      if (data != null)
+      {
+         data.close();
+      }
+   }
+
+   /**
+    * Set the dataFile.
+    * 
+    * @param dataFile The dataFile to set.
+    */
+   public void setDataFile(String dataFile)
+   {
+      this.dataFile = dataFile;
+   }
+
+   /**
+    * Get the dataFile.
+    * 
+    * @return the dataFile.
+    */
+   public String getDataFile()
+   {
+      return dataFile;
+   }
+
+}

Added: projects/jboss-jca/branches/performance/extensions/src/main/resources/stdio.xml
===================================================================
--- projects/jboss-jca/branches/performance/extensions/src/main/resources/stdio.xml	                        (rev 0)
+++ projects/jboss-jca/branches/performance/extensions/src/main/resources/stdio.xml	2010-07-28 11:50:01 UTC (rev 107143)
@@ -0,0 +1,47 @@
+<deployment>
+
+  <bean name="JBossStdioSystemOutStream" class="org.jboss.jca.performance.ext.ExtLoggingOutputStream">
+    <constructor>
+      <parameter>STDOUT</parameter>
+      <parameter>INFO</parameter>
+    </constructor>
+    <property name="DataFile">@JBJCA_DATA@</property>
+  </bean>
+
+  <bean name="JBossStdioSystemErrStream" class="org.jboss.stdio.LoggingOutputStream">
+    <constructor>
+      <parameter>STDERR</parameter>
+      <parameter>ERROR</parameter>
+    </constructor>
+  </bean>
+
+  <bean name="JBossStdioSystemInStream" class="org.jboss.stdio.NullInputStream">
+    <constructor factoryMethod="getInstance"/>
+  </bean>
+
+  <bean name="JBossStdioContext" class="org.jboss.stdio.StdioContext">
+    <constructor factoryMethod="create">
+      <parameter>
+        <inject bean="JBossStdioSystemInStream"/>
+      </parameter>
+      <parameter class="java.io.OutputStream">
+        <inject bean="JBossStdioSystemOutStream"/>
+      </parameter>
+      <parameter>
+        <inject bean="JBossStdioSystemErrStream"/>
+      </parameter>
+    </constructor>
+  </bean>
+
+  <bean name="JBossStdioService" class="org.jboss.stdio.StdioService">
+    <depends>JBossStdioContext</depends>
+  </bean>
+
+  <bean name="JBossStdioContextSelector" class="org.jboss.stdio.SimpleStdioContextSelector">
+    <constructor>
+      <parameter><inject bean="JBossStdioContext"/></parameter>
+    </constructor>
+    <install method="install"/>
+  </bean>
+
+</deployment>



More information about the jboss-cvs-commits mailing list