Package org.apache.aries.samples.ariestrader.api

Examples of org.apache.aries.samples.ariestrader.api.TradeServices


        String symbol, companyName;
        int errorCount = 0; // Give up gracefully after 10 errors
        if (tradeServicesManager == null) {
            tradeServicesManager = TradeServiceUtilities.getTradeServicesManager();
        }
        TradeServices tradeServices = tradeServicesManager.getTradeServices();

        if (tradeDBManager == null) {
            tradeDBManager = TradeServiceUtilities.getTradeDBManager();
        }

        // TradeStatistics.statisticsEnabled=false; // disable statistics
        out.println("<HEAD><BR><EM> TradeBuildDB: Building AriesTrader Database...</EM><BR>"
            + "This operation will take several minutes. Please wait...</HEAD>");
        out.println("<BODY>");

        if (warPath != null) {
            boolean success = false;
            String dbProductName = null;
            File ddlFile = null;
            Object[] sqlBuffer = null;

            // Find out the Database being used
            try {
                dbProductName = tradeDBManager.checkDBProductName();
            } catch (Exception e) {
                Log.error(e, "TradeBuildDB: Unable to check DB Product name");
            }
            if (dbProductName == null) {
                out.println("<BR>TradeBuildDB: **** Unable to check DB Product name,"
                    + "please check Database/AppServer configuration and retry ****</BR></BODY>");
                return;
            }

            // Locate DDL file for the specified database
            try {
                out.println("<BR>TradeBuildDB: **** Database Product detected: "
                    + dbProductName + " ****</BR>");
                if (warPath.equals("")) { // if empty warPath provided assume this is Aries under the Equinox test harness
                    ddlFile = new File("tradeDB.sql");                   
                } else if (dbProductName.startsWith("DB2/")) { // if db is DB2
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "db2" + File.separatorChar + "Table.ddl");
                } else if (dbProductName.startsWith("Apache Derby")) { // if db is Derby
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "derby" + File.separatorChar + "Table.ddl");
                } else if (dbProductName.startsWith("Oracle")) { // if the Db is Oracle
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "oracle" + File.separatorChar + "Table.ddl");
                } else { // Unsupported "Other" Database
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "other" + File.separatorChar + "Table.ddl");
                    out.println("<BR>TradeBuildDB: **** This Database is "
                        + "unsupported/untested use at your own risk ****</BR>");
                }

                if (!ddlFile.exists()) {
                    Log.error("TradeBuildDB: DDL file doesnt exist at path "
                        + ddlFile.getCanonicalPath()
                        + " , please provide the file and retry");
                    out.println("<BR>TradeBuildDB: DDL file doesnt exist at path <I>"
                        + ddlFile.getCanonicalPath() +
                        "</I> , please provide the file and retry ****</BR></BODY>");
                    return;
                }
                out.println("<BR>TradeBuildDB: **** The DDL file at path <I>"
                    + ddlFile.getCanonicalPath()
                    + "</I> will be used ****</BR>");
                out.flush();
            } catch (Exception e) {
                Log.error(e,
                    "TradeBuildDB: Unable to locate DDL file for the specified database");
                out.println("<BR>TradeBuildDB: **** Unable to locate DDL file for "
                    + "the specified database ****</BR></BODY>");
                return;
            }

            // parse the DDL file and fill the SQL commands into a buffer
            try {
                sqlBuffer = parseDDLToBuffer(ddlFile);
            } catch (Exception e) {
                Log.error(e, "TradeBuildDB: Unable to parse DDL file");
                out.println("<BR>TradeBuildDB: **** Unable to parse DDL file for the specified "+
                    "database ****</BR></BODY>");
                return;
            }
            if ((sqlBuffer == null) || (sqlBuffer.length == 0)) {
                out.println("<BR>TradeBuildDB: **** Parsing DDL file returned empty buffer, please check "+
                    "that a valid DB specific DDL file is available and retry ****</BR></BODY>");
                return;
            }

            // send the sql commands buffer to drop and recreate the AriesTrader tables
            out.println("<BR>TradeBuildDB: **** Dropping and Recreating the AriesTrader tables... ****</BR>");
            try {
                success = tradeDBManager.recreateDBTables(sqlBuffer, out);
            } catch (Exception e) {
                Log.error(e,
                    "TradeBuildDB: Unable to drop and recreate AriesTrader Db Tables, "+
                    "please check for database consistency before continuing");
            }
            if (!success) {
                out.println("<BR>TradeBuildDB: **** Unable to drop and recreate AriesTrader Db Tables, "+
                    "please check for database consistency before continuing ****</BR></BODY>");
                return;
            }
            out.println("<BR>TradeBuildDB: **** AriesTrader tables successfully created! ****</BR><BR><b> "+
                "Please Stop and Re-start your AriesTrader application (or your application server) and then use "+
                "the \"Repopulate AriesTrader Database\" link to populate your database.</b></BR><BR><BR></BODY>");
            return;
        } // end of createDBTables

        out.println("<BR>TradeBuildDB: **** Creating "
            + TradeConfig.getMAX_QUOTES() + " Quotes ****</BR>");
        // Attempt to delete all of the Trade users and Trade Quotes first
        try {
            tradeDBManager.resetTrade(true);
        } catch (Exception e) {
            Log.error(e, "TradeBuildDB: Unable to delete Trade users "+
                "(uid:0, uid:1, ...) and Trade Quotes (s:0, s:1, ...)");
        }
        for (int i = 0; i < TradeConfig.getMAX_QUOTES(); i++) {
            symbol = "s:" + i;
            companyName = "S" + i + " Incorporated";
            try {
                tradeServices.createQuote(symbol, companyName,
            new java.math.BigDecimal(TradeConfig.rndPrice()));
                if (i % 10 == 0) {
                    out.print("....." + symbol);
                    if (i % 100 == 0) {
                        out.println(" -<BR>");
                        out.flush();
                    }
                }
            } catch (Exception e) {
                if (errorCount++ >= 10) {
                    String error = "Populate Trade DB aborting after 10 create quote errors. Check "+
                        "the EJB datasource configuration. Check the log for details <BR><BR> Exception is: <BR> "
                        + e.toString();
                    Log.error(e, error);
                    throw e;
                }
            }
        }
        out.println("<BR>");
        out.println("<BR>**** Registering " + TradeConfig.getMAX_USERS()
            + " Users **** ");
        errorCount = 0; // reset for user registrations

        // Registration is a formal operation in Trade 2.
        for (int i = 0; i < TradeConfig.getMAX_USERS(); i++) {
            String userID = "uid:" + i;
            String fullname = TradeConfig.rndFullName();
            String email = TradeConfig.rndEmail(userID);
            String address = TradeConfig.rndAddress();
            String creditcard = TradeConfig.rndCreditCard();
            double initialBalance =
                (double) (TradeConfig.rndInt(100000)) + 200000;
            if (i == 0) {
                initialBalance = 1000000; // uid:0 starts with a cool million.
            }
            try {
                AccountDataBean accountData =
                    tradeServices.register(userID, "xxx", fullname, address,
                        email, creditcard, new BigDecimal(initialBalance));
                if (accountData != null) {
                    if (i % 50 == 0) {
                        out.print("<BR>Account# " + accountData.getAccountID()
                            + " userID=" + userID);
                    }

                    // 0-MAX_HOLDING (inclusive), avg holdings per user = (MAX-0)/2
                    int holdings = TradeConfig.rndInt(TradeConfig.getMAX_HOLDINGS() + 1);
                    double quantity = 0;
                    for (int j = 0; j < holdings; j++) {
                        symbol = TradeConfig.rndSymbol();
                        quantity = TradeConfig.rndQuantity();
                        tradeServices.buy(userID, symbol, quantity,
                TradeConfig.orderProcessingMode);
                    }
                    if (i % 50 == 0) {
                        out.println(" has " + holdings + " holdings.");
                        out.flush();
View Full Code Here


        String symbol, companyName;
        int errorCount = 0; // Give up gracefully after 10 errors
        if (tradeServicesManager == null) {
            tradeServicesManager = TradeServiceUtilities.getTradeServicesManager();
        }
        TradeServices tradeServices = tradeServicesManager.getTradeServices();

        if (tradeDBManager == null) {
            tradeDBManager = TradeServiceUtilities.getTradeDBManager();
        }

        // TradeStatistics.statisticsEnabled=false; // disable statistics
        out.println("<HEAD><BR><EM> TradeBuildDB: Building AriesTrader Database...</EM><BR>"
            + "This operation will take several minutes. Please wait...</HEAD>");
        out.println("<BODY>");

        if (warPath != null) {
            boolean success = false;
            String dbProductName = null;
            File ddlFile = null;
            Object[] sqlBuffer = null;

            // Find out the Database being used
            try {
                dbProductName = tradeDBManager.checkDBProductName();
            } catch (Exception e) {
                Log.error(e, "TradeBuildDB: Unable to check DB Product name");
            }
            if (dbProductName == null) {
                out.println("<BR>TradeBuildDB: **** Unable to check DB Product name,"
                    + "please check Database/AppServer configuration and retry ****</BR></BODY>");
                return;
            }

            // Locate DDL file for the specified database
            try {
                out.println("<BR>TradeBuildDB: **** Database Product detected: "
                    + dbProductName + " ****</BR>");
                if (dbProductName.startsWith("DB2/")) { // if db is DB2
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "db2" + File.separatorChar + "Table.ddl");
                } else if (dbProductName.startsWith("Apache Derby")) { // if db is Derby
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "derby" + File.separatorChar + "Table.ddl");
                } else if (dbProductName.startsWith("Oracle")) { // if the Db is Oracle
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "oracle" + File.separatorChar + "Table.ddl");
                } else { // Unsupported "Other" Database
                    ddlFile = new File(warPath + File.separatorChar + "dbscripts"
                        + File.separatorChar + "other" + File.separatorChar + "Table.ddl");
                    out.println("<BR>TradeBuildDB: **** This Database is "
                        + "unsupported/untested use at your own risk ****</BR>");
                }

                if (!ddlFile.exists()) {
                    Log.error("TradeBuildDB: DDL file doesnt exist at path "
                        + ddlFile.getCanonicalPath()
                        + " , please provide the file and retry");
                    out.println("<BR>TradeBuildDB: DDL file doesnt exist at path <I>"
                        + ddlFile.getCanonicalPath() +
                        "</I> , please provide the file and retry ****</BR></BODY>");
                    return;
                }
                out.println("<BR>TradeBuildDB: **** The DDL file at path <I>"
                    + ddlFile.getCanonicalPath()
                    + "</I> will be used ****</BR>");
                out.flush();
            } catch (Exception e) {
                Log.error(e,
                    "TradeBuildDB: Unable to locate DDL file for the specified database");
                out.println("<BR>TradeBuildDB: **** Unable to locate DDL file for "
                    + "the specified database ****</BR></BODY>");
                return;
            }

            // parse the DDL file and fill the SQL commands into a buffer
            try {
                sqlBuffer = parseDDLToBuffer(ddlFile);
            } catch (Exception e) {
                Log.error(e, "TradeBuildDB: Unable to parse DDL file");
                out.println("<BR>TradeBuildDB: **** Unable to parse DDL file for the specified "+
                    "database ****</BR></BODY>");
                return;
            }
            if ((sqlBuffer == null) || (sqlBuffer.length == 0)) {
                out.println("<BR>TradeBuildDB: **** Parsing DDL file returned empty buffer, please check "+
                    "that a valid DB specific DDL file is available and retry ****</BR></BODY>");
                return;
            }

            // send the sql commands buffer to drop and recreate the AriesTrader tables
            out.println("<BR>TradeBuildDB: **** Dropping and Recreating the AriesTrader tables... ****</BR>");
            try {
                success = tradeDBManager.recreateDBTables(sqlBuffer, out);
            } catch (Exception e) {
                Log.error(e,
                    "TradeBuildDB: Unable to drop and recreate AriesTrader Db Tables, "+
                    "please check for database consistency before continuing");
            }
            if (!success) {
                out.println("<BR>TradeBuildDB: **** Unable to drop and recreate AriesTrader Db Tables, "+
                    "please check for database consistency before continuing ****</BR></BODY>");
                return;
            }
            out.println("<BR>TradeBuildDB: **** AriesTrader tables successfully created! ****</BR><BR><b> "+
                "Please Stop and Re-start your AriesTrader application (or your application server) and then use "+
                "the \"Repopulate AriesTrader Database\" link to populate your database.</b></BR><BR><BR></BODY>");
            return;
        } // end of createDBTables

        out.println("<BR>TradeBuildDB: **** Creating "
            + TradeConfig.getMAX_QUOTES() + " Quotes ****</BR>");
        // Attempt to delete all of the Trade users and Trade Quotes first
        try {
            tradeDBManager.resetTrade(true);
        } catch (Exception e) {
            Log.error(e, "TradeBuildDB: Unable to delete Trade users "+
                "(uid:0, uid:1, ...) and Trade Quotes (s:0, s:1, ...)");
        }
        for (int i = 0; i < TradeConfig.getMAX_QUOTES(); i++) {
            symbol = "s:" + i;
            companyName = "S" + i + " Incorporated";
            try {
                tradeServices.createQuote(symbol, companyName,
            new java.math.BigDecimal(TradeConfig.rndPrice()));
                if (i % 10 == 0) {
                    out.print("....." + symbol);
                    if (i % 100 == 0) {
                        out.println(" -<BR>");
                        out.flush();
                    }
                }
            } catch (Exception e) {
                if (errorCount++ >= 10) {
                    String error = "Populate Trade DB aborting after 10 create quote errors. Check "+
                        "the EJB datasource configuration. Check the log for details <BR><BR> Exception is: <BR> "
                        + e.toString();
                    Log.error(e, error);
                    throw e;
                }
            }
        }
        out.println("<BR>");
        out.println("<BR>**** Registering " + TradeConfig.getMAX_USERS()
            + " Users **** ");
        errorCount = 0; // reset for user registrations

        // Registration is a formal operation in Trade 2.
        for (int i = 0; i < TradeConfig.getMAX_USERS(); i++) {
            String userID = "uid:" + i;
            String fullname = TradeConfig.rndFullName();
            String email = TradeConfig.rndEmail(userID);
            String address = TradeConfig.rndAddress();
            String creditcard = TradeConfig.rndCreditCard();
            double initialBalance =
                (double) (TradeConfig.rndInt(100000)) + 200000;
            if (i == 0) {
                initialBalance = 1000000; // uid:0 starts with a cool million.
            }
            try {
                AccountDataBean accountData =
                    tradeServices.register(userID, "xxx", fullname, address,
                        email, creditcard, new BigDecimal(initialBalance));
                if (accountData != null) {
                    if (i % 50 == 0) {
                        out.print("<BR>Account# " + accountData.getAccountID()
                            + " userID=" + userID);
                    }

                    // 0-MAX_HOLDING (inclusive), avg holdings per user = (MAX-0)/2
                    int holdings = TradeConfig.rndInt(TradeConfig.getMAX_HOLDINGS() + 1);
                    double quantity = 0;
                    for (int j = 0; j < holdings; j++) {
                        symbol = TradeConfig.rndSymbol();
                        quantity = TradeConfig.rndQuantity();
                        tradeServices.buy(userID, symbol, quantity,
                TradeConfig.orderProcessingMode);
                    }
                    if (i % 50 == 0) {
                        out.println(" has " + holdings + " holdings.");
                        out.flush();
View Full Code Here

    StringBuffer output = new StringBuffer(100);

    try
      {
      //TradeJdbc (via TradeServices) uses prepared statements so I am going to make use of it's code.
                        TradeServices tradeServices = TradeServiceUtilities.getTradeServices("(mode=JDBC)");
      symbol = TradeConfig.rndSymbol();
     
      QuoteDataBean quoteData = null;
      int iter = TradeConfig.getPrimIterations();
      for (int ii = 0; ii < iter; ii++) {
        quoteData = tradeServices.getQuote(symbol);
      }

      output.append(
        "<html><head><title>Ping JDBC Read w/ Prepared Stmt.</title></head>"
          + "<body><HR><FONT size=\"+2\" color=\"#000066\">Ping JDBC Read w/ Prep Stmt:</FONT><HR><FONT size=\"-1\" color=\"#000066\">Init time : "
View Full Code Here

    //get a random symbol to update and a random price.
    symbol = TradeConfig.rndSymbol();
    newPrice = TradeConfig.getRandomPriceChangeFactor();

    //TradeJdbc via TradeServices makes use of prepared statements so I am going to reuse the existing code.
                TradeServices tradeServices = TradeServiceUtilities.getTradeServices("(mode=JDBC)");

    //update the price of our symbol
    QuoteDataBean quoteData = null;
    int iter = TradeConfig.getPrimIterations();
    for (int ii = 0; ii < iter; ii++) {
      quoteData = tradeServices.updateQuotePriceVolume(symbol, newPrice, 100.0);
    }

    //write the output
    output.append(
      "<html><head><title>Ping JDBC Write w/ Prepared Stmt.</title></head>"
View Full Code Here

        String symbol, companyName;
        int errorCount = 0; // Give up gracefully after 10 errors
        if (tradeServicesManager == null) {
            tradeServicesManager = TradeServiceUtilities.getTradeServicesManager();
        }
        TradeServices tradeServices = tradeServicesManager.getTradeServices();

        if (tradeDBManager == null) {
            tradeDBManager = TradeServiceUtilities.getTradeDBManager();
        }

        // TradeStatistics.statisticsEnabled=false; // disable statistics
        out.println("<HEAD><BR><EM> TradeBuildDB: Building AriesTrader Database...</EM><BR>"
            + "This operation will take several minutes. Please wait...</HEAD>");
        out.println("<BODY>");

        if (createTables) {
            boolean success = false;
            String dbProductName = null;
            String fileLocation = null;
            URL ddlFile = null;
            Object[] sqlBuffer = null;

            // Find out the Database being used
            try {
                dbProductName = tradeDBManager.checkDBProductName();
            } catch (Exception e) {
                Log.error(e, "TradeBuildDB: Unable to check DB Product name");
            }
            if (dbProductName == null) {
                out.println("<BR>TradeBuildDB: **** Unable to check DB Product name,"
                    + "please check Database/AppServer configuration and retry ****</BR></BODY>");
                return;
            }

            // Locate DDL file for the specified database
            try {
                out.println("<BR>TradeBuildDB: **** Database Product detected: "
                    + dbProductName + " ****</BR>");
                if (dbProductName.startsWith("DB2/")) { // if db is DB2
                    fileLocation = File.separatorChar + "dbscripts" + File.separatorChar + "db2" + File.separatorChar + "Table.ddl";
                } else if (dbProductName.startsWith("Apache Derby")) { // if db is Derby
                    fileLocation = File.separatorChar + "dbscripts" + File.separatorChar + "derby" + File.separatorChar + "Table.ddl";
                } else if (dbProductName.startsWith("Oracle")) { // if the Db is Oracle
                    fileLocation = File.separatorChar + "dbscripts" + File.separatorChar + "oracle" + File.separatorChar + "Table.ddl";
                } else { // Unsupported "Other" Database
                    fileLocation = File.separatorChar + "dbscripts" + File.separatorChar + "other" + File.separatorChar + "Table.ddl";
                    out.println("<BR>TradeBuildDB: **** This Database is "
                        + "unsupported/untested use at your own risk ****</BR>");
                }

                ddlFile = this.getClass().getResource(fileLocation);               

            } catch (Exception e) {
                Log.error(e,
                    "TradeBuildDB: Unable to locate DDL file for the specified database");
                out.println("<BR>TradeBuildDB: **** Unable to locate DDL file for "
                    + "the specified database ****</BR></BODY>");
                return;
            }

            // parse the DDL file and fill the SQL commands into a buffer
            try {
                sqlBuffer = parseDDLToBuffer(ddlFile);
            } catch (Exception e) {
                Log.error(e, "TradeBuildDB: Unable to parse DDL file");
                out.println("<BR>TradeBuildDB: **** Unable to parse DDL file for the specified "+
                    "database ****</BR></BODY>");
                return;
            }
            if ((sqlBuffer == null) || (sqlBuffer.length == 0)) {
                out.println("<BR>TradeBuildDB: **** Parsing DDL file returned empty buffer, please check "+
                    "that a valid DB specific DDL file is available and retry ****</BR></BODY>");
                return;
            }

            // send the sql commands buffer to drop and recreate the AriesTrader tables
            out.println("<BR>TradeBuildDB: **** Dropping and Recreating the AriesTrader tables... ****</BR>");
            try {
                success = tradeDBManager.recreateDBTables(sqlBuffer, out);
            } catch (Exception e) {
                Log.error(e,
                    "TradeBuildDB: Unable to drop and recreate AriesTrader Db Tables, "+
                    "please check for database consistency before continuing");
            }
            if (!success) {
                out.println("<BR>TradeBuildDB: **** Unable to drop and recreate AriesTrader Db Tables, "+
                    "please check for database consistency before continuing ****</BR></BODY>");
                return;
            }
            out.println("<BR>TradeBuildDB: **** AriesTrader tables successfully created! ****</BR><BR><b> "+
                "Please Stop and Re-start your AriesTrader application (or your application server) and then use "+
                "the \"Repopulate AriesTrader Database\" link to populate your database.</b></BR><BR><BR></BODY>");
            return;
        } // end of createDBTables

        out.println("<BR>TradeBuildDB: **** Creating "
            + TradeConfig.getMAX_QUOTES() + " Quotes ****</BR>");
        // Attempt to delete all of the Trade users and Trade Quotes first
        try {
            tradeDBManager.resetTrade(true);
        } catch (Exception e) {
            Log.error(e, "TradeBuildDB: Unable to delete Trade users "+
                "(uid:0, uid:1, ...) and Trade Quotes (s:0, s:1, ...)");
        }
        for (int i = 0; i < TradeConfig.getMAX_QUOTES(); i++) {
            symbol = "s:" + i;
            companyName = "S" + i + " Incorporated";
            try {
                tradeServices.createQuote(symbol, companyName,
            new java.math.BigDecimal(TradeConfig.rndPrice()));
                if (i % 10 == 0) {
                    out.print("....." + symbol);
                    if (i % 100 == 0) {
                        out.println(" -<BR>");
                        out.flush();
                    }
                }
            } catch (Exception e) {
                if (errorCount++ >= 10) {
                    String error = "Populate Trade DB aborting after 10 create quote errors. Check "+
                        "the EJB datasource configuration. Check the log for details <BR><BR> Exception is: <BR> "
                        + e.toString();
                    Log.error(e, error);
                    throw e;
                }
            }
        }
        out.println("<BR>");
        out.println("<BR>**** Registering " + TradeConfig.getMAX_USERS()
            + " Users **** ");
        errorCount = 0; // reset for user registrations

        // Registration is a formal operation in Trade 2.
        for (int i = 0; i < TradeConfig.getMAX_USERS(); i++) {
            String userID = "uid:" + i;
            String fullname = TradeConfig.rndFullName();
            String email = TradeConfig.rndEmail(userID);
            String address = TradeConfig.rndAddress();
            String creditcard = TradeConfig.rndCreditCard();
            double initialBalance =
                (double) (TradeConfig.rndInt(100000)) + 200000;
            if (i == 0) {
                initialBalance = 1000000; // uid:0 starts with a cool million.
            }
            try {
                AccountDataBean accountData =
                    tradeServices.register(userID, "xxx", fullname, address,
                        email, creditcard, new BigDecimal(initialBalance));
                if (accountData != null) {
                    if (i % 50 == 0) {
                        out.print("<BR>Account# " + accountData.getAccountID()
                            + " userID=" + userID);
                    }

                    // 0-MAX_HOLDING (inclusive), avg holdings per user = (MAX-0)/2
                    int holdings = TradeConfig.rndInt(TradeConfig.getMAX_HOLDINGS() + 1);
                    double quantity = 0;
                    for (int j = 0; j < holdings; j++) {
                        symbol = TradeConfig.rndSymbol();
                        quantity = TradeConfig.rndQuantity();
                        tradeServices.buy(userID, symbol, quantity,
                TradeConfig.orderProcessingMode);
                    }
                    if (i % 50 == 0) {
                        out.println(" has " + holdings + " holdings.");
                        out.flush();
View Full Code Here

            return;

        if (tradeServicesManager == null) {
            tradeServicesManager = TradeServiceUtilities.getTradeServicesManager();
        }
        TradeServices tradeServices = tradeServicesManager.getTradeServices();

        try {
            String action = req.getParameter("action");
            if ( action != null ) {
                action = action.trim();
                if ( (action.length() > 0) && (!action.equals("logout")) ) {
                    String userID;
                    if ( action.equals("login") )
                        userID = req.getParameter("uid");
                    else
                        userID = (String) ((HttpServletRequest) req).getSession().getAttribute("uidBean");
                    if ( (userID != null) && (userID.trim().length()>0) ) {

                        java.util.Collection closedOrders = tradeServices.getClosedOrders(userID);
                        if ( (closedOrders!=null) && (closedOrders.size() > 0) ) {
                            req.setAttribute("closedOrders", closedOrders);
                        }
                        if (Log.doTrace()) {
                            Log.printCollection("OrdersAlertFilter: userID="+userID+" closedOrders=", closedOrders);
View Full Code Here

        resp.setContentType("text/html");

        if (tradeServicesManager == null) {
            tradeServicesManager = TradeServiceUtilities.getTradeServicesManager();
        }
        TradeServices tradeServices = tradeServicesManager.getTradeServices();

        TradeServletAction tsAction = new TradeServletAction(tradeServices);

        // Dyna - need status string - prepended to output
        action = req.getParameter("action");
View Full Code Here

    public ArrayList<Integer> getCurrentModes() {
        if (Log.doTrace())
            Log.trace("TradeServicesManagerImpl:getCurrentModes()");
        ArrayList<Integer> modes = new ArrayList<Integer>();
        for (int i=0; i<tradeServicesList.length; i++) {
            TradeServices tradeServicesRef = tradeServicesList[i];
            if (tradeServicesRef != null) {
                modes.add(i);
            }
        }
        return modes;
View Full Code Here

TOP

Related Classes of org.apache.aries.samples.ariestrader.api.TradeServices

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.