geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r822886 - in /geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main: java/org/apache/geronimo/samples/daytrader/core/ java/org/apache/geronimo/samples/daytrader/core/direct/ resources/OSGI-INF/blueprint/
Date Wed, 07 Oct 2009 20:06:18 GMT
Author: jbohn
Date: Wed Oct  7 20:06:16 2009
New Revision: 822886

URL: http://svn.apache.org/viewvc?rev=822886&view=rev
Log:
add some initial management for different modes, mocked up jpa services, and use direct reference
rather than reference-lists which have issues with listeners and set

Added:
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
  (with props)
Modified:
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBServices.java
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServices.java
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManager.java
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManagerImpl.java
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJDBCDirect.java
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/listener.xml

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBServices.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBServices.java?rev=822886&r1=822885&r2=822886&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBServices.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeDBServices.java
Wed Oct  7 20:06:16 2009
@@ -35,4 +35,13 @@
      * TradeBuildDB needs this abstracted method
      */
     public boolean recreateDBTables(Object[] sqlBuffer, java.io.PrintWriter out) throws Exception;
+
+    /**
+     * Get mode - returns the persistence mode
+     * (TradeConfig.JDBC, JPA, etc...)
+     *
+     * @return int mode
+     */
+    public int getMode();
+
 }   

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServices.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServices.java?rev=822886&r1=822885&r2=822886&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServices.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServices.java
Wed Oct  7 20:06:16 2009
@@ -280,5 +280,13 @@
 	 */
     public RunStatsDataBean resetTrade(boolean deleteAll) throws Exception, RemoteException;
     
+   /**
+    * Get mode - returns the persistence mode
+    * (TradeConfig.JDBC, JPA, etc...)
+    *
+    * @return int mode
+    */
+    public int getMode();
+
 }   
 

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManager.java?rev=822886&r1=822885&r2=822886&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManager.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManager.java
Wed Oct  7 20:06:16 2009
@@ -41,11 +41,6 @@
     public TradeServices getTradeServices();
 
     /**
-      * Get the list of TradeServices as a set.
-      */
-    public Set getTradeServicesSet();
-
-    /**
       * Set TradeDBServices reference
       */
     public void setTradeDBServices(TradeDBServices tradeDBServices);
@@ -56,10 +51,6 @@
 
     public TradeDBServices getTradeDBServices();
 
-    /**
-      * Get the list of TradeDBServices as a set.
-      */
-    public Set getTradeDBServicesSet();
 
 }   
 

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManagerImpl.java?rev=822886&r1=822885&r2=822886&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManagerImpl.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/TradeServicesManagerImpl.java
Wed Oct  7 20:06:16 2009
@@ -16,11 +16,11 @@
  */
 package org.apache.geronimo.samples.daytrader.core;
 
-import java.util.HashSet;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Set;
 
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
 import org.apache.geronimo.samples.daytrader.core.TradeServices;
 import org.apache.geronimo.samples.daytrader.core.TradeDBServices;
 
