001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.geronimo.samples.daytrader.session; 018 019 import javax.ejb.EJBObject; 020 import java.rmi.Remote; 021 import org.apache.geronimo.samples.daytrader.*; 022 023 public interface TradeJDBC extends EJBObject, TradeServices, Remote { 024 025 /** 026 * Queue the Order identified by orderID to be processed in a One Phase commit 027 * 028 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 029 * 2-phase commit transaction across Entity and MDB access 030 * 031 * Orders are submitted through JMS to a Trading Broker 032 * and completed asynchronously. This method queues the order for processing 033 * 034 * @param orderID the Order being queued for processing 035 * @return OrderDataBean providing the status of the completed order 036 */ 037 //public void queueOrderOnePhase(Integer orderID) throws Exception; 038 /** 039 * Complete the Order identified by orderID in a One Phase commit 040 * 041 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 042 * 2-phase commit transaction across Entity and MDB access 043 * 044 * Orders are submitted through JMS to a Trading agent 045 * and completed asynchronously. This method completes the order 046 * For a buy, the stock is purchased creating a holding and the users account is debited 047 * For a sell, the stock holding is removed and the users account is credited with the proceeds 048 * 049 * @param orderID the Order to complete 050 * @return OrderDataBean providing the status of the completed order 051 */ 052 // public OrderDataBean completeOrderOnePhase(Integer orderID) throws Exception; 053 054 /** 055 * Complete the Order identified by orderID in a One Phase commit 056 * using TradeDirect to complete the Order 057 * 058 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 059 * 2-phase commit transaction across DB and MDB access 060 * The EJB method is used only to start a new transaction so the direct runtime mode 061 * for the completeOrder will run in a 1-phase commit 062 * 063 * Orders are submitted through JMS to a Trading agent 064 * and completed asynchronously. This method completes the order using TradeDirect 065 * For a buy, the stock is purchased creating a holding and the users account is debited 066 * For a sell, the stock holding is removed and the users account is credited with the proceeds 067 * 068 * @param orderID the Order to complete 069 * @return OrderDataBean providing the status of the completed order 070 */ 071 //public OrderDataBean completeOrderOnePhaseDirect(Integer orderID) throws Exception; 072 073 /** 074 * Cancel the Order identefied by orderID 075 * 076 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 077 * 2-phase commit transaction across Entity and MDB access 078 * 079 * The boolean twoPhase specifies to the server implementation whether or not the 080 * method is to participate in a global transaction 081 * 082 * @param orderID the Order to complete 083 * @return OrderDataBean providing the status of the completed order 084 */ 085 // public void cancelOrderOnePhase(Integer orderID) throws Exception; 086 087 /** 088 * Cancel the Order identefied by orderID 089 * using TradeDirect to complete the Order 090 * 091 * In short, this method is deployed as TXN REQUIRES NEW to avoid a 092 * 2-phase commit transaction across DB and MDB access 093 * The EJB method is used only to start a new transaction so the direct runtime mode 094 * for the cancleOrder will run in a 1-phase commit 095 * 096 * The boolean twoPhase specifies to the server implementation whether or not the 097 * method is to participate in a global transaction 098 * 099 * @param orderID the Order to complete 100 * @return OrderDataBean providing the status of the completed order 101 */ 102 //public void cancelOrderOnePhaseDirect(Integer orderID) throws Exception; 103 104 /** 105 * Publish to the QuoteChange Message topic when a stock 106 * price and volume are updated 107 * 108 * This method is deployed as TXN REQUIRES NEW to avoid a 109 * 2-phase commit transaction across the DB update and MDB access 110 * (i.e. a failure to publish will not cause the stock update to fail 111 * 112 * @param quoteData - the updated Quote 113 * @param oldPrice - the price of the Quote before the update 114 * @param sharesTraded - the quantity of sharesTraded 115 */ 116 // public void publishQuotePriceChange(QuoteDataBean quoteData, java.math.BigDecimal oldPrice, java.math.BigDecimal changeFactor, double sharesTraded) throws Exception; 117 118 /** 119 * provides a simple session method with no database access to test performance of a simple 120 * path through a stateless session 121 * @param investment amount 122 * @param NetValue current value 123 * @return return on investment as a percentage 124 */ 125 // public double investmentReturn(double investment, double NetValue) throws Exception; 126 127 /** 128 * This method provides a ping test for a 2-phase commit operation 129 * 130 * @param symbol to lookup 131 * @return quoteData after sending JMS message 132 */ 133 //public QuoteDataBean pingTwoPhase(String symbol) throws Exception; 134 135 } 136