geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r808973 [5/7] - in /geronimo/daytrader/trunk: ./ assemblies/ assemblies/daytrader-web-jdbc/ assemblies/daytrader-web-jdbc/src/ assemblies/daytrader-web-jdbc/src/main/ assemblies/daytrader-web-jdbc/src/main/java/ assemblies/daytrader-web-jdb...
Date Fri, 28 Aug 2009 18:07:54 GMT
Modified: geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java?rev=808973&r1=808972&r2=808973&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java (original)
+++ geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java Fri Aug 28 18:07:49 2009
@@ -22,8 +22,8 @@
 import javax.naming.InitialContext;
 
 import org.apache.geronimo.samples.daytrader.direct.TradeDirect;
-import org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBRemote;
-import org.apache.geronimo.samples.daytrader.ejb3.DirectSLSBRemote;
+//import org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBRemote;
+//import org.apache.geronimo.samples.daytrader.ejb3.DirectSLSBRemote;
 import org.apache.geronimo.samples.daytrader.util.FinancialUtils;
 import org.apache.geronimo.samples.daytrader.util.Log;
 
@@ -61,17 +61,16 @@
     private void createTrade() {
         if (TradeConfig.runTimeMode == TradeConfig.EJB3) {
             try {
-                if (!(trade instanceof TradeSLSBRemote)) {
-                    TradeSLSBRemote tradeSLSB = null;
+                Class c = Class.forName("org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBRemote");
+                if ((trade == null) ||
+                    (!(trade.getClass().isAssignableFrom(c)))) {
                     InitialContext context = new InitialContext();
                     try {
-                        tradeSLSB = (TradeSLSBRemote) context.lookup("java:comp/env/ejb/TradeSLSBBean");                
+                        trade = (TradeServices) context.lookup("java:comp/env/ejb/TradeSLSBBean");                
                     } catch (Exception ex) {
                         Log.error("TradeAction:createTrade - Lookup of TradeSLSBRemote failed!!!");
-                        tradeSLSB = (TradeSLSBRemote) context.lookup("TradeSLSBBean");
+                        trade = (TradeServices) context.lookup("TradeSLSBBean");
                     }
-                
-                    trade = tradeSLSB;
                 }
             }
             catch (Exception e) {
@@ -80,30 +79,38 @@
             }
         } else if (TradeConfig.runTimeMode == TradeConfig.SESSION3) {
             try {
-                if (!(trade instanceof DirectSLSBRemote)) {
-                    DirectSLSBRemote directSLSB = null;
+                Class c = Class.forName("org.apache.geronimo.samples.daytrader.ejb3.DirectSLSBBean");
+                if ((trade == null) ||
+                    (!(trade.getClass().isAssignableFrom(c)))) {
                     InitialContext context = new InitialContext();
                     try {
-                        directSLSB = (DirectSLSBRemote) context.lookup("java:comp/env/ejb/DirectSLSBBean");                
+                        trade = (TradeServices) context.lookup("java:comp/env/ejb/DirectSLSBBean");                
                     } catch (Exception ex) {
                         Log.error("TradeAction:createTrade - Lookup of DirectSLSBRemote failed!!!");
-                        directSLSB = (DirectSLSBRemote) context.lookup("DirectSLSBBean");
+                        trade = (TradeServices) context.lookup("DirectSLSBBean");
                     }
-                
-                    trade = directSLSB;
                 }
             }
             catch (Exception e) {
                 Log.error("TradeAction:TradeAction() Creation of Trade SESSION3 failed\n" + e);
                 e.printStackTrace();
             }
-        }else if (TradeConfig.runTimeMode == TradeConfig.DIRECT) {
+        } else if (TradeConfig.runTimeMode == TradeConfig.DIRECT) {
             try {
                 trade = new TradeDirect();
             }
             catch (Exception e) {
-                Log.error("TradeAction:TradeAction() Creation of Trade Direct failed\n" + e);
+                Log.error("TradeAction:TradeAction() Creation of Trade JDBC Direct failed\n" + e);
             }
+        } else if (TradeConfig.runTimeMode == TradeConfig.JPA) {
+            try {
+                trade = new TradeDirect();
+            }
+            catch (Exception e) {
+                Log.error("TradeAction:TradeAction() Creation of Trade JPA Direct failed\n" + e);
+            }
+        } else {
+            Log.error("TradeAction:TradeAction() Unknown Trade runtime mode.");
         }
     }
 

Added: geronimo/daytrader/trunk/modules/ejb3/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/pom.xml?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/pom.xml (added)
+++ geronimo/daytrader/trunk/modules/ejb3/pom.xml Fri Aug 28 18:07:49 2009
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.geronimo.daytrader</groupId>
+        <artifactId>modules</artifactId>
+        <version>2.2-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.geronimo.daytrader.modules</groupId>
+    <artifactId>ejb3</artifactId>
+    <packaging>ejb</packaging>
+    <name>DayTrader :: Modules - EJB3</name>
+    <description>Daytrader EJB3 Module</description>
+
+    <scm>
+        <connection>scm:svn:http://svn.apache.org/repos/asf/geronimo/daytrader/trunk/modules/ejb3</connection>
+        <developerConnection>scm:svn:http://svn.apache.org/repos/asf/geronimo/daytrader/trunk/modules/ejb3</developerConnection>
+        <url>http://svn.apache.org/viewcvs.cgi/geronimo/daytrader/trunk/modules/ejb3</url>
+    </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.daytrader.modules</groupId>
+            <artifactId>core</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+<!--
+        <dependency>
+            <groupId>org.apache.geronimo.daytrader</groupId>
+            <artifactId>daytrader-wsappclient</artifactId>
+            <version>${pom.version}</version>
+            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jaxrpc_1.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+-->
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jms_1.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jpa_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+    	    <groupId>org.apache.geronimo.specs</groupId>
+    	    <artifactId>geronimo-annotation_1.0_spec</artifactId>
+    	    <scope>provided</scope>
+	</dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jta_1.1_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>    
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.openjpa</groupId>
+            <artifactId>openjpa</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <!-- OpenJPA enhancer depends
+        <dependency>
+            <groupId>net.sourceforge.serp</groupId>
+            <artifactId>serp</artifactId>
+            <version>1.13.1</version>
+            <scope>provided</scope>
+        </dependency> 
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.4</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.1</version>
+            <scope>provided</scope>
+        </dependency>
+        -->
+    </dependencies>
+    <build>
+        <resources>
+            <resource>
+                <directory>${basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+                <artifactId>maven-ejb-plugin</artifactId>
+                <configuration>
+                    <generateClient>true</generateClient>
+                    <archive>
+                        <manifestEntries>
+                            <Class-Path>wsappclient.jar</Class-Path>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: geronimo/daytrader/trunk/modules/ejb3/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTBroker3MDB.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTBroker3MDB.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTBroker3MDB.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTBroker3MDB.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,160 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.EJB;
+import javax.ejb.MessageDriven;
+import javax.ejb.MessageDrivenContext;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagementType;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+import org.apache.geronimo.samples.daytrader.TradeServices;
+import org.apache.geronimo.samples.daytrader.direct.TradeDirect;
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.MDBStats;
+import org.apache.geronimo.samples.daytrader.util.TimerStat;
+
+@TransactionAttribute(TransactionAttributeType.REQUIRED)
+@TransactionManagement(TransactionManagementType.CONTAINER)
+@MessageDriven(activationConfig =  {
+        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+        @ActivationConfigProperty(propertyName = "destination", propertyValue = "TradeBrokerQueue"),
+        @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NonDurable")
+    })
+public class DTBroker3MDB implements MessageListener {
+    private MDBStats mdbStats;
+    private int statInterval = 100;
+    
+    @EJB
+    private TradeSLSBLocal tradeSLSB;
+    
+    @Resource
+    public MessageDrivenContext mdc;
+    
+    /** Creates a new instance of DTBroker3MDB */
+    public DTBroker3MDB() {
+         if (Log.doTrace()) Log.trace("DTBroker3MDB:DTBroker3MDB()");
+         if ( statInterval <= 0 ) statInterval = 100;
+    mdbStats = MDBStats.getInstance();
+    }
+    
+    public void onMessage(Message message) {
+        try {
+            if (Log.doTrace())
+                Log.trace("TradeBroker:onMessage -- received message -->"
+                        + ((TextMessage)message).getText() + "command-->"
+                        +   message.getStringProperty("command") + "<--");
+            
+            if (message.getJMSRedelivered()) {
+                Log.log("DTBroker3MDB: The following JMS message was redelivered due to a rollback:\n"+ ((TextMessage)message).getText() );
+                //Order has been cancelled -- ignore returned messages
+                return;
+            }
+            String command = message.getStringProperty("command");
+            if (command==null) {
+                Log.debug("DTBroker3MDB:onMessage -- received message with null command. Message-->"+message);
+                return;
+            }
+            if (command.equalsIgnoreCase("neworder")) {
+                /* Get the Order ID and complete the Order */
+                Integer orderID = new Integer(message.getIntProperty("orderID"));
+                boolean twoPhase = message.getBooleanProperty("twoPhase");
+                boolean direct = message.getBooleanProperty("direct");
+                long publishTime = message.getLongProperty("publishTime");
+                long receiveTime = System.currentTimeMillis();
+                
+                
+                TradeServices trade = null;
+                
+                try {
+                    trade = getTrade(direct);
+                    
+                    if (Log.doTrace())
+                        Log.trace("DTBroker3MDB:onMessage - completing order " + orderID + " twoPhase=" +twoPhase + " direct="+direct);
+                    
+                    trade.completeOrder(orderID, twoPhase);
+                    
+                    TimerStat currentStats = mdbStats.addTiming("DTBroker3MDB:neworder", publishTime, receiveTime );
+                    
+                    if ( (currentStats.getCount() % statInterval) == 0) {
+                        Log.log(new java.util.Date()+ "\nDTBroker3MDB: processed 100 stock trading orders. " +
+                                "\nCurrent NewOrder Message Statistics\n\tTotal NewOrders process = " + currentStats.getCount() +
+                                "\n\tTime to receive messages (in seconds):" +
+                                "\n\t\tmin: " +currentStats.getMinSecs()+
+                                "\n\t\tmax: " +currentStats.getMaxSecs()+
+                                "\n\t\tavg: " +currentStats.getAvgSecs()+
+                                "\n\n\n\tThe current order being processed is:\n\t"+((TextMessage)message).getText());
+                    }
+                } catch (Exception e) {
+                    Log.error("DTBroker3MDB:onMessage Exception completing order: " + orderID + "\n",  e);
+                    mdc.setRollbackOnly();
+                    /* UPDATE - order is cancelled in trade if an error is caught
+                                try
+                                {
+                                        trade.cancelOrder(orderID, twoPhase);
+                                }
+                                catch (Exception e2)
+                                {
+                                        Log.error("order cancel failed", e);
+                                }*/
+                }
+            } else if (command.equalsIgnoreCase("ping")) {
+                if (Log.doTrace())
+                    Log.trace("DTBroker3MDB:onMessage  received test command -- message: " + ((TextMessage)message).getText());
+                
+                long publishTime = message.getLongProperty("publishTime");
+                long receiveTime = System.currentTimeMillis();
+                
+                TimerStat currentStats = mdbStats.addTiming("DTBroker3MDB:ping", publishTime, receiveTime );
+                
+                if ( (currentStats.getCount() % statInterval) == 0) {
+                    Log.log(new java.util.Date()+ "\nDTBroker3MDB: received 100 ping messages. " +
+                            "\nCurrent Ping Message Statistics\n\tTotal ping message count = " + currentStats.getCount() +
+                            "\n\tTime to receive messages (in seconds):" +
+                            "\n\t\tmin: " +currentStats.getMinSecs()+
+                            "\n\t\tmax: " +currentStats.getMaxSecs()+
+                            "\n\t\tavg: " +currentStats.getAvgSecs()+
+                            "\n\n\n\tThe current message is:\n\t"+((TextMessage)message).getText());
+                }
+            } else
+                Log.error("DTBroker3MDB:onMessage - unknown message request command-->" + command + "<-- message=" + ((TextMessage)message).getText());
+        } catch (Throwable t) {
+            //JMS onMessage should handle all exceptions
+            Log.error("DTBroker3MDB: Error rolling back transaction", t);
+            mdc.setRollbackOnly();
+        }
+    }
+    
+    private TradeServices getTrade(boolean direct) throws Exception{
+        TradeServices trade;
+        if (direct)
+            trade = new TradeDirect();
+        else
+            trade = tradeSLSB;
+        
+        return trade;
+    }
+    
+}

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTBroker3MDB.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTStreamer3MDB.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTStreamer3MDB.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTStreamer3MDB.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTStreamer3MDB.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,119 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import javax.annotation.Resource;
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.ejb.MessageDrivenContext;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionAttributeType;
+import javax.ejb.TransactionManagementType;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.TextMessage;
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.MDBStats;
+import org.apache.geronimo.samples.daytrader.util.TimerStat;
+
+@TransactionAttribute(TransactionAttributeType.REQUIRED)
+@TransactionManagement(TransactionManagementType.CONTAINER)
+@MessageDriven(activationConfig =  {
+        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
+        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
+        @ActivationConfigProperty(propertyName = "destination", propertyValue = "TradeStreamerTopic"),
+        @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NonDurable")
+    })
+public class DTStreamer3MDB implements MessageListener {
+    
+    private MDBStats mdbStats;
+    private int statInterval = 100;
+    
+    @Resource
+    public MessageDrivenContext mdc;
+    
+    /** Creates a new instance of TradeSteamerMDB */
+    public DTStreamer3MDB() {
+        if (Log.doTrace()) Log.trace("DTStreamer3MDB:DTStreamer3MDB()");
+        if ( statInterval <= 0 ) statInterval = 100;
+        mdbStats = MDBStats.getInstance();
+    }
+    
+    public void onMessage(Message message) {
+        try {
+            if (Log.doTrace())
+                Log.trace("DTStreamer3MDB:onMessage -- received message -->"
+                        + ((TextMessage)message).getText() + "command-->"
+                        +	message.getStringProperty("command") + "<--");
+            String command = message.getStringProperty("command");
+            if (command==null) {
+                Log.debug("DTStreamer3MDB:onMessage -- received message with null command. Message-->"+message);
+                return;
+            }
+            if (command.equalsIgnoreCase("updateQuote")) {
+                if (Log.doTrace())
+                    Log.trace("DTStreamer3MDB:onMessage -- received message -->"
+                            + ((TextMessage)message).getText()
+                            + "\n\t symbol = " + message.getStringProperty("symbol")
+                            + "\n\t current price =" + message.getStringProperty("price")
+                            + "\n\t old price =" + message.getStringProperty("oldPrice")
+                            );
+                long publishTime = message.getLongProperty("publishTime");
+                long receiveTime = System.currentTimeMillis();
+                
+                TimerStat currentStats = mdbStats.addTiming("DTStreamer3MDB:udpateQuote", publishTime, receiveTime );
+                
+                if ( (currentStats.getCount() % statInterval) == 0) {
+                    Log.log(new java.util.Date()+ "\nDTStreamer3MDB: 100 Trade stock prices updated:  " +
+                            "\nCurrent Statistics\n\tTotal update Quote Price message count = " + currentStats.getCount() +
+                            "\n\tTime to receive stock update alerts messages (in seconds):" +
+                            "\n\t\tmin: " +currentStats.getMinSecs()+
+                            "\n\t\tmax: " +currentStats.getMaxSecs()+
+                            "\n\t\tavg: " +currentStats.getAvgSecs()+
+                            "\n\n\n\tThe current price update is:\n\t"+((TextMessage)message).getText()) ;
+                }
+            } else if (command.equalsIgnoreCase("ping")) {
+                if (Log.doTrace())
+                    Log.trace("DTStreamer3MDB:onMessage  received ping command -- message: " + ((TextMessage)message).getText());
+                
+                long publishTime = message.getLongProperty("publishTime");
+                long receiveTime = System.currentTimeMillis();
+                
+                TimerStat currentStats = mdbStats.addTiming("DTStreamer3MDB:ping", publishTime, receiveTime );
+                
+                if ( (currentStats.getCount() % statInterval) == 0) {
+                    Log.log(new java.util.Date()+ "\nDTStreamer3MDB: received 100 ping messages. " +
+                            "\nCurrent Ping Message Statistics\n\tTotal ping message count = " + currentStats.getCount() +
+                            "\n\tTime to receive messages (in seconds):" +
+                            "\n\t\tmin: " +currentStats.getMinSecs()+
+                            "\n\t\tmax: " +currentStats.getMaxSecs()+
+                            "\n\t\tavg: " +currentStats.getAvgSecs()+
+                            "\n\n\n\tThe current message is:\n\t"+((TextMessage)message).getText());
+                }
+            } else
+                Log.error("DTStreamer3MDB:onMessage - unknown message request command-->" + command + "<-- message=" + ((TextMessage)message).getText());
+        } catch (Throwable t) {
+            //JMS onMessage should handle all exceptions
+            Log.error("DTStreamer3MDB: Exception", t);
+            //UPDATE - Not rolling back for now -- so error messages are not redelivered
+            //mdc.setRollbackOnly();
+        }
+    }
+    
+}

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTStreamer3MDB.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBBean.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBBean.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBBean.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,131 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import org.apache.geronimo.samples.daytrader.AccountDataBean;
+import org.apache.geronimo.samples.daytrader.AccountProfileDataBean;
+import org.apache.geronimo.samples.daytrader.HoldingDataBean;
+import org.apache.geronimo.samples.daytrader.OrderDataBean;
+import org.apache.geronimo.samples.daytrader.QuoteDataBean;
+import org.apache.geronimo.samples.daytrader.RunStatsDataBean;
+import org.apache.geronimo.samples.daytrader.MarketSummaryDataBean;
+import org.apache.geronimo.samples.daytrader.direct.TradeDirect;
+
+import java.math.BigDecimal;
+import java.util.Collection;
+import javax.ejb.*;
+
+
+@Stateless
+@TransactionAttribute(TransactionAttributeType.REQUIRED)
+@TransactionManagement(TransactionManagementType.CONTAINER)
+public class DirectSLSBBean implements DirectSLSBRemote, DirectSLSBLocal {
+
+	public DirectSLSBBean() {
+	}
+
+	public MarketSummaryDataBean getMarketSummary() throws Exception {
+		return (new TradeDirect(true)).getMarketSummary();
+	}
+
+
+	public OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode) throws Exception {
+		return (new TradeDirect(true)).buy(userID, symbol, quantity, orderProcessingMode);
+	}
+
+	public OrderDataBean sell(String userID, Integer holdingID, int orderProcessingMode) throws Exception {
+		return (new TradeDirect(true)).sell(userID, holdingID, orderProcessingMode);
+	}
+
+	public void queueOrder(Integer orderID, boolean twoPhase) throws Exception {
+		(new TradeDirect(true)).queueOrder(orderID, twoPhase);
+	}
+
+	public OrderDataBean completeOrder(Integer orderID, boolean twoPhase) throws Exception {
+		return (new TradeDirect(true)).completeOrder(orderID, twoPhase);
+	}
+
+	public void cancelOrder(Integer orderID, boolean twoPhase) throws Exception {
+		(new TradeDirect(true)).cancelOrder(orderID, twoPhase);
+	}
+
+	public void orderCompleted(String userID, Integer orderID) throws Exception {
+		(new TradeDirect(true)).orderCompleted(userID, orderID);
+	}
+
+	public Collection getOrders(String userID) throws Exception {
+		return (new TradeDirect(true)).getOrders(userID);
+	}
+
+	public Collection getClosedOrders(String userID) throws Exception {
+		return (new TradeDirect(true)).getClosedOrders(userID);
+	}
+
+	public QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price) throws Exception {
+		return (new TradeDirect(true)).createQuote(symbol, companyName, price);
+	}
+
+	public QuoteDataBean getQuote(String symbol) throws Exception {
+		return (new TradeDirect(true)).getQuote(symbol);
+	}
+
+	public Collection getAllQuotes() throws Exception {
+		return (new TradeDirect(true)).getAllQuotes();
+	}
+
+	public QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal newPrice, double sharesTraded) throws Exception {
+		return (new TradeDirect(true)).updateQuotePriceVolume(symbol, newPrice, sharesTraded);
+	}
+
+	public Collection getHoldings(String userID) throws Exception {
+		return (new TradeDirect(true)).getHoldings(userID);
+	}
+
+	public HoldingDataBean getHolding(Integer holdingID) throws Exception {
+		return (new TradeDirect(true)).getHolding(holdingID);
+	}
+
+	public AccountDataBean getAccountData(String userID) throws Exception {
+		return (new TradeDirect(true)).getAccountData(userID);
+	}
+
+	public AccountProfileDataBean getAccountProfileData(String userID) throws Exception {
+		return (new TradeDirect(true)).getAccountProfileData(userID);
+	}
+
+	public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) throws Exception {
+		return (new TradeDirect(true)).updateAccountProfile(profileData);
+	}
+
+	public AccountDataBean login(String userID, String password) throws Exception {
+		return (new TradeDirect(true)).login(userID, password);
+	}
+
+	public void logout(String userID) throws Exception {
+		(new TradeDirect(true)).logout(userID);
+	}
+
+	public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditcard, BigDecimal openBalance) throws Exception {
+		return (new TradeDirect(true)).register(userID, password, fullname, address, email, creditcard, openBalance);
+	}
+
+    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+	public RunStatsDataBean resetTrade(boolean deleteAll) throws Exception {
+		return (new TradeDirect(false)).resetTrade(deleteAll);
+	}
+}

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBLocal.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBLocal.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBLocal.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBLocal.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,26 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import javax.ejb.Local;
+import org.apache.geronimo.samples.daytrader.TradeServices;
+
+@Local
+public interface DirectSLSBLocal extends TradeServices {
+}
+

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBLocal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBRemote.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBRemote.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBRemote.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBRemote.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,26 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import javax.ejb.Remote;
+import org.apache.geronimo.samples.daytrader.TradeServices;
+
+@Remote
+public interface DirectSLSBRemote extends TradeServices {
+}
+

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBRemote.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,754 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import org.apache.geronimo.samples.daytrader.AccountDataBean;
+import org.apache.geronimo.samples.daytrader.AccountProfileDataBean;
+import org.apache.geronimo.samples.daytrader.HoldingDataBean;
+import org.apache.geronimo.samples.daytrader.OrderDataBean;
+import org.apache.geronimo.samples.daytrader.QuoteDataBean;
+import org.apache.geronimo.samples.daytrader.TradeConfig;
+import org.apache.geronimo.samples.daytrader.TradeAction;
+import org.apache.geronimo.samples.daytrader.RunStatsDataBean;
+import org.apache.geronimo.samples.daytrader.MarketSummaryDataBean;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.*;
+import javax.jms.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+import org.apache.geronimo.samples.daytrader.util.FinancialUtils;
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.MDBStats;
+
+@Stateless
+@TransactionAttribute(TransactionAttributeType.REQUIRED)
+@TransactionManagement(TransactionManagementType.CONTAINER)
+public class TradeSLSBBean implements TradeSLSBRemote, TradeSLSBLocal {
+
+    @Resource(name = "jms/QueueConnectionFactory")
+    private QueueConnectionFactory queueConnectionFactory;
+
+    @Resource(name = "jms/TopicConnectionFactory")
+    private TopicConnectionFactory topicConnectionFactory;
+
+    @Resource(name = "jms/TradeStreamerTopic")
+    private Topic tradeStreamerTopic;
+
+    @Resource(name = "jms/TradeBrokerQueue")
+    private Queue tradeBrokerQueue;
+
+    @PersistenceContext
+    private EntityManager entityManager;
+
+    /** Creates a new instance of TradeSLSBBean */
+    public TradeSLSBBean() {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:ejbCreate  -- JNDI lookups of EJB and JMS resources");
+    }
+
+    public MarketSummaryDataBean getMarketSummary() {
+        MarketSummaryDataBean marketSummaryData;
+        
+        try {
+            if (Log.doTrace())
+                Log.trace("TradeSLSBBean:getMarketSummary -- getting market summary");
+
+            // Find Trade Stock Index Quotes (Top 100 quotes)
+            // ordered by their change in value
+            Collection<QuoteDataBean> quotes;
+
+            Query query = entityManager.createNamedQuery("quoteejb.quotesByChange");
+            quotes = query.getResultList();
+
+            QuoteDataBean[] quoteArray = (QuoteDataBean[]) quotes.toArray(new QuoteDataBean[quotes.size()]);
+            ArrayList<QuoteDataBean> topGainers = new ArrayList<QuoteDataBean>(5);
+            ArrayList<QuoteDataBean> topLosers = new ArrayList<QuoteDataBean>(5);
+            BigDecimal TSIA = FinancialUtils.ZERO;
+            BigDecimal openTSIA = FinancialUtils.ZERO;
+            double totalVolume = 0.0;
+
+            if (quoteArray.length > 5) {
+                for (int i = 0; i < 5; i++)
+                    topGainers.add(quoteArray[i]);
+                for (int i = quoteArray.length - 1; i >= quoteArray.length - 5; i--)
+                    topLosers.add(quoteArray[i]);
+
+                for (QuoteDataBean quote : quoteArray) {
+                    BigDecimal price = quote.getPrice();
+                    BigDecimal open = quote.getOpen();
+                    double volume = quote.getVolume();
+                    TSIA = TSIA.add(price);
+                    openTSIA = openTSIA.add(open);
+                    totalVolume += volume;
+                }
+                TSIA = TSIA.divide(new BigDecimal(quoteArray.length), FinancialUtils.ROUND);
+                openTSIA = openTSIA.divide(new BigDecimal(quoteArray.length), FinancialUtils.ROUND);
+            }
+
+            marketSummaryData = new MarketSummaryDataBean(TSIA, openTSIA, totalVolume, topGainers, topLosers);
+        } catch (Exception e) {
+            Log.error("TradeSLSBBean:getMarketSummary", e);
+            throw new EJBException("TradeSLSBBean:getMarketSummary -- error ", e);
+        }
+        return marketSummaryData;
+    }
+
+    public OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode) {
+        OrderDataBean order;
+        BigDecimal total;
+        try {
+            if (Log.doTrace())
+                Log.trace("TradeSLSBBean:buy", userID, symbol, quantity, orderProcessingMode);
+
+            AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID);
+            AccountDataBean account = profile.getAccount();
+            QuoteDataBean quote = entityManager.find(QuoteDataBean.class, symbol);
+            HoldingDataBean holding = null; // The holding will be created by this buy order
+
+            order = createOrder(account, quote, holding, "buy", quantity);
+
+            // UPDATE - account should be credited during completeOrder
+            BigDecimal price = quote.getPrice();
+            BigDecimal orderFee = order.getOrderFee();
+            BigDecimal balance = account.getBalance();
+            total = (new BigDecimal(quantity).multiply(price)).add(orderFee);
+            account.setBalance(balance.subtract(total));
+
+            if (orderProcessingMode == TradeConfig.SYNCH)
+                completeOrder(order.getOrderID(), false);
+            else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
+                queueOrder(order.getOrderID(), true);
+        } catch (Exception e) {
+            Log.error("TradeSLSBBean:buy(" + userID + "," + symbol + "," + quantity + ") --> failed", e);
+            /* On exception - cancel the order */
+            // TODO figure out how to do this with JPA
+            // if (order != null) order.cancel();
+            throw new EJBException(e);
+        }
+        return order;
+    }
+
+    public OrderDataBean sell(String userID, Integer holdingID, int orderProcessingMode) {
+        OrderDataBean order;
+        BigDecimal total;
+        try {
+            if (Log.doTrace())
+                Log.trace("TradeSLSBBean:sell", userID, holdingID, orderProcessingMode);
+
+            AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID);
+            AccountDataBean account = profile.getAccount();
+            HoldingDataBean holding = entityManager.find(HoldingDataBean.class, holdingID);
+            
+            if (holding == null) {
+                Log.error("TradeSLSBBean:sell User " + userID + " attempted to sell holding " + holdingID + " which has already been sold");
+                
+                OrderDataBean orderData = new OrderDataBean();
+                orderData.setOrderStatus("cancelled");
+                entityManager.persist(orderData);
+                
+                return orderData;
+            }            
+
+            QuoteDataBean quote = holding.getQuote();
+            double quantity = holding.getQuantity();
+            order = createOrder(account, quote, holding, "sell", quantity);
+
+            // UPDATE the holding purchase data to signify this holding is "inflight" to be sold
+            // -- could add a new holdingStatus attribute to holdingEJB
+            holding.setPurchaseDate(new java.sql.Timestamp(0));
+
+            // UPDATE - account should be credited during completeOrder
+            BigDecimal price = quote.getPrice();
+            BigDecimal orderFee = order.getOrderFee();
+            BigDecimal balance = account.getBalance();
+            total = (new BigDecimal(quantity).multiply(price)).subtract(orderFee);
+            account.setBalance(balance.add(total));
+
+            if (orderProcessingMode == TradeConfig.SYNCH)
+                completeOrder(order.getOrderID(), false);
+            else if (orderProcessingMode == TradeConfig.ASYNCH_2PHASE)
+                queueOrder(order.getOrderID(), true);
+
+        } catch (Exception e) {
+            Log.error("TradeSLSBBean:sell(" + userID + "," + holdingID + ") --> failed", e);
+            // TODO figure out JPA cancel
+            // if (order != null) order.cancel();
+            // UPDATE - handle all exceptions like:
+            throw new EJBException("TradeSLSBBean:sell(" + userID + "," + holdingID + ")", e);
+        }
+        return order;
+    }
+
+    public void queueOrder(Integer orderID, boolean twoPhase) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:queueOrder", orderID);
+
+        Connection conn = null;
+        Session sess = null;
+        try {
+            conn = queueConnectionFactory.createConnection();
+            sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            MessageProducer msgProducer = sess.createProducer(tradeBrokerQueue);
+            TextMessage message = sess.createTextMessage();
+
+            message.setStringProperty("command", "neworder");
+            message.setIntProperty("orderID", orderID);
+            message.setBooleanProperty("twoPhase", twoPhase);
+            message.setText("neworder: orderID=" + orderID + " runtimeMode=EJB twoPhase=" + twoPhase);
+            message.setLongProperty("publishTime", System.currentTimeMillis());
+
+            if (Log.doTrace())
+                Log.trace("TradeSLSBBean:queueOrder Sending message: " + message.getText());
+            msgProducer.send(message);
+        } catch (javax.jms.JMSException e) {
+            throw new EJBException(e.getMessage(), e); // pass the exception back
+        } finally {
+            try {
+                if (conn != null)
+                    conn.close();
+                if (sess != null)
+                    sess.close();
+            } catch (javax.jms.JMSException e) {
+                throw new EJBException(e.getMessage(), e); // pass the exception back
+            }
+        }
+    }
+
+    public OrderDataBean completeOrder(Integer orderID, boolean twoPhase)
+            throws Exception {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:completeOrder", orderID + " twoPhase=" + twoPhase);
+
+        OrderDataBean order = entityManager.find(OrderDataBean.class, orderID);
+        order.getQuote();
+
+        if (order == null) {
+            Log.error("TradeSLSBBean:completeOrder -- Unable to find Order " + orderID + " FBPK returned " + order);
+            return null;
+        }
+
+        if (order.isCompleted())
+            throw new EJBException("Error: attempt to complete Order that is already completed\n" + order);
+
+        AccountDataBean account = order.getAccount();
+        QuoteDataBean quote = order.getQuote();
+        HoldingDataBean holding = order.getHolding();
+        BigDecimal price = order.getPrice();
+        double quantity = order.getQuantity();
+
+        String userID = account.getProfile().getUserID();
+
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBeanInternal:completeOrder--> Completing Order " + order.getOrderID() 
+                    + "\n\t Order info: " + order
+                    + "\n\t Account info: " + account 
+                    + "\n\t Quote info: " + quote 
+                    + "\n\t Holding info: " + holding);
+
+        if (order.isBuy()) {
+            /*
+             * Complete a Buy operation 
+             * - create a new Holding for the Account 
+             * - deduct the Order cost from the Account balance
+             */
+
+            HoldingDataBean newHolding = createHolding(account, quote, quantity, price);
+            order.setHolding(newHolding);
+        }
+
+        if (order.isSell()) {
+            /*
+             * Complete a Sell operation 
+             * - remove the Holding from the Account 
+             * - deposit the Order proceeds to the Account balance
+             */
+            if (holding == null) {
+                Log.error("TradeSLSBBean:completeOrder -- Unable to sell order " + order.getOrderID() + " holding already sold");
+                order.cancel();
+                return order;
+            } else {
+                entityManager.remove(holding);
+                order.setHolding(null);
+            }
+        }
+        order.setOrderStatus("closed");
+
+        order.setCompletionDate(new java.sql.Timestamp(System.currentTimeMillis()));
+
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:completeOrder--> Completed Order " + order.getOrderID() 
+                    + "\n\t Order info: " + order
+                    + "\n\t Account info: " + account 
+                    + "\n\t Quote info: " + quote 
+                    + "\n\t Holding info: " + holding);
+
+        //if (Log.doTrace())
+        //    Log.trace("Calling TradeAction:orderCompleted from Session EJB using Session Object");
+        // FUTURE All getEJBObjects could be local -- need to add local I/F
+
+        // commented out following call
+        // - orderCompleted doesn't really do anything (think it was a hook for old Trade caching code)
+        
+        /*TradeAction tradeAction = new TradeAction();
+        tradeAction.orderCompleted(userID, orderID);*/
+
+        return order;
+    }
+
+    public void cancelOrder(Integer orderID, boolean twoPhase) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:cancelOrder", orderID + " twoPhase=" + twoPhase);
+
+        OrderDataBean order = entityManager.find(OrderDataBean.class, orderID);
+        order.cancel();
+    }
+
+    public void orderCompleted(String userID, Integer orderID) {
+        throw new UnsupportedOperationException("TradeSLSBBean:orderCompleted method not supported");
+    }
+
+    public Collection<OrderDataBean> getOrders(String userID) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getOrders", userID);
+
+        AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID);
+        AccountDataBean account = profile.getAccount();
+        return account.getOrders();
+    }
+
+    public Collection<OrderDataBean> getClosedOrders(String userID) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getClosedOrders", userID);
+
+        try {
+
+            // Get the primary keys for all the closed Orders for this
+            // account.
+            Query query = entityManager.createNamedQuery("orderejb.closedOrders");
+            query.setParameter("userID", userID);
+            Collection results = query.getResultList();
+			Iterator itr = results.iterator();
+            
+            // Spin through the orders to populate the lazy quote fields
+            while (itr.hasNext()){
+                OrderDataBean thisOrder = (OrderDataBean)itr.next();
+                thisOrder.getQuote();
+            }
+            
+            /* Add logic to do update orders operation, because JBoss5' Hibernate 3.3.1GA DB2Dialect 
+             * and MySQL5Dialect do not work with annotated query "orderejb.completeClosedOrders"
+             * defined in OrderDatabean 
+             */
+            if (TradeConfig.jpaLayer == TradeConfig.OPENJPA) {
+                Query updateStatus = entityManager.createNamedQuery("orderejb.completeClosedOrders");
+                updateStatus.setParameter("userID", userID);
+                updateStatus.executeUpdate();
+                }
+                
+            if (TradeConfig.jpaLayer == TradeConfig.HIBERNATE) {
+                Query findaccountid = entityManager.createNativeQuery("select "+
+                                                                          "a.ACCOUNTID, "+
+                                                                          "a.LOGINCOUNT, "+
+                                                                          "a.LOGOUTCOUNT, "+
+                                                                          "a.LASTLOGIN, "+
+                                                                          "a.CREATIONDATE, "+
+                                                                          "a.BALANCE, "+
+                                                                          "a.OPENBALANCE, "+
+                                                                          "a.PROFILE_USERID "+
+                                                                          "from accountejb a where a.profile_userid = ?", org.apache.geronimo.samples.daytrader.AccountDataBean.class);
+                findaccountid.setParameter(1, userID);
+                AccountDataBean account = (AccountDataBean)findaccountid.getSingleResult();                
+                Integer accountid = account.getAccountID();
+                Query updateStatus = entityManager.createNativeQuery("UPDATE orderejb o SET o.orderStatus = 'completed' WHERE o.orderStatus = 'closed' AND o.ACCOUNT_ACCOUNTID  = ?");
+                updateStatus.setParameter(1, accountid.intValue());
+                updateStatus.executeUpdate();
+                }
+                
+            return results;
+        } catch (Exception e) {
+            Log.error("TradeSLSBBean.getClosedOrders", e);
+            throw new EJBException("TradeSLSBBean.getClosedOrders - error", e);
+        }
+    }
+
+    public QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price) {
+        try {
+            QuoteDataBean quote = new QuoteDataBean(symbol, companyName, 0, price, price, price, price, 0);
+            entityManager.persist(quote);
+            if (Log.doTrace())
+                Log.trace("TradeSLSBBean:createQuote-->" + quote);
+            return quote;
+        } catch (Exception e) {
+            Log.error("TradeSLSBBean:createQuote -- exception creating Quote", e);
+            throw new EJBException(e);
+        }
+    }
+
+    public QuoteDataBean getQuote(String symbol) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getQuote", symbol);
+
+        return entityManager.find(QuoteDataBean.class, symbol);
+    }
+
+    public Collection<QuoteDataBean> getAllQuotes() {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getAllQuotes");
+
+        Query query = entityManager.createNamedQuery("quoteejb.allQuotes");
+        return query.getResultList();
+    }
+
+    public QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal changeFactor, double sharesTraded) {
+        if (!TradeConfig.getUpdateQuotePrices())
+            return new QuoteDataBean();
+
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:updateQuote", symbol, changeFactor);
+
+        /* Add logic to determine JPA layer, because JBoss5' Hibernate 3.3.1GA DB2Dialect 
+         * and MySQL5Dialect do not work with annotated query "quoteejb.quoteForUpdate"
+         * defined in QuoteDatabean 
+          */    
+        QuoteDataBean quote = new QuoteDataBean();
+        if (TradeConfig.jpaLayer == TradeConfig.HIBERNATE) {
+            quote = entityManager.find(QuoteDataBean.class, symbol);
+           }
+           
+        if (TradeConfig.jpaLayer == TradeConfig.OPENJPA) {
+            Query q = entityManager.createNamedQuery("quoteejb.quoteForUpdate");
+            q.setParameter(1, symbol);
+            quote = (QuoteDataBean) q.getSingleResult();
+           }       
+
+        BigDecimal oldPrice = quote.getPrice();
+
+        if (quote.getPrice().equals(TradeConfig.PENNY_STOCK_PRICE)) {
+            changeFactor = TradeConfig.PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER;
+        }
+
+        BigDecimal newPrice = changeFactor.multiply(oldPrice).setScale(2, BigDecimal.ROUND_HALF_UP);
+
+        quote.setPrice(newPrice);
+        quote.setVolume(quote.getVolume() + sharesTraded);
+        entityManager.merge(quote);
+
+        // TODO find out if requires new here is really intended -- it is backwards,
+        // change can get published w/o it occurring.
+        // ((Trade) context.getEJBObject()).publishQuotePriceChange(quote,oldPrice, changeFactor, sharesTraded);
+        this.publishQuotePriceChange(quote, oldPrice, changeFactor, sharesTraded);
+
+        return quote;
+    }
+
+    public Collection<HoldingDataBean> getHoldings(String userID) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getHoldings", userID);
+
+        Query query = entityManager.createNamedQuery("holdingejb.holdingsByUserID");
+        query.setParameter("userID", userID);
+        Collection<HoldingDataBean> holdings = query.getResultList();
+        /*
+         * Inflate the lazy data memebers
+        */
+        Iterator itr = holdings.iterator();
+        while (itr.hasNext()) {
+            ((HoldingDataBean) itr.next()).getQuote();
+        }
+
+        return holdings;
+    }
+
+    public HoldingDataBean getHolding(Integer holdingID) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getHolding", holdingID);
+        return entityManager.find(HoldingDataBean.class, holdingID);
+    }
+
+    public AccountDataBean getAccountData(String userID) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getAccountData", userID);
+
+        AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID);
+        /*
+         * Inflate the lazy data memebers
+         */
+        AccountDataBean account = profile.getAccount();
+        account.getProfile();
+        
+        // Added to populate transient field for account
+        account.setProfileID(profile.getUserID());
+        return account;
+    }
+
+    public AccountProfileDataBean getAccountProfileData(String userID) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:getProfileData", userID);
+
+        return entityManager.find(AccountProfileDataBean.class, userID);
+    }
+
+    public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:updateAccountProfileData", profileData);
+        /*
+         * // Retreive the pevious account profile in order to get account
+         * data... hook it into new object AccountProfileDataBean temp =
+         * entityManager.find(AccountProfileDataBean.class,
+         * profileData.getUserID()); // In order for the object to merge
+         * correctly, the account has to be hooked into the temp object... // -
+         * may need to reverse this and obtain the full object first
+         * 
+         * profileData.setAccount(temp.getAccount());
+         * 
+         * //TODO this might not be correct temp =
+         * entityManager.merge(profileData); //System.out.println(temp);
+         */
+
+        AccountProfileDataBean temp = entityManager.find(AccountProfileDataBean.class, profileData.getUserID());
+        temp.setAddress(profileData.getAddress());
+        temp.setPassword(profileData.getPassword());
+        temp.setFullName(profileData.getFullName());
+        temp.setCreditCard(profileData.getCreditCard());
+        temp.setEmail(profileData.getEmail());
+
+        entityManager.merge(temp);
+
+        return temp;
+    }
+
+    public AccountDataBean login(String userID, String password) throws RollbackException {
+        AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID);
+
+        if (profile == null) {
+            throw new EJBException("No such user: " + userID);
+        }
+        entityManager.merge(profile);
+        AccountDataBean account = profile.getAccount();
+
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:login", userID, password);
+        account.login(password);
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:login(" + userID + "," + password + ") success" + account);
+
+        return account;
+    }
+
+    public void logout(String userID) {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:logout", userID);
+
+        AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class, userID);
+        AccountDataBean account = profile.getAccount();
+
+        account.logout();
+        
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:logout(" + userID + ") success");
+    }
+
+    public AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditcard, BigDecimal openBalance) {
+        AccountDataBean account = null;
+        AccountProfileDataBean profile = null;
+        
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:register", userID, password, fullname, address, email, creditcard, openBalance);
+
+        // Check to see if a profile with the desired userID already exists
+        profile = entityManager.find(AccountProfileDataBean.class, userID);
+
+        if (profile != null) {
+            Log.error("Failed to register new Account - AccountProfile with userID(" + userID + ") already exists");
+            return null;
+        } else {
+            profile = new AccountProfileDataBean(userID, password, fullname, address, email, creditcard);
+            account = new AccountDataBean(0, 0, null, new Timestamp(System.currentTimeMillis()), openBalance, openBalance, userID);
+
+            profile.setAccount(account);
+            account.setProfile(profile);
+
+            entityManager.persist(profile); 
+            entityManager.persist(account);
+        }
+        
+        return account;
+    }
+
+    @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
+    public RunStatsDataBean resetTrade(boolean deleteAll) throws Exception {
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:resetTrade", deleteAll);
+
+        return new org.apache.geronimo.samples.daytrader.direct.TradeDirect(false).resetTrade(deleteAll);
+    }
+
+    private void publishQuotePriceChange(QuoteDataBean quote, BigDecimal oldPrice, BigDecimal changeFactor, double sharesTraded) {
+        if (!TradeConfig.getPublishQuotePriceChange())
+            return;
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:publishQuotePricePublishing -- quoteData = " + quote);
+
+        Connection conn = null;
+        Session sess = null;
+
+        try {
+            conn = topicConnectionFactory.createConnection();
+            sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+            MessageProducer msgProducer = sess.createProducer(tradeStreamerTopic);
+            TextMessage message = sess.createTextMessage();
+
+            String command = "updateQuote";
+            message.setStringProperty("command", command);
+            message.setStringProperty("symbol", quote.getSymbol());
+            message.setStringProperty("company", quote.getCompanyName());
+            message.setStringProperty("price", quote.getPrice().toString());
+            message.setStringProperty("oldPrice", oldPrice.toString());
+            message.setStringProperty("open", quote.getOpen().toString());
+            message.setStringProperty("low", quote.getLow().toString());
+            message.setStringProperty("high", quote.getHigh().toString());
+            message.setDoubleProperty("volume", quote.getVolume());
+
+            message.setStringProperty("changeFactor", changeFactor.toString());
+            message.setDoubleProperty("sharesTraded", sharesTraded);
+            message.setLongProperty("publishTime", System.currentTimeMillis());
+            message.setText("Update Stock price for " + quote.getSymbol() + " old price = " + oldPrice + " new price = " + quote.getPrice());
+
+            msgProducer.send(message);
+        } catch (Exception e) {
+            throw new EJBException(e.getMessage(), e); // pass the exception back
+        } finally {
+            try {
+                if (conn != null)
+                    conn.close();
+                if (sess != null)
+                    sess.close();
+            } catch (javax.jms.JMSException e) {
+                throw new EJBException(e.getMessage(), e); // pass the exception back
+            }
+        }
+    }
+
+    private OrderDataBean createOrder(AccountDataBean account, QuoteDataBean quote, HoldingDataBean holding, String orderType, double quantity) {
+
+        OrderDataBean order;
+
+        if (Log.doTrace())
+            Log.trace("TradeSLSBBean:createOrder(orderID=" 
+                    + " account=" + ((account == null) ? null : account.getAccountID()) 
+                    + " quote=" + ((quote == null) ? null : quote.getSymbol()) 
+                    + " orderType=" + orderType 
+                    + " quantity=" + quantity);
+        try {
+            order = new OrderDataBean(orderType, "open", new Timestamp(System.currentTimeMillis()), null, quantity, quote.getPrice().setScale(FinancialUtils.SCALE, FinancialUtils.ROUND), 
+                    TradeConfig.getOrderFee(orderType), account, quote, holding);
+            entityManager.persist(order);
+        } catch (Exception e) {
+            Log.error("TradeSLSBBean:createOrder -- failed to create Order", e);
+            throw new EJBException("TradeSLSBBean:createOrder -- failed to create Order", e);
+        }
+        return order;
+    }
+
+    private HoldingDataBean createHolding(AccountDataBean account, QuoteDataBean quote, double quantity, BigDecimal purchasePrice) throws Exception {
+        HoldingDataBean newHolding = new HoldingDataBean(quantity, purchasePrice, new Timestamp(System.currentTimeMillis()), account, quote);
+        entityManager.persist(newHolding);
+        return newHolding;
+    }
+    
+    public double investmentReturn(double investment, double NetValue) throws Exception {
+        if (Log.doTrace()) Log.trace("TradeSLSBBean:investmentReturn");
+    
+        double diff = NetValue - investment;
+        double ir = diff / investment;
+        return ir;
+    }
+    
+    public QuoteDataBean pingTwoPhase(String symbol) throws Exception {
+        try{
+            if (Log.doTrace()) Log.trace("TradeSLSBBean:pingTwoPhase", symbol);
+            QuoteDataBean quoteData=null;
+            Connection conn = null;
+            Session sess = null;        
+            
+            try {
+
+                //Get a Quote and send a JMS message in a 2-phase commit
+                quoteData = entityManager.find(QuoteDataBean.class, symbol);
+
+                conn = queueConnectionFactory.createConnection();                        
+                sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+                MessageProducer msgProducer = sess.createProducer(tradeBrokerQueue);
+                TextMessage message = sess.createTextMessage();
+
+                String command= "ping";
+                message.setStringProperty("command", command);
+                message.setLongProperty("publishTime", System.currentTimeMillis());         
+                message.setText("Ping message for queue java:comp/env/jms/TradeBrokerQueue sent from TradeSLSBBean:pingTwoPhase at " + new java.util.Date());
+
+                msgProducer.send(message);  
+            } 
+            catch (Exception e) {
+                Log.error("TradeSLSBBean:pingTwoPhase -- exception caught",e);
+            }
+
+            finally {
+                if (conn != null)
+                    conn.close();   
+                if (sess != null)
+                    sess.close();
+            }           
+
+            return quoteData;
+        } catch (Exception e){
+            throw new Exception(e.getMessage(),e);
+        }
+    }
+
+    class quotePriceComparator implements java.util.Comparator {
+        public int compare(Object quote1, Object quote2) {
+            double change1 = ((QuoteDataBean) quote1).getChange();
+            double change2 = ((QuoteDataBean) quote2).getChange();
+            return new Double(change2).compareTo(change1);
+        }
+    }
+
+    @PostConstruct
+    public void postConstruct() {
+        Log.trace("POST CONSTRUCT");
+        Log.trace("updateQuotePrices: " + TradeConfig.getUpdateQuotePrices());
+        Log.trace("publishQuotePriceChange: " + TradeConfig.getPublishQuotePriceChange());
+    }
+}

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBLocal.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBLocal.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBLocal.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBLocal.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,29 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import javax.ejb.Local;
+import org.apache.geronimo.samples.daytrader.TradeServices;
+import org.apache.geronimo.samples.daytrader.QuoteDataBean;
+
+@Local
+public interface TradeSLSBLocal extends TradeServices {
+    public double investmentReturn(double investment, double NetValue) throws Exception;
+    
+    public QuoteDataBean pingTwoPhase(String symbol) throws Exception;
+}
\ No newline at end of file

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBLocal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBRemote.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBRemote.java?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBRemote.java (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBRemote.java Fri Aug 28 18:07:49 2009
@@ -0,0 +1,29 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.geronimo.samples.daytrader.ejb3;
+
+import javax.ejb.Remote;
+import org.apache.geronimo.samples.daytrader.TradeServices;
+import org.apache.geronimo.samples.daytrader.QuoteDataBean;
+
+@Remote
+public interface TradeSLSBRemote extends TradeServices {
+    public double investmentReturn(double investment, double NetValue) throws Exception;
+    
+    public QuoteDataBean pingTwoPhase(String symbol) throws Exception;
+}
\ No newline at end of file

Propchange: geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBRemote.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/LICENSE?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/LICENSE (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/LICENSE Fri Aug 28 18:07:49 2009
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/NOTICE?rev=808973&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/NOTICE (added)
+++ geronimo/daytrader/trunk/modules/ejb3/src/main/resources/META-INF/NOTICE Fri Aug 28 18:07:49 2009
@@ -0,0 +1,9 @@
+Apache Geronimo 
+Copyright 2003-2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were developed at IBM and donated to the 
+ASF under the Apache 2.0 license.  The former work was referred to 
+as Trade 6.



Mime
View raw message