@@ -44,10 +44,15 @@
 
 public class TradeServicesManagerImpl implements TradeServicesManager {
 
-    private Set tradeServicesSet = new HashSet();
-    private Set tradeDBServicesSet = new HashSet();
+//    private Set tradeServicesSet = new HashSet();
+    private Map<Integer, TradeServices> tradeServicesMap = new HashMap<Integer,
TradeServices>();
+//    private Set tradeDBServicesSet = new HashSet();
+    private Map<Integer, TradeDBServices> tradeDBServicesMap = new HashMap<Integer,
TradeDBServices>();
     private TradeServices tradeServices = null;
     private TradeDBServices tradeDBServices = null;
+    private TradeServices tradeServicesJPA = null;
+    private TradeDBServices tradeDBServicesJPA = null;
+    private int currentMode = TradeConfig.JDBC;
     private String test;
 
     /**
@@ -55,7 +60,7 @@
       */
     public TradeServicesManagerImpl() 
     {
-        System.out.println("@JAB TradeServicesManagerImpl() ");
+//        System.out.println("@JAB TradeServicesManagerImpl() ");
     }
 
     /**
@@ -63,7 +68,7 @@
       */
     public void setTest(String test)
     {
-        System.out.println("@JAB TradeServicesManager.setTest " + test);
+//        System.out.println("@JAB TradeServicesManagerImpl.setTest " + test);
         this.test = test;
     }
 
@@ -72,7 +77,7 @@
       */
     public void init()
     {
-        System.out.println("@JAB TradeServicesManager.init - Initialized ");
+//        System.out.println("@JAB TradeServicesManagerImpl.init - Initialized ");
     }
 
     /**
@@ -80,77 +85,69 @@
       */
     public void setTradeServices(TradeServices tradeServices)
     {
-        System.out.println("@JAB TradeServicesManager.setTradeServices " + tradeServices);
-        tradeServicesSet.add(tradeServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeServices current size
" + tradeServicesMap.size() + " adding " + tradeServices);
+        tradeServicesMap.put(tradeServices.getMode(), tradeServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeServices new size " +
tradeServicesMap.size());
+    }
+
+    /**
+      * Set TradeServices reference
+      */
+    public void setTradeServicesJPA(TradeServices tradeServicesJPA)
+    {
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeServicesJPA current size
" + tradeServicesMap.size() + " adding " + tradeServicesJPA);
+        tradeServicesMap.put(tradeServicesJPA.getMode(), tradeServicesJPA);
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeServicesJPA new size
" + tradeServicesMap.size());
     }
 
 
     public TradeServices getTradeServices()
     {
-        System.out.println("@JAB TradeServicesManager.getTradeServices");
-
-        // @JAB for now just return the first (only) item in the set if present.
+        // @JAB for now this is hard-coded to JDBC.
         // Eventually, we need to keep track of the selected TradeServices and return that
-        if (tradeServices == null) {
-            Iterator it = tradeServicesSet.iterator();
-            if (it.hasNext()) {
-              tradeServices = (TradeServices) it.next();
-            }
-        }
-        return tradeServices;
+//        System.out.println("@JAB TradeServicesManagerImpl.getTradeServices - returning
" + tradeServicesMap.get(currentMode));
+        return tradeServicesMap.get(currentMode);
     }
 
     /**
-      * Get the list of TradeServices as a set.
+      * Set TradeDBServices reference
       */
-    public Set getTradeServicesSet()
+    public void setTradeDBServices(TradeDBServices tradeDBServices)
     {
-        System.out.println("@JAB TradeServicesManager.getTradeServicesSet " + tradeServicesSet.size());
-        return tradeServicesSet;
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeDBServices current size
" + tradeDBServicesMap.size() + " adding " + tradeDBServices);
+        tradeDBServicesMap.put(tradeDBServices.getMode(), tradeDBServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeDBServices new size "
+ tradeDBServicesMap.size());
     }
 
     /**
-      * Set TradeDBServices reference
+      * Set TradeDBServicesJPA reference
       */
-    public void setTradeDBServices(TradeDBServices tradeDBServices)
+    public void setTradeDBServicesJPA(TradeDBServices tradeDBServicesJPA)
     {
-        System.out.println("@JAB TradeServicesManager.setTradeDBServices " + tradeDBServices);
-        tradeDBServicesSet.add(tradeDBServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeDBServicesJPA current
size " + tradeDBServicesMap.size() + " adding " + tradeDBServicesJPA);
+        tradeDBServicesMap.put(tradeDBServicesJPA.getMode(), tradeDBServicesJPA);
+//        System.out.println("@JAB TradeServicesManagerImpl.setTradeDBServicesJPA new size
" + tradeDBServicesMap.size());
     }
 
 
     public TradeDBServices getTradeDBServices()
     {
-        System.out.println("@JAB TradeServicesManager.getTradeDBServices");
-
-        // @JAB for now just return the first (only) item in the set if present.
-        // Eventually, we need to keep track of the selected TradeDBServices and return that
-        if (tradeDBServices == null) {
-            Iterator it = tradeDBServicesSet.iterator();
-            if (it.hasNext()) {
-              tradeDBServices = (TradeDBServices) it.next();
-            }
-        }
-        return tradeDBServices;
-    }
-
-    /**
-      * Get the list of TradeDBServices as a set.
-      */
-    public Set getTradeDBServicesSet()
-    {
-        System.out.println("@JAB TradeServicesManager.getTradeDBServicesSet " + tradeDBServicesSet.size());
-        return tradeDBServicesSet;
+        // @JAB for now this is hard-coded to JDBC.
+        // Eventually, we need to keep track of the selected TradeServices and return that
+//        System.out.println("@JAB TradeServicesManagerImpl.getTradeServices - returning
" + tradeServicesMap.get(currentMode));
+        return tradeDBServicesMap.get(currentMode);
     }
 
-
     /**
       * Bind a new TradeServices implementation
       */
     public void bindService(TradeServices tradeServices, Map props)
     {
-        System.out.println("@JAB TradeServicesManager.bindService " + tradeServices + " Properties
" + props);
-        tradeServicesSet.add(tradeServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.bindService current size " +
tradeServicesMap.size() + " adding " + tradeServices + "Properties " + props);
+        if (tradeServices != null) {
+            tradeServicesMap.put(tradeServices.getMode(), tradeServices);
+        }
+//        System.out.println("@JAB TradeServicesManagerImpl.bindService new size " + tradeServicesMap.size());
     }
 
     /**
@@ -158,8 +155,11 @@
       */
     public void unbindService(TradeServices tradeServices, Map props)
     {
-        System.out.println("@JAB TradeServicesManager.unbindService " + tradeServices + "
Properties " + props);
-        tradeServicesSet.remove(tradeServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.unbindService current size "
+ tradeServicesMap.size() + " adding " + tradeServices + "Properties " + props);
+        if (tradeServices != null) {
+            tradeServicesMap.remove(tradeServices.getMode());
+        }
+//        System.out.println("@JAB TradeServicesManagerImpl.unbindService new size " + tradeServicesMap.size());
     }
 
     /**
@@ -167,8 +167,11 @@
       */
     public void bindDBService(TradeDBServices tradeDBServices, Map props)
     {
-        System.out.println("@JAB TradeServicesManager.bindDBService " + tradeDBServices +
" Properties " + props);
-        tradeDBServicesSet.add(tradeDBServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.bindDBService current size "
+ tradeDBServicesMap.size() + " adding " + tradeDBServices + "Properties " + props);
+        if (tradeDBServices != null) {
+            tradeDBServicesMap.put(tradeDBServices.getMode(), tradeDBServices);
+        }
+//        System.out.println("@JAB TradeServicesManagerImpl.bindDBService new size " + tradeDBServicesMap.size());
     }
 
     /**
@@ -176,8 +179,10 @@
       */
     public void unbindDBService(TradeServices tradeDBServices, Map props)
     {
-        System.out.println("@JAB TradeServicesManager.unbindDBService " + tradeDBServices
+ " Properties " + props);
-        tradeDBServicesSet.remove(tradeDBServices);
+//        System.out.println("@JAB TradeServicesManagerImpl.unbindDBService current size
" + tradeDBServicesMap.size() + " adding " + tradeDBServices + "Properties " + props);
+        if (tradeDBServices != null) {
+            tradeDBServicesMap.remove(tradeDBServices.getMode());
+        }
+//        System.out.println("@JAB TradeServicesManagerImpl.unbindDBService new size " +
tradeDBServicesMap.size());
     }
-
 }

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJDBCDirect.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJDBCDirect.java?rev=822886&r1=822885&r2=822886&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJDBCDirect.java
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJDBCDirect.java
Wed Oct  7 20:06:16 2009
@@ -70,11 +70,13 @@
      * Zero arg constructor for TradeJDBCDirect
      */
     public TradeJDBCDirect() {
+//        System.out.println("@JAB TradeJDBCDirect() ");
         if (initialized == false)
             init();
     }
 
     public TradeJDBCDirect(boolean inSession) {
+//        System.out.println("@JAB TradeJDBCDirect( " + inSession + " )");
         if (initialized == false)
             init();
 
@@ -2004,4 +2006,13 @@
         this.inGlobalTxn = inGlobalTxn;
     }
 
+    /**
+     * Get mode - returns the persistence mode (TradeConfig.JDBC)
+     * 
+     * @return int mode
+     */
+    public int getMode() {
+        return TradeConfig.JDBC;
+    }
+
 }

Added: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java?rev=822886&view=auto
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
(added)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
Wed Oct  7 20:06:16 2009
@@ -0,0 +1,407 @@
+/**
+ *  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.core.direct;
+
+import java.math.BigDecimal;
+import java.util.Collection;
+import java.util.ArrayList;
+import javax.naming.InitialContext;
+
+import javax.sql.DataSource;
+
+import org.apache.geronimo.samples.daytrader.beans.*;
+import org.apache.geronimo.samples.daytrader.core.*;
+import org.apache.geronimo.samples.daytrader.util.*;
+
+import java.rmi.RemoteException;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+
+
+/**
+ * TradeJPADirect - mocked up object until real one is available
+ * 
+ * @see org.apache.geronimo.samples.daytrader.TradeServices
+ * 
+ */
+
+public class TradeJPADirect implements TradeServices, TradeDBServices {
+
+    private static String dsName = TradeConfig.DATASOURCE;
+
+    private static DataSource datasource = null;
+
+    private static BigDecimal ZERO = new BigDecimal(0.0);
+
+    private boolean inGlobalTxn = false;
+
+    private boolean inSession = false;
+
+    /**
+     * Zero arg constructor for TradeJPADirect
+     */
+    public TradeJPADirect() {
+        System.out.println("@JAB TradeJPADirect() ");
+    }
+
+    public TradeJPADirect(boolean inSession) {
+        System.out.println("@JAB TradeJPADirect( " + inSession + " )");
+
+        this.inSession = inSession;
+    }
+
+    /**
+     * @see TradeServices#getMarketSummary()
+     */
+    public MarketSummaryDataBean getMarketSummary() throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getMarketSummary()");
+
+        MarketSummaryDataBean marketSummaryData = null;
+
+        return marketSummaryData;
+
+    }
+
+    /**
+     * @see TradeServices#buy(String, String, double)
+     */
+    public OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode)
throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.buy()");
+
+        OrderDataBean orderData = null;
+
+        return orderData;
+    }
+
+    /**
+     * @see TradeServices#sell(String, Integer)
+     */
+    public OrderDataBean sell(String userID, Integer holdingID, int orderProcessingMode)
throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.sell()");
+
+        OrderDataBean orderData = null;
+
+        return orderData;
+    }
+
+    /**
+     * @see TradeServices#queueOrder(Integer)
+     */
+    public void queueOrder(Integer orderID, boolean twoPhase) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.queueOrder()");
+    }
+
+    /**
+     * @see TradeServices#completeOrder(Integer)
+     */
+    public OrderDataBean completeOrder(Integer orderID, boolean twoPhase) throws Exception
{
+
+        System.out.println("@JAB TradeJPADirect.completeOrder()");
+
+        OrderDataBean orderData = null;
+
+        return orderData;
+
+    }
+
+    /**
+     * @see TradeServices#cancelOrder(Integer, boolean)
+     */
+    public void cancelOrder(Integer orderID, boolean twoPhase) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.cancelOrder()");
+
+    }
+
+
+    public void orderCompleted(String userID, Integer orderID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.orderCompleted()");
+
+    }
+
+
+
+
+    /**
+     * @see TradeServices#getOrders(String)
+     */
+    public Collection getOrders(String userID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getOrders()");
+
+        Collection orderDataBeans = new ArrayList();
+
+        return orderDataBeans;
+    }
+
+    /**
+     * @see TradeServices#getClosedOrders(String)
+     */
+    public Collection getClosedOrders(String userID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getClosedOrders()");
+
+        Collection orderDataBeans = new ArrayList();
+
+        return orderDataBeans;
+    }
+
+    /**
+     * @see TradeServices#createQuote(String, String, BigDecimal)
+     */
+    public QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price)
throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.createQuote()");
+
+        QuoteDataBean quoteData = null;
+
+        return quoteData;
+    }
+
+    /**
+     * @see TradeServices#getQuote(String)
+     */
+
+    public QuoteDataBean getQuote(String symbol) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getQuote()");
+
+        QuoteDataBean quoteData = null;
+
+        return quoteData;
+    }
+
+
+
+    /**
+     * @see TradeServices#getAllQuotes(String)
+     */
+    public Collection getAllQuotes() throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getAllQuotes()");
+
+        Collection quotes = new ArrayList();
+
+        return quotes;
+    }
+
+    /**
+     * @see TradeServices#getHoldings(String)
+     */
+    public Collection getHoldings(String userID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getHoldings()");
+
+        Collection holdingDataBeans = new ArrayList();
+
+        return holdingDataBeans;
+    }
+
+    /**
+     * @see TradeServices#getHolding(Integer)
+     */
+    public HoldingDataBean getHolding(Integer holdingID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getHolding()");
+
+        HoldingDataBean holdingData = null;
+
+        return holdingData;
+    }
+
+    /**
+     * @see TradeServices#getAccountData(String)
+     */
+    public AccountDataBean getAccountData(String userID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getAccountData()");
+
+            AccountDataBean accountData = null;
+            return accountData;
+    }
+
+
+    /**
+     * @see TradeServices#getAccountData(String)
+     */
+    public AccountDataBean getAccountData(int accountID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getAccountData() 3 ");
+
+        AccountDataBean accountData = null;
+
+        return accountData;
+    }
+
+
+
+    /**
+     * @see TradeServices#getAccountProfileData(String)
+     */
+    public AccountProfileDataBean getAccountProfileData(String userID) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.getAccountProfileData()");
+
+        AccountProfileDataBean accountProfileData = null;
+
+        return accountProfileData;
+    }
+
+
+    /**
+     * @see TradeServices#updateAccountProfile(AccountProfileDataBean)
+     */
+    public AccountProfileDataBean updateAccountProfile(AccountProfileDataBean profileData)
throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.updateAccountProfile()");
+
+        AccountProfileDataBean accountProfileData = null;
+
+        return accountProfileData;
+    }
+
+    public QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal changeFactor, double
sharesTraded)
+        throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.updateQuotePriceVolume()");
+
+        return updateQuotePriceVolumeInt(symbol, changeFactor, sharesTraded, TradeConfig.getPublishQuotePriceChange());
+    }
+
+    /**
+     * Update a quote's price and volume
+     * 
+     * @param symbol
+     *            The PK of the quote
+     * @param changeFactor
+     *            the percent to change the old price by (between 50% and 150%)
+     * @param sharedTraded
+     *            the ammount to add to the current volume
+     * @param publishQuotePriceChange
+     *            used by the PingJDBCWrite Primitive to ensure no JMS is used, should be
true for all normal calls to
+     *            this API
+     */
+    public QuoteDataBean updateQuotePriceVolumeInt(String symbol, BigDecimal changeFactor,
double sharesTraded,
+        boolean publishQuotePriceChange) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.updateQuotePriceVolumeInt()");
+
+        QuoteDataBean quoteData = null;
+
+        return quoteData;
+    }
+
+
+    /**
+     * @see TradeServices#login(String, String)
+     */
+
+    public AccountDataBean login(String userID, String password) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.login()");
+
+        AccountDataBean accountData = null;
+
+        return accountData;
+    }
+
+    /**
+     * @see TradeServices#logout(String)
+     */
+    public void logout(String userID) throws Exception {
+
+
+        System.out.println("@JAB TradeJPADirect.logout()");
+
+    }
+
+    /**
+     * @see TradeServices#register(String, String, String, String, String, String, BigDecimal,
boolean)
+     */
+
+    public AccountDataBean register(String userID, String password, String fullname, String
address, String email,
+        String creditCard, BigDecimal openBalance) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.register()");
+
+        AccountDataBean accountData = null;
+
+        return accountData;
+    }
+
+
+    public String checkDBProductName() throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.checkDBProductName()");
+
+        String dbProductName = null;
+
+        return dbProductName;
+    }
+
+    public boolean recreateDBTables(Object[] sqlBuffer, java.io.PrintWriter out) throws Exception
{
+
+        System.out.println("@JAB TradeJPADirect.recreateDBTables()");
+
+        boolean success = false;
+
+        return success;
+    }
+
+    public RunStatsDataBean resetTrade(boolean deleteAll) throws Exception {
+
+        System.out.println("@JAB TradeJPADirect.resetTrade()");
+
+        RunStatsDataBean runStatsData = new RunStatsDataBean();
+
+        return runStatsData;
+
+    }
+
+    public static synchronized void init() {
+
+        System.out.println("@JAB TradeJPADirect.init");
+
+    }
+
+    public static void destroy() {
+
+        System.out.println("@JAB TradeJPADirect.destroy");
+
+    }
+
+
+    /**
+     * Get mode - returns the persistence mode (TradeConfig.JPA)
+     * 
+     * @return int mode
+     */
+    public int getMode() {
+        return TradeConfig.JPA;
+    }
+
+}

