geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viol...@apache.org
Subject svn commit: r1071543 [10/15] - in /geronimo/daytrader/trunk: ./ assemblies/javaee/ javaee6/ javaee6/assemblies/ javaee6/assemblies/daytrader-ear/ javaee6/assemblies/daytrader-ear/src/ javaee6/assemblies/daytrader-ear/src/main/ javaee6/assemblies/daytra...
Date Thu, 17 Feb 2011 08:24:04 GMT
Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingServletWriter.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingServletWriter.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingServletWriter.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingServletWriter.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,98 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.annotation.WebServlet;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+
+
+/**
+ *
+ * PingServlet extends PingServlet by using a PrintWriter for formatted 
+ * output vs. the output stream used by {@link PingServlet}.
+ * 
+ */
+@WebServlet("/servlet/PingServletWriter")
+public class PingServletWriter extends HttpServlet {
+
+    private static String initTime;
+    private static int hitCount;
+
+    /**
+     * forwards post requests to the doGet method
+     * Creation date: (11/6/2000 10:52:39 AM)
+     * @param res javax.servlet.http.HttpServletRequest
+     * @param res2 javax.servlet.http.HttpServletResponse
+     */
+    public void doPost(HttpServletRequest req, HttpServletResponse res)
+        throws ServletException, IOException {
+        doGet(req, res);
+    }
+    /**
+    * this is the main method of the servlet that will service all get requests.
+    * @param request HttpServletRequest
+    * @param responce HttpServletResponce
+    **/
+    public void doGet(HttpServletRequest req, HttpServletResponse res)
+        throws ServletException, IOException {
+        try
+        {
+            res.setContentType("text/html");
+
+            // The following 2 lines are the difference between PingServlet and PingServletWriter
+            //   the latter uses a PrintWriter for output versus a binary output stream.
+            //ServletOutputStream out = res.getOutputStream();
+            java.io.PrintWriter out = res.getWriter();
+                        hitCount++;
+            out.println(
+                "<html><head><title>Ping Servlet Writer</title></head>"
+                    + "<body><HR><BR><FONT size=\"+2\" color=\"#000066\">Ping Servlet Writer:<BR></FONT><FONT size=\"+1\" color=\"#000066\">Init time : "
+                    + initTime
+                    + "<BR><BR></FONT>  <B>Hit Count: "
+                    + hitCount
+                    + "</B></body></html>"); 
+        }
+        catch (Exception e)
+        {
+            Log.error(e, "PingServletWriter.doGet(...): general exception caught"); 
+            res.sendError(500, e.toString());
+        }
+    }
+    /** 
+     * returns a string of information about the servlet
+     * @return info String: contains info about the servlet
+     **/
+
+    public String getServletInfo()
+    {
+        return "Basic dynamic HTML generation through a servlet using a PrintWriter";
+    }
+    /**
+    * called when the class is loaded to initialize the servlet
+    * @param config ServletConfig:
+    **/
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession1.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession1.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession1.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession1.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,128 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+
+import javax.servlet.annotation.WebServlet;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+/**
+ *
+ * PingHTTPSession1 - SessionID tests fundamental HTTP session functionality 
+ * by creating a unique session ID for each individual user. The ID is stored 
+ * in the users session and is accessed and displayed on each user request.
+ *
+ */
+@WebServlet("/servlet/PingSession1")
+public class PingSession1 extends HttpServlet {
+    private static int count;
+    // For each new session created, add a session ID of the form "sessionID:" + count
+    private static String initTime;
+    private static int hitCount;
+/**
+ * forwards post requests to the doGet method
+ * Creation date: (11/6/2000 10:52:39 AM)
+ * @param res javax.servlet.http.HttpServletRequest
+ * @param res2 javax.servlet.http.HttpServletResponse
+ */
+public void doPost(HttpServletRequest req, HttpServletResponse res)
+    throws ServletException, IOException {
+    doGet(req, res);
+}
+/**
+* this is the main method of the servlet that will service all get requests.
+* @param request HttpServletRequest
+* @param responce HttpServletResponce
+**/
+public void doGet(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException {
+    HttpSession session = null;
+    try
+    {
+        try
+        {
+            //get the users session, if the user does not have a session create one.
+            session = request.getSession(true);
+        }
+        catch (Exception e)
+        {
+            Log.error(e, "PingSession1.doGet(...): error getting session"); 
+            //rethrow the exception for handling in one place.
+            throw e;
+        }
+
+        // Get the session data value
+        Integer ival = (Integer) session.getAttribute("sessiontest.counter");
+        //if their is not a counter create one.
+        if (ival == null)
+        {
+            ival = new Integer(count++);
+            session.setAttribute("sessiontest.counter", ival);
+        }
+        String SessionID = "SessionID:" + ival.toString();
+
+        // Output the page
+        response.setContentType("text/html");
+        response.setHeader("SessionKeyTest-SessionID", SessionID);
+
+        PrintWriter out = response.getWriter();
+        out.println(
+            "<html><head><title>HTTP Session Key Test</title></head><body><HR><BR><FONT size=\"+2\" color=\"#000066\">HTTP Session Test 1: Session Key<BR></FONT><FONT size=\"+1\" color=\"#000066\">Init time: "
+                + initTime
+                + "</FONT><BR><BR>");
+                hitCount++;
+        out.println(
+            "<B>Hit Count: "
+                + hitCount
+                + "<BR>Your HTTP Session key is "
+                + SessionID
+                + "</B></body></html>"); 
+    }
+    catch (Exception e)
+    {
+        //log the excecption
+        Log.error(e, "PingSession1.doGet(..l.): error."); 
+        //set the server responce to 500 and forward to the web app defined error page 
+        response.sendError(
+            500, 
+            "PingSession1.doGet(...): error. " + e.toString()); 
+    }
+}
+/** 
+ * returns a string of information about the servlet
+ * @return info String: contains info about the servlet
+ **/
+
+public String getServletInfo()
+{
+    return "HTTP Session Key: Tests management of a read only unique id";
+}
+/**
+* called when the class is loaded to initialize the servlet
+* @param config ServletConfig:
+**/
+public void init(ServletConfig config) throws ServletException {
+    super.init(config);
+    count = 0;
+    hitCount = 0;
+    initTime = new java.util.Date().toString();
+
+}
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession2.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession2.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession2.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession2.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,145 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.annotation.WebServlet;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+
+/**
+ *
+ * PingHTTPSession2 session create/destroy further extends the previous test by
+ * invalidating the HTTP Session on every 5th user access. This results in testing
+ * HTTPSession create and destroy
+ *
+ */
+@WebServlet("/servlet/PingSession2")
+public class PingSession2 extends HttpServlet {
+
+    private static String initTime;
+    private static int hitCount;
+
+/**
+ * forwards post requests to the doGet method
+ * Creation date: (11/6/2000 10:52:39 AM)
+ * @param res javax.servlet.http.HttpServletRequest
+ * @param res2 javax.servlet.http.HttpServletResponse
+ */
+public void doPost(HttpServletRequest req, HttpServletResponse res)
+    throws ServletException, IOException {
+    doGet(req, res);
+}
+/**
+* this is the main method of the servlet that will service all get requests.
+* @param request HttpServletRequest
+* @param responce HttpServletResponce
+**/
+public void doGet(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException {
+    HttpSession session = null;
+    try
+    {
+        try
+        {
+            session = request.getSession(true);
+        }
+        catch (Exception e)
+        {
+            Log.error(e, "PingSession2.doGet(...): error getting session"); 
+            //rethrow the exception for handling in one place.
+            throw e;
+
+        }
+
+        // Get the session data value
+        Integer ival = (Integer) session.getAttribute("sessiontest.counter");
+        //if there is not a counter then create one.
+        if (ival == null)
+        {
+            ival = new Integer(1);
+        }
+        else
+        {
+            ival = new Integer(ival.intValue() + 1);
+        }
+        session.setAttribute("sessiontest.counter", ival);
+        //if the session count is equal to five invalidate the session
+        if (ival.intValue() == 5)
+        {
+            session.invalidate();
+        }
+
+        try
+        {
+            // Output the page
+            response.setContentType("text/html");
+            response.setHeader("SessionTrackingTest-counter", ival.toString());
+
+            PrintWriter out = response.getWriter();
+            out.println(
+                "<html><head><title>Session Tracking Test 2</title></head><body><HR><BR><FONT size=\"+2\" color=\"#000066\">HTTP Session Test 2: Session create/invalidate <BR></FONT><FONT size=\"+1\" color=\"#000066\">Init time: "
+                    + initTime
+                    + "</FONT><BR><BR>");
+                        hitCount++;
+            out.println(
+                "<B>Hit Count: "
+                    + hitCount
+                    + "<BR>Session hits: "
+                    + ival
+                    + "</B></body></html>"); 
+        }
+        catch (Exception e)
+        {
+            Log.error(e, "PingSession2.doGet(...): error getting session information"); 
+            //rethrow the exception for handling in one place.
+            throw e;
+        }
+
+    }
+
+    catch (Exception e)
+    {
+        //log the excecption
+        Log.error(e, "PingSession2.doGet(...): error."); 
+        //set the server responce to 500 and forward to the web app defined error page 
+        response.sendError(
+            500, 
+            "PingSession2.doGet(...): error. " + e.toString()); 
+    }
+} //end of the method
+/** 
+ * returns a string of information about the servlet
+ * @return info String: contains info about the servlet
+ **/
+public String getServletInfo()
+{
+    return "HTTP Session Key: Tests management of a read/write unique id";
+}
+/**
+* called when the class is loaded to initialize the servlet
+* @param config ServletConfig:
+**/
+public void init(ServletConfig config) throws ServletException {
+    super.init(config);
+    hitCount = 0;
+    initTime = new java.util.Date().toString();
+
+}
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,178 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.annotation.WebServlet;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+
+
+/**
+ * 
+ * PingHTTPSession3 tests the servers ability to manage 
+ * and persist large HTTPSession data objects. The servlet creates the large custom 
+ * java object {@link PingSession3Object}. This large session object is 
+ * retrieved and stored to the session on each user request.  The default settings
+ * result in approx 2024 bits being retrieved and stored upon each request.
+ *
+ */
+@WebServlet("/servlet/PingSession3")
+public class PingSession3 extends HttpServlet {
+    private static int NUM_OBJECTS = 2;
+    private static String initTime = null;
+    private static int hitCount = 0;
+
+/**
+ * forwards post requests to the doGet method
+ * Creation date: (11/6/2000 10:52:39 AM)
+ * @param res javax.servlet.http.HttpServletRequest
+ * @param res2 javax.servlet.http.HttpServletResponse
+ */
+public void doPost(HttpServletRequest req, HttpServletResponse res)
+    throws ServletException, IOException {
+    doGet(req, res);
+}
+/**
+* this is the main method of the servlet that will service all get requests.
+* @param request HttpServletRequest
+* @param responce HttpServletResponce
+**/
+public void doGet(HttpServletRequest request, HttpServletResponse response)
+    throws ServletException, IOException {
+
+    PrintWriter out = response.getWriter();
+    //Using a StringBuffer to output all at once.
+    StringBuffer outputBuffer = new StringBuffer();
+    HttpSession session = null;
+    PingSession3Object[] sessionData;
+    response.setContentType("text/html");
+
+    //this is a general try/catch block.  The catch block at the end of this will forward the responce
+    //to an error page if there is an exception
+    try
+    {
+
+        try
+        {
+            session = request.getSession(true);
+        }
+        catch (Exception e)
+        {
+            Log.error(e, "PingSession3.doGet(...): error getting session"); 
+            //rethrow the exception for handling in one place.
+            throw e;
+
+        }
+        // Each PingSession3Object in the PingSession3Object array is 1K in size
+        // NUM_OBJECTS sets the size of the array to allocate and thus set the size in KBytes of the session object
+        // NUM_OBJECTS can be initialized by the servlet
+        // Here we check for the request parameter to change the size and invalidate the session if it exists
+        // NOTE: Current user sessions will remain the same (i.e. when NUM_OBJECTS is changed, all user thread must be restarted
+        // for the change to fully take effect
+
+        String num_objects;
+        if ((num_objects = request.getParameter("num_objects")) != null)
+        {
+            //validate input
+            try
+            {
+                int x = Integer.parseInt(num_objects);
+                if (x > 0)
+                {
+                    NUM_OBJECTS = x;
+                }
+            }
+            catch (Exception e)
+            {
+                Log.error(e, "PingSession3.doGet(...): input should be an integer, input=" + num_objects); 
+            } //  revert to current value on exception
+
+            outputBuffer.append(
+                "<html><head> Session object size set to "
+                    + NUM_OBJECTS
+                    + "K bytes </head><body></body></html>"); 
+            if (session != null)
+                session.invalidate();
+            out.print(outputBuffer.toString());
+            out.close();
+            return;
+        }
+
+        // Get the session data value
+        sessionData = 
+            (PingSession3Object[]) session.getAttribute("sessiontest.sessionData"); 
+        if (sessionData == null)
+        {
+            sessionData = new PingSession3Object[NUM_OBJECTS];
+            for (int i = 0; i < NUM_OBJECTS; i++)
+            {
+                sessionData[i] = new PingSession3Object();
+            }
+        }
+
+        session.setAttribute("sessiontest.sessionData", sessionData);
+
+        //Each PingSession3Object is about 1024 bits, there are 8 bits in a byte.
+        int num_bytes = (NUM_OBJECTS*1024)/8;
+        response.setHeader(
+            "SessionTrackingTest-largeSessionData", 
+            num_bytes + "bytes"); 
+
+        outputBuffer
+            .append("<html><head><title>Session Large Data Test</title></head><body><HR><BR><FONT size=\"+2\" color=\"#000066\">HTTP Session Test 3: Large Data<BR></FONT><FONT size=\"+1\" color=\"#000066\">Init time: ")
+            .append(initTime)
+            .append("</FONT><BR><BR>");
+                hitCount++;
+        outputBuffer.append("<B>Hit Count: ").append(hitCount).append(
+            "<BR>Session object updated. Session Object size = "
+                + num_bytes
+                + " bytes </B></body></html>"); 
+        //output the Buffer to the printWriter.
+        out.println(outputBuffer.toString());
+
+    }
+    catch (Exception e)
+    {
+        //log the excecption
+        Log.error(e, "PingSession3.doGet(..l.): error."); 
+        //set the server responce to 500 and forward to the web app defined error page 
+        response.sendError(
+            500, 
+            "PingSession3.doGet(...): error. " + e.toString());     }
+}
+/** 
+ * returns a string of information about the servlet
+ * @return info String: contains info about the servlet
+ **/
+public String getServletInfo()
+{
+    return "HTTP Session Object: Tests management of a large custom session class";
+}    
+/**
+* called when the class is loaded to initialize the servlet
+* @param config ServletConfig:
+**/
+public void init(ServletConfig config) throws ServletException {
+    super.init(config);
+    hitCount = 0;
+    initTime = new java.util.Date().toString();
+
+}
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3Object.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3Object.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3Object.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/PingSession3Object.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,89 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims;
+
+import java.io.*;
+
+/**
+ * 
+ * An object that contains approximately 1024 bits of information.  This is used by
+ * {@link PingSession3}
+ *
+ */
+public class PingSession3Object implements Serializable {
+    // PingSession3Object represents a BLOB of session data of various. 
+    // Each instantiation of this class is approximately 1K in size (not including overhead for arrays and Strings)
+    // Using different datatype exercises the various serialization algorithms for each type
+
+    byte[] byteVal = new byte[16]; // 8 * 16 = 128 bits
+    char[] charVal = new char[8]; // 16 * 8 = 128 bits
+    int a, b, c, d; // 4 * 32 = 128 bits
+    float e, f, g, h; // 4 * 32 = 128 bits
+    double i, j; // 2 * 64 = 128 bits
+    // Primitive type size = ~5*128=   640
+
+    String s1 = new String("123456789012");     
+    String s2 = new String("abcdefghijkl");
+//                                         String type size = ~2*12*16 =   384
+//                                         Total blob size (w/o overhead) =  1024
+
+
+//     The Session blob must be filled with data to avoid compression of the blob during serialization
+    PingSession3Object()
+    {
+        int index;
+        byte b = 0x8;
+        for (index=0; index<16; index++)
+        {
+            byteVal[index] = (byte) (b+2);
+        }
+
+        char c = 'a';
+        for (index=0; index<8; index++)
+        {
+            charVal[index] = (char) (c+2);
+        }
+
+        a=1; b=2; c=3; d=5;
+        e = (float)7.0; f=(float)11.0; g=(float)13.0; h=(float)17.0;
+        i=(double)19.0; j=(double)23.0;
+    }
+/**
+ * Main method to test the serialization of the Session Data blob object
+ * Creation date: (4/3/2000 3:07:34 PM)
+ * @param args java.lang.String[]
+ */
+
+/** Since the following main method were written for testing purpose, we comment them out
+*public static void main(String[] args) {
+*    try {
+*        PingSession3Object data = new PingSession3Object();
+*
+*        FileOutputStream ostream = new FileOutputStream("c:\\temp\\datablob.xxx");
+*        ObjectOutputStream p = new ObjectOutputStream(ostream);
+*        p.writeObject(data);
+*        p.flush();
+*        ostream.close();
+*    }
+*    catch (Exception e)
+*    {
+*        System.out.println("Exception: " + e.toString());
+*    }
+*}
+*/
+
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Entity.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Entity.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Entity.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Entity.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,105 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.annotation.WebServlet;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.ejb.EJB;
+
+
+import org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+/**
+ * 
+ * Primitive designed to run within the TradeApplication and makes use of
+ * {@link trade_client.TradeConfig} for config parameters and random stock
+ * symbols. Servlet will generate a random stock symbol and get the price of
+ * that symbol using a {@link trade.Quote} Entity EJB This tests the common path
+ * of a Servlet calling an Entity EJB to get data
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Entity")
+public class PingServlet2Entity extends HttpServlet {
+    private static String initTime;
+
+    private static int hitCount;
+    
+    private @EJB QuoteDataBean quote;
+
+    @PersistenceContext
+    private EntityManager em;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+
+        String symbol = null;
+
+        StringBuffer output = new StringBuffer(100);
+        output.append("<html><head><title>Servlet2Entity</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Entity<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\"><BR>PingServlet2Entity accesses an EntityManager"
+                + " using a PersistenceContext annotaion and then gets the price of a random symbol (generated by TradeConfig)" + " through the EntityManager find method");
+        try {
+            // generate random symbol
+            try {
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    // get a random symbol to look up and get the key to that
+                    // symbol.
+                    symbol = TradeConfig.rndSymbol();
+                    // find the EntityInstance.
+                    quote = (QuoteDataBean) em.find(QuoteDataBean.class, symbol);
+                }
+            } catch (Exception e) {
+                Log.error("web_primtv.PingServlet2Entity.doGet(...): error performing find");
+                throw e;
+            }
+            // get the price and print the output.
+            output.append("<HR>initTime: " + initTime + "<BR>Hit Count: ").append(hitCount++);
+            output.append("<HR>Quote Information<BR><BR> " + quote.toHTML());
+            output.append("</font><HR></body></html>");
+            out.println(output.toString());
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2Entity.doGet(...): error");
+            // this will send an Error to teh web applications defined error
+            // page.
+            res.sendError(500, "PingServlet2Entity.doGet(...): error" + e.toString());
+
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Entity EJB path";
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBQueue.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBQueue.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBQueue.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBQueue.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,131 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.IOException;
+
+import javax.annotation.Resource;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.annotation.WebServlet;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+/**
+ * This primitive is designed to run inside the TradeApplication and relies upon
+ * the {@link org.apache.geronimo.samples.daytrader.util.TradeConfig} class to
+ * set config parameters. PingServlet2MDBQueue tests key functionality of a
+ * servlet call to a post a message to an MDB Queue. The TradeBrokerMDB receives
+ * the message This servlet makes use of the MDB EJB
+ * {@link org.apache.geronimo.samples.daytrader.ejb.TradeBrokerMDB} by posting a
+ * message to the MDB Queue
+ */
+@WebServlet("/ejb3/PingServlet2MDBQueue")
+public class PingServlet2MDBQueue extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @Resource(name = "jms/QueueConnectionFactory")
+    private ConnectionFactory queueConnectionFactory;
+
+    @Resource(name = "jms/TradeBrokerQueue")
+    private Queue tradeBrokerQueue;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        // use a stringbuffer to avoid concatenation of Strings
+        StringBuffer output = new StringBuffer(100);
+        output.append("<html><head><title>PingServlet2MDBQueue</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2MDBQueue<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">" + "Tests the basic operation of a servlet posting a message to an EJB MDB through a JMS Queue.<BR>"
+                + "<FONT color=\"red\"><B>Note:</B> Not intended for performance testing.</FONT>");
+
+        try {
+            Connection conn = queueConnectionFactory.createConnection();
+
+            try {
+                TextMessage message = null;
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+                    try {
+                        MessageProducer producer = sess.createProducer(tradeBrokerQueue);
+
+                        message = sess.createTextMessage();
+
+                        String command = "ping";
+                        message.setStringProperty("command", command);
+                        message.setLongProperty("publishTime", System.currentTimeMillis());
+                        message.setText("Ping message for queue java:comp/env/jms/TradeBrokerQueue sent from PingServlet2MDBQueue at " + new java.util.Date());
+                        producer.send(message);
+                    } finally {
+                        sess.close();
+                    }
+                }
+
+                // write out the output
+                output.append("<HR>initTime: ").append(initTime);
+                output.append("<BR>Hit Count: ").append(hitCount++);
+                output.append("<HR>Posted Text message to java:comp/env/jms/TradeBrokerQueue destination");
+                output.append("<BR>Message: ").append(message);
+                output.append("<BR><BR>Message text: ").append(message.getText());
+                output.append("<BR><HR></FONT></BODY></HTML>");
+                out.println(output.toString());
+
+            } catch (Exception e) {
+                Log.error("PingServlet2MDBQueue.doGet(...):exception posting message to TradeBrokerQueue destination ");
+                throw e;
+            } finally {
+                conn.close();
+            }
+        } // this is where I actually handle the exceptions
+        catch (Exception e) {
+            Log.error(e, "PingServlet2MDBQueue.doGet(...): error");
+            res.sendError(500, "PingServlet2MDBQueue.doGet(...): error, " + e.toString());
+
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, configured with trade runtime configs, tests Servlet to Session EJB path";
+
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBTopic.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBTopic.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBTopic.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2MDBTopic.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,132 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.IOException;
+
+import javax.annotation.Resource;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+/**
+ * This primitive is designed to run inside the TradeApplication and relies upon
+ * the {@link org.apache.geronimo.samples.daytrader.util.TradeConfig} class to
+ * set config parameters. PingServlet2MDBQueue tests key functionality of a
+ * servlet call to a post a message to an MDB Topic. The TradeStreamerMDB (and
+ * any other subscribers) receives the message This servlet makes use of the MDB
+ * EJB {@link org.apache.geronimo.samples.daytrader.ejb.TradeStreamerMDB} by
+ * posting a message to the MDB Topic
+ */
+@WebServlet("/ejb3/PingServlet2MDBTopic")
+public class PingServlet2MDBTopic extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @Resource(name = "jms/TopicConnectionFactory")
+    private ConnectionFactory topicConnectionFactory;
+
+    @Resource(name = "jms/TradeStreamerTopic")
+    private Topic tradeStreamerTopic;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        // use a stringbuffer to avoid concatenation of Strings
+        StringBuffer output = new StringBuffer(100);
+        output.append("<html><head><title>PingServlet2MDBTopic</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2MDBTopic<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">"
+                + "Tests the basic operation of a servlet posting a message to an EJB MDB (and other subscribers) through a JMS Topic.<BR>" + "<FONT color=\"red\"><B>Note:</B> Not intended for performance testing.</FONT>");
+
+        // we only want to look up the JMS resources once
+        try {
+
+            Connection conn = topicConnectionFactory.createConnection();
+
+            try {
+                TextMessage message = null;
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+                    try {
+                        MessageProducer producer = sess.createProducer(tradeStreamerTopic);
+                        message = sess.createTextMessage();
+
+                        String command = "ping";
+                        message.setStringProperty("command", command);
+                        message.setLongProperty("publishTime", System.currentTimeMillis());
+                        message.setText("Ping message for topic java:comp/env/jms/TradeStreamerTopic sent from PingServlet2MDBTopic at " + new java.util.Date());
+
+                        producer.send(message);
+                    } finally {
+                        sess.close();
+                    }
+                }
+
+                // write out the output
+                output.append("<HR>initTime: ").append(initTime);
+                output.append("<BR>Hit Count: ").append(hitCount++);
+                output.append("<HR>Posted Text message to java:comp/env/jms/TradeStreamerTopic topic");
+                output.append("<BR>Message: ").append(message);
+                output.append("<BR><BR>Message text: ").append(message.getText());
+                output.append("<BR><HR></FONT></BODY></HTML>");
+                out.println(output.toString());
+
+            } catch (Exception e) {
+                Log.error("PingServlet2MDBTopic.doGet(...):exception posting message to TradeStreamerTopic topic");
+                throw e;
+            } finally {
+                conn.close();
+            }
+        } // this is where I actually handle the exceptions
+        catch (Exception e) {
+            Log.error(e, "PingServlet2MDBTopic.doGet(...): error");
+            res.sendError(500, "PingServlet2MDBTopic.doGet(...): error, " + e.toString());
+
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, configured with trade runtime configs, tests Servlet to Session EJB path";
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,106 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.annotation.WebServlet;
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.TradeSLSBRemote;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+/**
+ * 
+ * This primitive is designed to run inside the TradeApplication and relies upon
+ * the {@link trade_client.TradeConfig} class to set configuration parameters.
+ * PingServlet2SessionEJB tests key functionality of a servlet call to a
+ * stateless SessionEJB. This servlet makes use of the Stateless Session EJB
+ * {@link trade.Trade} by calling calculateInvestmentReturn with three random
+ * numbers.
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Session")
+public class PingServlet2Session extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private TradeSLSBRemote tradeSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        // use a stringbuffer to avoid concatenation of Strings
+        StringBuffer output = new StringBuffer(100);
+        output.append("<html><head><title>PingServlet2Session</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">" + "Tests the basis path from a Servlet to a Session Bean.");
+
+        try {
+
+            try {
+                // create three random numbers
+                double rnd1 = Math.random() * 1000000;
+                double rnd2 = Math.random() * 1000000;
+                double rnd3 = Math.random() * 1000000;
+
+                // use a function to do some work.
+                double increase = 0.0;
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    increase = tradeSLSBRemote.investmentReturn(rnd1, rnd2);
+                }
+
+                // write out the output
+                output.append("<HR>initTime: " + initTime);
+                output.append("<BR>Hit Count: " + hitCount++);
+                output.append("<HR>Investment Return Information <BR><BR>investment: " + rnd1);
+                output.append("<BR>current Value: " + rnd2);
+                output.append("<BR>investment return " + increase + "<HR></FONT></BODY></HTML>");
+                out.println(output.toString());
+
+            } catch (Exception e) {
+                Log.error("PingServlet2Session.doGet(...):exception calling trade.investmentReturn ");
+                throw e;
+            }
+        } // this is where I actually handle the exceptions
+        catch (Exception e) {
+            Log.error(e, "PingServlet2Session.doGet(...): error");
+            res.sendError(500, "PingServlet2Session.doGet(...): error, " + e.toString());
+
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, configured with trade runtime configs, tests Servlet to Session EJB path";
+
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2Many.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2Many.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2Many.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2Many.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,101 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import java.util.Collection;
+import java.util.Iterator;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.annotation.WebServlet;
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.TradeSLSBRemote;
+import org.apache.geronimo.daytrader.javaee6.entities.OrderDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+/**
+ * Primitive to test Entity Container Managed Relationshiop One to One Servlet
+ * will generate a random userID and get the profile for that user using a
+ * {@link trade.Account} Entity EJB This tests the common path of a Servlet
+ * calling a Session to Entity EJB to get CMR One to One data
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Session2CMROne2Many")
+public class PingServlet2Session2CMROne2Many extends HttpServlet {
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private TradeSLSBRemote tradeSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+
+        String userID = null;
+
+        StringBuffer output = new StringBuffer(100);
+        output.append("<html><head><title>Servlet2Session2CMROne20ne</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2CMROne2Many<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\"><BR>PingServlet2Session2CMROne2Many uses the Trade Session EJB"
+                + " to get the orders for a user using an EJB 3.0 Entity CMR one to many relationship");
+        try {
+
+            Collection orderDataBeans = null;
+            int iter = TradeConfig.getPrimIterations();
+            for (int ii = 0; ii < iter; ii++) {
+                userID = TradeConfig.rndUserID();
+
+                // get the users orders and print the output.
+                orderDataBeans = tradeSLSBRemote.getOrders(userID);
+            }
+
+            output.append("<HR>initTime: " + initTime + "<BR>Hit Count: ").append(hitCount++);
+            output.append("<HR>One to Many CMR access of Account Orders from Account Entity<BR> ");
+            output.append("<HR>User: " + userID + " currently has " + orderDataBeans.size() + " stock orders:");
+            Iterator it = orderDataBeans.iterator();
+            while (it.hasNext()) {
+                OrderDataBean orderData = (OrderDataBean) it.next();
+                output.append("<BR>" + orderData.toHTML());
+            }
+            output.append("</font><HR></body></html>");
+            out.println(output.toString());
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2Session2CMROne2Many.doGet(...): error");
+            // this will send an Error to teh web applications defined error
+            // page.
+            res.sendError(500, "PingServlet2Session2CMROne2Many.doGet(...): error" + e.toString());
+
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Entity EJB path";
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2One.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2One.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2One.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2CMROne2One.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,92 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import javax.servlet.annotation.WebServlet;
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.TradeSLSBRemote;
+import org.apache.geronimo.daytrader.javaee6.entities.AccountProfileDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+/**
+ * Primitive to test Entity Container Managed Relationshiop One to One Servlet
+ * will generate a random userID and get the profile for that user using a
+ * {@link trade.Account} Entity EJB This tests the common path of a Servlet
+ * calling a Session to Entity EJB to get CMR One to One data
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Session2CMROne2One")
+public class PingServlet2Session2CMROne2One extends HttpServlet {
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private TradeSLSBRemote tradeSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+
+        String userID = null;
+
+        StringBuffer output = new StringBuffer(100);
+        output.append("<html><head><title>Servlet2Session2CMROne20ne</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2CMROne2One<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\"><BR>PingServlet2Session2CMROne2One uses the Trade Session EJB"
+                + " to get the profile for a user using an EJB 3.0 CMR one to one relationship");
+        try {
+
+            AccountProfileDataBean accountProfileData = null;
+            int iter = TradeConfig.getPrimIterations();
+            for (int ii = 0; ii < iter; ii++) {
+                userID = TradeConfig.rndUserID();
+                // get the price and print the output.
+                accountProfileData = tradeSLSBRemote.getAccountProfileData(userID);
+            }
+
+            output.append("<HR>initTime: " + initTime + "<BR>Hit Count: ").append(hitCount++);
+            output.append("<HR>One to One CMR access of AccountProfile Information from Account Entity<BR><BR> " + accountProfileData.toHTML());
+            output.append("</font><HR></body></html>");
+            out.println(output.toString());
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2Session2CMROne2One.doGet(...): error");
+            // this will send an Error to teh web applications defined error
+            // page.
+            res.sendError(500, "PingServlet2Session2CMROne2One.doGet(...): error" + e.toString());
+
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Entity EJB path";
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2Entity.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2Entity.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2Entity.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2Entity.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,99 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.*;
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.TradeSLSBRemote;
+import org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+/**
+ * 
+ * PingServlet2Session2Entity tests key functionality of a servlet call to a
+ * stateless SessionEJB, and then to a Entity EJB representing data in a
+ * database. This servlet makes use of the Stateless Session EJB {@link Trade},
+ * and then uses {@link TradeConfig} to generate a random stock symbol. The
+ * stocks price is looked up using the Quote Entity EJB.
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Session2Entity")
+public class PingServlet2Session2Entity extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private TradeSLSBRemote tradeSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        String symbol = null;
+        QuoteDataBean quoteData = null;
+        StringBuffer output = new StringBuffer(100);
+
+        output.append("<html><head><title>PingServlet2Session2Entity</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2Entity<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">" + "PingServlet2Session2Entity tests the common path of a Servlet calling a Session EJB "
+                + "which in turn calls an Entity EJB.<BR>");
+
+        try {
+            try {
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    symbol = TradeConfig.rndSymbol();
+                    // getQuote will call findQuote which will instaniate the
+                    // Quote Entity Bean
+                    // and then will return a QuoteObject
+                    quoteData = tradeSLSBRemote.getQuote(symbol);
+                }
+            } catch (Exception ne) {
+                Log.error(ne, "PingServlet2Session2Entity.goGet(...): exception getting QuoteData through Trade");
+                throw ne;
+            }
+
+            output.append("<HR>initTime: " + initTime).append("<BR>Hit Count: " + hitCount++);
+            output.append("<HR>Quote Information<BR><BR>" + quoteData.toHTML());
+            out.println(output.toString());
+
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2Session2Entity.doGet(...): General Exception caught");
+            res.sendError(500, "General Exception caught, " + e.toString());
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Session to Entity EJB path";
+
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2EntityCollection.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2EntityCollection.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2EntityCollection.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2EntityCollection.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,108 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.*;
+import java.util.Collection;
+import java.util.Iterator;
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.TradeSLSBRemote;
+import org.apache.geronimo.daytrader.javaee6.entities.HoldingDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+
+/**
+ * 
+ * PingServlet2Session2Entity tests key functionality of a servlet call to a
+ * stateless SessionEJB, and then to a Entity EJB representing data in a
+ * database. This servlet makes use of the Stateless Session EJB {@link Trade},
+ * and then uses {@link TradeConfig} to generate a random user. The users
+ * portfolio is looked up using the Holding Entity EJB returnin a collection of
+ * Holdings
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Session2EntityCollection")
+public class PingServlet2Session2EntityCollection extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private TradeSLSBRemote tradeSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        String userID = null;
+        Collection holdingDataBeans = null;
+        StringBuffer output = new StringBuffer(100);
+
+        output.append("<html><head><title>PingServlet2Session2EntityCollection</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2EntityCollection<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">"
+                + "PingServlet2Session2EntityCollection tests the common path of a Servlet calling a Session EJB " + "which in turn calls a finder on an Entity EJB returning a collection of Entity EJBs.<BR>");
+
+        try {
+
+            try {
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    userID = TradeConfig.rndUserID();
+                    // getQuote will call findQuote which will instaniate the
+                    // Quote Entity Bean
+                    // and then will return a QuoteObject
+                    holdingDataBeans = tradeSLSBRemote.getHoldings(userID);
+                    // trade.remove();
+                }
+            } catch (Exception ne) {
+                Log.error(ne, "PingServlet2Session2EntityCollection.goGet(...): exception getting HoldingData collection through Trade for user " + userID);
+                throw ne;
+            }
+
+            output.append("<HR>initTime: " + initTime).append("<BR>Hit Count: " + hitCount++);
+            output.append("<HR>User: " + userID + " is currently holding " + holdingDataBeans.size() + " stock holdings:");
+            Iterator it = holdingDataBeans.iterator();
+            while (it.hasNext()) {
+                HoldingDataBean holdingData = (HoldingDataBean) it.next();
+                output.append("<BR>" + holdingData.toHTML());
+            }
+            out.println(output.toString());
+
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2Session2EntityCollection.doGet(...): General Exception caught");
+            res.sendError(500, "General Exception caught, " + e.toString());
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Session to Entity returning a collection of Entity EJBs";
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+}
\ No newline at end of file

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBC.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBC.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBC.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBC.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,102 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.*;
+
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.DirectSLSBRemote;
+
+// TODO: fix comments
+/**
+ * 
+ * PingServlet2Session2JDBC tests key functionality of a servlet call to a
+ * stateless SessionEJB, and then to a Entity EJB representing data in a
+ * database. This servlet makes use of the Stateless Session EJB {@link Trade},
+ * and then uses {@link TradeConfig} to generate a random stock symbol. The
+ * stocks price is looked up using the Quote Entity EJB.
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Session2JDBC")
+public class PingServlet2Session2JDBC extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private DirectSLSBRemote directSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        String symbol = null;
+        QuoteDataBean quoteData = null;
+        StringBuffer output = new StringBuffer(100);
+
+        output.append("<html><head><title>PingServlet2Session2JDBC</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2JDBC<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">" + "PingServlet2Session2JDBC tests the common path of a Servlet calling a Session EJB "
+                + "which in turn calls JDBC.<BR>");
+
+        try {
+
+            try {
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    symbol = TradeConfig.rndSymbol();
+                    // getQuote will call findQuote which will instaniate the
+                    // Quote Entity Bean
+                    // and then will return a QuoteObject
+                    quoteData = directSLSBRemote.getQuote(symbol);
+                }
+            } catch (Exception ne) {
+                Log.error(ne, "PingServlet2Session2JDBC.goGet(...): exception getting QuoteData through Trade");
+                throw ne;
+            }
+
+            output.append("<HR>initTime: " + initTime).append("<BR>Hit Count: " + hitCount++);
+            output.append("<HR>Quote Information<BR><BR>" + quoteData.toHTML());
+            out.println(output.toString());
+
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2Session2JDBC.doGet(...): General Exception caught");
+            res.sendError(500, "General Exception caught, " + e.toString());
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Session to Entity EJB path";
+
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBCCollection.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBCCollection.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBCCollection.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2Session2JDBCCollection.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,111 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.*;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.entities.HoldingDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.DirectSLSBRemote;
+
+// TODO: Fix comments
+/**
+ * 
+ * PingServlet2Session2Entity tests key functionality of a servlet call to a
+ * stateless SessionEJB, and then to a Entity EJB representing data in a
+ * database. This servlet makes use of the Stateless Session EJB {@link Trade},
+ * and then uses {@link TradeConfig} to generate a random user. The users
+ * portfolio is looked up using the Holding Entity EJB returnin a collection of
+ * Holdings
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2Session2JDBCCollection")
+public class PingServlet2Session2JDBCCollection extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private DirectSLSBRemote directSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        String userID = null;
+        Collection holdingDataBeans = null;
+        // TradeJDBC trade = null;
+        StringBuffer output = new StringBuffer(100);
+
+        output.append("<html><head><title>PingServlet2Session2JDBCCollection</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2Session2JDBCCollection<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">"
+                + "PingServlet2Session2JDBCCollection tests the common path of a Servlet calling a Session EJB " + "which perform a multi-row JDBC query.<BR>");
+
+        try {
+
+            try {
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    userID = TradeConfig.rndUserID();
+                    // getQuote will call findQuote which will instaniate the
+                    // Quote Entity Bean
+                    // and then will return a QuoteObject
+                    holdingDataBeans = directSLSBRemote.getHoldings(userID);
+                }
+            } catch (Exception ne) {
+                Log.error(ne, "PingServlet2Session2JDBCCollection.goGet(...): exception getting HoldingData collection through Trade for user " + userID);
+                throw ne;
+            }
+
+            output.append("<HR>initTime: " + initTime).append("<BR>Hit Count: " + hitCount++);
+            output.append("<HR>User: " + userID + " is currently holding " + holdingDataBeans.size() + " stock holdings:");
+            Iterator it = holdingDataBeans.iterator();
+            while (it.hasNext()) {
+                HoldingDataBean holdingData = (HoldingDataBean) it.next();
+                output.append("<BR>" + holdingData.toHTML());
+            }
+            out.println(output.toString());
+
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2Session2JDBCCollection.doGet(...): General Exception caught");
+            res.sendError(500, "General Exception caught, " + e.toString());
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Session to Entity returning a collection of Entity EJBs";
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+
+    }
+}

Added: geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2TwoPhase.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2TwoPhase.java?rev=1071543&view=auto
==============================================================================
--- geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2TwoPhase.java (added)
+++ geronimo/daytrader/trunk/javaee6/modules/web/src/main/java/org/apache/geronimo/daytrader/javaee6/web/prims/ejb3/PingServlet2TwoPhase.java Thu Feb 17 08:23:57 2011
@@ -0,0 +1,101 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.daytrader.javaee6.web.prims.ejb3;
+
+import java.io.*;
+import javax.servlet.*;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.*;
+
+import javax.ejb.EJB;
+
+import org.apache.geronimo.daytrader.javaee6.web.ejb3.TradeSLSBRemote;
+
+import org.apache.geronimo.daytrader.javaee6.entities.QuoteDataBean;
+import org.apache.geronimo.daytrader.javaee6.utils.Log;
+import org.apache.geronimo.daytrader.javaee6.utils.TradeConfig;
+/**
+ * 
+ * PingServlet2TwoPhase tests key functionality of a TwoPhase commit In this
+ * primitive a servlet calls a Session EJB which begins a global txn The Session
+ * EJB then reads a DB row and sends a message to JMS Queue The txn is closed w/
+ * a 2-phase commit
+ * 
+ */
+@WebServlet("/ejb3/PingServlet2TwoPhase")
+public class PingServlet2TwoPhase extends HttpServlet {
+
+    private static String initTime;
+
+    private static int hitCount;
+
+    @EJB
+    private TradeSLSBRemote tradeSLSBRemote;
+
+    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
+        doGet(req, res);
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
+
+        res.setContentType("text/html");
+        java.io.PrintWriter out = res.getWriter();
+        String symbol = null;
+        QuoteDataBean quoteData = null;
+        StringBuffer output = new StringBuffer(100);
+
+        output.append("<html><head><title>PingServlet2TwoPhase</title></head>" + "<body><HR><FONT size=\"+2\" color=\"#000066\">PingServlet2TwoPhase<BR></FONT>" + "<FONT size=\"-1\" color=\"#000066\">" + "PingServlet2TwoPhase tests the path of a Servlet calling a Session EJB "
+                + "which in turn calls an Entity EJB to read a DB row (quote). The Session EJB " + "then posts a message to a JMS Queue. " + "<BR> These operations are wrapped in a 2-phase commit<BR>");
+
+        try {
+
+            try {
+                int iter = TradeConfig.getPrimIterations();
+                for (int ii = 0; ii < iter; ii++) {
+                    symbol = TradeConfig.rndSymbol();
+                    // getQuote will call findQuote which will instaniate the
+                    // Quote Entity Bean
+                    // and then will return a QuoteObject
+                    quoteData = tradeSLSBRemote.pingTwoPhase(symbol);
+
+                }
+            } catch (Exception ne) {
+                Log.error(ne, "PingServlet2TwoPhase.goGet(...): exception getting QuoteData through Trade");
+                throw ne;
+            }
+
+            output.append("<HR>initTime: " + initTime).append("<BR>Hit Count: " + hitCount++);
+            output.append("<HR>Two phase ping selected a quote and sent a message to TradeBrokerQueue JMS queue<BR>Quote Information<BR><BR>" + quoteData.toHTML());
+            out.println(output.toString());
+
+        } catch (Exception e) {
+            Log.error(e, "PingServlet2TwoPhase.doGet(...): General Exception caught");
+            res.sendError(500, "General Exception caught, " + e.toString());
+        }
+    }
+
+    public String getServletInfo() {
+        return "web primitive, tests Servlet to Session to Entity EJB and JMS -- 2-phase commit path";
+
+    }
+
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        hitCount = 0;
+        initTime = new java.util.Date().toString();
+    }
+}
\ No newline at end of file



Mime
View raw message