001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.geronimo.samples.daytrader; 018 019 import java.math.BigDecimal; 020 import java.util.ArrayList; 021 import java.util.Random; 022 023 import org.apache.geronimo.samples.daytrader.util.Log; 024 025 026 /** 027 * TradeConfig is a JavaBean holding all configuration and runtime parameters for the Trade application 028 * TradeConfig sets runtime parameters such as the RunTimeMode (EJB, JDBC, EJB_ALT) 029 * 030 */ 031 032 public class TradeConfig { 033 034 /* Trade Runtime Configuration Parameters */ 035 036 /* Trade Runtime Mode parameters */ 037 public static String[] runTimeModeNames = { "EJB", "Direct", "SessionDirect", "JPA" }; 038 public static final int EJB = 0; 039 public static final int DIRECT = 1; 040 public static final int SESSION = 2; 041 public static final int JPA = 3; 042 public static int runTimeMode = JPA; 043 044 public static String[] orderProcessingModeNames = 045 { "Synchronous", "Asynchronous_1-Phase", "Asynchronous_2-Phase" }; 046 public static final int SYNCH = 0; 047 public static final int ASYNCH = 1; 048 public static final int ASYNCH_2PHASE = 2; 049 public static int orderProcessingMode = SYNCH; 050 051 public static String[] accessModeNames = { "Standard", "WebServices" }; 052 public static final int STANDARD = 0; 053 public static final int WEBSERVICES = 1; 054 private static int accessMode = STANDARD; 055 056 /* Trade Scenario Workload parameters */ 057 public static String[] workloadMixNames = { "Standard", "High-Volume", }; 058 public final static int SCENARIOMIX_STANDARD = 0; 059 public final static int SCENARIOMIX_HIGHVOLUME = 1; 060 public static int workloadMix = SCENARIOMIX_STANDARD; 061 062 /* Trade Web Interface parameters */ 063 public static String[] webInterfaceNames = { "JSP", "JSP-Images" }; 064 public static final int JSP = 0; 065 public static final int JSP_Images = 1; 066 public static int webInterface = JSP; 067 068 /* Trade Caching Type parameters */ 069 public static String[] cachingTypeNames = { "DistributedMap", "Command Caching", "No Caching" }; 070 public static final int DISTRIBUTEDMAP = 0; 071 public static final int COMMAND_CACHING = 1; 072 public static final int NO_CACHING = 2; 073 public static int cachingType = NO_CACHING; 074 075 /* Trade Database Scaling parameters*/ 076 private static int MAX_USERS = 50; 077 private static int MAX_QUOTES = 100; 078 079 /* Trade Database specific paramters */ 080 public static String JDBC_UID = null; 081 public static String JDBC_PWD = null; 082 public static String DS_NAME = "java:comp/env/jdbc/TradeDataSource"; 083 084 /*Trade SOAP specific parameters */ 085 private static String SoapURL = 086 "http://localhost:8080/daytrader/services/TradeWSServices"; 087 088 /*Trade XA Datasource specific parameters */ 089 public static boolean JDBCDriverNeedsGlobalTransation = false; 090 091 /* Trade Config Miscellaneous itmes */ 092 public static String DATASOURCE = "java:comp/env/jdbc/TradeDataSource"; 093 public static int KEYBLOCKSIZE = 1000; 094 public static int QUOTES_PER_PAGE = 10; 095 public static boolean RND_USER = true; 096 //public static int RND_SEED = 0; 097 private static int MAX_HOLDINGS = 10; 098 private static int count = 0; 099 private static Object userID_count_semaphore = new Object(); 100 private static int userID_count = 0; 101 private static String hostName = null; 102 private static Random r0 = new Random(System.currentTimeMillis()); 103 //private static Random r1 = new Random(RND_SEED); 104 private static Random randomNumberGenerator = r0; 105 public static final String newUserPrefix = "ru:"; 106 public static final int verifyPercent = 5; 107 private static boolean trace = false; 108 private static boolean actionTrace = false; 109 private static boolean updateQuotePrices = true; 110 private static int primIterations = 1; 111 private static boolean longRun = true; 112 113 /* 114 * Penny stocks is a problem where the random price change factor gets a stock 115 * down to $.01. In this case trade jumpstarts the price back to $6.00 to 116 * keep the math interesting. 117 */ 118 public static BigDecimal PENNY_STOCK_PRICE; 119 public static BigDecimal PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER; 120 static { 121 PENNY_STOCK_PRICE = new BigDecimal(0.01); 122 PENNY_STOCK_PRICE = 123 PENNY_STOCK_PRICE.setScale(2, BigDecimal.ROUND_HALF_UP); 124 PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER = new BigDecimal(600.0); 125 PENNY_STOCK_RECOVERY_MIRACLE_MULTIPLIER.setScale( 126 2, 127 BigDecimal.ROUND_HALF_UP); 128 } 129 130 /* Trade Scenario actions mixes. Each of the array rows represents a specific Trade Scenario Mix. 131 The columns give the percentages for each action in the column header. Note: "login" is always 0. 132 logout represents both login and logout (because each logout operation will cause a new login when 133 the user context attempts the next action. 134 */ 135 /* Trade Scenario Workload parameters */ 136 public final static int HOME_OP = 0; 137 public final static int QUOTE_OP = 1; 138 public final static int LOGIN_OP = 2; 139 public final static int LOGOUT_OP = 3; 140 public final static int REGISTER_OP = 4; 141 public final static int ACCOUNT_OP = 5; 142 public final static int PORTFOLIO_OP = 6; 143 public final static int BUY_OP = 7; 144 public final static int SELL_OP = 8; 145 public final static int UPDATEACCOUNT_OP = 9; 146 147 private static int scenarioMixes[][] = { 148 // h q l o r a p b s u 149 { 20, 40, 0, 4, 2, 10, 12, 4, 4, 4 }, //STANDARD 150 { 151 20, 40, 0, 4, 2, 7, 7, 7, 7, 6 }, //High Volume 152 }; 153 private static char actions[] = 154 { 'h', 'q', 'l', 'o', 'r', 'a', 'p', 'b', 's', 'u' }; 155 private static int sellDeficit = 0; 156 //Tracks the number of buys over sell when a users portfolio is empty 157 // Used to maintain the correct ratio of buys/sells 158 159 /* JSP pages for all Trade Actions */ 160 161 public final static int WELCOME_PAGE = 0; 162 public final static int REGISTER_PAGE = 1; 163 public final static int PORTFOLIO_PAGE = 2; 164 public final static int QUOTE_PAGE = 3; 165 public final static int HOME_PAGE = 4; 166 public final static int ACCOUNT_PAGE = 5; 167 public final static int ORDER_PAGE = 6; 168 public final static int CONFIG_PAGE = 7; 169 public final static int STATS_PAGE = 8; 170 171 //FUTURE Add XML/XSL View 172 public static String webUI[][] = 173 { 174 { 175 "/welcome.jsp", 176 "/register.jsp", 177 "/portfolio.jsp", 178 "/quote.jsp", 179 "/tradehome.jsp", 180 "/account.jsp", 181 "/order.jsp", 182 "/config.jsp", 183 "/runStats.jsp" }, 184 //JSP Interface 185 { 186 "/welcomeImg.jsp", 187 "/registerImg.jsp", 188 "/portfolioImg.jsp", 189 "/quoteImg.jsp", 190 "/tradehomeImg.jsp", 191 "/accountImg.jsp", 192 "/orderImg.jsp", 193 "/config.jsp", 194 "/runStats.jsp" }, 195 //JSP Interface 196 }; 197 198 // These are the property settings the VAJ access beans look for. 199 private static final String NAMESERVICE_TYPE_PROPERTY = 200 "java.naming.factory.initial"; 201 private static final String NAMESERVICE_PROVIDER_URL_PROPERTY = 202 "java.naming.provider.url"; 203 204 // FUTURE: 205 // If a "trade2.properties" property file is supplied, reset the default values 206 // to match those specified in the file. This provides a persistent runtime 207 // property mechanism during server startup 208 209 /** 210 * Return the hostname for this system 211 * Creation date: (2/16/2000 9:02:25 PM) 212 */ 213 214 private static String getHostname() { 215 try { 216 if (hostName == null) { 217 hostName = java.net.InetAddress.getLocalHost().getHostName(); 218 //Strip of fully qualifed domain if necessary 219 try { 220 hostName = hostName.substring(0, hostName.indexOf('.')); 221 } catch (Exception e) { 222 } 223 } 224 } catch (Exception e) { 225 Log.error( 226 "Exception getting local host name using 'localhost' - ", 227 e); 228 hostName = "localhost"; 229 } 230 return hostName; 231 } 232 233 /** 234 * Return a Trade UI Web page based on the current configuration 235 * This may return a JSP page or a Servlet page 236 * Creation date: (3/14/2000 9:08:34 PM) 237 */ 238 239 public static String getPage(int pageNumber) { 240 return webUI[webInterface][pageNumber]; 241 } 242 243 /** 244 * Return the list of run time mode names 245 * Creation date: (3/8/2000 5:58:34 PM) 246 * @return java.lang.String[] 247 */ 248 public static java.lang.String[] getRunTimeModeNames() { 249 return runTimeModeNames; 250 } 251 252 private static int scenarioCount = 0; 253 254 /** 255 * Return a Trade Scenario Operation based on the setting of the current mix (TradeScenarioMix) 256 * Creation date: (2/10/2000 9:08:34 PM) 257 */ 258 259 public static char getScenarioAction(boolean newUser) { 260 int r = rndInt(100); //0 to 99 = 100 261 int i = 0; 262 int sum = scenarioMixes[workloadMix][i]; 263 while (sum <= r) { 264 i++; 265 sum += scenarioMixes[workloadMix][i]; 266 } 267 268 incrementScenarioCount(); 269 270 /* In TradeScenarioServlet, if a sell action is selected, but the users portfolio is empty, 271 * a buy is executed instead and sellDefecit is incremented. This allows the number of buy/sell 272 * operations to stay in sync w/ the given Trade mix. 273 */ 274 275 if ((!newUser) && (actions[i] == 'b')) { 276 synchronized (TradeConfig.class) { 277 if (sellDeficit > 0) { 278 sellDeficit--; 279 return 's'; 280 //Special case for TradeScenarioServlet to note this is a buy switched to a sell to fix sellDeficit 281 } 282 } 283 } 284 285 return actions[i]; 286 } 287 288 public static String getUserID() { 289 String userID; 290 if (RND_USER) { 291 userID = rndUserID(); 292 } else { 293 userID = nextUserID(); 294 } 295 return userID; 296 } 297 private static final BigDecimal orderFee = new BigDecimal("24.95"); 298 private static final BigDecimal cashFee = new BigDecimal("0.0"); 299 public static BigDecimal getOrderFee(String orderType) { 300 if ((orderType.compareToIgnoreCase("BUY") == 0) 301 || (orderType.compareToIgnoreCase("SELL") == 0)) 302 return orderFee; 303 304 return cashFee; 305 306 } 307 308 /** 309 * Increment the sell deficit counter 310 * Creation date: (6/21/2000 11:33:45 AM) 311 */ 312 public synchronized static void incrementSellDeficit() { 313 sellDeficit++; 314 } 315 316 public static String nextUserID() { 317 String userID; 318 synchronized (userID_count_semaphore) { 319 userID = "uid:" + userID_count; 320 userID_count++; 321 if (userID_count % MAX_USERS == 0) { 322 userID_count = 0; 323 } 324 } 325 return userID; 326 } 327 public static double random() { 328 return randomNumberGenerator.nextDouble(); 329 } 330 public static String rndAddress() { 331 return rndInt(1000) + " Oak St."; 332 } 333 public static String rndBalance() { 334 //Give all new users a cool mill in which to trade 335 return "1000000"; 336 } 337 public static String rndCreditCard() { 338 return rndInt(100) 339 + "-" 340 + rndInt(1000) 341 + "-" 342 + rndInt(1000) 343 + "-" 344 + rndInt(1000); 345 } 346 public static String rndEmail(String userID) { 347 return userID + "@" + rndInt(100) + ".com"; 348 } 349 public static String rndFullName() { 350 return "first:" + rndInt(1000) + " last:" + rndInt(5000); 351 } 352 public static int rndInt(int i) { 353 return (new Float(random() * i)).intValue(); 354 } 355 public static float rndFloat(int i) { 356 return (new Float(random() * i)).floatValue(); 357 } 358 public static BigDecimal rndBigDecimal(float f) { 359 return (new BigDecimal(random() * f)).setScale( 360 2, 361 BigDecimal.ROUND_HALF_UP); 362 } 363 364 public static boolean rndBoolean() { 365 return randomNumberGenerator.nextBoolean(); 366 } 367 368 /** 369 * Returns a new Trade user 370 * Creation date: (2/16/2000 8:50:35 PM) 371 */ 372 public synchronized static String rndNewUserID() { 373 374 return newUserPrefix 375 + getHostname() 376 + System.currentTimeMillis() 377 + count++; 378 } 379 380 public static float rndPrice() { 381 return ((new Integer(rndInt(200))).floatValue()) + 1.0f; 382 } 383 private final static BigDecimal ONE = new BigDecimal(1.0); 384 public static BigDecimal getRandomPriceChangeFactor() { 385 //stocks are equally likely to go up or down 386 double percentGain = rndFloat(1) + 0.5; 387 // change factor is between +/- 50% 388 BigDecimal percentGainBD = 389 (new BigDecimal(percentGain)).setScale(2, BigDecimal.ROUND_HALF_UP); 390 if (percentGainBD.doubleValue() <= 0.0) 391 percentGainBD = ONE; 392 393 return percentGainBD; 394 } 395 396 public static float rndQuantity() { 397 return ((new Integer(rndInt(200))).floatValue()) + 1.0f; 398 } 399 400 public static String rndSymbol() { 401 return "s:" + rndInt(MAX_QUOTES - 1); 402 } 403 public static String rndSymbols() { 404 405 String symbols = ""; 406 int num_symbols = rndInt(QUOTES_PER_PAGE); 407 408 for (int i = 0; i <= num_symbols; i++) { 409 symbols += "s:" + rndInt(MAX_QUOTES - 1); 410 if (i < num_symbols) 411 symbols += ","; 412 } 413 return symbols; 414 } 415 416 public static String rndUserID() { 417 String nextUser = getNextUserIDFromDeck(); 418 if (Log.doTrace()) 419 Log.trace("TradeConfig:rndUserID -- new trader = " + nextUser); 420 421 return nextUser; 422 } 423 424 private static synchronized String getNextUserIDFromDeck() { 425 int numUsers = getMAX_USERS(); 426 if (deck == null) { 427 deck = new ArrayList(numUsers); 428 for (int i = 0; i < numUsers; i++) 429 deck.add(i, new Integer(i)); 430 java.util.Collections.shuffle(deck, r0); 431 } 432 if (card >= numUsers) 433 card = 0; 434 return "uid:" + deck.get(card++); 435 436 } 437 438 //Trade implements a card deck approach to selecting 439 // users for trading with tradescenarioservlet 440 private static ArrayList deck = null; 441 private static int card = 0; 442 443 /** 444 * Set the list of run time mode names 445 * Creation date: (3/8/2000 5:58:34 PM) 446 * @param newRunTimeModeNames java.lang.String[] 447 */ 448 public static void setRunTimeModeNames( 449 java.lang.String[] newRunTimeModeNames) { 450 runTimeModeNames = newRunTimeModeNames; 451 } 452 /** 453 * This is a convenience method for servlets to set Trade configuration parameters 454 * from servlet initialization parameters. The servlet provides the init param and its 455 * value as strings. This method then parses the parameter, converts the value to the 456 * correct type and sets the corresponding TradeConfig parameter to the converted value 457 * 458 */ 459 public static void setConfigParam(String parm, String value) { 460 Log.log("TradeConfig setting parameter: " + parm + "=" + value); 461 // Compare the parm value to valid TradeConfig parameters that can be set 462 // by servlet initialization 463 464 // First check the proposed new parm and value - if empty or null ignore it 465 if (parm == null) 466 return; 467 parm = parm.trim(); 468 if (parm.length() <= 0) 469 return; 470 if (value == null) 471 return; 472 value = value.trim(); 473 474 if (parm.equalsIgnoreCase("runTimeMode")) { 475 try { 476 for (int i = 0; i < runTimeModeNames.length; i++) { 477 if (value.equalsIgnoreCase(runTimeModeNames[i])) { 478 runTimeMode = i; 479 break; 480 } 481 } 482 } catch (Exception e) { 483 //>>rjm 484 Log.error( 485 "TradeConfig.setConfigParm(..): minor exception caught" 486 + "trying to set runtimemode to " 487 + value 488 + "reverting to current value: " 489 + runTimeModeNames[runTimeMode], 490 e); 491 } // If the value is bad, simply revert to current 492 } else if (parm.equalsIgnoreCase("orderProcessingMode")) { 493 try { 494 for (int i = 0; i < orderProcessingModeNames.length; i++) { 495 if (value.equalsIgnoreCase(orderProcessingModeNames[i])) { 496 orderProcessingMode = i; 497 break; 498 } 499 } 500 } catch (Exception e) { 501 Log.error( 502 "TradeConfig.setConfigParm(..): minor exception caught" 503 + "trying to set orderProcessingMode to " 504 + value 505 + "reverting to current value: " 506 + orderProcessingModeNames[orderProcessingMode], 507 e); 508 } // If the value is bad, simply revert to current 509 } else if (parm.equalsIgnoreCase("accessMode")) { 510 try { 511 for (int i = 0; i < accessModeNames.length; i++) { 512 if (value.equalsIgnoreCase(accessModeNames[i])) { 513 accessMode = i; 514 break; 515 } 516 } 517 } 518 catch (Exception e) { 519 Log.error( 520 "TradeConfig.setConfigParm(..): minor exception caught" 521 + "trying to set accessMode to " 522 + value 523 + "reverting to current value: " 524 + accessModeNames[accessMode], 525 e); 526 } 527 } else if (parm.equalsIgnoreCase("webServicesEndpoint")) { 528 try { 529 setSoapURL(value); 530 } catch (Exception e) { 531 Log.error( 532 "TradeConfig.setConfigParm(..): minor exception caught" 533 + "Setting web services endpoint", 534 e); 535 } //On error, revert to saved 536 } else if (parm.equalsIgnoreCase("workloadMix")) { 537 try { 538 for (int i = 0; i < workloadMixNames.length; i++) { 539 if (value.equalsIgnoreCase(workloadMixNames[i])) { 540 workloadMix = i; 541 break; 542 } 543 } 544 } catch (Exception e) { 545 Log.error( 546 "TradeConfig.setConfigParm(..): minor exception caught" 547 + "trying to set workloadMix to " 548 + value 549 + "reverting to current value: " 550 + workloadMixNames[workloadMix], 551 e); 552 } // If the value is bad, simply revert to current 553 } else if (parm.equalsIgnoreCase("WebInterface")) { 554 try { 555 for (int i = 0; i < webInterfaceNames.length; i++) { 556 if (value.equalsIgnoreCase(webInterfaceNames[i])) { 557 webInterface = i; 558 break; 559 } 560 } 561 } catch (Exception e) { 562 Log.error( 563 "TradeConfig.setConfigParm(..): minor exception caught" 564 + "trying to set WebInterface to " 565 + value 566 + "reverting to current value: " 567 + webInterfaceNames[webInterface], 568 e); 569 570 } // If the value is bad, simply revert to current 571 } else if (parm.equalsIgnoreCase("CachingType")) { 572 try { 573 for (int i = 0; i < cachingTypeNames.length; i++) { 574 if (value.equalsIgnoreCase(cachingTypeNames[i])) { 575 cachingType = i; 576 break; 577 } 578 } 579 } catch (Exception e) { 580 Log.error( 581 "TradeConfig.setConfigParm(..): minor exception caught" 582 + "trying to set CachingType to " 583 + value 584 + "reverting to current value: " 585 + cachingTypeNames[cachingType], 586 e); 587 } // If the value is bad, simply revert to current 588 } else if (parm.equalsIgnoreCase("maxUsers")) { 589 try { 590 MAX_USERS = Integer.parseInt(value); 591 } catch (Exception e) { 592 Log.error( 593 "TradeConfig.setConfigParm(..): minor exception caught" 594 + "Setting maxusers, error parsing string to int:" 595 + value 596 + "revering to current value: " 597 + MAX_USERS, 598 e); 599 } //On error, revert to saved 600 } else if (parm.equalsIgnoreCase("maxQuotes")) { 601 try { 602 MAX_QUOTES = Integer.parseInt(value); 603 } catch (Exception e) { 604 //>>rjm 605 Log.error( 606 "TradeConfig.setConfigParm(...) minor exception caught" 607 + "Setting max_quotes, error parsing string to int " 608 + value 609 + "reverting to current value: " 610 + MAX_QUOTES, 611 e); 612 //<<rjm 613 } //On error, revert to saved 614 } else if (parm.equalsIgnoreCase("primIterations")) { 615 try { 616 primIterations = Integer.parseInt(value); 617 } catch (Exception e) { 618 Log.error( 619 "TradeConfig.setConfigParm(..): minor exception caught" 620 + "Setting primIterations, error parsing string to int:" 621 + value 622 + "revering to current value: " 623 + primIterations, 624 e); 625 } //On error, revert to saved 626 } 627 } 628 629 /** 630 * Gets the orderProcessingModeNames 631 * @return Returns a String[] 632 */ 633 public static String[] getOrderProcessingModeNames() { 634 return orderProcessingModeNames; 635 } 636 637 /** 638 * Gets the workloadMixNames 639 * @return Returns a String[] 640 */ 641 public static String[] getWorkloadMixNames() { 642 return workloadMixNames; 643 } 644 645 /** 646 * Gets the webInterfaceNames 647 * @return Returns a String[] 648 */ 649 public static String[] getWebInterfaceNames() { 650 return webInterfaceNames; 651 } 652 653 /** 654 * Gets the webInterfaceNames 655 * @return Returns a String[] 656 */ 657 public static String[] getCachingTypeNames() { 658 return cachingTypeNames; 659 } 660 661 /** 662 * Gets the scenarioMixes 663 * @return Returns a int[][] 664 */ 665 public static int[][] getScenarioMixes() { 666 return scenarioMixes; 667 } 668 669 /** 670 * Gets the trace 671 * @return Returns a boolean 672 */ 673 public static boolean getTrace() { 674 return trace; 675 } 676 /** 677 * Sets the trace 678 * @param trace The trace to set 679 */ 680 public static void setTrace(boolean traceValue) { 681 trace = traceValue; 682 } 683 684 /** 685 * Gets the mAX_USERS. 686 * @return Returns a int 687 */ 688 public static int getMAX_USERS() { 689 return MAX_USERS; 690 } 691 692 /** 693 * Sets the mAX_USERS. 694 * @param mAX_USERS The mAX_USERS to set 695 */ 696 public static void setMAX_USERS(int mAX_USERS) { 697 MAX_USERS = mAX_USERS; 698 deck = null; // reset the card deck for selecting users 699 } 700 701 /** 702 * Gets the mAX_QUOTES. 703 * @return Returns a int 704 */ 705 public static int getMAX_QUOTES() { 706 return MAX_QUOTES; 707 } 708 709 /** 710 * Sets the mAX_QUOTES. 711 * @param mAX_QUOTES The mAX_QUOTES to set 712 */ 713 public static void setMAX_QUOTES(int mAX_QUOTES) { 714 MAX_QUOTES = mAX_QUOTES; 715 } 716 717 /** 718 * Gets the mAX_HOLDINGS. 719 * @return Returns a int 720 */ 721 public static int getMAX_HOLDINGS() { 722 return MAX_HOLDINGS; 723 } 724 725 /** 726 * Sets the mAX_HOLDINGS. 727 * @param mAX_HOLDINGS The mAX_HOLDINGS to set 728 */ 729 public static void setMAX_HOLDINGS(int mAX_HOLDINGS) { 730 MAX_HOLDINGS = mAX_HOLDINGS; 731 } 732 733 /** 734 * Gets the actionTrace. 735 * @return Returns a boolean 736 */ 737 public static boolean getActionTrace() { 738 return actionTrace; 739 } 740 741 /** 742 * Sets the actionTrace. 743 * @param actionTrace The actionTrace to set 744 */ 745 public static void setActionTrace(boolean actionTrace) { 746 TradeConfig.actionTrace = actionTrace; 747 } 748 749 /** 750 * Gets the scenarioCount. 751 * @return Returns a int 752 */ 753 public static int getScenarioCount() { 754 return scenarioCount; 755 } 756 757 /** 758 * Sets the scenarioCount. 759 * @param scenarioCount The scenarioCount to set 760 */ 761 public static void setScenarioCount(int scenarioCount) { 762 TradeConfig.scenarioCount = scenarioCount; 763 } 764 765 public static synchronized void incrementScenarioCount() { 766 scenarioCount++; 767 } 768 769 /** 770 * Gets the jdbc driver needs global transaction 771 * Some XA Drivers require a global transaction to be started 772 * for all SQL calls. To work around this, set this to true 773 * to cause the direct mode to start a user transaction. 774 * @return Returns a boolean 775 */ 776 public static boolean getJDBCDriverNeedsGlobalTransation() { 777 return JDBCDriverNeedsGlobalTransation; 778 } 779 780 /** 781 * Sets the jdbc driver needs global transaction 782 * @param JDBCDriverNeedsGlobalTransationVal the value 783 */ 784 public static void setJDBCDriverNeedsGlobalTransation(boolean JDBCDriverNeedsGlobalTransationVal) { 785 JDBCDriverNeedsGlobalTransation = JDBCDriverNeedsGlobalTransationVal; 786 } 787 788 /** 789 * Gets the updateQuotePrices. 790 * @return Returns a boolean 791 */ 792 public static boolean getUpdateQuotePrices() { 793 return updateQuotePrices; 794 } 795 796 /** 797 * Sets the updateQuotePrices. 798 * @param updateQuotePrices The updateQuotePrices to set 799 */ 800 public static void setUpdateQuotePrices(boolean updateQuotePrices) { 801 TradeConfig.updateQuotePrices = updateQuotePrices; 802 } 803 804 public static String getSoapURL() { 805 return SoapURL; 806 } 807 808 public static void setSoapURL(String value) { 809 SoapURL = value; 810 // TradeWebSoapProxy.updateServicePort(); 811 } 812 813 public static int getAccessMode() { 814 return accessMode; 815 } 816 817 public static void setAccessMode(int value) { 818 accessMode = value; 819 // TradeWebSoapProxy.updateServicePort(); 820 } 821 822 public static int getPrimIterations() { 823 return primIterations; 824 } 825 826 public static void setPrimIterations(int iter) { 827 primIterations = iter; 828 } 829 830 public static boolean getLongRun() { 831 return longRun; 832 } 833 834 public static void setLongRun(boolean longRun) { 835 TradeConfig.longRun = longRun; 836 } 837 }