Propchange: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/core/direct/TradeJPADirect.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=822886&r1=822885&r2=822886&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Wed Oct  7 20:06:16 2009
@@ -1,18 +1,32 @@
 <blueprint>
 
-  <bean id="tradeServiceComponent" class="org.apache.geronimo.samples.daytrader.core.direct.TradeJDBCDirect"
activation="lazy" init-method="init"/>
-  
-  <service id="tradeDBService" ref="tradeServiceComponent" interface="org.apache.geronimo.samples.daytrader.core.TradeDBServices">
+  <bean id="tradeServicesBeanJDBC" class="org.apache.geronimo.samples.daytrader.core.direct.TradeJDBCDirect"
activation="lazy" init-method="init"/>
+
+  <service id="tradeServicesJDBC" ref="tradeServicesBeanJDBC" interface="org.apache.geronimo.samples.daytrader.core.TradeServices">
       <service-properties>
           <entry key="mode" value="jdbc"/>
       </service-properties>
   </service>
 
-  <service id="tradeService" ref="tradeServiceComponent" interface="org.apache.geronimo.samples.daytrader.core.TradeServices">
+  <service id="tradeDBServicesJDBC" ref="tradeServicesBeanJDBC" interface="org.apache.geronimo.samples.daytrader.core.TradeDBServices">
       <service-properties>
           <entry key="mode" value="jdbc"/>
       </service-properties>
   </service>
 
