String stepPeriodString = (String)map.get(STEP_PERIOD); if ((stepPeriodString != null) && (!(stepPeriodString.trim().equals("")))) { try { stepPeriod = (new Long(stepPeriodString)).longValue(); } catch (Exception e) { stepPeriod = -1; } } else {  stepPeriod = 24 * 60 * 60; stepPeriod = stepPeriod * 1000; }  if (!isLegalPeriod(stepPeriod)) { logger.error("Illegal Step Period - not in days or hours"); stepPeriod = -1; }
  private HashMap readParameters() {    final String errorString = "DemandGeneratorPlugin requires 2 parameters, Supply Type and Gemerate Period (secs).  Generate Period must be in whole days or whole hours (< 24).  There is also a optional parameter RANDOM_DEVIATION_ON=<true,false> which enables whole number POISSON random deviation around the supply task quanity.";    Collection p = getParameters();    if (p.isEmpty()) {      if (logger.isErrorEnabled()) {        logger.error(errorString);      }      return null;    }    HashMap map = new HashMap();    int idx;    for (Iterator i = p.iterator(); i.hasNext();) {      String s = (String) i.next();      if ((idx = s.indexOf('=')) != -1) {        String key = new String(s.substring(0, idx));        String value = new String(s.substring(idx + 1, s.length()));        map.put(key.trim(), value.trim());      }    }    supplyType = (String) map.get(SUPPLY_TYPE);    String periodString = (String) map.get(GENERATE_PERIOD);    if ((periodString != null) &&        (!(periodString.trim().equals("")))) {      try {        period = (new Long(periodString)).longValue();      } catch (Exception e) {        period = -1;      }    } else {      //Default is 24 hours      period = 24 * 60 * 60;      period = period * 1000;    }    if (!isLegalPeriod(period)) {      logger.error("Illegal Period - not in days or hours");      period = -1;    }    String poissonOnString = (String) map.get(RANDOM_DEVIATION_ON);    if (poissonOnString != null) {      poissonOnString = poissonOnString.trim().toLowerCase();      poissonOn = (poissonOnString.equals("true"));      //logger.shout("RANDOM_DEVIATION_ON=" + poissonOn);    }    if (((supplyType == null) ||        (period <= 0) &&        logger.isErrorEnabled())) {      logger.error(errorString);    }    return map;  }