├── .classpath ├── .gitignore ├── .jazzignore ├── .project ├── .settings ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.component └── org.eclipse.wst.common.project.facet.core.xml ├── README.md ├── WebContent ├── META-INF │ └── MANIFEST.MF ├── PingHtml.html ├── PingJsp.jsp ├── PingJspEL.jsp ├── PingServlet2Jsp.jsp ├── WEB-INF │ ├── lib │ │ └── com.ibm.json4j.jar │ └── web.xml ├── account.jsp ├── accountImg.jsp ├── clearCookies.jsp ├── config.jsp ├── configure.htmlx ├── configure.jsp ├── contentHome.html ├── css │ └── bootstrap.min.css ├── displayQuote.jsp ├── docs │ ├── benchmarking.html │ ├── documentation.html │ ├── glossary.html │ ├── rtCharacterisitics.html │ ├── tradeFAQ.html │ ├── tradeTech.pdf │ ├── tradeUML.pdf │ └── tradeversion.html ├── error.jsp ├── generateOOM.jsp ├── header.html ├── images │ ├── .picasa.ini │ ├── .picasaoriginals │ │ ├── .picasa.ini │ │ └── 10.jpg │ ├── IBMBackGround1.gif │ ├── IBMBackGround2.gif │ ├── SOAPconfig.gif │ ├── WEBSPHERE_18P_UNIX.GIF │ ├── account.gif │ ├── arrowdown.gif │ ├── arrowup.gif │ ├── daytrader_simple_arch.png │ ├── graph.gif │ ├── gridx2.png │ ├── home.gif │ ├── homeBanner.gif │ ├── ibmlogo.png │ ├── lanim.gif │ ├── line.gif │ ├── logout.gif │ ├── portfolio.gif │ ├── profile1.jpg │ ├── profile2.jpg │ ├── quotes.gif │ ├── ticker-anim.gif │ ├── topline.jpg │ ├── tradeLogo.gif │ ├── tradeLogoSmall.gif │ └── tradeTopology.gif ├── index.html ├── index.htmlx ├── leftMenu.html ├── marketSummary.jsp ├── order.jsp ├── orderImg.jsp ├── port.jsp ├── portfolio.jsp ├── portfolioImg.jsp ├── quote.jsp ├── quoteImg.jsp ├── register.jsp ├── registerImg.jsp ├── runStats.jsp ├── setup_db.sql ├── socialFeed.html ├── stress.jsp ├── style.css ├── style2.css ├── topBanner.html ├── tradehome.jsp ├── tradehomeImg.jsp ├── web_prmtv.html ├── welcome.jsp ├── welcome.jspx └── welcomeImg.jsp ├── diagram.png ├── pom.xml ├── src └── com │ └── ibm │ └── samples │ └── trade │ ├── AccountDataBean.java │ ├── AccountProfileDataBean.java │ ├── HoldingDataBean.java │ ├── MarketSummaryDataBean.java │ ├── MarketSummaryDataBeanWS.java │ ├── OrderDataBean.java │ ├── QuoteDataBean.java │ ├── RunStatsDataBean.java │ ├── TradeConfig.java │ ├── TradeServices.java │ ├── direct │ ├── KeySequenceDirect.java │ └── TradeDirect.java │ ├── util │ ├── FinancialUtils.java │ ├── KeyBlock.java │ ├── Log.java │ ├── MDBStats.java │ └── TimerStat.java │ └── web │ ├── GenerateOOM.java │ ├── OrdersAlertFilter.java │ ├── TestServlet.java │ ├── TradeAppServlet.java │ ├── TradeBuildDB.java │ ├── TradeConfigServlet.java │ ├── TradeScenarioServlet.java │ ├── TradeServletAction.java │ ├── TradeWebContextListener.java │ └── prims │ ├── PingBean.java │ ├── PingJDBCRead.java │ ├── PingJDBCWrite.java │ ├── PingServlet.java │ ├── PingServlet2Include.java │ ├── PingServlet2IncludeRcv.java │ ├── PingServlet2JNDI.java │ ├── PingServlet2Jsp.java │ ├── PingServlet2Servlet.java │ ├── PingServlet2ServletRcv.java │ ├── PingServletWriter.java │ ├── PingSession1.java │ ├── PingSession2.java │ ├── PingSession3.java │ └── PingSession3Object.java └── xdocs ├── cleardb_screenshot.png └── populate_screenshot.png /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/* 2 | target/* 3 | /build/ 4 | /target/ 5 | -------------------------------------------------------------------------------- /.jazzignore: -------------------------------------------------------------------------------- 1 | ### Jazz Ignore 0 2 | # Ignored files and folders will not be committed, but may be modified during 3 | # accept or update. 4 | # - Ignore properties should contain a space separated list of filename patterns. 5 | # - Each pattern is case sensitive and surrounded by braces ('{' and '}'). 6 | # - "*" matches zero or more characters. 7 | # - "?" matches a single character. 8 | # - The pattern list may be split across lines by ending the line with a 9 | # backslash and starting the next line with a tab. 10 | # - Patterns in core.ignore prevent matching resources in the same 11 | # directory from being committed. 12 | # - Patterns in core.ignore.recursive matching resources in the current 13 | # directory and all subdirectories from being committed. 14 | # - The default value of core.ignore.recursive is *.class 15 | # - The default value for core.ignore is bin 16 | # 17 | # To ignore shell scripts and hidden files in this subtree: 18 | # e.g: core.ignore.recursive = {*.sh} {\.*} 19 | # 20 | # To ignore resources named 'bin' in the current directory (but allow 21 | # them in any sub directorybelow): 22 | # e.g: core.ignore.recursive = {*.sh} {\.*} 23 | # 24 | # NOTE: modifying ignore files will not change the ignore status of 25 | # Eclipse derived resources. 26 | 27 | core.ignore.recursive= \ 28 | {*.class} 29 | 30 | core.ignore= \ 31 | {README.txt} \ 32 | {apps} \ 33 | {bin} \ 34 | {build_package.xml} \ 35 | {output} \ 36 | {server.xml} -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | CloudTrader 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | org.eclipse.m2e.core.maven2Builder 30 | 31 | 32 | 33 | 34 | 35 | org.eclipse.m2e.core.maven2Nature 36 | org.eclipse.jem.workbench.JavaEMFNature 37 | org.eclipse.wst.common.modulecore.ModuleCoreNature 38 | org.eclipse.wst.common.project.facet.core.nature 39 | org.eclipse.jdt.core.javanature 40 | org.eclipse.wst.jsdt.core.jsNature 41 | 42 | 43 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.compliance=1.8 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.8 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sample Stock Trading application in Java EE 2 | 3 | For more detailed instructions with images, click here: http://www.ibm.com/developerworks/cloud/library/cl-cloudtrader-app/index.html 4 | 5 | ![Diagram](https://raw.githubusercontent.com/IBM-Bluemix/JavaCloudTrader/master/diagram.png) 6 | 7 | ## Prereqs 8 | **Eclipse for Java EE Developers** http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/neonr 9 | 10 | **Bluemix Eclipse plugin** 11 | https://marketplace.eclipse.org/content/ibm-eclipse-tools-bluemix 12 | 13 | ## Step 1. Download Source 14 | 15 | - Clone the source code locally. 16 | `git clone https://github.com/IBM-Bluemix/CloudTrader.git` 17 | - Launch Eclipse. **File > Import > General > Existing Projects into Workspace > Select root directory > [Point to the CloudTrader src]**. 18 | You should now see the CloudTrader project (with code) in your Project Explorer view. 19 | 20 | ## Step 2. Create a Bluemix server on Eclipse 21 | 22 | - In Eclipse, **right-click the Servers** view and select **New** > **Server**. If you don't see the Servers view in Eclipse, make sure you are in the Java EE perspective and look in the bottom section for the Servers tab. 23 | - In the Define a New Server window, expand the IBM folder, select **IBM Bluemix**, and click Next. 24 | - **Enter your credentials** for your Bluemix account. 25 | - Click on Validate Account, then click **Finish**. 26 | 27 | ## Step 3. Deploy the application to Bluemix 28 | 29 | - You can now **drag and drop the CloudTrader project** onto the Bluemix server you just created. 30 | - You will be presented with a wizard. Choose a unique name for your application to prevent name collisions on the ng.bluemix.net domain. 31 | - On the next panel, you can select the URL and Memory information. Accept the defaults and click Next. 32 | 33 | ![Database](https://raw.githubusercontent.com/IBM-Bluemix/JavaCloudTrader/master/xdocs/cleardb_screenshot.png) 34 | 35 | - On the Services selection panel, we will create the services the application needs. For now, we will only create the database service. Click on the **Add Service Icon** for the add service window icon near the top right to open the Add Service window. **Select cleardb**. 36 | - For the Name, enter **TradeDataSource**. Bluemix will create the necessary configuration so that CloudTrader can look for this datasource with this JNDI name. 37 | 38 | 39 | 40 | Click **Finish** on both wizards. Within a couple of minutes, your application should be deployed to the route you choose. Visit your application and click on Configuration -> (Re)-populate Database. 41 | 42 | ![Populate](https://raw.githubusercontent.com/IBM-Bluemix/JavaCloudTrader/master/xdocs/populate_screenshot.png) 43 | 44 | After it's deployed, add these other optional services: **Monitoring & Analytics** **Auto-Scaling** and **Session Cache**. No changes are needed to the source code to leverage these services. 45 | 46 | ## Running CloudTrader locally and connecting to a mysql (cleardb) server 47 | 48 | Download [mysql-connector-java-5.1.32.jar](https://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.32) 49 | and place it in `$LIBERTY_HOME/wlp/usr/shared/resources/mysql`. If `mysql` directory does not exist, create it. 50 | 51 | ``` 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | ``` 67 | 68 | 69 | ## Running CloudTrader locally and connecting to dashDB DB2 on the Bluemix 70 | 71 | Download DB2 JDBC Driver from https://www-01.ibm.com/support/docview.wss?uid=swg21363866 72 | 73 | Unzip the downloaded zip file using command line to get the jar. (On OS X, you might get a cpgz file if you don't use command line) 74 | ``` 75 | unzip ./db2_db2driver_for_jdbc_sqlj_v11.1.zip 76 | ``` 77 | Copy the db2jcc4.jar to `$LIBERTY_HOME/wlp/usr/shared/resources/db2`. If `db2` directory does not exist, create it. 78 | 79 | Add the following datasource config to your Liberty server.xml. Replace the values with your database credentials 80 | ``` 81 | 82 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | ``` 96 | -------------------------------------------------------------------------------- /WebContent/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /WebContent/PingHtml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | PingHTML.html 4 | 5 | 6 |
7 |

PING HTML:

8 |

Hello World

9 | 10 | 11 | -------------------------------------------------------------------------------- /WebContent/PingJsp.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | PingJsp 9 | 10 | 11 | <%! int hitCount = 0; 12 | String initTime = new java.util.Date().toString(); 13 | %> 14 |
15 |
16 | PING JSP:
17 |
Init time: <%= initTime %> 18 | <% hitCount++; %> 19 |

Hit Count: <%= hitCount %>

20 | 21 | 22 | -------------------------------------------------------------------------------- /WebContent/PingJspEL.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PingJspEL 5 | 6 | 7 | <%@ page import="com.ibm.samples.trade.*" session="false" %> 8 | 9 | <%! 10 | int hitCount = 0; 11 | String initTime = new java.util.Date().toString(); 12 | %> 13 | 14 | <% 15 | // setup some variables to work with later 16 | int someint1 = TradeConfig.rndInt(100) + 1; 17 | pageContext.setAttribute("someint1", new Integer(someint1)); 18 | int someint2 = TradeConfig.rndInt(100) + 1; 19 | pageContext.setAttribute("someint2", new Integer(someint2)); 20 | float somefloat1 = TradeConfig.rndFloat(100) + 1.0f; 21 | pageContext.setAttribute("somefloat1", new Float(somefloat1)); 22 | float somefloat2 = TradeConfig.rndFloat(100) + 1.0f; 23 | pageContext.setAttribute("somefloat2", new Float(somefloat2)); 24 | 25 | QuoteDataBean quoteData1 = QuoteDataBean.getRandomInstance(); 26 | pageContext.setAttribute("quoteData1", quoteData1); 27 | QuoteDataBean quoteData2 = QuoteDataBean.getRandomInstance(); 28 | pageContext.setAttribute("quoteData2", quoteData2); 29 | QuoteDataBean quoteData3 = QuoteDataBean.getRandomInstance(); 30 | pageContext.setAttribute("quoteData3", quoteData3); 31 | QuoteDataBean quoteData4 = QuoteDataBean.getRandomInstance(); 32 | pageContext.setAttribute("quoteData4", quoteData4); 33 | 34 | QuoteDataBean quoteData[] = new QuoteDataBean[4]; 35 | quoteData[0] = quoteData1; 36 | quoteData[1] = quoteData2; 37 | quoteData[2] = quoteData3; 38 | quoteData[3] = quoteData4; 39 | pageContext.setAttribute("quoteData", quoteData); 40 | %> 41 | 42 |
43 |
44 | PING JSP EL:
Init time: <%= initTime %> 45 |

46 | Hit Count: <%= hitCount++ %> 47 |

48 |
49 | 50 |

51 | 52 | someint1 = <%= someint1 %>
53 | someint2 = <%= someint2 %>
54 | somefloat1 = <%= somefloat1 %>
55 | somefloat2 = <%= somefloat2 %>
56 | 57 |

58 | 59 |


60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 91 | 98 | 99 | 100 | 101 | 105 | 109 | 110 |
EL TypeEL ExpressionsResult
Integer Arithmetic\${someint1 + someint2 - someint1 * someint2 mod someint1}${someint1 + someint2 - someint1 * someint2 mod someint1}
Floating Point Arithmetic\${somefloat1 + somefloat2 - somefloat1 * somefloat2 / somefloat1}${somefloat1 + somefloat2 - somefloat1 * somefloat2 / somefloat1}
Logical Operations\${(someint1 < someint2) && (someint1 <= someint2) || (someint1 == someint2) && !Boolean.FALSE}${(someint1 < someint2) && (someint1 <= someint2) || (someint1 == someint2) && !Boolean.FALSE}
Indexing Operations 85 | \${quoteData3.symbol}
86 | \${quoteData[2].symbol}
87 | \${quoteData4["symbol"]}
88 | \${header["host"]}
89 | \${header.host}
90 |
92 | ${quoteData3.symbol}
93 | ${quoteData[1].symbol}
94 | ${quoteData4["symbol"]}
95 | ${header["host"]}
96 | ${header.host} 97 |
Variable Scope Tests 102 | \${(quoteData3 == null) ? "null" : quoteData3}
103 | \${(noSuchVariableAtAnyScope == null) ? "null" : noSuchVariableAtAnyScope} 104 |
106 | ${(quoteData3 == null) ? "null" : quoteData3}
107 | ${(noSuchVariableAtAnyScope == null) ? "null" : noSuchVariableAtAnyScope} 108 |
111 | 112 | 113 | -------------------------------------------------------------------------------- /WebContent/PingServlet2Jsp.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | PingJsp 9 | 10 | 11 | <%@ page import="com.ibm.samples.trade.web.prims.PingBean" %> 12 | <%!String initTime = (new java.util.Date()).toString();%> 13 | 14 |
15 |
16 | Ping Servlet2JSP:
17 |
Init time: <%= initTime %>
18 |
19 | Message from Servlet: <%= ab.getMsg() %> 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /WebContent/WEB-INF/lib/com.ibm.json4j.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM-Cloud/JavaCloudTrader/e3d58503e81f58df605e273daee224925bb0123a/WebContent/WEB-INF/lib/com.ibm.json4j.jar -------------------------------------------------------------------------------- /WebContent/clearCookies.jsp: -------------------------------------------------------------------------------- 1 | <% 2 | 3 | 4 | Cookie[] cookies = request.getCookies(); 5 | 6 | for(int i=0;i -------------------------------------------------------------------------------- /WebContent/configure.htmlx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Configuration and utilities 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 |
16 |

Configuration utilities

17 |
22 |
23 |
24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 34 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 54 | 55 | 56 | 57 | 58 | 61 | 62 | 74 | 75 | 76 | 78 | 79 | 80 | 81 | 82 | 83 | 84 |
Benchmark Configuration
28 | Tools
Description
Reset Trade
33 | (to be done before each run)
Reset the Trade runtime to a clean starting 35 | point by logging off all users, removing 36 | new registrations and other general cleanup. 37 | Also refreshes the DB schema. 38 | For consistent results this URL should be 39 | run before each Trade run.
Configure Trade run-time parametersThis link provides an interface to set configuration 44 | parameters that control Trade run-time characteristics 45 | such as using EJBs or JDBC. This link also 46 | provides utilities such as setting the UID 47 | and Password for a remote or protected database 48 | when using JDBC.
(Re)-populate  Trade Database 52 | 53 | This link is used to initially populate or re-populate the Trade database with fictitious users (uid:0, uid:1, ...) and stocks (s:0, s:1, ...). First all existing users and stocks are deleted (if any). The database is then populated with a new set of Trade users and stocks.
Test Trade ScenarioThis links pops up a browser to manually 59 | step through a Trade scenario by hitting 60 | "Reload" on your browser
Trade Version Trade application version and change history 77 | information
85 |
86 |
87 |
88 |
89 | 90 | 91 | -------------------------------------------------------------------------------- /WebContent/configure.jsp: -------------------------------------------------------------------------------- 1 | 2 | 18 | <% 19 | 20 | String vcap = System.getenv("VCAP_APPLICATION"); 21 | String instance_id = "unknown"; 22 | String port = "unknown"; 23 | 24 | if (vcap == null) { 25 | //System.out.println("No VCAP_SERVICES found"); 26 | } 27 | else { 28 | try { 29 | JSONObject obj = (JSONObject)JSON.parse(vcap); 30 | System.out.println(obj.toString()); 31 | port = ((Long)obj.get("port")).toString(); 32 | instance_id = obj.get("instance_id").toString(); 33 | 34 | } catch (Exception e) { 35 | e.printStackTrace(); 36 | 37 | } 38 | } 39 | 40 | %> 41 | 42 | 43 | 44 | 45 | Configuration and utilities 46 | 47 | 48 | 49 |
50 | <%@ page import="java.util.Collection, java.util.Iterator,com.ibm.json.java.*" isThreadSafe="true" isErrorPage="false"%> 51 | 52 | 53 | 54 | 55 | 56 | 57 | 62 | 63 | 64 | 65 | 67 | 96 | 97 | 98 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 123 | 124 | 125 |
58 |

Configuration Utilities

59 | Running on port <%=port %> , instance ID : <%= instance_id %> 60 |
61 |
Configuration ToolsDescription 66 |
(Re)-populate DatabaseThis link is used to initially populate or re-populate the 99 | database with fictitious users (uid:0, uid:1, ...) and 100 | stocks (s:0, s:1, ...). First all existing users and stocks are 101 | deleted (if any). The database is then populated with a new set of 102 | users and stocks. This option does not drop and recreate the 103 | db tables.
Generate Out Of Memory failureThis link will cause an OOM and kill the server of one (not necessarily this) application instance. If you have multiple instances, re-visit the application immediately after the OOM to get redirected to another instance. The killed instance should restart in a few minutes.
Stress testRun a script which will generate mock load on the server by logging in with multiple users and issuing trades.
VCAP_SERVICES 116 |
126 | 127 | 128 | 129 | 130 |
131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /WebContent/contentHome.html: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Trade Overview 26 | 27 | 28 | 29 |
30 | 31 | 32 | 37 | 38 | 39 | 42 | 43 |
33 |
This 34 | sample is a collection of Java classes, Java Servlets, Java Server Pages. This application is meant to be deployed onto the cloud, and use services provided by the cloud. At a minimum, a SQLDB service is required.
35 |


36 |

40 |
41 |
44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /WebContent/displayQuote.jsp: -------------------------------------------------------------------------------- 1 | <%@ page import="java.util.Collection, java.util.Iterator, java.math.BigDecimal,com.ibm.samples.trade.*,com.ibm.samples.trade.util.*,com.ibm.samples.trade.direct.*" session="true" isThreadSafe="true" isErrorPage="false"%> 2 | <% 3 | String symbol = request.getParameter("symbol"); 4 | TradeServices tAction=null; 5 | if(TradeConfig.getAccessMode() == TradeConfig.STANDARD) 6 | tAction = new TradeDirect(); 7 | try { 8 | QuoteDataBean quoteData = tAction.getQuote(symbol); 9 | 10 | %> 11 | 12 | <%= FinancialUtils.printQuoteLink(quoteData.getSymbol()) %> 13 | <%= quoteData.getCompanyName()%> 14 | <%= quoteData.getVolume()%> 15 | <%= quoteData.getLow() + " - " + quoteData.getHigh()%> 16 | <%= quoteData.getOpen()%> 17 | $ <%= quoteData.getPrice()%> 18 | <%= FinancialUtils.printGainHTML(new BigDecimal(quoteData.getChange())) %> <%= FinancialUtils.printGainPercentHTML( FinancialUtils.computeGainPercent(quoteData.getPrice(), quoteData.getOpen())) %> 19 | 20 |
">
21 | 22 | 23 | 24 | <% 25 | } 26 | catch (Exception e) 27 | { 28 | Log.error("displayQuote.jsp exception", e); 29 | } 30 | %> 31 | -------------------------------------------------------------------------------- /WebContent/docs/benchmarking.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Benchmarking Details 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 |
16 |

Benchmarking

17 |
22 |
23 |

Trade provides two servlets to create a workload for benchmarking: TradeApp servlet and TradeScenario servlet. 24 | In either case, the load generation tool used to drive the Trade workload must provide cookie support to handle 25 | HTTP sessions.

26 |

TradeApp servlet provides the standard web interface and 27 | can be accessed with the Go Trade! link. Driving benchmark load using this 28 | interface requires a sophisticated web load 29 | generator that is capable of filling HTML 30 | forms and posting dynamic data.

31 |

TradeScenario servlet emulates a population of web users by generating 32 | a specific Trade operation for a randomly 33 | chosen user on each access to the URL. Test 34 | this servlet by clicking Trade Scenario and hit "Reload" on your browser to step through a Trade Scenario. 35 | To benchmark using this URL aim your favorite web load generator at the 36 | Trade Scenario URL and fire away.

37 |

There is a drawback to using the Trade Scenario 38 | servlet to drive the workload versus using a series of more complicated 39 | load scripts. As previously mentioned, the scenario 40 | servlet is responsible for managing clients and emulating user 41 | operations by dispatching simple client requests to complex Trade 42 | actions. This causes the application server to spend a large percentage 43 | of time performing work that would typically be handled by a client or 44 | a more complex load driver. Consequently, performance numbers are 45 | artificially deflated when using Trade Scenario servlet as compared to 46 | driving the workload directly.

47 | 48 | 49 |

Web Primitive Benchmarking

50 |

A set of automated Web Primitives is also provided. The web primitives leverage the Trade infrastructure to test specific features of the web application development environment. This provides basic worloads for servlets, JSPs, EJBs, MDBs and more. The Web Primitives are installed automatically with the Trade package.
51 |

52 |
53 | 54 | 55 | -------------------------------------------------------------------------------- /WebContent/docs/documentation.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Technical Documentation 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 |
16 |

Technical Documentation

17 |
22 |
23 |
24 |

Documents below provide documentation on Trade application design, runtime 25 | characteristics and FAQs.

26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 |
Trade Technical OverviewProvides an overview of the Trade application design, configuration, and usage
Trade UML DiagramsUML diagrams showing application architecture
FAQFrequently Asked Questions
Runtime and Database
43 | Usage Characteristics
Details runtime characteristics and database operations
49 |
50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /WebContent/docs/glossary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Technical Documentation 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 |
17 |

Trade Glossary and Terms

18 |
23 |
24 |
25 |
    26 |
  • account ID - A unique Integer based key. Each user is assigned an account ID at account creation time.
  • 27 |
  • account Created - The time and date the users account was first created.
  • 28 |
  • cash balance - The current cash balance in the users account. This does not include current stock holdings.
  • 29 |
  • company - The full company name for an individual stock.
    30 |
  • 31 |
  • current gain/loss - The total gain or loss of this account, computed by substracting the current sum of cash/holdings minus the opening account balance.
  • 32 |
  • current price - The current trading price for a given stock symbol.
    33 |
  • 34 | 35 |
  • gain/loss - The current gain or loss of an individual stock holding, computed as (current market value - holding basis).
    36 |
  • 37 |
  • last login - The date and time this user last logged in to Trade.
  • 38 |
  • market value - The current total value of a stock holding, computed as (quantity * current price).
    39 |
  • 40 | 41 | 42 |
  • number of holdings - The total number of stocks currently owned by this account.
  • 43 |
  • open price - The price of a given stock at the open of the trading session.
    44 |
  • 45 |
  • opening balance - The initial cash balance in this account when it was opened.
  • 46 |
  • order id - A unique Integer based key. Each order is assigned an order ID at order creation time.
  • 47 |
  • order status - orders are opened, processed, closed and completed. Order status shows the current stat for this order.
  • 48 |
  • price range - The low and high prices for this stock during the current trading session
    49 |
  • 50 |
  • purchase date - The date and time the a stock was purchased.
  • 51 |
  • purchase price - The price used when purchasing the stock.
  • 52 |
  • purchase basis - The total cost to purchase this holding. This is computed as (quantity * purchase price).
    53 |
  • 54 | 55 |
  • quantity - The number of stock shares in the order or user holding.
    56 |
  • 57 | 58 |
  • session created - An HTTP session is created for each user at during login. Session created shows the time and day when the session was created.
  • 59 |
  • sum of cash/holdings - The total current value of this account. This is the sum of the cash balance along with the value of current stock holdings.
  • 60 |
  • symbol - The symbol for a Trade stock.
    61 |
  • 62 |
  • total logins - The total number of logins performed by this user since the last Trade Reset.
  • 63 |
  • total logouts - The total number of logouts performed by this user since the last Trade Reset.
    64 |
  • 65 | 66 |
  • total of holdings - The current total value of all stock holdings in this account given the current valuation of each stock held.
  • 67 |
  • Top gainers - The list of stock gaining the most in price during the current trading session.
  • 68 |
  • Top losers - The list of stock falling the most in price during the current trading session.
    69 |
  • 70 |
  • Trade Stock Index (TSIA) - A computed index of the top 20 stocks in Trade.
  • 71 |
  • Trading Volume - The total number of shares traded for all stocks during this trading session.
    72 |
  • 73 |
  • txn fee - The fee charged by the brokerage to process this order.
  • 74 |
  • type - The order type (buy or sell).
    75 |
  • 76 | 77 |
  • user ID - The unique user ID for the account chosen by the user at account registration.
  • 78 |
  • volume - The total number of shares traded for this stock.
  • 79 | 80 |
81 | 82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /WebContent/docs/rtCharacterisitics.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Trade Runtime and Database Usage Characteristics 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
Trade Runtime and Database Usage Characteristics
20 |

The table below details each of the high level user operations in the Trade 21 | application.
22 |

23 |
    24 |
  • Description - a short description of the user operation 25 |
  • Complexity - the J2EE components invoked to complete the operation 26 |
  • HTTP Session - operations on HTTP Session objects 27 |
  • DB Activity - Create, Read, RC Read Collection, Update, and Delete operations on database tables 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 49 | 50 | 51 | 52 | 53 | 56 | 57 | 59 | 60 | 61 | 62 | 63 | 67 | 68 | 72 | 73 | 74 | 75 | 76 | 79 | 80 | 83 | 84 | 85 | 86 | 87 | 88 | 91 | 92 | 94 | 95 | 96 | 97 | 98 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 128 | 129 | 131 | 132 | 133 | 134 | 135 | 137 | 138 | 139 | 140 |
Trade ActionDescriptionComplexityHTTP SessionDB Activity
37 | (C, R, U, D)
LoginUser sign in, session creation, market summaryServlet, JSP,
43 | Session EJB
44 | CMP Beans Read, Update, Collections
Create, UpdateAccount: R, U
47 | AccountProfile: R
48 |
Quote: RC *3
LogoutUse sign-off, session destroyServlet, JSP,
54 | Session EJB
55 | CMP Bean Read, Update
Read, DestroyAccount: R, U
58 | AccountProfile: R
BuyQuote followed buy a security purchaseServlet, JSP,
64 | Session EJB
65 | Message Driven Beans (Queue and Pub/Sub)
66 | Multi CMP Read/Update
ReadQuote: R
69 | Account: R, U
70 | Holding: C, R, U
Orders: C, R, U 71 |
SellPortfolio followed by the sell of a holdingServlet, JSP,
77 | Session EJB
78 | Message Driven Beans (Queue and Pub/Sub)
Multi CMP Read/Update
ReadQuote: R
81 | Account: R, U
82 | Holding: D, R
Orders: R, U
RegisterCreate a new user profile and accountServlet, JSP,
89 | Session EJB
90 | CMP Bean Creates
Create, UpdateAccount: C, R
93 | AccountProfile: C
HomePersonalized home page including current market conditions in a detailed market summaryServlet, JSP,
99 | Session EJB
100 | CMP Bean Read, Collections
ReadAccount: R
AccountProfile: R
Quote: RC *3
AccountReview current user account and profile information along with recent ordersServlet, JSP,
108 | Session EJB
109 | CMP Bean Read, Collections
ReadAccount: R
AccountProfile: R
Orders: RC
Account UpdateAccount followed by user profile update Servlet, JSP,
117 | Session EJB
118 | CMP Bean Read/Update, Collections
ReadAccount: R
AccountProfile: R, U
Orders: RCQuote: RC
PortfolioView users current security holdingsServlet, JSP,
126 | Session EJB
127 | CMP Bean Read, Collections
ReadHolding: RC
130 | Quote: RC
QuotesView an arbirtray list of current security quotesServlet, JSP
136 | Cached CMP Bean Read, Collections
ReadQuote: RC
141 |
142 | 143 | 144 | -------------------------------------------------------------------------------- /WebContent/docs/tradeTech.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM-Cloud/JavaCloudTrader/e3d58503e81f58df605e273daee224925bb0123a/WebContent/docs/tradeTech.pdf -------------------------------------------------------------------------------- /WebContent/docs/tradeUML.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM-Cloud/JavaCloudTrader/e3d58503e81f58df605e273daee224925bb0123a/WebContent/docs/tradeUML.pdf -------------------------------------------------------------------------------- /WebContent/docs/tradeversion.html: -------------------------------------------------------------------------------- 1 | 2 | Trade Version 3 | IBM Trade Performance Benchmark Sample for WebSphere Application Server - Trade 6.1
4 | Date: 20060308 5 | -------------------------------------------------------------------------------- /WebContent/error.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page import="java.io.*, java.lang.reflect.*" %> 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | 80 | 81 | 82 | 83 | 84 | 85 | 88 | 89 | 90 |
12 |
13 |
An Error has occured during Trade processing.
19 | The stack trace detailing the error follows. 20 |

Please consult the application server error logs (SystemOut.log/SystemErr.log/FFDC) for further details.

21 |
26 | 27 | <% 28 | String message = null; 29 | int status_code = -1; 30 | String exception_info = null; 31 | String url = null; 32 | 33 | try { 34 | Exception theException = null; 35 | Integer status = null; 36 | 37 | //these attribute names are specified by Servlet 2.2 38 | message = (String) request.getAttribute("javax.servlet.error.message"); 39 | status = ((Integer) request.getAttribute("javax.servlet.error.status_code")); 40 | theException = (Exception) request.getAttribute("javax.servlet.error.exception"); 41 | url = (String) request.getAttribute("javax.servlet.error.request_uri"); 42 | 43 | // convert the stack trace to a string 44 | StringWriter sw = new StringWriter(); 45 | PrintWriter pw = new PrintWriter(sw); 46 | theException.printStackTrace(pw); 47 | pw.flush(); 48 | pw.close(); 49 | 50 | if (message == null) { 51 | message = "not available"; 52 | } 53 | 54 | if (status == null) { 55 | status_code = -1; 56 | } 57 | else { 58 | status_code = status.intValue(); 59 | } 60 | if (theException == null) { 61 | exception_info = "not available"; 62 | } 63 | else { 64 | exception_info = theException.toString(); 65 | exception_info = exception_info + "
" + sw.toString(); 66 | sw.close(); 67 | } 68 | } catch (Exception e) { 69 | e.printStackTrace(); 70 | } 71 | 72 | out.println("

Processing request:" + url); 73 | out.println("
StatusCode: " + status_code); 74 | out.println("
Message:" + message); 75 | out.println("
Exception:" + exception_info); 76 | 77 | %> 78 |
79 |
86 |
87 |
91 | 92 | 93 | -------------------------------------------------------------------------------- /WebContent/generateOOM.jsp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Configuration and utilities 26 | 27 | 28 | 29 |
30 | <%@ page import="java.util.Collection, java.util.Iterator,com.ibm.json.java.*" isThreadSafe="true" isErrorPage="false"%> 31 | 32 |

Generate OOM

33 | 34 | 35 | 36 | 37 |
38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /WebContent/header.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 32 | 33 | 34 | 35 |