+  <bean id="tradeServicesBeanJPA" class="org.apache.geronimo.samples.daytrader.core.direct.TradeJPADirect"
activation="lazy"/> 
+  
+  <service id="tradeServicesJPA" ref="tradeServicesBeanJPA" interface="org.apache.geronimo.samples.daytrader.core.TradeServices">
+      <service-properties>
+          <entry key="mode" value="jpa"/>
+      </service-properties>
+  </service>
+
+  <service id="tradeDBServicesJPA" ref="tradeServicesBeanJPA" interface="org.apache.geronimo.samples.daytrader.core.TradeDBServices">
+      <service-properties>
+          <entry key="mode" value="jpa"/>
+      </service-properties>
+  </service>
+
 </blueprint>
 

Modified: geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/listener.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/listener.xml?rev=822886&r1=822885&r2=822886&view=diff
==============================================================================
--- geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/listener.xml
(original)
+++ geronimo/sandbox/jbohn/daytrader-bp/modules/core/src/main/resources/OSGI-INF/blueprint/listener.xml
Wed Oct  7 20:06:16 2009
@@ -1,28 +1,38 @@
 <blueprint>
 
-  <bean id="tradeServicesManager" class="org.apache.geronimo.samples.daytrader.core.TradeServicesManagerImpl"
activation="lazy" init-method="init">
-      <property name="tradeServices" ref="tradeServicesList"/>
-      <property name="tradeDBServices" ref="tradeDBServicesList"/>
+  <bean id="tradeServicesManagerBean" class="org.apache.geronimo.samples.daytrader.core.TradeServicesManagerImpl"
activation="lazy" init-method="init">
+      <!--<property name="tradeServices" ref="tradeServicesList"/>-->
+      <!--<property name="tradeDBServices" ref="tradeDBServicesList"/>-->
+      <property name="tradeServices" ref="tradeServicesRefJDBC"/>
+      <property name="tradeDBServices" ref="tradeDBServicesRefJDBC"/>
+      <property name="tradeServicesJPA" ref="tradeServicesRefJPA"/>
+      <property name="tradeDBServicesJPA" ref="tradeDBServicesRefJPA"/>
       <property name="test" value="test"/>
   </bean>
   
