├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── build.gradle ├── daytrader3-ee6-ejb ├── .gitignore ├── build.gradle ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ibm │ │ └── websphere │ │ └── samples │ │ └── daytrader │ │ ├── AccountDataBean.java │ │ ├── AccountProfileDataBean.java │ │ ├── HoldingDataBean.java │ │ ├── MarketSummaryDataBean.java │ │ ├── MarketSummaryDataBeanWS.java │ │ ├── OrderDataBean.java │ │ ├── QuoteDataBean.java │ │ ├── RunStatsDataBean.java │ │ ├── TradeAction.java │ │ ├── TradeConfig.java │ │ ├── TradeServices.java │ │ ├── TradeWSAction.java │ │ ├── TradeWSServices.java │ │ ├── direct │ │ ├── KeySequenceDirect.java │ │ └── TradeDirect.java │ │ ├── ejb3 │ │ ├── DTBroker3MDB.java │ │ ├── DTStreamer3MDB.java │ │ ├── DirectSLSBBean.java │ │ ├── DirectSLSBLocal.java │ │ ├── TradeSLSBBean.java │ │ └── TradeSLSBLocal.java │ │ └── util │ │ ├── FinancialUtils.java │ │ ├── KeyBlock.java │ │ ├── Log.java │ │ ├── MDBStats.java │ │ └── TimerStat.java │ └── resources │ └── META-INF │ ├── DEPENDENCIES │ ├── LICENSE.txt │ ├── MANIFEST.MF │ ├── NOTICE.txt │ ├── daytrader.sql │ ├── ejb-jar.xml │ ├── ibm-ejb-jar-bnd.xml │ ├── jboss.xml │ └── persistence.xml ├── daytrader3-ee6-rest ├── .gitignore ├── build.gradle ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── ibm │ │ └── websphere │ │ └── samples │ │ └── daytrader │ │ └── rest │ │ ├── Address.java │ │ ├── AddressApplication.java │ │ ├── AddressBook.java │ │ ├── AddressBookDatabase.java │ │ ├── AddressList.java │ │ └── ObjectFactory.java │ └── webapp │ └── WEB-INF │ └── web.xml ├── daytrader3-ee6-web ├── .gitignore ├── build.gradle ├── pom.xml └── src │ └── main │ ├── java │ ├── build.properties │ └── com │ │ └── ibm │ │ └── websphere │ │ └── samples │ │ └── daytrader │ │ └── web │ │ ├── OrdersAlertFilter.java │ │ ├── TestServlet.java │ │ ├── TradeAppServlet.java │ │ ├── TradeBuildDB.java │ │ ├── TradeConfigServlet.java │ │ ├── TradeScenarioServlet.java │ │ ├── TradeServletAction.java │ │ ├── TradeWebContextListener.java │ │ ├── jsf │ │ ├── AccountBean.java │ │ └── QuoteBean.java │ │ └── prims │ │ ├── ExplicitGC.java │ │ ├── PingBean.java │ │ ├── PingJDBCRead.java │ │ ├── PingJDBCRead2JSP.java │ │ ├── PingJDBCWrite.java │ │ ├── PingServlet.java │ │ ├── PingServlet2DB.java │ │ ├── PingServlet2Include.java │ │ ├── PingServlet2IncludeRcv.java │ │ ├── PingServlet2JNDI.java │ │ ├── PingServlet2Jsp.java │ │ ├── PingServlet2PDF.java │ │ ├── PingServlet2Servlet.java │ │ ├── PingServlet2ServletRcv.java │ │ ├── PingServletSetContentLength.java │ │ ├── PingServletWriter.java │ │ ├── PingSession1.java │ │ ├── PingSession2.java │ │ ├── PingSession3.java │ │ ├── PingSession3Object.java │ │ └── ejb3 │ │ ├── PingServlet2Entity.java │ │ ├── PingServlet2MDBQueue.java │ │ ├── PingServlet2MDBTopic.java │ │ ├── PingServlet2Session.java │ │ ├── PingServlet2Session2CMROne2Many.java │ │ ├── PingServlet2Session2CMROne2One.java │ │ ├── PingServlet2Session2Entity.java │ │ ├── PingServlet2Session2Entity2JSP.java │ │ ├── PingServlet2Session2EntityCollection.java │ │ ├── PingServlet2Session2JDBC.java │ │ ├── PingServlet2Session2JDBCCollection.java │ │ ├── PingServlet2SessionLocal.java │ │ └── PingServlet2TwoPhase.java │ └── webapp │ ├── META-INF │ ├── LICENSE │ ├── MANIFEST.MF │ └── NOTICE │ ├── PingFaceletLarge.xhtml │ ├── PingFaceletSmall.xhtml │ ├── PingHtml.html │ ├── PingJsp.jsp │ ├── PingJspEL.jsp │ ├── PingServlet2Jsp.jsp │ ├── WAS_V7_64-bit_performance.pdf │ ├── WEB-INF │ ├── classes │ │ └── META-INF │ │ │ ├── DEPENDENCIES │ │ │ ├── LICENSE │ │ │ └── NOTICE │ ├── faces-config.xml │ ├── geronimo-web.xml │ ├── ibm-web-bnd.xml │ ├── ibm-web-ext.xml │ ├── jboss-web.xml │ └── web.xml │ ├── account.jsp │ ├── accountImg.jsp │ ├── config.jsp │ ├── configure.html │ ├── contentHome.html │ ├── dbscripts │ ├── db2 │ │ └── Table.ddl │ ├── derby │ │ └── Table.ddl │ └── oracle │ │ └── Table.ddl │ ├── displayQuote.jsp │ ├── docs │ ├── benchmarking.html │ ├── documentation.html │ ├── glossary.html │ ├── rtCharacterisitics.html │ ├── tradeFAQ.html │ └── tradeversion.html │ ├── error.jsp │ ├── footer.html │ ├── header.html │ ├── images │ ├── DayTraderHead_blue.gif │ ├── DayTraderHead_red.gif │ ├── about.gif │ ├── account.gif │ ├── arrowdown.gif │ ├── arrowup.gif │ ├── bottomRedBar.gif │ ├── configuration.gif │ ├── copyRight.gif │ ├── dayTraderLogo.gif │ ├── daytrader_simple_arch.gif │ ├── faq.gif │ ├── graph.gif │ ├── home.gif │ ├── homeBanner.gif │ ├── line.gif │ ├── logout.gif │ ├── lower_banner.gif │ ├── menuHome.gif │ ├── portfolio.gif │ ├── primitives.gif │ ├── quotes.gif │ ├── reports.gif │ ├── spacer.gif │ ├── ticker-anim.gif │ ├── topRedBar.gif │ ├── topline.jpg │ └── tradingAndPortfolios.gif │ ├── index.html │ ├── leftMenu.html │ ├── marketSummary.jsp │ ├── order.jsp │ ├── orderImg.jsp │ ├── portfolio.jsp │ ├── portfolioImg.jsp │ ├── quote.jsp │ ├── quoteDataPrimitive.jsp │ ├── quoteImg.jsp │ ├── register.jsp │ ├── registerImg.jsp │ ├── runStats.jsp │ ├── sample.jsp │ ├── style.css │ ├── theme │ └── stylesheet.css │ ├── tradehome.jsp │ ├── tradehomeImg.jsp │ ├── web_prmtv.html │ ├── welcome.jsp │ └── welcomeImg.jsp ├── daytrader3-ee6-wlpcfg ├── .gitignore ├── build.gradle ├── pom.xml └── servers │ └── daytrader3_Sample │ ├── apps │ └── META-INF │ │ ├── DEPENDENCIES │ │ ├── LICENSE.txt │ │ ├── MANIFEST.MF │ │ ├── application.xml │ │ └── maven │ │ └── net.wasdev.wlp.sample │ │ └── daytrader3-ee6 │ │ ├── pom.properties │ │ └── pom.xml │ ├── derby.log │ ├── messaging │ └── messageStore │ │ ├── Log │ │ ├── PermanentStore │ │ └── TemporaryStore │ ├── server.xml │ └── tranlog │ ├── partnerlog │ ├── DO NOT DELETE LOG FILES │ ├── log1 │ └── log2 │ └── tranlog │ ├── DO NOT DELETE LOG FILES │ ├── log1 │ └── log2 ├── daytrader3-ee6 ├── .gitignore ├── build.gradle ├── pom.xml └── src │ └── main │ └── application │ └── META-INF │ ├── DEPENDENCIES │ ├── LICENSE.txt │ └── application.xml ├── docs ├── Downloading-WAS-Liberty.md ├── Starting-the-server.md ├── Using-WDT.md └── Using-cmd-line.md ├── gradle.properties ├── jmeter_files ├── README.txt └── daytrader3.jmx ├── pom.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | /target/ 3 | .*.swp 4 | /.project 5 | /.settings/ 6 | .DS_Store 7 | /build/ 8 | /.gradle/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | jdk: 4 | - openjdk8 5 | 6 | env: 7 | - TEST_COMMAND="gradle clean build" 8 | - TEST_COMMAND="mvn clean install" 9 | 10 | script: 11 | - (eval "$TEST_COMMAND") 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sample.daytrader3 [![Build Status](https://travis-ci.org/WASdev/sample.daytrader3.svg?branch=master)](https://travis-ci.org/WASdev/sample.daytrader3) 2 | 3 | # Java EE6: DayTrader3 Sample 4 | 5 | Java EE6 DayTrader3 Sample 6 | 7 | 8 | This sample contains the DayTrader 3 benchmark, which is an application built around the paradigm of an online stock trading system. The application allows users to login, view their portfolio, lookup stock quotes, and buy or sell stock shares. With the aid of a Web-based load driver such as Apache JMeter, the real-world workload provided by DayTrader can be used to measure and compare the performance of Java Platform, Enterprise Edition (Java EE) application servers offered by a variety of vendors. In addition to the full workload, the application also contains a set of primitives used for functional and performance testing of various Java EE components and common design patterns. 9 | 10 | DayTrader is an end-to-end benchmark and performance sample application. It provides a real world Java EE workload. 11 | 12 | ## Getting Started 13 | 14 | Browse the code to see what it does, or build and run it yourself: 15 | * [Building and running on the command line using Maven and Gradle](/docs/Using-cmd-line.md) 16 | * [Building and running using Eclipse and WebSphere Development Tools (WDT)](/docs/Using-WDT.md) 17 | * [Downloading WAS Liberty](/docs/Downloading-WAS-Liberty.md) 18 | 19 | Once the server has been started, go to [http://localhost:9083/daytrader](http://localhost:9083/daytrader) to interact with the sample. 20 | 21 | ## Notice 22 | 23 | © Copyright IBM Corporation 2015. 24 | 25 | ## License 26 | 27 | ```text 28 | Licensed under the Apache License, Version 2.0 (the "License"); 29 | you may not use this file except in compliance with the License. 30 | You may obtain a copy of the License at 31 | 32 | http://www.apache.org/licenses/LICENSE-2.0 33 | 34 | Unless required by applicable law or agreed to in writing, software 35 | distributed under the License is distributed on an "AS IS" BASIS, 36 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 37 | See the License for the specific language governing permissions and 38 | limitations under the License. 39 | ```` 40 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | apply plugin: 'eclipse' 3 | } 4 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated/ 2 | /target/ 3 | /build/ 4 | /bin/ 5 | .classpath 6 | .project 7 | /.settings/ 8 | .factorypath 9 | /.gradle -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'eclipse-wtp' 3 | 4 | jar { 5 | baseName 'dt-ejb' 6 | } 7 | 8 | 9 | // Dependencies 10 | repositories { mavenCentral(); } 11 | 12 | dependencies { 13 | compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.0-api', version: '1.0.1.Final' 14 | compile group: 'javax.ejb', name: 'ejb-api', version: '3.0' 15 | compile group: 'javax.jms', name: 'jms-api', version: '1.1-rev-1' 16 | compile group: 'javax.transaction', name: 'jta', version: '1.1' 17 | } 18 | 19 | sourceCompatibility = 1.7 20 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | net.wasdev.wlp.sample 5 | daytrader3 6 | 1.0-SNAPSHOT 7 | 8 | 9 | jar 10 | WAS Liberty Sample - Java EE6 Benchmark Sample - EJB Module 11 | dt-ejb 12 | daytrader3-ee6-ejb 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | javax.jms 18 | jms-api 19 | 1.1-rev-1 20 | provided 21 | 22 | 23 | javax.ejb 24 | ejb-api 25 | 3.0 26 | provided 27 | 28 | 29 | org.hibernate.javax.persistence 30 | hibernate-jpa-2.0-api 31 | 1.0.1.Final 32 | provided 33 | 34 | 35 | javax.transaction 36 | jta 37 | 1.1 38 | provided 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/java/com/ibm/websphere/samples/daytrader/TradeWSServices.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader; 18 | 19 | public interface TradeWSServices extends java.rmi.Remote { 20 | public com.ibm.websphere.samples.daytrader.MarketSummaryDataBeanWS getMarketSummary() throws java.rmi.RemoteException; 21 | public com.ibm.websphere.samples.daytrader.OrderDataBean buy(java.lang.String userID, java.lang.String symbol, double quantity, int orderProcessingMode) throws java.rmi.RemoteException; 22 | public com.ibm.websphere.samples.daytrader.OrderDataBean sell(java.lang.String userID, java.lang.Integer holdingID, int orderProcessingMode) throws java.rmi.RemoteException; 23 | public void queueOrder(java.lang.Integer orderID, boolean twoPhase) throws java.rmi.RemoteException; 24 | public com.ibm.websphere.samples.daytrader.OrderDataBean completeOrder(java.lang.Integer orderID, boolean twoPhase) throws java.rmi.RemoteException; 25 | public void cancelOrder(java.lang.Integer orderID, boolean twoPhase) throws java.rmi.RemoteException; 26 | public void orderCompleted(java.lang.String userID, java.lang.Integer orderID) throws java.rmi.RemoteException; 27 | public com.ibm.websphere.samples.daytrader.OrderDataBean[] getOrders(java.lang.String userID) throws java.rmi.RemoteException; 28 | public com.ibm.websphere.samples.daytrader.OrderDataBean[] getClosedOrders(java.lang.String userID) throws java.rmi.RemoteException; 29 | public com.ibm.websphere.samples.daytrader.QuoteDataBean createQuote(java.lang.String symbol, java.lang.String companyName, java.math.BigDecimal price) throws java.rmi.RemoteException; 30 | public com.ibm.websphere.samples.daytrader.QuoteDataBean getQuote(java.lang.String symbol) throws java.rmi.RemoteException; 31 | public com.ibm.websphere.samples.daytrader.QuoteDataBean[] getAllQuotes() throws java.rmi.RemoteException; 32 | public com.ibm.websphere.samples.daytrader.QuoteDataBean updateQuotePriceVolume(java.lang.String symbol, java.math.BigDecimal newPrice, double sharesTraded) throws java.rmi.RemoteException; 33 | public com.ibm.websphere.samples.daytrader.HoldingDataBean[] getHoldings(java.lang.String userID) throws java.rmi.RemoteException; 34 | public com.ibm.websphere.samples.daytrader.HoldingDataBean getHolding(java.lang.Integer holdingID) throws java.rmi.RemoteException; 35 | public com.ibm.websphere.samples.daytrader.AccountDataBean getAccountData(java.lang.String userID) throws java.rmi.RemoteException; 36 | public com.ibm.websphere.samples.daytrader.AccountProfileDataBean getAccountProfileData(java.lang.String userID) throws java.rmi.RemoteException; 37 | public com.ibm.websphere.samples.daytrader.AccountProfileDataBean updateAccountProfile(com.ibm.websphere.samples.daytrader.AccountProfileDataBean profileData) throws java.rmi.RemoteException; 38 | public com.ibm.websphere.samples.daytrader.AccountDataBean login(java.lang.String userID, java.lang.String password) throws java.rmi.RemoteException; 39 | public void logout(java.lang.String userID) throws java.rmi.RemoteException; 40 | public com.ibm.websphere.samples.daytrader.AccountDataBean register(java.lang.String userID, java.lang.String password, java.lang.String fullname, java.lang.String address, java.lang.String email, java.lang.String creditcard, java.math.BigDecimal openBalance) throws java.rmi.RemoteException; 41 | public com.ibm.websphere.samples.daytrader.RunStatsDataBean resetTrade(boolean deleteAll) throws java.rmi.RemoteException; 42 | } 43 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/java/com/ibm/websphere/samples/daytrader/ejb3/DirectSLSBLocal.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.ibm.websphere.samples.daytrader.ejb3; 19 | 20 | import javax.ejb.Local; 21 | 22 | import com.ibm.websphere.samples.daytrader.TradeServices; 23 | 24 | @Local 25 | public interface DirectSLSBLocal extends TradeServices { 26 | } 27 | 28 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/java/com/ibm/websphere/samples/daytrader/ejb3/TradeSLSBLocal.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.ibm.websphere.samples.daytrader.ejb3; 19 | 20 | import java.math.BigDecimal; 21 | 22 | import javax.ejb.Local; 23 | 24 | import com.ibm.websphere.samples.daytrader.QuoteDataBean; 25 | import com.ibm.websphere.samples.daytrader.TradeServices; 26 | 27 | @Local 28 | public interface TradeSLSBLocal extends TradeServices { 29 | public double investmentReturn(double investment, double NetValue) throws Exception; 30 | 31 | public QuoteDataBean pingTwoPhase(String symbol) throws Exception; 32 | 33 | public void publishQuotePriceChange(QuoteDataBean quote, BigDecimal oldPrice, BigDecimal changeFactor, double sharesTraded); 34 | } -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/java/com/ibm/websphere/samples/daytrader/util/KeyBlock.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.util; 18 | 19 | import java.util.AbstractSequentialList; 20 | import java.util.ListIterator; 21 | public class KeyBlock extends AbstractSequentialList 22 | { 23 | 24 | // min and max provide range of valid primary keys for this KeyBlock 25 | private int min = 0; 26 | private int max = 0; 27 | private int index = 0; 28 | 29 | /** 30 | * Constructor for KeyBlock 31 | */ 32 | public KeyBlock() { 33 | super(); 34 | min = 0; 35 | max = 0; 36 | index = min; 37 | } 38 | 39 | /** 40 | * Constructor for KeyBlock 41 | */ 42 | public KeyBlock(int min, int max) { 43 | super(); 44 | this.min = min; 45 | this.max = max; 46 | index = min; 47 | } 48 | 49 | /** 50 | * @see AbstractCollection#size() 51 | */ 52 | public int size() { 53 | return (max - min) + 1; 54 | } 55 | 56 | /** 57 | * @see AbstractSequentialList#listIterator(int) 58 | */ 59 | public ListIterator listIterator(int arg0) { 60 | return new KeyBlockIterator(); 61 | } 62 | 63 | class KeyBlockIterator implements ListIterator { 64 | 65 | /** 66 | * @see ListIterator#hasNext() 67 | */ 68 | public boolean hasNext() { 69 | return index <= max; 70 | } 71 | 72 | /** 73 | * @see ListIterator#next() 74 | */ 75 | public synchronized Object next() { 76 | if (index > max) 77 | throw new java.lang.RuntimeException("KeyBlock:next() -- Error KeyBlock depleted"); 78 | return new Integer(index++); 79 | } 80 | 81 | /** 82 | * @see ListIterator#hasPrevious() 83 | */ 84 | public boolean hasPrevious() { 85 | return index > min; 86 | } 87 | 88 | /** 89 | * @see ListIterator#previous() 90 | */ 91 | public Object previous() { 92 | return new Integer(--index); 93 | } 94 | 95 | /** 96 | * @see ListIterator#nextIndex() 97 | */ 98 | public int nextIndex() { 99 | return index-min; 100 | } 101 | 102 | /** 103 | * @see ListIterator#previousIndex() 104 | */ 105 | public int previousIndex() { 106 | throw new UnsupportedOperationException("KeyBlock: previousIndex() not supported"); 107 | } 108 | 109 | /** 110 | * @see ListIterator#add() 111 | */ 112 | public void add(Object o) { 113 | throw new UnsupportedOperationException("KeyBlock: add() not supported"); 114 | } 115 | 116 | /** 117 | * @see ListIterator#remove() 118 | */ 119 | public void remove() { 120 | throw new UnsupportedOperationException("KeyBlock: remove() not supported"); 121 | } 122 | 123 | /** 124 | * @see ListIterator#set(Object) 125 | */ 126 | public void set(Object arg0) { 127 | } 128 | } 129 | } -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/java/com/ibm/websphere/samples/daytrader/util/MDBStats.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.util; 18 | 19 | 20 | /** 21 | * 22 | * To change this generated comment edit the template variable "typecomment": 23 | * Window>Preferences>Java>Templates. 24 | * To enable and disable the creation of type comments go to 25 | * Window>Preferences>Java>Code Generation. 26 | */ 27 | public class MDBStats extends java.util.HashMap { 28 | 29 | 30 | private static final long serialVersionUID = -3759835921094193760L; 31 | //Singleton class 32 | private static MDBStats mdbStats = null; 33 | private MDBStats() 34 | { 35 | } 36 | 37 | public static synchronized MDBStats getInstance() 38 | { 39 | if (mdbStats == null) 40 | mdbStats = new MDBStats(); 41 | return mdbStats; 42 | } 43 | 44 | public TimerStat addTiming(String type, long sendTime, long recvTime) 45 | { 46 | TimerStat stats = null; 47 | synchronized (type) 48 | { 49 | 50 | stats = (TimerStat) get(type); 51 | if (stats == null) stats = new TimerStat(); 52 | 53 | long time = recvTime - sendTime; 54 | if ( time > stats.getMax() ) stats.setMax(time); 55 | if ( time < stats.getMin() ) stats.setMin(time); 56 | stats.setCount(stats.getCount()+1); 57 | stats.setTotalTime(stats.getTotalTime() + time); 58 | 59 | put(type, stats); 60 | } 61 | return stats; 62 | } 63 | 64 | 65 | 66 | public synchronized void reset() 67 | { 68 | clear(); 69 | } 70 | 71 | 72 | 73 | } 74 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/java/com/ibm/websphere/samples/daytrader/util/TimerStat.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.util; 18 | 19 | /** 20 | * 21 | * To change this generated comment edit the template variable "typecomment": 22 | * Window>Preferences>Java>Templates. 23 | * To enable and disable the creation of type comments go to 24 | * Window>Preferences>Java>Code Generation. 25 | */ 26 | public class TimerStat { 27 | 28 | private double min=1000000000.0, max=0.0, totalTime=0.0; 29 | private int count; 30 | /** 31 | * Returns the count. 32 | * @return int 33 | */ 34 | public int getCount() { 35 | return count; 36 | } 37 | 38 | /** 39 | * Returns the max. 40 | * @return double 41 | */ 42 | public double getMax() { 43 | return max; 44 | } 45 | 46 | /** 47 | * Returns the min. 48 | * @return double 49 | */ 50 | public double getMin() { 51 | return min; 52 | } 53 | 54 | /** 55 | * Sets the count. 56 | * @param count The count to set 57 | */ 58 | public void setCount(int count) { 59 | this.count = count; 60 | } 61 | 62 | /** 63 | * Sets the max. 64 | * @param max The max to set 65 | */ 66 | public void setMax(double max) { 67 | this.max = max; 68 | } 69 | 70 | /** 71 | * Sets the min. 72 | * @param min The min to set 73 | */ 74 | public void setMin(double min) { 75 | this.min = min; 76 | } 77 | 78 | /** 79 | * Returns the totalTime. 80 | * @return double 81 | */ 82 | public double getTotalTime() { 83 | return totalTime; 84 | } 85 | 86 | /** 87 | * Sets the totalTime. 88 | * @param totalTime The totalTime to set 89 | */ 90 | public void setTotalTime(double totalTime) { 91 | this.totalTime = totalTime; 92 | } 93 | 94 | /** 95 | * Returns the max in Secs 96 | * @return double 97 | */ 98 | public double getMaxSecs() { 99 | return max/1000.0; 100 | } 101 | 102 | /** 103 | * Returns the min in Secs 104 | * @return double 105 | */ 106 | public double getMinSecs() { 107 | return min/1000.0; 108 | } 109 | 110 | /** 111 | * Returns the average time in Secs 112 | * @return double 113 | */ 114 | public double getAvgSecs() { 115 | 116 | double avg = (double)getTotalTime() / (double)getCount(); 117 | return avg / 1000.0; 118 | } 119 | 120 | 121 | } 122 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/DEPENDENCIES: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------ 2 | // Transitive dependencies of this project determined from the 3 | // maven pom organized by organization. 4 | // ------------------------------------------------------------------ 5 | 6 | DayTrader :: EJBs 7 | 8 | 9 | From: 'Apache Software Foundation' (http://www.apache.org/) 10 | - DayTrader :: WS Application Client (http://geronimo.apache.org/maven/genesis/EE6/config/project-config/daytrader/daytrader-wsappclient) com.ibm.websphere.samples.daytrader:daytrader-wsappclient:jar:EE6 11 | License: The Apache Software License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Ant-Version: Apache Ant 1.7.1 3 | Created-By: 2.4 (IBM Corporation) 4 | 5 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Apache Geronimo 2 | Copyright 2003-2006 The Apache Software Foundation 3 | 4 | This product includes software developed by 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | Portions of this software were developed at IBM and donated to the 8 | ASF under the Apache 2.0 license. The former work was referred to 9 | as Trade 6. 10 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/daytrader.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Licensed to the Apache Software Foundation (ASF) under one or more 3 | -- contributor license agreements. See the NOTICE file distributed with 4 | -- this work for additional information regarding copyright ownership. 5 | -- The ASF licenses this file to You under the Apache License, Version 2.0 6 | -- (the "License"); you may not use this file except in compliance with 7 | -- the License. You may obtain a copy of the License at 8 | -- 9 | -- http://www.apache.org/licenses/LICENSE-2.0 10 | -- 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | -- 17 | 18 | --drop table holdingejb; 19 | --drop table accountprofileejb; 20 | --drop table quoteejb; 21 | --drop table keygenejb; 22 | --drop table accountejb; 23 | --drop table orderejb; 24 | 25 | create table holdingejb 26 | (purchaseprice decimal(10, 2), 27 | holdingid integer not null, 28 | quantity double not null, 29 | purchasedate timestamp, 30 | account_accountid integer, 31 | quote_symbol varchar(250), 32 | optLock integer); 33 | 34 | alter table holdingejb 35 | add constraint pk_holdingejb primary key (holdingid); 36 | 37 | create table accountprofileejb 38 | (address varchar(250), 39 | passwd varchar(250), 40 | userid varchar(250) not null, 41 | email varchar(250), 42 | creditcard varchar(250), 43 | fullname varchar(250), 44 | optLock integer); 45 | 46 | alter table accountprofileejb 47 | add constraint pk_accountprofile2 primary key (userid); 48 | 49 | create table quoteejb 50 | (low decimal(10, 2), 51 | open1 decimal(10, 2), 52 | volume double not null, 53 | price decimal(10, 2), 54 | high decimal(10, 2), 55 | companyname varchar(250), 56 | symbol varchar(250) not null, 57 | change1 double not null, 58 | optLock integer); 59 | 60 | alter table quoteejb 61 | add constraint pk_quoteejb primary key (symbol); 62 | 63 | create table keygenejb 64 | (keyval integer not null, 65 | keyname varchar(250) not null); 66 | 67 | alter table keygenejb 68 | add constraint pk_keygenejb primary key (keyname); 69 | 70 | create table accountejb 71 | (creationdate timestamp, 72 | openbalance decimal(10, 2), 73 | logoutcount integer not null, 74 | balance decimal(10, 2), 75 | accountid integer not null, 76 | lastlogin timestamp, 77 | logincount integer not null, 78 | PROFILE_USERID VARCHAR(250), 79 | optLock integer); 80 | 81 | alter table accountejb 82 | add constraint pk_accountejb primary key (accountid); 83 | 84 | create table orderejb 85 | (orderfee decimal(10, 2), 86 | completiondate timestamp, 87 | ordertype varchar(250), 88 | orderstatus varchar(250), 89 | price decimal(10, 2), 90 | quantity double not null, 91 | opendate timestamp, 92 | orderid integer not null, 93 | account_accountid integer, 94 | quote_symbol varchar(250), 95 | holding_holdingid integer, 96 | optLock integer); 97 | 98 | alter table orderejb 99 | add constraint pk_orderejb primary key (orderid); 100 | 101 | create index profile_userid on accountejb(profile_userid); 102 | create index account_accountid on holdingejb(account_accountid); 103 | create index account_accountidt on orderejb(account_accountid); 104 | create index holding_holdingid on orderejb(holding_holdingid); 105 | create index orderstatus on orderejb(orderstatus); 106 | create index ordertype on orderejb(ordertype); 107 | 108 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/ejb-jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 21 | DayTrader Enterprise Bean Definitions 22 | 23 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/ibm-ejb-jar-bnd.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/jboss.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | TradeSLSBBean 24 | ejb/TradeSLSBBean 25 | 26 | 27 | 28 | 29 | jdbc/TradeDataSource 30 | 31 | jdbc/TradeDataSource 32 | 33 | 34 | 35 | 36 | jdbc/TradeJDBCDirect 37 | 38 | jdbc/TradeDataSource 39 | 40 | 41 | 42 | 43 | jms/TradeBrokerQueue 44 | jms/TradeBrokerQueue 45 | 46 | 47 | jms/TradeStreamerTopic 48 | jms/TradeStreamerTopic 49 | 50 | 51 | 52 | DirectSLSBBean 53 | 54 | DirectSLSBBean 55 | DirectSLSBBean 56 | 57 | 58 | 59 | 60 | DTStreamer3MDB 61 | TradeStreamerTopic 62 | 63 | 64 | 65 | DTBroker3MDB 66 | TradeBrokerQueue 67 | 68 | TradeSLSBBean 69 | TradeSLSBBean 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | jms/TradeStreamerTopic 79 | TradeStreamerTopic 80 | 81 | 82 | 83 | jms/TradeBrokerQueue 84 | TradeBrokerQueue 85 | 86 | 87 | jdbc/TradeDataSource 88 | 89 | jdbc/TradeDataSource 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /daytrader3-ee6-ejb/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | jdbc/TradeDataSource 22 | jdbc/NoTxTradeDataSource 23 | 24 | com.ibm.websphere.samples.daytrader.AccountDataBean 25 | com.ibm.websphere.samples.daytrader.AccountProfileDataBean 26 | com.ibm.websphere.samples.daytrader.HoldingDataBean 27 | com.ibm.websphere.samples.daytrader.OrderDataBean 28 | com.ibm.websphere.samples.daytrader.QuoteDataBean 29 | true 30 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated/ 2 | /target/ 3 | /target/ 4 | /build/ 5 | /bin/ 6 | .classpath 7 | .project 8 | /.settings/ 9 | .factorypath 10 | /.gradle 11 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply plugin: 'eclipse-wtp' 3 | 4 | war { 5 | archiveName 'Rest.war' 6 | } 7 | 8 | 9 | buildscript { 10 | repositories { 11 | mavenCentral() 12 | maven { 13 | name = 'Sonatype Nexus Snapshots' 14 | url = 'https://oss.sonatype.org/content/repositories/snapshots/' 15 | } 16 | } 17 | } 18 | 19 | // Dependencies 20 | repositories { mavenCentral(); } 21 | 22 | 23 | dependencies { 24 | providedCompile group:'javax.ws.rs', name: 'jsr311-api', version: '1.1.1' 25 | } 26 | 27 | 28 | 29 | // Set the Eclipse facets to use 3.1 of the Dynamic Web Module which requires Java 1.7 by default. 30 | eclipse.wtp.facet { 31 | // Clear default facets to work around bug where you get duplicates including wst 2.4 32 | 33 | } 34 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | net.wasdev.wlp.sample 5 | daytrader3 6 | 1.0-SNAPSHOT 7 | 8 | 9 | war 10 | WAS Liberty Sample - Java EE6 Benchmark Sample - Web Module 11 | Rest 12 | daytrader3-ee6-rest 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | 18 | 19 | 20 | javax.ws.rs 21 | jsr311-api 22 | 1.1.1 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/src/main/java/com/ibm/websphere/samples/daytrader/rest/Address.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package com.ibm.websphere.samples.daytrader.rest; 21 | 22 | import java.util.List; 23 | 24 | import javax.ws.rs.Consumes; 25 | import javax.ws.rs.GET; 26 | import javax.ws.rs.Produces; 27 | import javax.ws.rs.core.Context; 28 | import javax.ws.rs.core.HttpHeaders; 29 | import javax.ws.rs.core.MediaType; 30 | import javax.ws.rs.core.Response; 31 | import javax.xml.bind.annotation.XmlRootElement; 32 | 33 | @XmlRootElement 34 | public class Address { 35 | 36 | private String entryName; 37 | 38 | private String zipCode; 39 | 40 | private String streetAddress; 41 | 42 | private String city; 43 | 44 | private String state; 45 | 46 | private String country; 47 | 48 | public Address() { 49 | 50 | } 51 | 52 | public Address(String entryName, String zipCode, String streetAddress, String city, String state, String country) { 53 | this.entryName = entryName; 54 | this.zipCode = zipCode; 55 | this.streetAddress = streetAddress; 56 | this.city = city; 57 | this.state = state; 58 | this.country = country; 59 | } 60 | 61 | @GET 62 | @Consumes(value = { "text/xml", "application/x-www-form-urlencoded" }) 63 | @Produces(value = { "text/xml" }) 64 | public Response get(@Context HttpHeaders headers) { 65 | List acceptTypes = headers.getAcceptableMediaTypes(); 66 | Response r = null; 67 | if (acceptTypes.contains(MediaType.TEXT_XML)) { 68 | r = Response.ok(this).build(); 69 | } 70 | 71 | return r; 72 | } 73 | 74 | public String getEntryName() { 75 | return entryName; 76 | } 77 | 78 | public void setEntryName(String entryName) { 79 | this.entryName = entryName; 80 | } 81 | 82 | public String getZipCode() { 83 | return zipCode; 84 | } 85 | 86 | public void setZipCode(String zipCode) { 87 | this.zipCode = zipCode; 88 | } 89 | 90 | public String getStreetAddress() { 91 | return streetAddress; 92 | } 93 | 94 | public void setStreetAddress(String streetAddress) { 95 | this.streetAddress = streetAddress; 96 | } 97 | 98 | public String getCity() { 99 | return city; 100 | } 101 | 102 | public void setCity(String city) { 103 | this.city = city; 104 | } 105 | 106 | public String getState() { 107 | return state; 108 | } 109 | 110 | public void setState(String state) { 111 | this.state = state; 112 | } 113 | 114 | public String getCountry() { 115 | return country; 116 | } 117 | 118 | public void setCountry(String country) { 119 | this.country = country; 120 | } 121 | 122 | public String toString() { 123 | StringBuffer sb = new StringBuffer(); 124 | sb.append("Entry Name: " + entryName); 125 | sb.append("\n"); 126 | sb.append("Street Address: " + streetAddress); 127 | sb.append("\n"); 128 | sb.append("City: " + city); 129 | sb.append("\n"); 130 | sb.append("Zip Code: " + zipCode); 131 | sb.append("\n"); 132 | sb.append("State: " + state); 133 | sb.append("\n"); 134 | sb.append("Country: " + country); 135 | return sb.toString(); 136 | } 137 | 138 | } 139 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/src/main/java/com/ibm/websphere/samples/daytrader/rest/AddressApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package com.ibm.websphere.samples.daytrader.rest; 21 | 22 | import java.util.HashSet; 23 | import java.util.Set; 24 | 25 | import javax.ws.rs.core.Application; 26 | 27 | public class AddressApplication extends Application { 28 | 29 | public Set> getClasses() { 30 | Set> set = new HashSet>(); 31 | set.add(AddressBook.class); 32 | return set; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/src/main/java/com/ibm/websphere/samples/daytrader/rest/AddressBook.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package com.ibm.websphere.samples.daytrader.rest; 21 | 22 | import java.util.Iterator; 23 | import java.util.List; 24 | 25 | import javax.ws.rs.GET; 26 | import javax.ws.rs.Path; 27 | import javax.ws.rs.PathParam; 28 | import javax.ws.rs.Produces; 29 | 30 | @Path(value = "/addresses") 31 | public class AddressBook { 32 | 33 | static { 34 | 35 | Address Addr = new Address("Entry5", "12345", "Address", "City", "State", "Country"); 36 | AddressBookDatabase.storeAddress("Entry5", Addr); 37 | 38 | Addr = new Address("Entry4", "12345", "Address", "City", "State", "Country"); 39 | AddressBookDatabase.storeAddress("Entry4", Addr); 40 | 41 | Addr = new Address("Entry3", "12345", "Address", "City", "State", "Country"); 42 | AddressBookDatabase.storeAddress("Entry3", Addr); 43 | 44 | Addr = new Address("Entry2", "12345", "Address", "City", "State", "Country"); 45 | AddressBookDatabase.storeAddress("Entry2", Addr); 46 | 47 | Addr = new Address("Entry1", "12345", "Address", "City", "State", "Country"); 48 | AddressBookDatabase.storeAddress("Entry1", Addr); 49 | 50 | } 51 | 52 | public AddressBook() { 53 | 54 | } 55 | 56 | @GET 57 | @Path(value = "/search/{searchstring}") 58 | @Produces(value = { "application/json" }) 59 | public AddressList search(@PathParam(value = "searchstring") String searchString) { 60 | AddressList addressList = new AddressList(); 61 | List
addresses = addressList.getAddresses(); 62 | Iterator
addressIter = AddressBookDatabase.getAddresses(); 63 | while (addressIter.hasNext()) { 64 | Address address = addressIter.next(); 65 | if (address.getEntryName().startsWith(searchString)) { 66 | addresses.add(address); 67 | } 68 | } 69 | return addressList; 70 | } 71 | 72 | @GET 73 | @Produces(value = { "application/json" }) 74 | public AddressList getAddresses() { 75 | AddressList addressList = new AddressList(); 76 | List
addresses = addressList.getAddresses(); 77 | Iterator
addressIter = AddressBookDatabase.getAddresses(); 78 | while (addressIter.hasNext()) { 79 | Address address = addressIter.next(); 80 | addresses.add(address); 81 | } 82 | return addressList; 83 | } 84 | 85 | @Path("/{entryName}") 86 | public Address getAddress(@PathParam(value = "entryName") String entryName) { 87 | Address addr = AddressBookDatabase.getAddress(entryName); 88 | return addr; 89 | } 90 | 91 | 92 | } 93 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/src/main/java/com/ibm/websphere/samples/daytrader/rest/AddressBookDatabase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package com.ibm.websphere.samples.daytrader.rest; 21 | 22 | import java.util.HashMap; 23 | import java.util.Iterator; 24 | import java.util.Map; 25 | 26 | /** 27 | * Sample that will mock a database for the AddressBook resource 28 | * @author Dustin 29 | * 30 | */ 31 | public class AddressBookDatabase { 32 | 33 | private static Map addressMap = new HashMap(); 34 | 35 | public static Address getAddress(String entryName) { 36 | return addressMap.get(entryName); 37 | } 38 | 39 | public static void storeAddress(String entryName, Address address) { 40 | addressMap.put(entryName, address); 41 | } 42 | 43 | public static Iterator
getAddresses() { 44 | return addressMap.values().iterator(); 45 | } 46 | 47 | public static void removeAddress(String entryName) { 48 | addressMap.remove(entryName); 49 | } 50 | 51 | public static void clearEntries() { 52 | if (addressMap != null) { 53 | addressMap.clear(); 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/src/main/java/com/ibm/websphere/samples/daytrader/rest/AddressList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package com.ibm.websphere.samples.daytrader.rest; 21 | 22 | import java.util.LinkedList; 23 | import java.util.List; 24 | 25 | import javax.xml.bind.annotation.XmlElement; 26 | import javax.xml.bind.annotation.XmlRootElement; 27 | 28 | @XmlRootElement 29 | public class AddressList { 30 | 31 | @XmlElement 32 | private List
addresses = new LinkedList
(); 33 | 34 | public List
getAddresses() { 35 | return addresses; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/src/main/java/com/ibm/websphere/samples/daytrader/rest/ObjectFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | 20 | package com.ibm.websphere.samples.daytrader.rest; 21 | 22 | import javax.xml.bind.annotation.XmlRegistry; 23 | 24 | @XmlRegistry 25 | public class ObjectFactory { 26 | 27 | public AddressList createAddressList() { 28 | return new AddressList(); 29 | } 30 | 31 | public Address createAddress() { 32 | return new Address(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /daytrader3-ee6-rest/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 14 | 16 | 17 | javax.ws.rs.core.Application 18 | 1 19 | 20 | 21 | javax.ws.rs.core.Application 22 | /* 23 | 24 | 25 | 26 | 42 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/.gitignore: -------------------------------------------------------------------------------- 1 | /.apt_generated/ 2 | /target/ 3 | /build/ 4 | /bin/ 5 | .classpath 6 | .project 7 | /.settings/ 8 | .factorypath 9 | /.gradle -------------------------------------------------------------------------------- /daytrader3-ee6-web/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'war' 2 | apply plugin: 'eclipse-wtp' 3 | 4 | war { 5 | archiveName 'web.war' 6 | } 7 | 8 | buildscript { 9 | repositories { 10 | mavenCentral() 11 | maven { 12 | name = 'Sonatype Nexus Snapshots' 13 | url = 'https://oss.sonatype.org/content/repositories/snapshots/' 14 | } 15 | } 16 | } 17 | 18 | // Dependencies 19 | repositories { mavenCentral(); } 20 | dependencies { 21 | providedCompile project (path: ':daytrader3-ee6-ejb', configuration: 'archives') 22 | providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1' 23 | providedCompile group: 'javax.jms', name: 'jms-api', version: '1.1-rev-1' 24 | providedCompile group: 'javax.ejb', name: 'ejb-api', version: '3.0' 25 | providedCompile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.0-api', version: '1.0.1.Final' 26 | providedCompile group:'javax.faces', name:'javax.faces-api', version:'2.1' 27 | compile group:'taglibs', name:'standard',version:'1.1.1' 28 | } 29 | 30 | 31 | 32 | // Set the Eclipse facets to use 3.1 of the Dynamic Web Module which requires Java 1.7 by default. 33 | eclipse.wtp.facet { 34 | // Clear default facets to work around bug where you get duplicates including wst 2.4 35 | 36 | } 37 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | net.wasdev.wlp.sample 5 | daytrader3 6 | 1.0-SNAPSHOT 7 | 8 | 9 | war 10 | WAS Liberty Sample - Java EE6 Benchmark Sample - Web Module 11 | web 12 | daytrader3-ee6-web 13 | 1.0-SNAPSHOT 14 | 15 | 16 | 17 | taglibs 18 | standard 19 | 1.1.1 20 | 21 | 22 | javax.servlet 23 | javax.servlet-api 24 | 3.0.1 25 | provided 26 | 27 | 28 | javax.jms 29 | jms-api 30 | 1.1-rev-1 31 | provided 32 | 33 | 34 | javax.ejb 35 | ejb-api 36 | 3.0 37 | provided 38 | 39 | 40 | org.hibernate.javax.persistence 41 | hibernate-jpa-2.0-api 42 | 1.0.1.Final 43 | provided 44 | 45 | 46 | javax.faces 47 | javax.faces-api 48 | 2.1 49 | provided 50 | 51 | 52 | net.wasdev.wlp.sample 53 | daytrader3-ee6-ejb 54 | 1.0-SNAPSHOT 55 | jar 56 | provided 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/build.properties: -------------------------------------------------------------------------------- 1 | ## Licensed to the Apache Software Foundation (ASF) under one or more 2 | ## contributor license agreements. See the NOTICE file distributed with 3 | ## this work for additional information regarding copyright ownership. 4 | ## The ASF licenses this file to You under the Apache License, Version 2.0 5 | ## (the "License"); you may not use this file except in compliance with 6 | ## the License. You may obtain a copy of the License at 7 | ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 9 | ## 10 | ## Unless required by applicable law or agreed to in writing, software 11 | ## distributed under the License is distributed on an "AS IS" BASIS, 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ## See the License for the specific language governing permissions and 14 | ## limitations under the License. 15 | 16 | ejb_version=${pom.version} 17 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/OrdersAlertFilter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web; 18 | 19 | import java.io.IOException; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.servlet.annotation.WebFilter; 23 | 24 | //import com.ibm.websphere.samples.daytrader.soap.*; 25 | 26 | import com.ibm.websphere.samples.daytrader.*; 27 | import com.ibm.websphere.samples.daytrader.util.*; 28 | 29 | @WebFilter(filterName = "OrdersAlertFilter", urlPatterns = "/app") 30 | public class OrdersAlertFilter implements Filter { 31 | 32 | /** 33 | * Constructor for CompletedOrdersAlertFilter 34 | */ 35 | public OrdersAlertFilter() { 36 | super(); 37 | } 38 | 39 | /** 40 | * @see Filter#init(FilterConfig) 41 | */ 42 | private FilterConfig filterConfig = null; 43 | public void init(FilterConfig filterConfig) throws ServletException { 44 | this.filterConfig = filterConfig; 45 | } 46 | 47 | /** 48 | * @see Filter#doFilter(ServletRequest, ServletResponse, FilterChain) 49 | */ 50 | public void doFilter( 51 | ServletRequest req, 52 | ServletResponse resp, 53 | FilterChain chain) 54 | throws IOException, ServletException { 55 | if (filterConfig == null) 56 | return; 57 | 58 | try 59 | { 60 | String action = req.getParameter("action"); 61 | if ( action != null ) 62 | { 63 | action = action.trim(); 64 | if ( (action.length() > 0) && (!action.equals("logout")) ) 65 | { 66 | String userID; 67 | if ( action.equals("login") ) 68 | userID = req.getParameter("uid"); 69 | else 70 | userID = (String) ((HttpServletRequest) req).getSession().getAttribute("uidBean"); 71 | if ( (userID != null) && (userID.trim().length()>0) ) 72 | { 73 | TradeServices tAction=null; 74 | tAction = new TradeAction(); 75 | java.util.Collection closedOrders = tAction.getClosedOrders(userID); 76 | if ( (closedOrders!=null) && (closedOrders.size() > 0) ) 77 | req.setAttribute("closedOrders", closedOrders); 78 | if (Log.doTrace()) Log.printCollection("OrderAlertFilter: userID="+userID+" closedOrders=", closedOrders); 79 | } 80 | } 81 | } 82 | } 83 | catch (Exception e) 84 | { 85 | Log.error(e, "OrdersAlertFilter - Error checking for closedOrders"); 86 | } 87 | 88 | ServletContext sc = filterConfig.getServletContext(); 89 | //String xyz = (String) sc.getAttribute("hitCounter"); 90 | chain.doFilter(req, resp/*wrapper*/); 91 | 92 | } 93 | 94 | /** 95 | * @see Filter#destroy() 96 | */ 97 | public void destroy() { 98 | this.filterConfig = null; 99 | } 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/TestServlet.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web; 18 | 19 | import javax.servlet.*; 20 | import javax.servlet.http.*; 21 | import javax.servlet.annotation.WebServlet; 22 | 23 | 24 | import java.io.IOException; 25 | import java.math.BigDecimal; 26 | 27 | import com.ibm.websphere.samples.daytrader.*; 28 | import com.ibm.websphere.samples.daytrader.util.*; 29 | 30 | @WebServlet(name = "TestServlet", urlPatterns = {"/TestServlet"}) 31 | public class TestServlet extends HttpServlet { 32 | 33 | 34 | private static final long serialVersionUID = -2927579146688173127L; 35 | 36 | public void init(ServletConfig config) throws ServletException 37 | { 38 | super.init(config); 39 | } 40 | 41 | 42 | /** 43 | * Process incoming HTTP GET requests 44 | * 45 | * @param request Object that encapsulates the request to the servlet 46 | * @param response Object that encapsulates the response from the servlet 47 | */ 48 | public void doGet(HttpServletRequest request, HttpServletResponse response) 49 | throws ServletException, IOException 50 | { 51 | performTask(request,response); 52 | } 53 | 54 | /** 55 | * Process incoming HTTP POST requests 56 | * 57 | * @param request Object that encapsulates the request to the servlet 58 | * @param response Object that encapsulates the response from the servlet 59 | */ 60 | public void doPost(HttpServletRequest request, HttpServletResponse response) 61 | throws ServletException, IOException 62 | { 63 | performTask(request,response); 64 | } 65 | 66 | /** 67 | * Main service method for TradeAppServlet 68 | * 69 | * @param request Object that encapsulates the request to the servlet 70 | * @param response Object that encapsulates the response from the servlet 71 | */ 72 | public void performTask(HttpServletRequest req, HttpServletResponse resp) 73 | throws ServletException, IOException 74 | { 75 | try { 76 | Log.debug("Enter TestServlet doGet"); 77 | TradeConfig.runTimeMode = TradeConfig.DIRECT; 78 | for (int i=0; i<10; i++) 79 | { 80 | new TradeAction().createQuote("s:"+i, "Company " + i, new BigDecimal(i*1.1)); 81 | } 82 | /* 83 | 84 | AccountDataBean accountData = new TradeAction().register("user1", "password", "fullname", "address", 85 | "email", "creditCard", new BigDecimal(123.45), false); 86 | 87 | OrderDataBean orderData = new TradeAction().buy("user1", "s:1", 100.0); 88 | orderData = new TradeAction().buy("user1", "s:2", 200.0); 89 | Thread.sleep(5000); 90 | accountData = new TradeAction().getAccountData("user1"); 91 | Collection holdingDataBeans = new TradeAction().getHoldings("user1"); 92 | PrintWriter out = resp.getWriter(); 93 | resp.setContentType("text/html"); 94 | out.write("

"); 95 | out.write(accountData.toString()); 96 | Log.printCollection("user1 Holdings", holdingDataBeans); 97 | ServletContext sc = getServletContext(); 98 | req.setAttribute("results", "Success"); 99 | req.setAttribute("accountData", accountData); 100 | req.setAttribute("holdingDataBeans", holdingDataBeans); 101 | getServletContext().getRequestDispatcher("/tradehome.jsp").include(req, resp); 102 | out.write("

done."); 103 | */ 104 | } 105 | catch (Exception e) 106 | { 107 | Log.error("TestServletException", e); 108 | } 109 | } 110 | } 111 | 112 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/TradeWebContextListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web; 18 | 19 | import javax.servlet.*; 20 | import javax.servlet.annotation.WebListener; 21 | 22 | import com.ibm.websphere.samples.daytrader.direct.*; 23 | import com.ibm.websphere.samples.daytrader.util.*; 24 | 25 | @WebListener() 26 | public class TradeWebContextListener 27 | implements ServletContextListener 28 | { 29 | 30 | //receieve trade web app startup/shutown events to start(initialized)/stop TradeDirect 31 | public void contextInitialized(ServletContextEvent event) 32 | { 33 | Log.trace("TradeWebContextListener contextInitialized -- initializing TradeDirect"); 34 | TradeDirect.init(); 35 | } 36 | public void contextDestroyed(ServletContextEvent event) 37 | { 38 | Log.trace("TradeWebContextListener contextDestroy calling TradeDirect:destroy()"); 39 | //TradeDirect.destroy(); 40 | } 41 | 42 | 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/jsf/QuoteBean.java: -------------------------------------------------------------------------------- 1 | package com.ibm.websphere.samples.daytrader.web.jsf; 2 | 3 | import javax.annotation.PostConstruct; 4 | import javax.ejb.EJB; 5 | import javax.faces.bean.ManagedBean; 6 | import javax.faces.bean.RequestScoped; 7 | 8 | import com.ibm.websphere.samples.daytrader.QuoteDataBean; 9 | import com.ibm.websphere.samples.daytrader.TradeConfig; 10 | import com.ibm.websphere.samples.daytrader.direct.TradeDirect; 11 | import com.ibm.websphere.samples.daytrader.ejb3.DirectSLSBLocal; 12 | import com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBLocal; 13 | import com.ibm.websphere.samples.daytrader.util.Log; 14 | 15 | @ManagedBean 16 | @RequestScoped 17 | public class QuoteBean { 18 | 19 | //Local Interface to Session Bean used for the Entity Bean lookup 20 | @EJB 21 | private TradeSLSBLocal tradeSLSBBeanLocal; 22 | 23 | //Local Interface to Session Bean used for the Session Direct lookup 24 | @EJB 25 | private DirectSLSBLocal directSLSBLocal; 26 | 27 | private TradeDirect tradeDirect; 28 | 29 | private QuoteDataBean quoteDataBean; 30 | 31 | // Generates a random stock symbol to lookup 32 | public QuoteBean() { 33 | super(); 34 | 35 | if (TradeConfig.runTimeMode == TradeConfig.DIRECT) { 36 | try { 37 | tradeDirect = new TradeDirect(); 38 | } 39 | catch (Exception e) { 40 | Log.error("TradeAction:TradeAction() Creation of Trade Direct failed\n" + e); 41 | } 42 | } 43 | 44 | } 45 | 46 | @PostConstruct 47 | public void quoteLookup() { 48 | 49 | final int symbolNum = (int) (Math.random()*(TradeConfig.getMAX_QUOTES()-1)); // 10,000 quotes is normal database size 50 | 51 | if (TradeConfig.runTimeMode == TradeConfig.EJB3) { 52 | try { 53 | quoteDataBean = tradeSLSBBeanLocal.getQuote("s:" + symbolNum); 54 | } catch (Exception e) { 55 | Log.error("QuoteBean:quoteLookup -- error getting quote", e); 56 | } 57 | } 58 | else if (TradeConfig.runTimeMode == TradeConfig.SESSION3) { 59 | try { 60 | quoteDataBean = directSLSBLocal.getQuote("s:" + symbolNum); 61 | } catch (Exception e) { 62 | Log.error("QuoteBean:quoteLookup -- error getting quote", e); 63 | } 64 | } 65 | else if (TradeConfig.runTimeMode == TradeConfig.DIRECT) { 66 | try { 67 | quoteDataBean = tradeDirect.getQuote("s:" + symbolNum); 68 | } catch (Exception e) { 69 | Log.error("QuoteBean:quoteLookup -- error getting quote", e); 70 | } 71 | } 72 | 73 | 74 | } 75 | 76 | public QuoteDataBean getQuoteDataBean() { 77 | return quoteDataBean; 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingBean.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | /** 20 | * 21 | * Simple bean to get and set messages 22 | */ 23 | 24 | 25 | public class PingBean { 26 | 27 | private String msg; 28 | 29 | /** 30 | * returns the message contained in the bean 31 | * @return message String 32 | **/ 33 | public String getMsg() 34 | { 35 | return msg; 36 | } 37 | /** 38 | * sets the message contained in the bean 39 | * param message String 40 | **/ 41 | public void setMsg(String s) 42 | { 43 | msg = s; 44 | } 45 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingJDBCRead2JSP.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | 23 | import javax.servlet.annotation.WebServlet; 24 | 25 | 26 | import com.ibm.websphere.samples.daytrader.*; 27 | import com.ibm.websphere.samples.daytrader.direct.*; 28 | import com.ibm.websphere.samples.daytrader.util.*; 29 | 30 | /** 31 | * 32 | * PingJDBCReadPrepStmt uses a prepared statement for database read access. 33 | * This primative uses {@link com.ibm.websphere.samples.daytrader.direct.TradeDirect} to set the price of a random stock 34 | * (generated by {@link com.ibm.websphere.samples.daytrader.Trade_Config}) through the use of prepared statements. 35 | * 36 | */ 37 | 38 | @WebServlet(name = "PingJDBCRead2JSP", urlPatterns = {"/servlet/PingJDBCRead2JSP"}) 39 | public class PingJDBCRead2JSP extends HttpServlet 40 | { 41 | 42 | private static final long serialVersionUID = 1118803761565654806L; 43 | private static String initTime; 44 | private static int hitCount; 45 | 46 | /** 47 | * forwards post requests to the doGet method 48 | * Creation date: (11/6/2000 10:52:39 AM) 49 | * @param res javax.servlet.http.HttpServletRequest 50 | * @param res2 javax.servlet.http.HttpServletResponse 51 | */ 52 | public void doPost(HttpServletRequest req, HttpServletResponse res) 53 | throws ServletException, IOException 54 | { 55 | doGet(req, res); 56 | } 57 | /** 58 | * this is the main method of the servlet that will service all get requests. 59 | * @param request HttpServletRequest 60 | * @param responce HttpServletResponce 61 | **/ 62 | public void doGet(HttpServletRequest req, HttpServletResponse res) 63 | throws ServletException, IOException 64 | { 65 | String symbol=null; 66 | QuoteDataBean quoteData = null; 67 | ServletContext ctx = getServletConfig().getServletContext(); 68 | 69 | try 70 | { 71 | //TradeJDBC uses prepared statements so I am going to make use of it's code. 72 | TradeDirect trade = new TradeDirect(); 73 | symbol = TradeConfig.rndSymbol(); 74 | 75 | int iter = TradeConfig.getPrimIterations(); 76 | for (int ii = 0; ii < iter; ii++) { 77 | quoteData = trade.getQuote(symbol); 78 | } 79 | 80 | req.setAttribute("quoteData", quoteData); 81 | //req.setAttribute("hitCount", hitCount); 82 | //req.setAttribute("initTime", initTime); 83 | 84 | ctx.getRequestDispatcher("/quoteDataPrimitive.jsp").include(req, res); 85 | } 86 | catch (Exception e) 87 | { 88 | Log.error( 89 | e, 90 | "PingJDBCRead2JPS -- error getting quote for symbol", 91 | symbol); 92 | res.sendError(500, "PingJDBCRead2JSP Exception caught: " + e.toString()); 93 | } 94 | 95 | } 96 | /** 97 | * returns a string of information about the servlet 98 | * @return info String: contains info about the servlet 99 | **/ 100 | public String getServletInfo() 101 | { 102 | return "Basic JDBC Read using a prepared statment forwarded to a JSP, makes use of TradeJDBC class"; 103 | } 104 | /** 105 | * called when the class is loaded to initialize the servlet 106 | * @param config ServletConfig: 107 | **/ 108 | public void init(ServletConfig config) throws ServletException 109 | { 110 | super.init(config); 111 | //hitCount = 0; 112 | //initTime = new java.util.Date().toString(); 113 | } 114 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.servlet.annotation.WebServlet; 23 | 24 | import com.ibm.websphere.samples.daytrader.util.*; 25 | 26 | 27 | /** 28 | * 29 | * PingServlet tests fundamental dynamic HTML creation functionality through 30 | * server side servlet processing. 31 | * 32 | */ 33 | 34 | @WebServlet(name = "PingServlet", urlPatterns = {"/servlet/PingServlet"}) 35 | public class PingServlet extends HttpServlet 36 | { 37 | 38 | private static final long serialVersionUID = 8731300373855056660L; 39 | private static String initTime; 40 | private static int hitCount; 41 | 42 | /** 43 | * forwards post requests to the doGet method 44 | * Creation date: (11/6/2000 10:52:39 AM) 45 | * @param res javax.servlet.http.HttpServletRequest 46 | * @param res2 javax.servlet.http.HttpServletResponse 47 | */ 48 | public void doPost(HttpServletRequest req, HttpServletResponse res) 49 | throws ServletException, IOException 50 | { 51 | doGet(req, res); 52 | } 53 | /** 54 | * this is the main method of the servlet that will service all get requests. 55 | * @param request HttpServletRequest 56 | * @param responce HttpServletResponce 57 | **/ 58 | public void doGet(HttpServletRequest req, HttpServletResponse res) 59 | throws ServletException, IOException 60 | { 61 | try 62 | { 63 | res.setContentType("text/html"); 64 | 65 | // The following 2 lines are the difference between PingServlet and PingServletWriter 66 | // the latter uses a PrintWriter for output versus a binary output stream. 67 | ServletOutputStream out = res.getOutputStream(); 68 | //java.io.PrintWriter out = res.getWriter(); 69 | hitCount++; 70 | out.println( 71 | "Ping Servlet" 72 | + "

Ping Servlet
Init time : " 73 | + initTime 74 | + "

Hit Count: " 75 | + hitCount 76 | + ""); 77 | } 78 | catch (Exception e) 79 | { 80 | Log.error(e, "PingServlet.doGet(...): general exception caught"); 81 | res.sendError(500, e.toString()); 82 | 83 | } 84 | } 85 | /** 86 | * returns a string of information about the servlet 87 | * @return info String: contains info about the servlet 88 | **/ 89 | public String getServletInfo() 90 | { 91 | return "Basic dynamic HTML generation through a servlet"; 92 | } 93 | /** 94 | * called when the class is loaded to initialize the servlet 95 | * @param config ServletConfig: 96 | **/ 97 | public void init(ServletConfig config) throws ServletException 98 | { 99 | super.init(config); 100 | initTime = new java.util.Date().toString(); 101 | hitCount = 0; 102 | 103 | } 104 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2DB.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | 23 | import javax.servlet.annotation.WebServlet; 24 | 25 | import com.ibm.websphere.samples.daytrader.direct.*; 26 | import com.ibm.websphere.samples.daytrader.util.*; 27 | 28 | /** 29 | * 30 | * PingServlet2DB tests the path of a servlet making a JDBC connection to a database 31 | * 32 | */ 33 | 34 | @WebServlet(name = "PingServlet2DB", urlPatterns = {"/servlet/PingServlet2DB"}) 35 | public class PingServlet2DB extends HttpServlet 36 | { 37 | 38 | private static final long serialVersionUID = -6456675185605592049L; 39 | private static String initTime; 40 | private static int hitCount; 41 | 42 | /** 43 | * forwards post requests to the doGet method 44 | * Creation date: (11/6/2000 10:52:39 AM) 45 | * @param res javax.servlet.http.HttpServletRequest 46 | * @param res2 javax.servlet.http.HttpServletResponse 47 | */ 48 | public void doPost(HttpServletRequest req, HttpServletResponse res) 49 | throws ServletException, IOException 50 | { 51 | doGet(req, res); 52 | } 53 | /** 54 | * this is the main method of the servlet that will service all get requests. 55 | * @param request HttpServletRequest 56 | * @param responce HttpServletResponce 57 | **/ 58 | public void doGet(HttpServletRequest req, HttpServletResponse res) 59 | throws ServletException, IOException 60 | { 61 | res.setContentType("text/html"); 62 | java.io.PrintWriter out = res.getWriter(); 63 | String symbol=null; 64 | StringBuffer output = new StringBuffer(100); 65 | 66 | try 67 | { 68 | //TradeJDBC uses prepared statements so I am going to make use of it's code. 69 | TradeDirect trade = new TradeDirect(); 70 | trade.getConnPublic(); 71 | 72 | output.append( 73 | "PingServlet2DB." 74 | + "
PingServlet2DB:
Init time : " 75 | + initTime); 76 | hitCount++; 77 | output.append("
Hit Count: " + hitCount); 78 | output.append("
"); 79 | out.println(output.toString()); 80 | } 81 | catch (Exception e) 82 | { 83 | Log.error( 84 | e, 85 | "PingServlet2DB -- error getting connection to the database", 86 | symbol); 87 | res.sendError(500, "PingServlet2DB Exception caught: " + e.toString()); 88 | } 89 | } 90 | /** 91 | * returns a string of information about the servlet 92 | * @return info String: contains info about the servlet 93 | **/ 94 | public String getServletInfo() 95 | { 96 | return "Basic JDBC Read using a prepared statment, makes use of TradeJDBC class"; 97 | } 98 | /** 99 | * called when the class is loaded to initialize the servlet 100 | * @param config ServletConfig: 101 | **/ 102 | public void init(ServletConfig config) throws ServletException 103 | { 104 | super.init(config); 105 | hitCount = 0; 106 | initTime = new java.util.Date().toString(); 107 | } 108 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2Include.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.servlet.annotation.WebServlet; 23 | 24 | 25 | import com.ibm.websphere.samples.daytrader.*; 26 | import com.ibm.websphere.samples.daytrader.util.*; 27 | 28 | /** 29 | * 30 | * PingServlet2Include tests servlet to servlet request dispatching. Servlet 1, 31 | * the controller, creates a new JavaBean object forwards the servlet request with 32 | * the JavaBean added to Servlet 2. Servlet 2 obtains access to the JavaBean through 33 | * the Servlet request object and provides the dynamic HTML output based on the JavaBean 34 | * data. 35 | * PingServlet2Servlet is the initial servlet that sends a request to {@link PingServlet2ServletRcv} 36 | * 37 | */ 38 | @WebServlet(name = "PingServlet2Include", urlPatterns = {"/servlet/PingServlet2Include"}) 39 | public class PingServlet2Include extends HttpServlet { 40 | 41 | private static final long serialVersionUID = 1063447780151198793L; 42 | private static String initTime; 43 | private static int hitCount; 44 | 45 | /** 46 | * forwards post requests to the doGet method 47 | * Creation date: (11/6/2000 10:52:39 AM) 48 | * @param res javax.servlet.http.HttpServletRequest 49 | * @param res2 javax.servlet.http.HttpServletResponse 50 | */ 51 | public void doPost(HttpServletRequest req, HttpServletResponse res) 52 | throws ServletException, IOException { 53 | doGet(req, res); 54 | } 55 | /** 56 | * this is the main method of the servlet that will service all get requests. 57 | * @param request HttpServletRequest 58 | * @param responce HttpServletResponce 59 | **/ 60 | public void doGet(HttpServletRequest req, HttpServletResponse res) 61 | throws ServletException, IOException { 62 | PingBean ab; 63 | try { 64 | res.setContentType("text/html"); 65 | 66 | int iter = TradeConfig.getPrimIterations(); 67 | for (int ii = 0; ii < iter; ii++) { 68 | getServletConfig().getServletContext().getRequestDispatcher("/servlet/PingServlet2IncludeRcv").include(req, res); 69 | } 70 | 71 | // ServletOutputStream out = res.getOutputStream(); 72 | java.io.PrintWriter out = res.getWriter(); 73 | out.println( 74 | "Ping Servlet 2 Include" 75 | + "

Ping Servlet 2 Include
Init time : " 76 | + initTime 77 | + "

Hit Count: " 78 | + hitCount++ 79 | + ""); 80 | } catch (Exception ex) { 81 | Log.error(ex, "PingServlet2Include.doGet(...): general exception"); 82 | res.sendError(500, "PingServlet2Include.doGet(...): general exception" + ex.toString()); 83 | } 84 | } 85 | 86 | /** 87 | * called when the class is loaded to initialize the servlet 88 | * @param config ServletConfig: 89 | **/ 90 | public void init(ServletConfig config) throws ServletException { 91 | super.init(config); 92 | initTime = new java.util.Date().toString(); 93 | hitCount = 0; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2IncludeRcv.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | 23 | import javax.servlet.annotation.WebServlet; 24 | 25 | /** 26 | * 27 | * PingServlet2Include tests servlet to servlet request dispatching. Servlet 1, 28 | * the controller, creates a new JavaBean object forwards the servlet request with 29 | * the JavaBean added to Servlet 2. Servlet 2 obtains access to the JavaBean through 30 | * the Servlet request object and provides the dynamic HTML output based on the JavaBean 31 | * data. 32 | * PingServlet2Servlet is the initial servlet that sends a request to {@link PingServlet2ServletRcv} 33 | * 34 | */ 35 | @WebServlet(name = "PingServlet2IncludeRcv", urlPatterns = {"/servlet/PingServlet2IncludeRcv"}) 36 | public class PingServlet2IncludeRcv extends HttpServlet { 37 | 38 | private static final long serialVersionUID = 2628801298561220872L; 39 | /** 40 | * forwards post requests to the doGet method 41 | * Creation date: (11/6/2000 10:52:39 AM) 42 | * @param res javax.servlet.http.HttpServletRequest 43 | * @param res2 javax.servlet.http.HttpServletResponse 44 | */ 45 | public void doPost(HttpServletRequest req, HttpServletResponse res) 46 | throws ServletException, IOException { 47 | doGet(req, res); 48 | } 49 | /** 50 | * this is the main method of the servlet that will service all get requests. 51 | * @param request HttpServletRequest 52 | * @param responce HttpServletResponce 53 | **/ 54 | public void doGet(HttpServletRequest req, HttpServletResponse res) 55 | throws ServletException, IOException { 56 | // do nothing but get included by PingServlet2Include 57 | } 58 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2JNDI.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.naming.InitialContext; 23 | import javax.sql.DataSource; 24 | import javax.servlet.annotation.WebServlet; 25 | 26 | 27 | import com.ibm.websphere.samples.daytrader.*; 28 | import com.ibm.websphere.samples.daytrader.util.*; 29 | 30 | /** 31 | * 32 | * PingServlet2JNDI performs a basic JNDI lookup of a JDBC DataSource 33 | * 34 | */ 35 | 36 | @WebServlet(name = "PingServlet2JNDI", urlPatterns = {"/servlet/PingServlet2JNDI"}) 37 | public class PingServlet2JNDI extends HttpServlet 38 | { 39 | 40 | private static final long serialVersionUID = -8236271998141415347L; 41 | private static String initTime; 42 | private static int hitCount; 43 | 44 | /** 45 | * forwards post requests to the doGet method 46 | * Creation date: (11/6/2000 10:52:39 AM) 47 | * @param res javax.servlet.http.HttpServletRequest 48 | * @param res2 javax.servlet.http.HttpServletResponse 49 | */ 50 | public void doPost(HttpServletRequest req, HttpServletResponse res) 51 | throws ServletException, IOException 52 | { 53 | doGet(req, res); 54 | } 55 | /** 56 | * this is the main method of the servlet that will service all get requests. 57 | * @param request HttpServletRequest 58 | * @param responce HttpServletResponce 59 | **/ 60 | public void doGet(HttpServletRequest req, HttpServletResponse res) 61 | throws ServletException, IOException 62 | { 63 | res.setContentType("text/html"); 64 | java.io.PrintWriter out = res.getWriter(); 65 | 66 | StringBuffer output = new StringBuffer(100); 67 | 68 | try 69 | { 70 | 71 | int iter = TradeConfig.getPrimIterations(); 72 | for (int ii = 0; ii < iter; ii++) { 73 | InitialContext context = new InitialContext(); 74 | DataSource datasource = (DataSource) context.lookup(TradeConfig.DS_NAME); 75 | } 76 | 77 | output.append( 78 | "Ping JNDI -- lookup of JDBC DataSource" 79 | + "
Ping JNDI -- lookup of JDBC DataSource
Init time : " 80 | + initTime); 81 | hitCount++; 82 | output.append("
Hit Count: " + hitCount); 83 | output.append("
"); 84 | out.println(output.toString()); 85 | } 86 | catch (Exception e) 87 | { 88 | Log.error(e, "PingServlet2JNDI -- error look up of a JDBC DataSource"); 89 | res.sendError(500, "PingServlet2JNDI Exception caught: " + e.toString()); 90 | } 91 | 92 | } 93 | /** 94 | * returns a string of information about the servlet 95 | * @return info String: contains info about the servlet 96 | **/ 97 | public String getServletInfo() 98 | { 99 | return "Basic JNDI look up of a JDBC DataSource"; 100 | } 101 | /** 102 | * called when the class is loaded to initialize the servlet 103 | * @param config ServletConfig: 104 | **/ 105 | public void init(ServletConfig config) throws ServletException 106 | { 107 | super.init(config); 108 | hitCount = 0; 109 | initTime = new java.util.Date().toString(); 110 | } 111 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2Jsp.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | 23 | import javax.servlet.annotation.WebServlet; 24 | 25 | import com.ibm.websphere.samples.daytrader.util.*; 26 | 27 | 28 | /** 29 | * 30 | * PingServlet2JSP tests a call from a servlet to a JavaServer Page providing server-side dynamic 31 | * HTML through JSP scripting. 32 | * 33 | */ 34 | @WebServlet(name = "PingServlet2Jsp", urlPatterns = {"/servlet/PingServlet2Jsp"}) 35 | public class PingServlet2Jsp extends HttpServlet { 36 | private static final long serialVersionUID = -5199543766883932389L; 37 | private static int hitCount = 0; 38 | 39 | /** 40 | * forwards post requests to the doGet method 41 | * Creation date: (11/6/2000 10:52:39 AM) 42 | * @param res javax.servlet.http.HttpServletRequest 43 | * @param res2 javax.servlet.http.HttpServletResponse 44 | */ 45 | public void doPost(HttpServletRequest req, HttpServletResponse res) 46 | throws ServletException, IOException { 47 | doGet(req, res); 48 | } 49 | 50 | /** 51 | * this is the main method of the servlet that will service all get requests. 52 | * @param request HttpServletRequest 53 | * @param responce HttpServletResponce 54 | **/ 55 | public void doGet(HttpServletRequest req, HttpServletResponse res) 56 | throws ServletException, IOException { 57 | PingBean ab; 58 | try 59 | { 60 | ab = new PingBean(); 61 | hitCount++; 62 | ab.setMsg("Hit Count: " + hitCount); 63 | req.setAttribute("ab", ab); 64 | 65 | getServletConfig().getServletContext().getRequestDispatcher("/PingServlet2Jsp.jsp").forward(req, res); 66 | } 67 | catch (Exception ex) 68 | { 69 | Log.error( 70 | ex,"PingServlet2Jsp.doGet(...): request error"); 71 | res.sendError( 72 | 500, 73 | "PingServlet2Jsp.doGet(...): request error" 74 | + ex.toString()); 75 | 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2PDF.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import java.net.URL; 21 | import java.net.URLConnection; 22 | 23 | import javax.servlet.*; 24 | import javax.servlet.http.*; 25 | 26 | import javax.servlet.annotation.WebServlet; 27 | 28 | import com.ibm.websphere.samples.daytrader.util.*; 29 | 30 | 31 | /** 32 | * 33 | * PingServlet2PDF tests a call to a servlet which then loads a PDF document. 34 | * 35 | */ 36 | @WebServlet(name = "PingServlet2PDF", urlPatterns = {"/servlet/PingServlet2PDF"}) 37 | public class PingServlet2PDF extends HttpServlet { 38 | 39 | private static final long serialVersionUID = -1321793174442755868L; 40 | private static int hitCount = 0; 41 | private static final int BUFFER_SIZE = 1024*8; // 8 KB 42 | 43 | /** 44 | * forwards post requests to the doGet method 45 | * Creation date: (11/6/2000 10:52:39 AM) 46 | * @param res javax.servlet.http.HttpServletRequest 47 | * @param res2 javax.servlet.http.HttpServletResponse 48 | */ 49 | public void doPost(HttpServletRequest req, HttpServletResponse res) 50 | throws ServletException, IOException { 51 | doGet(req, res); 52 | } 53 | 54 | /** 55 | * this is the main method of the servlet that will service all get requests. 56 | * @param request HttpServletRequest 57 | * @param responce HttpServletResponce 58 | **/ 59 | public void doGet(HttpServletRequest req, HttpServletResponse res) 60 | throws ServletException, IOException { 61 | PingBean ab; 62 | BufferedInputStream bis = null; 63 | BufferedOutputStream bos = null; 64 | try { 65 | ab = new PingBean(); 66 | hitCount++; 67 | ab.setMsg("Hit Count: " + hitCount); 68 | req.setAttribute("ab", ab); 69 | 70 | ServletOutputStream out = res.getOutputStream(); 71 | 72 | // MIME type for pdf doc 73 | res.setContentType( "application/pdf" ); 74 | 75 | //Open an InputStream to the PDF document 76 | String fileURL = "http://localhost:9080/daytrader/WAS_V7_64-bit_performance.pdf"; 77 | URL url = new URL ( fileURL ); 78 | URLConnection conn = url.openConnection(); 79 | bis = new BufferedInputStream(conn.getInputStream()); 80 | 81 | //Transfer the InputStream (PDF Document) to OutputStream (servlet) 82 | bos = new BufferedOutputStream(out); 83 | byte[] buff = new byte[BUFFER_SIZE]; 84 | int bytesRead; 85 | // Simple read/write loop. 86 | while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) { 87 | bos.write(buff, 0, bytesRead); 88 | } 89 | 90 | 91 | 92 | } 93 | catch (Exception ex) 94 | { 95 | Log.error( 96 | ex,"PingServlet2Jsp.doGet(...): request error"); 97 | res.sendError( 98 | 500, 99 | "PingServlet2Jsp.doGet(...): request error" 100 | + ex.toString()); 101 | 102 | } 103 | 104 | 105 | finally { 106 | if (bis != null) 107 | bis.close(); 108 | if (bos != null) 109 | bos.close(); 110 | } 111 | 112 | 113 | } 114 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2Servlet.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.servlet.annotation.WebServlet; 23 | 24 | import com.ibm.websphere.samples.daytrader.util.*; 25 | 26 | 27 | /** 28 | * 29 | * PingServlet2Servlet tests servlet to servlet request dispatching. Servlet 1, 30 | * the controller, creates a new JavaBean object forwards the servlet request with 31 | * the JavaBean added to Servlet 2. Servlet 2 obtains access to the JavaBean through 32 | * the Servlet request object and provides the dynamic HTML output based on the JavaBean 33 | * data. 34 | * PingServlet2Servlet is the initial servlet that sends a request to {@link PingServlet2ServletRcv} 35 | * 36 | */ 37 | @WebServlet(name = "PingServlet2Servlet", urlPatterns = {"/servlet/PingServlet2Servlet"}) 38 | public class PingServlet2Servlet extends HttpServlet { 39 | private static final long serialVersionUID = -955942781902636048L; 40 | private static int hitCount = 0; 41 | 42 | /** 43 | * forwards post requests to the doGet method 44 | * Creation date: (11/6/2000 10:52:39 AM) 45 | * @param res javax.servlet.http.HttpServletRequest 46 | * @param res2 javax.servlet.http.HttpServletResponse 47 | */ 48 | public void doPost(HttpServletRequest req, HttpServletResponse res) 49 | throws ServletException, IOException { 50 | doGet(req, res); 51 | } 52 | /** 53 | * this is the main method of the servlet that will service all get requests. 54 | * @param request HttpServletRequest 55 | * @param responce HttpServletResponce 56 | **/ 57 | public void doGet(HttpServletRequest req, HttpServletResponse res) 58 | throws ServletException, IOException { 59 | PingBean ab; 60 | try 61 | { 62 | ab = new PingBean(); 63 | hitCount++; 64 | ab.setMsg("Hit Count: " + hitCount); 65 | req.setAttribute("ab", ab); 66 | 67 | getServletConfig().getServletContext().getRequestDispatcher("/servlet/PingServlet2ServletRcv").forward(req, res); 68 | } 69 | catch (Exception ex) 70 | { 71 | Log.error( 72 | ex, "PingServlet2Servlet.doGet(...): general exception"); 73 | res.sendError(500, "PingServlet2Servlet.doGet(...): general exception" + ex.toString()); 74 | 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServlet2ServletRcv.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.servlet.annotation.WebServlet; 23 | 24 | import com.ibm.websphere.samples.daytrader.util.*; 25 | 26 | 27 | /** 28 | * 29 | * PingServlet2Servlet tests servlet to servlet request dispatching. Servlet 1, 30 | * the controller, creates a new JavaBean object forwards the servlet request with 31 | * the JavaBean added to Servlet 2. Servlet 2 obtains access to the JavaBean through 32 | * the Servlet request object and provides the dynamic HTML output based on the JavaBean 33 | * data. 34 | * PingServlet2ServletRcv receives a request from {@link PingServlet2Servlet} and displays output. 35 | * 36 | */ 37 | @WebServlet(name = "PingServlet2ServletRcv", urlPatterns = {"/servlet/PingServlet2ServletRcv"}) 38 | public class PingServlet2ServletRcv extends HttpServlet { 39 | private static final long serialVersionUID = -5241563129216549706L; 40 | private static String initTime = null; 41 | 42 | /** 43 | * forwards post requests to the doGet method 44 | * Creation date: (11/6/2000 10:52:39 AM) 45 | * @param res javax.servlet.http.HttpServletRequest 46 | * @param res2 javax.servlet.http.HttpServletResponse 47 | */ 48 | public void doPost(HttpServletRequest req, HttpServletResponse res) 49 | throws ServletException, IOException { 50 | doGet(req, res); 51 | } 52 | 53 | 54 | /** 55 | * this is the main method of the servlet that will service all get requests. 56 | * @param request HttpServletRequest 57 | * @param responce HttpServletResponce 58 | **/ 59 | public void doGet(HttpServletRequest req, HttpServletResponse res) 60 | throws ServletException, IOException { 61 | PingBean ab; 62 | try 63 | { 64 | ab = (PingBean) req.getAttribute("ab"); 65 | res.setContentType("text/html"); 66 | PrintWriter out = res.getWriter(); 67 | out.println( 68 | "Ping Servlet2Servlet" 69 | + "

PingServlet2Servlet:
Init time: " 70 | + initTime 71 | + "

Message from Servlet: " 72 | + ab.getMsg() 73 | + ""); 74 | } 75 | catch (Exception ex) 76 | { 77 | Log.error(ex, "PingServlet2ServletRcv.doGet(...): general exception"); 78 | res.sendError( 79 | 500, 80 | "PingServlet2ServletRcv.doGet(...): general exception" 81 | + ex.toString()); 82 | } 83 | 84 | } 85 | /** 86 | * called when the class is loaded to initialize the servlet 87 | * @param config ServletConfig: 88 | **/ 89 | public void init(ServletConfig config) throws ServletException { 90 | super.init(config); 91 | initTime = new java.util.Date().toString(); 92 | 93 | } 94 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServletSetContentLength.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.servlet.annotation.WebServlet; 23 | 24 | import com.ibm.websphere.samples.daytrader.util.*; 25 | 26 | 27 | 28 | /** 29 | * 30 | * PingServletSetContentLength tests fundamental dynamic HTML creation functionality through 31 | * server side servlet processing. 32 | * 33 | */ 34 | 35 | @WebServlet(name = "PingServletSetContentLength", urlPatterns = {"/servlet/PingServletSetContentLength"}) 36 | public class PingServletSetContentLength extends HttpServlet 37 | { 38 | 39 | private static final long serialVersionUID = 8731300373855056661L; 40 | 41 | /** 42 | * forwards post requests to the doGet method 43 | * Creation date: (02/07/2013 10:52:39 AM) 44 | * @param res javax.servlet.http.HttpServletRequest 45 | * @param res2 javax.servlet.http.HttpServletResponse 46 | */ 47 | public void doPost(HttpServletRequest req, HttpServletResponse res) 48 | throws ServletException, IOException 49 | { 50 | doGet(req, res); 51 | } 52 | /** 53 | * this is the main method of the servlet that will service all get requests. 54 | * @param request HttpServletRequest 55 | * @param responce HttpServletResponce 56 | **/ 57 | public void doGet(HttpServletRequest req, HttpServletResponse res) 58 | throws ServletException, IOException 59 | { 60 | try 61 | { 62 | res.setContentType("text/html"); 63 | String lengthParam=req.getParameter("contentLength"); 64 | Integer length; 65 | 66 | if (lengthParam == null) 67 | length = 0; 68 | else 69 | length = Integer.parseInt(lengthParam); 70 | 71 | ServletOutputStream out = res.getOutputStream(); 72 | 73 | // Add characters (a's) to the SOS to equal the requested length 74 | // 167 is the smallest length possible. 75 | 76 | // TODO Improve how to do this? 77 | int i=0; 78 | String buffer=""; 79 | 80 | while (i + 167 < length) 81 | { 82 | buffer = buffer + "a"; 83 | i++; 84 | } 85 | 86 | out.println( 87 | "Ping Servlet" 88 | + "

Ping Servlet
" 89 | + buffer 90 | + ""); 91 | } 92 | catch (Exception e) 93 | { 94 | Log.error(e, "PingServlet.doGet(...): general exception caught"); 95 | res.sendError(500, e.toString()); 96 | 97 | } 98 | } 99 | /** 100 | * returns a string of information about the servlet 101 | * @return info String: contains info about the servlet 102 | **/ 103 | public String getServletInfo() 104 | { 105 | return "Basic dynamic HTML generation through a servlet, with " + 106 | "contentLength set by contentLength parameter."; 107 | } 108 | /** 109 | * called when the class is loaded to initialize the servlet 110 | * @param config ServletConfig: 111 | **/ 112 | public void init(ServletConfig config) throws ServletException 113 | { 114 | super.init(config); 115 | } 116 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingServletWriter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | import javax.servlet.*; 21 | import javax.servlet.http.*; 22 | import javax.servlet.annotation.WebServlet; 23 | 24 | import com.ibm.websphere.samples.daytrader.util.*; 25 | 26 | 27 | /** 28 | * 29 | * PingServlet extends PingServlet by using a PrintWriter for formatted 30 | * output vs. the output stream used by {@link PingServlet}. 31 | * 32 | */ 33 | @WebServlet(name = "PingServletWriter", urlPatterns = {"/servlet/PingServletWriter"}) 34 | public class PingServletWriter extends HttpServlet { 35 | 36 | private static final long serialVersionUID = -267847365014523225L; 37 | private static String initTime; 38 | private static int hitCount; 39 | 40 | /** 41 | * forwards post requests to the doGet method 42 | * Creation date: (11/6/2000 10:52:39 AM) 43 | * @param res javax.servlet.http.HttpServletRequest 44 | * @param res2 javax.servlet.http.HttpServletResponse 45 | */ 46 | public void doPost(HttpServletRequest req, HttpServletResponse res) 47 | throws ServletException, IOException { 48 | doGet(req, res); 49 | } 50 | /** 51 | * this is the main method of the servlet that will service all get requests. 52 | * @param request HttpServletRequest 53 | * @param responce HttpServletResponce 54 | **/ 55 | public void doGet(HttpServletRequest req, HttpServletResponse res) 56 | throws ServletException, IOException { 57 | try 58 | { 59 | res.setContentType("text/html"); 60 | 61 | // The following 2 lines are the difference between PingServlet and PingServletWriter 62 | // the latter uses a PrintWriter for output versus a binary output stream. 63 | //ServletOutputStream out = res.getOutputStream(); 64 | java.io.PrintWriter out = res.getWriter(); 65 | hitCount++; 66 | out.println( 67 | "Ping Servlet Writer" 68 | + "

Ping Servlet Writer:
Init time : " 69 | + initTime 70 | + "

Hit Count: " 71 | + hitCount 72 | + ""); 73 | } 74 | catch (Exception e) 75 | { 76 | Log.error(e, "PingServletWriter.doGet(...): general exception caught"); 77 | res.sendError(500, e.toString()); 78 | } 79 | } 80 | /** 81 | * returns a string of information about the servlet 82 | * @return info String: contains info about the servlet 83 | **/ 84 | 85 | public String getServletInfo() 86 | { 87 | return "Basic dynamic HTML generation through a servlet using a PrintWriter"; 88 | } 89 | /** 90 | * called when the class is loaded to initialize the servlet 91 | * @param config ServletConfig: 92 | **/ 93 | public void init(ServletConfig config) throws ServletException { 94 | super.init(config); 95 | hitCount = 0; 96 | initTime = new java.util.Date().toString(); 97 | 98 | } 99 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/java/com/ibm/websphere/samples/daytrader/web/prims/PingSession3Object.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.ibm.websphere.samples.daytrader.web.prims; 18 | 19 | import java.io.*; 20 | 21 | /** 22 | * 23 | * An object that contains approximately 1024 bits of information. This is used by 24 | * {@link PingSession3} 25 | * 26 | */ 27 | public class PingSession3Object implements Serializable { 28 | // PingSession3Object represents a BLOB of session data of various. 29 | // Each instantiation of this class is approximately 1K in size (not including overhead for arrays and Strings) 30 | // Using different datatype exercises the various serialization algorithms for each type 31 | 32 | private static final long serialVersionUID = 1452347702903504717L; 33 | byte[] byteVal = new byte[16]; // 8 * 16 = 128 bits 34 | char[] charVal = new char[8]; // 16 * 8 = 128 bits 35 | int a, b, c, d; // 4 * 32 = 128 bits 36 | float e, f, g, h; // 4 * 32 = 128 bits 37 | double i, j; // 2 * 64 = 128 bits 38 | // Primitive type size = ~5*128= 640 39 | 40 | String s1 = new String("123456789012"); 41 | String s2 = new String("abcdefghijkl"); 42 | // String type size = ~2*12*16 = 384 43 | // Total blob size (w/o overhead) = 1024 44 | 45 | 46 | // The Session blob must be filled with data to avoid compression of the blob during serialization 47 | PingSession3Object() 48 | { 49 | int index; 50 | byte b = 0x8; 51 | for (index=0; index<16; index++) 52 | { 53 | byteVal[index] = (byte) (b+2); 54 | } 55 | 56 | char c = 'a'; 57 | for (index=0; index<8; index++) 58 | { 59 | charVal[index] = (char) (c+2); 60 | } 61 | 62 | a=1; b=2; c=3; d=5; 63 | e = (float)7.0; f=(float)11.0; g=(float)13.0; h=(float)17.0; 64 | i=(double)19.0; j=(double)23.0; 65 | } 66 | /** 67 | * Main method to test the serialization of the Session Data blob object 68 | * Creation date: (4/3/2000 3:07:34 PM) 69 | * @param args java.lang.String[] 70 | */ 71 | 72 | /** Since the following main method were written for testing purpose, we comment them out 73 | *public static void main(String[] args) { 74 | * try { 75 | * PingSession3Object data = new PingSession3Object(); 76 | * 77 | * FileOutputStream ostream = new FileOutputStream("c:\\temp\\datablob.xxx"); 78 | * ObjectOutputStream p = new ObjectOutputStream(ostream); 79 | * p.writeObject(data); 80 | * p.flush(); 81 | * ostream.close(); 82 | * } 83 | * catch (Exception e) 84 | * { 85 | * System.out.println("Exception: " + e.toString()); 86 | * } 87 | *} 88 | */ 89 | 90 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Ant-Version: Apache Ant 1.7.1 3 | Created-By: 2.4 (IBM Corporation) 4 | 5 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/META-INF/NOTICE: -------------------------------------------------------------------------------- 1 | 2 | DayTrader :: Web Application 3 | Copyright 2005-2010 Apache Software Foundation 4 | 5 | This product includes software developed at 6 | The Apache Software Foundation (http://www.apache.org/). 7 | 8 | 9 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/PingFaceletSmall.xhtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | PingFaceletSmall - Stock Lookup Service 11 | 12 | 13 | 14 | 15 | 16 | 17 |

PingFaceletSmall - Stock Lookup Service

18 | 19 |

Displays the stock information from a random stock in the database.

20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
47 | 48 | 49 |
50 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/PingHtml.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | PingHTML.html 20 | 21 | 22 |
23 |

PING HTML:

24 |

Hello World

25 | 26 | 27 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/PingJsp.jsp: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | PingJsp 24 | 25 | 26 | <%! int hitCount = 0; 27 | String initTime = new java.util.Date().toString(); 28 | %> 29 |
30 |
31 | PING JSP:
32 |
Init time: <%= initTime %> 33 | <% hitCount++; %> 34 |

Hit Count: <%= hitCount %>

35 | 36 | 37 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/PingServlet2Jsp.jsp: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | PingJsp 24 | 25 | 26 | <%! String initTime = (new java.util.Date()).toString(); 27 | %> 28 | 29 |
30 |
31 | Ping Servlet2JSP:
32 |
Init time: <%= initTime %>
33 |
34 | Message from Servlet: <%= ab.getMsg() %> 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WAS_V7_64-bit_performance.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/WAS_V7_64-bit_performance.pdf -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WEB-INF/classes/META-INF/DEPENDENCIES: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------ 2 | // Transitive dependencies of this project determined from the 3 | // maven pom organized by organization. 4 | // ------------------------------------------------------------------ 5 | 6 | DayTrader :: Web Application 7 | 8 | 9 | From: 'an unknown organization' 10 | - Unnamed - taglibs:standard:jar:1.1.1 taglibs:standard:jar:1.1.1 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WEB-INF/classes/META-INF/NOTICE: -------------------------------------------------------------------------------- 1 | 2 | DayTrader :: Web Application 3 | Copyright 2005-2010 Apache Software Foundation 4 | 5 | This product includes software developed at 6 | The Apache Software Foundation (http://www.apache.org/). 7 | 8 | 9 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WEB-INF/faces-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WEB-INF/geronimo-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 23 | 24 | false 25 | 26 | 27 | jdbc/TradeDataSource 28 | 29 | TradeDataSource 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WEB-INF/ibm-web-bnd.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WEB-INF/ibm-web-ext.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/WEB-INF/jboss-web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | jdbc/TradeDataSource 26 | java:/jdbc/TradeDataSource 27 | 28 | 29 | 30 | jms/QueueConnectionFactory 31 | java:/jms/QueueConnectionFactory 32 | 33 | 34 | 35 | jms/TopicConnectionFactory 36 | java:/jms/TopicConnectionFactory 37 | 38 | 39 | 40 | TradeSLSBBean 41 | java:app/dt-ejb/TradeSLSBBean!com.ibm.websphere.samples.daytrader.ejb3.TradeSLSBLocal 42 | 43 | 44 | 45 | DirectSLSBean 46 | java:app/dt-ejb/DirectSLSBBean!com.ibm.websphere.samples.daytrader.ejb3.DirectSLSBLocal 47 | 48 | 49 | 50 | 51 | jms/TradeBrokerQueue 52 | java:/jms/TradeBrokerQueue 53 | 54 | 55 | 56 | jms/TradeStreamerTopic 57 | java:/jms/TradeStreamerTopic 58 | 59 | 60 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/contentHome.html: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | Geronimo performance benchmark sample overview 24 | 25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 | 71 | 72 | 73 | 76 | 77 |
30 |
31 |
35 |

Overview

36 |
The GeronimoTM 37 | performance benchmark sample provides a suite of Apache developed 38 | workloads for characterizing performance of the Geronimo J2EE 39 | Application Server. The workloads consist of an end to end web 40 | application and a full set of primitives. The applications are a 41 | collection of Java classes, Java Servlets, Java Server Pages, Web 42 | Services, and Enterprise Java Beans built to open J2EE APIs. Together 43 | these provide versatile and portable test cases designed to measure 44 | aspects of scalability and performance.
45 |


46 | DayTrader J2EE Components
47 | Model-View-Controller Architecture

48 |
DayTrader
49 | DayTrader is the Geronimo end-to-end benchmark and performance sample 50 | application. The new DayTrader benchmark has been re-designed and 51 | developed to cover Geronimo's significantly expanding programming 52 | model. This provides a real world workload driving Geronimo's 53 | implementation of J2EE 1.4 and Web Services including key Geronimo 54 | performance components and features.
55 |
56 | DayTrader's new design spans J2EE 1.4 including the new EJB 2.1 57 | component architecture, Message Driven beans, transactions (1-phase, 58 | 2-phase commit) and Web Services (SOAP, WSDL).
59 |
60 | Primitives
61 |
The Primitives provide a set of workloads to 63 | individually test various components of the Geronimo Application 64 | Server. The primitives leverage the DayTrader application 65 | infrastructure to test specific Geronimo J2EE components such as the 66 | servlet engine, JSP support, EJB Entitiy, Session and Message Driven 67 | beans, HTTP Session support and more.
68 |
Additional overview 69 | information is included in the FAQ
70 |
74 |
75 |
78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/dbscripts/db2/Table.ddl: -------------------------------------------------------------------------------- 1 | ## Licensed to the Apache Software Foundation (ASF) under one or more 2 | ## contributor license agreements. See the NOTICE file distributed with 3 | ## this work for additional information regarding copyright ownership. 4 | ## The ASF licenses this file to You under the Apache License, Version 2.0 5 | ## (the "License"); you may not use this file except in compliance with 6 | ## the License. You may obtain a copy of the License at 7 | ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 9 | ## 10 | ## Unless required by applicable law or agreed to in writing, software 11 | ## distributed under the License is distributed on an "AS IS" BASIS, 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ## See the License for the specific language governing permissions and 14 | ## limitations under the License. 15 | 16 | # Each SQL statement in this file should terminate with a semicolon (;) 17 | # Lines starting with the pound character (#) are considered as comments 18 | DROP TABLE HOLDINGEJB; 19 | DROP TABLE ACCOUNTPROFILEEJB; 20 | DROP TABLE QUOTEEJB; 21 | DROP TABLE KEYGENEJB; 22 | DROP TABLE ACCOUNTEJB; 23 | DROP TABLE ORDEREJB; 24 | 25 | CREATE TABLE HOLDINGEJB 26 | (PURCHASEPRICE DECIMAL(14, 2), 27 | HOLDINGID INTEGER NOT NULL, 28 | QUANTITY DOUBLE NOT NULL, 29 | PURCHASEDATE TIMESTAMP, 30 | ACCOUNT_ACCOUNTID INTEGER, 31 | QUOTE_SYMBOL VARCHAR(250)); 32 | 33 | ALTER TABLE HOLDINGEJB 34 | ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID); 35 | 36 | CREATE TABLE ACCOUNTPROFILEEJB 37 | (ADDRESS VARCHAR(250), 38 | PASSWD VARCHAR(250), 39 | USERID VARCHAR(250) NOT NULL, 40 | EMAIL VARCHAR(250), 41 | CREDITCARD VARCHAR(250), 42 | FULLNAME VARCHAR(250)); 43 | 44 | ALTER TABLE ACCOUNTPROFILEEJB 45 | ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID); 46 | 47 | CREATE TABLE QUOTEEJB 48 | (LOW DECIMAL(14, 2), 49 | OPEN1 DECIMAL(14, 2), 50 | VOLUME DOUBLE NOT NULL, 51 | PRICE DECIMAL(14, 2), 52 | HIGH DECIMAL(14, 2), 53 | COMPANYNAME VARCHAR(250), 54 | SYMBOL VARCHAR(250) NOT NULL, 55 | CHANGE1 DOUBLE NOT NULL); 56 | 57 | ALTER TABLE QUOTEEJB 58 | ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL); 59 | 60 | CREATE TABLE KEYGENEJB 61 | (KEYVAL INTEGER NOT NULL, 62 | KEYNAME VARCHAR(250) NOT NULL); 63 | 64 | ALTER TABLE KEYGENEJB 65 | ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME); 66 | 67 | CREATE TABLE ACCOUNTEJB 68 | (CREATIONDATE TIMESTAMP, 69 | OPENBALANCE DECIMAL(14, 2), 70 | LOGOUTCOUNT INTEGER NOT NULL, 71 | BALANCE DECIMAL(14, 2), 72 | ACCOUNTID INTEGER NOT NULL, 73 | LASTLOGIN TIMESTAMP, 74 | LOGINCOUNT INTEGER NOT NULL, 75 | PROFILE_USERID VARCHAR(250)); 76 | 77 | ALTER TABLE ACCOUNTEJB 78 | ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID); 79 | 80 | CREATE TABLE ORDEREJB 81 | (ORDERFEE DECIMAL(14, 2), 82 | COMPLETIONDATE TIMESTAMP, 83 | ORDERTYPE VARCHAR(250), 84 | ORDERSTATUS VARCHAR(250), 85 | PRICE DECIMAL(14, 2), 86 | QUANTITY DOUBLE NOT NULL, 87 | OPENDATE TIMESTAMP, 88 | ORDERID INTEGER NOT NULL, 89 | ACCOUNT_ACCOUNTID INTEGER, 90 | QUOTE_SYMBOL VARCHAR(250), 91 | HOLDING_HOLDINGID INTEGER); 92 | 93 | ALTER TABLE ORDEREJB 94 | ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID); 95 | 96 | ALTER TABLE HOLDINGEJB VOLATILE; 97 | ALTER TABLE ACCOUNTPROFILEEJB VOLATILE; 98 | ALTER TABLE QUOTEEJB VOLATILE; 99 | ALTER TABLE KEYGENEJB VOLATILE; 100 | ALTER TABLE ACCOUNTEJB VOLATILE; 101 | ALTER TABLE ORDEREJB VOLATILE; 102 | 103 | CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID); 104 | CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID); 105 | CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID); 106 | CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID); 107 | CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS); 108 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/dbscripts/derby/Table.ddl: -------------------------------------------------------------------------------- 1 | ## Licensed to the Apache Software Foundation (ASF) under one or more 2 | ## contributor license agreements. See the NOTICE file distributed with 3 | ## this work for additional information regarding copyright ownership. 4 | ## The ASF licenses this file to You under the Apache License, Version 2.0 5 | ## (the "License"); you may not use this file except in compliance with 6 | ## the License. You may obtain a copy of the License at 7 | ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 9 | ## 10 | ## Unless required by applicable law or agreed to in writing, software 11 | ## distributed under the License is distributed on an "AS IS" BASIS, 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ## See the License for the specific language governing permissions and 14 | ## limitations under the License. 15 | 16 | # Each SQL statement in this file should terminate with a semicolon (;) 17 | # Lines starting with the pound character (#) are considered as comments 18 | DROP TABLE HOLDINGEJB; 19 | DROP TABLE ACCOUNTPROFILEEJB; 20 | DROP TABLE QUOTEEJB; 21 | DROP TABLE KEYGENEJB; 22 | DROP TABLE ACCOUNTEJB; 23 | DROP TABLE ORDEREJB; 24 | 25 | DROP TABLE OPENJPASEQ; 26 | 27 | create table OPENJPASEQ 28 | (ID SMALLINT NOT NULL PRIMARY KEY, 29 | SEQUENCE_VALUE BIGINT); 30 | 31 | CREATE TABLE HOLDINGEJB 32 | (PURCHASEPRICE DECIMAL(14, 2), 33 | HOLDINGID INTEGER NOT NULL, 34 | QUANTITY DOUBLE NOT NULL, 35 | PURCHASEDATE TIMESTAMP, 36 | ACCOUNT_ACCOUNTID INTEGER, 37 | QUOTE_SYMBOL VARCHAR(250)); 38 | 39 | ALTER TABLE HOLDINGEJB 40 | ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID); 41 | 42 | CREATE TABLE ACCOUNTPROFILEEJB 43 | (ADDRESS VARCHAR(250), 44 | PASSWD VARCHAR(250), 45 | USERID VARCHAR(250) NOT NULL, 46 | EMAIL VARCHAR(250), 47 | CREDITCARD VARCHAR(250), 48 | FULLNAME VARCHAR(250)); 49 | 50 | ALTER TABLE ACCOUNTPROFILEEJB 51 | ADD CONSTRAINT PK_ACCOUNTPROFILE2 PRIMARY KEY (USERID); 52 | 53 | CREATE TABLE QUOTEEJB 54 | (LOW DECIMAL(14, 2), 55 | OPEN1 DECIMAL(14, 2), 56 | VOLUME DOUBLE NOT NULL, 57 | PRICE DECIMAL(14, 2), 58 | HIGH DECIMAL(14, 2), 59 | COMPANYNAME VARCHAR(250), 60 | SYMBOL VARCHAR(250) NOT NULL, 61 | CHANGE1 DOUBLE NOT NULL); 62 | 63 | ALTER TABLE QUOTEEJB 64 | ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL); 65 | 66 | CREATE TABLE KEYGENEJB 67 | (KEYVAL INTEGER NOT NULL, 68 | KEYNAME VARCHAR(250) NOT NULL); 69 | 70 | ALTER TABLE KEYGENEJB 71 | ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME); 72 | 73 | CREATE TABLE ACCOUNTEJB 74 | (CREATIONDATE TIMESTAMP, 75 | OPENBALANCE DECIMAL(14, 2), 76 | LOGOUTCOUNT INTEGER NOT NULL, 77 | BALANCE DECIMAL(14, 2), 78 | ACCOUNTID INTEGER NOT NULL, 79 | LASTLOGIN TIMESTAMP, 80 | LOGINCOUNT INTEGER NOT NULL, 81 | PROFILE_USERID VARCHAR(250)); 82 | 83 | ALTER TABLE ACCOUNTEJB 84 | ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID); 85 | 86 | CREATE TABLE ORDEREJB 87 | (ORDERFEE DECIMAL(14, 2), 88 | COMPLETIONDATE TIMESTAMP, 89 | ORDERTYPE VARCHAR(250), 90 | ORDERSTATUS VARCHAR(250), 91 | PRICE DECIMAL(14, 2), 92 | QUANTITY DOUBLE NOT NULL, 93 | OPENDATE TIMESTAMP, 94 | ORDERID INTEGER NOT NULL, 95 | ACCOUNT_ACCOUNTID INTEGER, 96 | QUOTE_SYMBOL VARCHAR(250), 97 | HOLDING_HOLDINGID INTEGER); 98 | 99 | ALTER TABLE ORDEREJB 100 | ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID); 101 | 102 | CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID); 103 | CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID); 104 | CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID); 105 | CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID); 106 | CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS); 107 | 108 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/dbscripts/oracle/Table.ddl: -------------------------------------------------------------------------------- 1 | ## Licensed to the Apache Software Foundation (ASF) under one or more 2 | ## contributor license agreements. See the NOTICE file distributed with 3 | ## this work for additional information regarding copyright ownership. 4 | ## The ASF licenses this file to You under the Apache License, Version 2.0 5 | ## (the "License"); you may not use this file except in compliance with 6 | ## the License. You may obtain a copy of the License at 7 | ## 8 | ## http://www.apache.org/licenses/LICENSE-2.0 9 | ## 10 | ## Unless required by applicable law or agreed to in writing, software 11 | ## distributed under the License is distributed on an "AS IS" BASIS, 12 | ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | ## See the License for the specific language governing permissions and 14 | ## limitations under the License. 15 | 16 | # Each SQL statement in this file should terminate with a semicolon (;) 17 | # Lines starting with the pound character (#) are considered as comments 18 | DROP TABLE HOLDINGEJB cascade constraints; 19 | DROP TABLE ACCOUNTPROFILEEJB cascade constraints; 20 | DROP TABLE QUOTEEJB cascade constraints; 21 | DROP TABLE KEYGENEJB cascade constraints; 22 | DROP TABLE ACCOUNTEJB cascade constraints; 23 | DROP TABLE ORDEREJB cascade constraints; 24 | 25 | CREATE TABLE HOLDINGEJB 26 | (PURCHASEPRICE DECIMAL(14, 2) NULL, 27 | HOLDINGID INTEGER NOT NULL, 28 | QUANTITY NUMBER NOT NULL, 29 | PURCHASEDATE DATE NULL, 30 | ACCOUNT_ACCOUNTID INTEGER NULL, 31 | QUOTE_SYMBOL VARCHAR2(250) NULL); 32 | 33 | ALTER TABLE HOLDINGEJB 34 | ADD CONSTRAINT PK_HOLDINGEJB PRIMARY KEY (HOLDINGID); 35 | 36 | CREATE TABLE ACCOUNTPROFILEEJB 37 | (ADDRESS VARCHAR2(250) NULL, 38 | PASSWD VARCHAR2(250) NULL, 39 | USERID VARCHAR2(250) NOT NULL, 40 | EMAIL VARCHAR2(250) NULL, 41 | CREDITCARD VARCHAR2(250) NULL, 42 | FULLNAME VARCHAR2(250) NULL); 43 | 44 | ALTER TABLE ACCOUNTPROFILEEJB 45 | ADD CONSTRAINT PK_ACCOUNTPROFILEEJB PRIMARY KEY (USERID); 46 | 47 | CREATE TABLE QUOTEEJB 48 | (LOW DECIMAL(14, 2) NULL, 49 | OPEN1 DECIMAL(14, 2) NULL, 50 | VOLUME NUMBER NOT NULL, 51 | PRICE DECIMAL(14, 2) NULL, 52 | HIGH DECIMAL(14, 2) NULL, 53 | COMPANYNAME VARCHAR2(250) NULL, 54 | SYMBOL VARCHAR2(250) NOT NULL, 55 | CHANGE1 NUMBER NOT NULL); 56 | 57 | ALTER TABLE QUOTEEJB 58 | ADD CONSTRAINT PK_QUOTEEJB PRIMARY KEY (SYMBOL); 59 | 60 | CREATE TABLE KEYGENEJB 61 | (KEYVAL INTEGER NOT NULL, 62 | KEYNAME VARCHAR2(250) NOT NULL); 63 | 64 | ALTER TABLE KEYGENEJB 65 | ADD CONSTRAINT PK_KEYGENEJB PRIMARY KEY (KEYNAME); 66 | 67 | CREATE TABLE ACCOUNTEJB 68 | (CREATIONDATE DATE NULL, 69 | OPENBALANCE DECIMAL(14, 2) NULL, 70 | LOGOUTCOUNT INTEGER NOT NULL, 71 | BALANCE DECIMAL(14, 2) NULL, 72 | ACCOUNTID INTEGER NOT NULL, 73 | LASTLOGIN DATE NULL, 74 | LOGINCOUNT INTEGER NOT NULL, 75 | PROFILE_USERID VARCHAR2(250) NULL); 76 | 77 | ALTER TABLE ACCOUNTEJB 78 | ADD CONSTRAINT PK_ACCOUNTEJB PRIMARY KEY (ACCOUNTID); 79 | 80 | CREATE TABLE ORDEREJB 81 | (ORDERFEE DECIMAL(14, 2) NULL, 82 | COMPLETIONDATE DATE NULL, 83 | ORDERTYPE VARCHAR2(250) NULL, 84 | ORDERSTATUS VARCHAR2(250) NULL, 85 | PRICE DECIMAL(14, 2) NULL, 86 | QUANTITY NUMBER NOT NULL, 87 | OPENDATE DATE NULL, 88 | ORDERID INTEGER NOT NULL, 89 | ACCOUNT_ACCOUNTID INTEGER NULL, 90 | QUOTE_SYMBOL VARCHAR2(250) NULL, 91 | HOLDING_HOLDINGID INTEGER NULL); 92 | 93 | ALTER TABLE ORDEREJB 94 | ADD CONSTRAINT PK_ORDEREJB PRIMARY KEY (ORDERID); 95 | 96 | CREATE INDEX ACCOUNT_USERID ON ACCOUNTEJB(PROFILE_USERID); 97 | CREATE INDEX HOLDING_ACCOUNTID ON HOLDINGEJB(ACCOUNT_ACCOUNTID); 98 | CREATE INDEX ORDER_ACCOUNTID ON ORDEREJB(ACCOUNT_ACCOUNTID); 99 | CREATE INDEX ORDER_HOLDINGID ON ORDEREJB(HOLDING_HOLDINGID); 100 | CREATE INDEX CLOSED_ORDERS ON ORDEREJB(ACCOUNT_ACCOUNTID,ORDERSTATUS); 101 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/displayQuote.jsp: -------------------------------------------------------------------------------- 1 | 17 | <%@ page 18 | import="java.math.BigDecimal,com.ibm.websphere.samples.daytrader.*,com.ibm.websphere.samples.daytrader.util.*" 19 | session="true" isThreadSafe="true" isErrorPage="false"%> 20 | <% 21 | String symbol = request.getParameter("symbol"); 22 | TradeServices tAction=null; 23 | tAction = new TradeAction(); 24 | try { 25 | QuoteDataBean quoteData = tAction.getQuote(symbol); 26 | 27 | %> 28 | 29 | <%= FinancialUtils.printQuoteLink(quoteData.getSymbol()) %> 30 | <%= quoteData.getCompanyName()%> 31 | <%= quoteData.getVolume()%> 32 | <%= quoteData.getLow() + " - " + quoteData.getHigh()%> 33 | <%= quoteData.getOpen()%> 34 | $ <%= quoteData.getPrice()%> 35 | <%= FinancialUtils.printGainHTML(new BigDecimal(quoteData.getChange())) %> 36 | <%= FinancialUtils.printGainPercentHTML( FinancialUtils.computeGainPercent(quoteData.getPrice(), quoteData.getOpen())) %> 37 | 38 |
41 | 42 | 43 | 44 | <% 45 | } 46 | catch (Exception e) 47 | { 48 | Log.error("displayQuote.jsp exception", e); 49 | } 50 | %> 51 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/docs/benchmarking.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | Benchmarking Details 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 33 | 34 | 35 |
31 |

Benchmarking

32 |
36 |
37 |

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

40 |

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

45 |

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

51 |

There is a drawback to using the Trade Scenario 52 | servlet to drive the workload versus using a series of more complicated 53 | load scripts. As previously mentioned, the scenario 54 | servlet is responsible for managing clients and emulating user 55 | operations by dispatching simple client requests to complex Trade 56 | actions. This causes the application server to spend a large percentage 57 | of time performing work that would typically be handled by a client or 58 | a more complex load driver. Consequently, performance numbers are 59 | artificially deflated when using Trade Scenario servlet as compared to 60 | driving the workload directly.

61 | 62 | 63 |

Web Primitive Benchmarking

64 |

A set of automated Web Primitives is also provided. The web primitives leverage the DayTrader infrastructure to test specific features of the web application development environment. This provides basic workloads for servlets, JSPs, EJBs, MDBs and more. The Web Primitives are installed automatically with the daytrader configuration archive.
65 |

66 |
67 | 68 | 69 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/docs/documentation.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Technical Documentation 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | 34 | 35 | 36 | 37 |
32 |

Technical Documentation

33 |
38 |
39 |
40 |

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

42 |
43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 60 | 61 | 62 | 63 | 64 |
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
59 | Usage Characteristics
Details runtime characteristics and database operations
65 |
66 |
67 | 68 | 69 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/docs/tradeversion.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | DayTrader Version 19 | 20 | IBM WebSphere Application Server Samples - DayTrader 3.0.9 (No Caching) 21 |
Full EE6 Spec Compliant for WebSphere 8.5.5.0 22 |
Date: 20140107 23 |
Contact: jdmcclur@us.ibm.com 24 | 25 | 26 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/footer.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | daytrader2_matts_mods 20 | 21 | 22 | 23 | 24 | 25 | 26 | 37 | 38 |
27 | 28 | 29 | 31 | 32 | 33 | 35 | 36 |
39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/DayTraderHead_blue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/DayTraderHead_blue.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/DayTraderHead_red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/DayTraderHead_red.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/about.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/about.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/account.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/account.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/arrowdown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/arrowdown.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/arrowup.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/arrowup.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/bottomRedBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/bottomRedBar.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/configuration.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/configuration.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/copyRight.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/copyRight.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/dayTraderLogo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/dayTraderLogo.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/daytrader_simple_arch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/daytrader_simple_arch.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/faq.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/faq.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/graph.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/graph.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/home.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/home.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/homeBanner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/homeBanner.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/line.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/line.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/logout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/logout.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/lower_banner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/lower_banner.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/menuHome.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/menuHome.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/portfolio.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/portfolio.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/primitives.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/primitives.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/quotes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/quotes.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/reports.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/reports.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/spacer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/spacer.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/ticker-anim.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/ticker-anim.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/topRedBar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/topRedBar.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/topline.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/topline.jpg -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/images/tradingAndPortfolios.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-web/src/main/webapp/images/tradingAndPortfolios.gif -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | DayTrader 22 | 23 | 24 | 25 | 26 | 27 | 28 | <BODY> 29 | <P>Need browser which supports frames to see this page</P> 30 | </BODY> 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/leftMenu.html: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | Leftmenu 22 | 23 | 24 | 25 | 26 |
27 |


28 |
29 | Overview

30 | 32 |

Benchmarking

33 |

Configuration

34 |

Go Trade!

35 |

Web Primitives

36 |
37 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/quoteDataPrimitive.jsp: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | 21 | 22 | 23 | Quote Data Primitive (PingServet2Session2Entity2JSP) 24 | 25 | 26 | <%@ page import="com.ibm.websphere.samples.daytrader.*,com.ibm.websphere.samples.daytrader.util.*" session="false" isThreadSafe="true" isErrorPage="false"%> 27 | <%! int hitCount = 0; 28 | String initTime = new java.util.Date().toString(); 29 | %> 30 | <% 31 | QuoteDataBean quoteData = (QuoteDataBean) request.getAttribute("quoteData"); 32 | %> 33 |
34 |
35 | Quote Data Primitive (PingServlet2Session2EntityJSP):
36 |
Init time: <%= initTime %> 37 | <% hitCount++; %> 38 |

Hit Count: <%= hitCount %>

39 |
Quote Information

<%= quoteData.toHTML() %> 40 | 41 | 42 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/sample.jsp: -------------------------------------------------------------------------------- 1 | 17 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 18 | <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 19 | <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %> 20 | <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %> 21 | 22 | 23 | 24 | Hello world JSP on 25 | 26 | 27 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/style.css: -------------------------------------------------------------------------------- 1 | /*====================================================================== 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | ======================================================================*/ 17 | A:HOVER { 18 | text-decoration: underline; color: red; 19 | } 20 | 21 | A:ACTIVE { 22 | color: red; 23 | font-weight: bold 24 | } -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/theme/stylesheet.css: -------------------------------------------------------------------------------- 1 | /******************************** 2 | * Faces Components Stylesheet * 3 | ********************************/ 4 | 5 | .form { 6 | } 7 | 8 | .commandLink { 9 | } 10 | 11 | .outputLink { 12 | } 13 | 14 | .link { 15 | } 16 | 17 | .graphicImage { 18 | } 19 | 20 | .outputLabel { 21 | } 22 | 23 | .inputText { 24 | } 25 | 26 | .inputText_Error { 27 | border-style: solid; 28 | border-color: #DE5C5C; 29 | } 30 | 31 | .inputTextarea { 32 | } 33 | 34 | .inputSecret { 35 | } 36 | 37 | .inputHidden { 38 | } 39 | 40 | .outputText { 41 | } 42 | 43 | .outputFormat { 44 | } 45 | 46 | .commandButton { 47 | } 48 | 49 | .button { 50 | } 51 | 52 | .message { 53 | } 54 | 55 | .messages { 56 | } 57 | 58 | .selectBooleanCheckbox { 59 | } 60 | 61 | .selectBooleanCheckbox_Error { 62 | } 63 | 64 | .selectOneRadio { 65 | } 66 | 67 | .selectOneRadio_Error { 68 | } 69 | 70 | .selectOneRadio_Disabled { 71 | color: GrayText; 72 | } 73 | 74 | .selectManyCheckbox { 75 | } 76 | 77 | .selectManyCheckbox_Error { 78 | } 79 | 80 | .selectManyCheckbox_Disabled { 81 | color: GrayText; 82 | } 83 | 84 | .selectOneListbox { 85 | } 86 | 87 | .selectOneListbox_Error { 88 | } 89 | 90 | .selectManyListbox { 91 | } 92 | 93 | .selectManyListbox_Error { 94 | } 95 | 96 | .selectOneMenu { 97 | } 98 | 99 | .selectOneMenu_Error { 100 | } 101 | 102 | .selectManyMenu { 103 | } 104 | 105 | .selectManyMenu_Error { 106 | } 107 | 108 | .panelGroup { 109 | } 110 | 111 | .panelGrid { 112 | } 113 | 114 | .dataTable { 115 | empty-cells:show; 116 | } 117 | 118 | .headerClass { 119 | background-color: ThreeDFace; 120 | color: WindowText; 121 | border-width: 1px; 122 | border-style: solid; 123 | border-color: ThreeDShadow; 124 | margin:2px; 125 | padding:0px; 126 | padding-left:4pt; 127 | padding-right:4pt; 128 | padding-bottom:2px; 129 | font-weight: 400; 130 | overflow: -moz-scrollbars-none; 131 | } 132 | 133 | .footerClass { 134 | background-color: ThreeDFace; 135 | color: WindowText; 136 | border-width: 0px; 137 | border-style: none; 138 | padding:0px; 139 | padding-left:4pt; 140 | padding-right:4pt; 141 | font-weight: 400; 142 | overflow: -moz-scrollbars-none; 143 | } 144 | 145 | .rowClass1 { 146 | background-color: window; 147 | } 148 | 149 | .rowClass2 { 150 | background-color: ThreeDFace; 151 | } 152 | 153 | .columnClass1 { 154 | background-color: window; 155 | margin:2px; 156 | padding:0px; 157 | padding-left:4pt; 158 | padding-right:4pt; 159 | padding-bottom:2px; 160 | overflow: -moz-scrollbars-none; 161 | } 162 | 163 | .columnClass2 { 164 | background-color: ThreeDFace; 165 | margin:2px; 166 | padding:0px; 167 | padding-left:4pt; 168 | padding-right:4pt; 169 | padding-bottom:2px; 170 | } 171 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/welcome.jsp: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | DayTrader Login 21 | 22 | 23 | 24 | <%@ page session="false"%> 25 | 26 | 27 | 28 | 30 | 32 | 33 | 34 |
DayTrader LoginDayTrader
35 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 |
<% String results; 40 | results = (String) request.getAttribute("results"); 41 | if ( results != null )out.print(results); 42 | %>
47 |
48 | 49 | 50 | 51 | 52 | 55 | 56 | 57 | 61 | 62 | 63 | 70 | 71 | 72 |
Log in 53 |
54 |
Username        58 |           Password       59 |                     60 |            
64 |
         
69 |
73 | 74 | 75 | 76 | 77 | 80 | 81 | 82 | 83 | 85 | 86 | 87 | 88 | 89 | 90 | 94 | 95 | 96 | 99 | 100 | 101 |
78 |
79 |
First time user?  Please 84 | Register
91 |
Register With DayTrader 92 |
93 |
97 |
98 |
102 | 103 | 104 | 105 | 108 | 109 | 110 | 111 | 112 | 113 | 115 | 117 | 118 | 119 |
106 |
107 |
DayTrader LoginDayTrader
120 | 121 | 122 | -------------------------------------------------------------------------------- /daytrader3-ee6-web/src/main/webapp/welcomeImg.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%-- 3 | Licensed to the Apache Software Foundation (ASF) under one or more 4 | contributor license agreements. See the NOTICE file distributed with 5 | this work for additional information regarding copyright ownership. 6 | The ASF licenses this file to You under the Apache License, Version 2.0 7 | (the "License"); you may not use this file except in compliance with 8 | the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | --%> 18 | 19 | 20 | DayTrader Login 21 | 22 | 23 | 24 | <%@ page session="false"%> 25 | 26 | 27 | 28 | 30 | 32 | 33 | 34 |
DayTrader LoginDayTrader
35 | 36 | 37 | 38 | 39 | 43 | 44 | 46 | 47 | 48 |
<% String results; 40 | results = (String) request.getAttribute("results"); 41 | if ( results != null )out.print(results); 42 | %>
49 |
50 | 51 | 52 | 53 | 54 | 57 | 58 | 59 | 63 | 64 | 65 | 72 | 73 | 74 |
Log in 55 |
56 |
Username        60 |           Password       61 |                     62 |            
66 |
         
71 |
75 | 76 | 77 | 78 | 79 | 82 | 83 | 84 | 85 | 87 | 88 | 89 | 90 | 91 | 92 | 96 | 97 | 98 | 101 | 102 | 103 |
80 |
81 |
First time user?  Please 86 | Register
93 |
Register With DayTrader 94 |
95 |
99 |
100 |
104 | 105 | 106 | 107 | 110 | 111 | 112 | 114 | 116 | 117 | 118 |

108 |
DayTrader LoginDayTrader
119 | 120 | 121 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | /target/ 3 | .*.swp 4 | /.project 5 | /.settings/ 6 | .DS_Store 7 | /build/ 8 | /.gradle/ 9 | /servers/daytrader7Sample/apps 10 | /servers/daytrader7Sample/logs 11 | /servers/daytrader7Sample/workarea 12 | /servers/daytrader7Sample/messaging 13 | /servers/daytrader7Sample/tranlog 14 | /servers/daytrader7Sample/derby.log 15 | /shared/* -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/build.gradle: -------------------------------------------------------------------------------- 1 | task clean { 2 | doLast{ 3 | ant.delete(includeemptydirs: 'true') { 4 | fileset(dir: 'servers', includes: '**/logs/**, **/apps/*, **/workarea/**') 5 | fileset(dir: 'shared/resources', includes: '**/data/**, **/Daytrader3_SampleDerbyLibs/*') 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | 7 | 8 | net.wasdev.wlp.sample 9 | daytrader3 10 | 1.0-SNAPSHOT 11 | 12 | 13 | daytrader3-ee6-wlpcfg 14 | pom 15 | WAS Liberty Sample - Java EE6 Benchmark Server 16 | https://wasdev.github.io 17 | 18 | 19 | 20 | 21 | maven-clean-plugin 22 | 2.6.1 23 | 24 | true 25 | 26 | 27 | target 28 | 29 | 30 | servers/daytrader3_Sample 31 | false 32 | 33 | **/logs/** 34 | **/apps/* 35 | **/workarea/** 36 | 37 | 38 | 39 | shared 40 | false 41 | 42 | **/resources/data/** 43 | **/resources/Daytrader3_SampleDerbyLibs/* 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/apps/META-INF/DEPENDENCIES: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------ 2 | // Transitive dependencies of this project determined from the 3 | // maven pom organized by organization. 4 | // ------------------------------------------------------------------ 5 | 6 | DayTrader :: Enterprise Application 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/apps/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Archiver-Version: Plexus Archiver 3 | Built-By: jdmcclur 4 | Created-By: Apache Maven 3.3.9 5 | Build-Jdk: 1.8.0_121 6 | 7 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/apps/META-INF/application.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | DayTrader Stock Trading Performance Benchmark Sample 4 | DayTrader EE6 5 | 6 | 7 | web.war 8 | /daytrader 9 | 10 | 11 | 12 | dt-ejb.jar 13 | 14 | 15 | 16 | Rest.war 17 | rest 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/apps/META-INF/maven/net.wasdev.wlp.sample/daytrader3-ee6/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Fri May 12 12:37:18 CDT 2017 3 | version=1.0-SNAPSHOT 4 | groupId=net.wasdev.wlp.sample 5 | artifactId=daytrader3-ee6 6 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/derby.log: -------------------------------------------------------------------------------- 1 | ---------------------------------------------------------------- 2 | Fri May 12 13:00:17 CDT 2017: 3 | Booting Derby version The Apache Software Foundation - Apache Derby - 10.10.1.1 - (1458268): instance a816c00e-015b-fdd1-8226-00001146d5f0 4 | on database directory /Users/jdmcclur/git/sample.daytrader3/daytrader3-ee6-wlpcfg/shared/resources/data/tradedb with class loader com.ibm.ws.classloading.internal.AppClassLoader@4271ad75 5 | Loaded from file:/Users/jdmcclur/git/sample.daytrader3/daytrader3-ee6-wlpcfg/shared/resources/Daytrader3_SampleDerbyLibs/derby-10.10.1.1.jar 6 | java.vendor=Oracle Corporation 7 | java.runtime.version=1.8.0_121-b13 8 | user.dir=/Users/jdmcclur/git/sample.daytrader3/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample 9 | os.name=Mac OS X 10 | os.arch=x86_64 11 | os.version=10.12.4 12 | derby.system.home=null 13 | Database Class Loader started - derby.database.classpath='' 14 | ---------------------------------------------------------------- 15 | Fri May 12 13:00:19 CDT 2017: 16 | Shutting down instance a816c00e-015b-fdd1-8226-00001146d5f0 on database directory /Users/jdmcclur/git/sample.daytrader3/daytrader3-ee6-wlpcfg/shared/resources/data/tradedb with class loader com.ibm.ws.classloading.internal.AppClassLoader@4271ad75 17 | ---------------------------------------------------------------- 18 | Fri May 12 13:00:19 CDT 2017: Shutting down Derby engine 19 | ---------------------------------------------------------------- 20 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/messaging/messageStore/Log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/messaging/messageStore/Log -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/messaging/messageStore/PermanentStore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/messaging/messageStore/PermanentStore -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/messaging/messageStore/TemporaryStore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/messaging/messageStore/TemporaryStore -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/server.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ejbLite-3.1 4 | jsf-2.0 5 | jaxrs-1.1 6 | jpa-2.0 7 | jmsMdb-3.1 8 | wasJmsServer-1.0 9 | wasJmsClient-1.1 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 38 | 39 | 40 | 41 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 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 | -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/partnerlog/DO NOT DELETE LOG FILES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/partnerlog/DO NOT DELETE LOG FILES -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/partnerlog/log1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/partnerlog/log1 -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/partnerlog/log2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/partnerlog/log2 -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/tranlog/DO NOT DELETE LOG FILES: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/tranlog/DO NOT DELETE LOG FILES -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/tranlog/log1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/tranlog/log1 -------------------------------------------------------------------------------- /daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/tranlog/log2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WASdev/sample.daytrader3/a2d61af8c75c771fe4c9ad3f101bbdef08046c1a/daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/tranlog/tranlog/log2 -------------------------------------------------------------------------------- /daytrader3-ee6/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /build/ 3 | /bin/ 4 | .classpath 5 | .project 6 | /.settings/ 7 | .factorypath 8 | /.gradle -------------------------------------------------------------------------------- /daytrader3-ee6/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'ear' 2 | apply plugin: 'java' 3 | apply plugin: 'eclipse-wtp' 4 | apply plugin: 'maven-publish' 5 | 6 | // Use the Liberty Gradle plugin to run our functional tests 7 | apply plugin: 'liberty' 8 | 9 | buildscript { 10 | repositories { 11 | mavenCentral() 12 | } 13 | dependencies { 14 | classpath 'net.wasdev.wlp.gradle.plugins:liberty-gradle-plugin:2.4' 15 | } 16 | } 17 | archivesBaseName = 'daytrader3-ee6' 18 | 19 | ear { 20 | manifest { 21 | attributes 'Implementation-Title': 'DayTrader 3' 22 | } 23 | archiveName="$baseName.$extension" 24 | } 25 | 26 | task copyDerbyLib(type: Copy) { 27 | into "../daytrader3-ee6-wlpcfg/shared/resources/Daytrader3_SampleDerbyLibs" 28 | from configurations.runtime 29 | } 30 | 31 | /* publishing { 32 | publications { 33 | mavenWar(MavenPublication) { 34 | version '1.0-SNAPSHOT' 35 | groupId 'net.wasdev.wlp.sample' 36 | artifactId 'daytrader3-ee6' 37 | 38 | from components.web 39 | } 40 | } 41 | } */ 42 | 43 | // Add a functional test task that runs during the 'check' phase that uses the Liberty Gradle plugin 44 | // to launch Liberty and run the test classes in the fvt source set 45 | task fvt(type: Test, dependsOn: installApps) { 46 | group 'Verification' 47 | description 'Runs the functional verification tests.' 48 | reports.html.destination = file("$buildDir/reports/fvt") 49 | reports.junitXml.destination = file("$buildDir/test-results/fvt") 50 | include '**/fvt/**' 51 | exclude '**/unit/**' 52 | systemProperties = ['liberty.test.port': getHttpPort()] 53 | dependsOn libertyStart 54 | finalizedBy libertyStop 55 | // If libertyRoot is not set, automatically download & install Liberty runtime 56 | } 57 | 58 | test { 59 | reports.html.destination = file("$buildDir/reports/unit") 60 | reports.junitXml.destination = file("$buildDir/test-results/unit") 61 | include '**/unit/**' 62 | exclude '**/fvt/**' 63 | } 64 | 65 | repositories { mavenCentral(); } 66 | dependencies { 67 | deploy project (path: ':daytrader3-ee6-ejb', configuration: 'archives') 68 | deploy project (path: ':daytrader3-ee6-web', configuration: 'archives') 69 | deploy project (path: ':daytrader3-ee6-rest', configuration: 'archives') 70 | compile group: 'org.apache.derby', name: 'derby', version: '10.10.1.1' 71 | } 72 | String getHttpPort() { 73 | def DEFAULT_HTTP_PORT = 9083 74 | def serverXmlFile = file(new File('../daytrader3-ee6-wlpcfg/servers/daytrader3_Sample/server.xml')) 75 | def portPattern = ~/.*httpPort="(\d+)".*/ 76 | serverXmlFile.eachLine { line -> 77 | def portMatcher = line =~ portPattern 78 | if (portMatcher) { 79 | return portMatcher.group(1) 80 | } 81 | } 82 | return DEFAULT_HTTP_PORT 83 | } 84 | 85 | installApps.dependsOn 'ear' 86 | libertyStart.mustRunAfter 'installApps' 87 | 88 | liberty { 89 | installDir = owner.hasProperty('libertyRoot') ? "${libertyRoot}" : null 90 | server{ 91 | name = 'daytrader3_Sample' 92 | userDir = rootProject.getProjectDir().getAbsolutePath()+'/daytrader3-ee6-wlpcfg' 93 | looseApplication = false 94 | apps = [file(ear.archivePath)] 95 | features { 96 | name = ['daytrader3_Sample'] 97 | acceptLicense = true 98 | } 99 | } 100 | } 101 | 102 | if (!hasProperty('libertyRoot')) { 103 | fvt.dependsOn('installFeature') 104 | } 105 | 106 | assemble.dependsOn 'installApps','copyDerbyLib' 107 | 108 | // Run FVT by default 109 | check.dependsOn 'fvt' 110 | // do not create server since the usr directory is prebuilt.\ 111 | libertyCreate.enabled = false 112 | -------------------------------------------------------------------------------- /daytrader3-ee6/src/main/application/META-INF/DEPENDENCIES: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------ 2 | // Transitive dependencies of this project determined from the 3 | // maven pom organized by organization. 4 | // ------------------------------------------------------------------ 5 | 6 | DayTrader :: Enterprise Application 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /daytrader3-ee6/src/main/application/META-INF/application.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | DayTrader Stock Trading Performance Benchmark Sample 4 | DayTrader EE6 5 | 6 | 7 | web.war 8 | /daytrader 9 | 10 | 11 | 12 | dt-ejb.jar 13 | 14 | 15 | 16 | Rest.war 17 | rest 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/Downloading-WAS-Liberty.md: -------------------------------------------------------------------------------- 1 | There are lots of ways to get your hands on WAS Liberty. Note that you will need a version of Liberty that has support for JAX-RS 2.0, CDI 1.2, EJB Lite 3.2, and Concurrency Utilities for this sample (Java EE 7 Web Profile will do). 2 | 3 | To download just the WAS Liberty runtime, go to the [wasdev.net Downloads page][wasdev], and choose between the [latest version of the runtime][wasdev-latest] or the [latest beta][wasdev-beta]. You can also download Liberty via [Eclipse and WDT](/docs/Downloading-WAS-Liberty.md) 4 | 5 | There are a few options to choose from (especially for the beta drivers). Choose the one that is most appropriate. 6 | * There are convenience archives for downloading pre-defined content groupings 7 | * You can add additional features from the repository using the [installUtility][installUtility] or the [maven][maven-plugin]/[Gradle][gradle-plugin] plugins. 8 | 9 | [wasdev]: https://developer.ibm.com/wasdev/downloads/ 10 | [wasdev-latest]: https://developer.ibm.com/wasdev/downloads/liberty-profile-using-non-eclipse-environments/ 11 | [wasdev-beta]: https://developer.ibm.com/wasdev/downloads/liberty-profile-beta/ 12 | [installUtility]: http://www-01.ibm.com/support/knowledgecenter/#!/was_beta_liberty/com.ibm.websphere.wlp.nd.multiplatform.doc/ae/rwlp_command_installutility.html 13 | [maven-plugin]: https://github.com/WASdev/ci.maven 14 | [gradle-plugin]: https://github.com/WASdev/ci.gradle 15 | 16 | ## Tips 17 | 18 | * If you use bash, consider trying the [command line tools](https://github.com/WASdev/util.bash.completion), which provide tab-completion for the server and other commands. 19 | -------------------------------------------------------------------------------- /docs/Starting-the-server.md: -------------------------------------------------------------------------------- 1 | You can use the [Gradle](#running-with-gradle) or [maven](#running-with-maven) to control and manipulate the server for use in automated builds to support continuous integration. 2 | 3 | ## Running with Gradle 4 | 5 | The [Gradle plugin](https://github.com/WASdev/ci.gradle) can manage the server using the following operations: 6 | 7 | * TODO: more here. I know, you're impatient. Stop gnashing your teeth at me. 8 | 9 | ## Running with maven 10 | 11 | The [maven plugin](https://github.com/WASdev/ci.maven) can manage the server using the following operations: 12 | 13 | * TODO: more here. I know, you're impatient. Stop gnashing your teeth at me. 14 | 15 | ## Additional Notes 16 | 17 | :star: *Note:* The maven target and Gradle clean task will clean server output (logs and workarea, etc) from the daytrader3-ee6-wlpcfg directory, however, if you wanted to maintain strict separation between what is checked into daytrader3-ee6-wlpcfg and what is generated by a running server, you could also specify the WLP_OUTPUT_DIR environment variable, e.g. into the maven target directory. 18 | 19 | ```bash 20 | $ export WLP_OUTPUT_DIR=${WLP_USER_DIR}/target 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/Using-cmd-line.md: -------------------------------------------------------------------------------- 1 | ## Building and running the sample using the command line 2 | 3 | ### Clone Git Repo 4 | :pushpin: [Switch to Eclipse example](/docs/Using-WDT.md/#clone-git-repo) 5 | 6 | ```bash 7 | 8 | $ git clone https://github.com/WASdev/sample.daytrader3.git 9 | $ cd sample.daytrader3 10 | 11 | ``` 12 | 13 | ### Building the sample 14 | :pushpin: [Switch to Eclipse example](/docs/Using-WDT.md/#building-the-sample-in-eclipse) 15 | 16 | This sample can be built using either [Gradle](#gradle-commands) or [Maven](#apache-maven-commands). 17 | 18 | ###### [Gradle](http://gradle.org/) commands 19 | 20 | ```bash 21 | $ gradle build 22 | ``` 23 | ###### [Apache Maven](http://maven.apache.org/) commands 24 | 25 | ```bash 26 | $ mvn install 27 | ``` 28 | 29 | 30 | The built ear file is copied into the apps directory of the server configuration located in the daytrader3-ee6-wlpcfg directory: 31 | 32 | ```text 33 | daytrader3-ee6-wlpcfg 34 | +- servers 35 | +- daytrader3-ee6-wlpcfg <-- specific server configuration 36 | +- server.xml <-- server configuration 37 | +- apps <- directory for applications 38 | +- daytrader3-ee6.ear <- sample application 39 | +- logs <- created by running the server locally 40 | +- workarea <- created by running the server locally 41 | ``` 42 | 43 | ### Running the application locally 44 | :pushpin: [Switch to Eclipse example](/docs/Using-WDT.md/#running-the-application-locally) 45 | 46 | Pre-requisite: [Download WAS Liberty](/docs/Downloading-WAS-Liberty.md) 47 | 48 | Use the following to start the server and run the application: 49 | 50 | ```bash 51 | $ export WLP_USER_DIR=/path/to/sample.daytrader3/daytrader3-ee6-wlpcfg 52 | $ /path/to/wlp/bin/installUtility install daytrader3_Sample 53 | $ /path/to/wlp/bin/server start daytrader3_Sample 54 | 55 | 1. Confirm web browser opens on "http://localhost:9083/daytrader" 56 | 2. In the web browser, Click on the configuration tab. 57 | 3. Click on '(Re)-create DayTrader Database Tables and Indexes' to create the database. 58 | 4. Click on '(Re)-populate DayTrader Database' to populate the database. 59 | 5. Restart the server-> . Now the application will be ready for use. 60 | $ /path/to/wlp/bin/server stop daytrader3_Sample 61 | $ /path/to/wlp/bin/server start daytrader3_Sample 62 | ``` 63 | 64 | * `start` runs the server in the background. Look in the logs directory for console.log to see what's going on, e.g. 65 | * `stop` stop the server in the background. Look in the logs directory for console.log to see what's going on, e.g. 66 | * `run` runs the server in the foreground. 67 | 68 | ```bash 69 | $ tail -f ${WLP_USER_DIR}/servers/daytrader3_Sample/logs/console.log 70 | ``` 71 | 72 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Install paths 2 | # ------------- 3 | # Update this to point to a liberty server install 4 | # This is needed to find the dependencies to build the code and to run the tests 5 | #libertyRoot= 6 | -------------------------------------------------------------------------------- /jmeter_files/README.txt: -------------------------------------------------------------------------------- 1 | # (C) Copyright IBM Corporation 2015. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | daytrader3.jmx is an Apache JMeter script that may be used for running the DayTrader3 benchmark. 17 | 18 | Jmeter version 3.3 or later is highly recommended. 19 | 20 | The script has the following options: 21 | -JHOST The name of the machine running the DayTrader Application. The default is localhost. 22 | -JPORT The HTTP port of the server running the DayTrader Application. The default is 9083. 23 | -JTHREADS The number of jmeter threads to start. The default is 50. 24 | -JDURATION The time (in seconds) to run jmeter. 25 | -JSTOCKS The total amount of stocks/quotes in the database, minus one. The default is 9999, which assumes there are 10,000 stocks in the database. 26 | -JBOTUID The lowest user id. The default is 0. 27 | -JTOPUID The highest user id. The default is 14999, which assumes there are 15,000 users in the database. 28 | 29 | Example: ./jmeter -n -t daytrader3.jmx -JHOST=myserver -JPORT=9083 -JDURATION=300 -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 5 | 4.0.0 6 | 7 | 8 | net.wasdev.maven.parent 9 | java7-parent 10 | 1.3 11 | 12 | 13 | net.wasdev.wlp.sample 14 | daytrader3 15 | pom 16 | 1.0-SNAPSHOT 17 | WAS Liberty Sample - Java EE6 Benchmark Sample 18 | 19 | 20 | 21 | The Apache Software License, Version 2.0 22 | https://raw.github.com/WASdev/sample.async.jaxrs/master/LICENSE 23 | repo 24 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | daytrader3-ee6-ejb 36 | daytrader3-ee6-rest 37 | daytrader3-ee6-web 38 | daytrader3-ee6 39 | daytrader3-ee6-wlpcfg 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'daytrader3' 2 | 3 | include ':daytrader3-ee6' 4 | include ':daytrader3-ee6-wlpcfg' 5 | include ':daytrader3-ee6-ejb' 6 | include ':daytrader3-ee6-web' 7 | include ':daytrader3-ee6-rest' 8 | 9 | 10 | project(':daytrader3-ee6').projectDir = "$rootDir/daytrader3-ee6" as File 11 | project(':daytrader3-ee6-wlpcfg').projectDir = "$rootDir/daytrader3-ee6-wlpcfg" as File 12 | project(':daytrader3-ee6-ejb').projectDir = "$rootDir/daytrader3-ee6-ejb" as File 13 | project(':daytrader3-ee6-web').projectDir = "$rootDir/daytrader3-ee6-web" as File 14 | project(':daytrader3-ee6-rest').projectDir = "$rootDir/daytrader3-ee6-rest" as File 15 | --------------------------------------------------------------------------------