-  <service ref="tradeServicesManager" interface="org.apache.geronimo.samples.daytrader.core.TradeServicesManager"/>
+  <service id="TradeServicesManager" ref="tradeServicesManagerBean" interface="org.apache.geronimo.samples.daytrader.core.TradeServicesManager"/>
 
-  <reference id="tradeServicesList" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeServices">
-    <reference-listener ref="tradeServicesManager" bind-method="bindService" unbind-method="unbindService"/>
+  <reference id="tradeServicesRefJDBC" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeServices"
filter="(mode=jdbc)">
+    <reference-listener ref="tradeServicesManagerBean" bind-method="bindService" unbind-method="unbindService"/>
+  </reference>
+  <reference id="tradeServicesRefJPA" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeServices"
filter="(mode=jpa)">
+    <reference-listener ref="tradeServicesManagerBean" bind-method="bindService" unbind-method="unbindService"/>
   </reference>
 <!--
   <ref-list id="tradeServicesList" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeServices">
-      <reference-listener ref="tradeServicesManager" bind-method="bindService" unbind-method="unbindService"
/>
+      <reference-listener ref="tradeServicesManagerBean" bind-method="bindService" unbind-method="unbindService"
/>
   </ref-list>
 -->
 
-  <reference id="tradeDBServicesList" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeDBServices">
-    <reference-listener ref="tradeServicesManager" bind-method="bindDBService" unbind-method="unbindDBService"/>
+  <reference id="tradeDBServicesRefJDBC" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeDBServices"
filter="(mode=jdbc)">
+    <reference-listener ref="tradeServicesManagerBean" bind-method="bindDBService" unbind-method="unbindDBService"/>
+  </reference>
+  <reference id="tradeDBServicesRefJPA" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeDBServices"
filter="(mode=jpa)">
+    <reference-listener ref="tradeServicesManagerBean" bind-method="bindDBService" unbind-method="unbindDBService"/>
   </reference>
 <!--
   <ref-list id="tradeDBServicesList" availability="optional" interface="org.apache.geronimo.samples.daytrader.core.TradeDBServices">
-      <reference-listener ref="tradeServicesManager" bind-method="bindDBService" unbind-method="unbindDBService"
/>
+      <reference-listener ref="tradeServicesManagerBean" bind-method="bindDBService" unbind-method="unbindDBService"
/>
   </ref-list>
 -->
 </blueprint>



Mime
View raw message