aggMILSubscription = (CollectionSubscription) blackboard.subscribe(new AggMILPredicate(), false);
aggMILSubscription = (IncrementalSubscription) blackboard.subscribe(new AggMILPredicate());
  protected void setupSubscriptions() {    if (!getBlackboardService().didRehydrate()) {      setupOperatingModes();      prevLevel6 = getEndOfLevelSix();    } else {      // if we did rehydrate set a flag to rehydrate the inventories      //when we are ready in the execute block      rehydrateInvs = true;      Collection level2OMs = getBlackboardService().          query(new OperatingModePredicate(supplyType, LEVEL_2_TIME_HORIZON));      //there should only be one.      Iterator level2it = level2OMs.iterator();      if (level2it.hasNext()) {        level2Horizon = (OperatingMode) level2it.next();      }      Collection level6OMs = getBlackboardService().          query(new OperatingModePredicate(supplyType, LEVEL_6_TIME_HORIZON));      //there should only be one.      Iterator level6it = level6OMs.iterator();      if (level6it.hasNext()) {        level6Horizon = (OperatingMode) level6it.next();      }      prevLevel6 = getEndOfLevelSix();      if (level2Horizon == null || level6Horizon == null) {        if (logger.isErrorEnabled()) {          logger.error("InventoryPlugin in agent: " + getAgentIdentifier() +                       " of supply type: " + supplyType +                       " is missing operating modes upon rehydration... level2 OM is: " +                       level2Horizon + " level 6 OM is: " + level6Horizon);        }      }    }    Level6OMSubscription = (IncrementalSubscription) blackboard.subscribe(new OperatingModePredicate(supplyType, LEVEL_6_TIME_HORIZON));    detReqSubscription = (IncrementalSubscription) blackboard.subscribe(new DetInvReqPredicate(taskUtils));    aggMILSubscription = (CollectionSubscription) blackboard.subscribe(new AggMILPredicate(), false);    milSubscription = (IncrementalSubscription) blackboard.subscribe(new MILPredicate());    detReqHandler.addMILTasks(milSubscription.elements());    selfOrganizations = (IncrementalSubscription) blackboard.subscribe(orgsPredicate);    inventoryPolicySubscription = (IncrementalSubscription) blackboard.subscribe(new InventoryPolicyPredicate(supplyType));    logisticsOPlanSubscription = (IncrementalSubscription) blackboard.subscribe(new LogisticsOPlanPredicate());    withdrawTaskSubscription = (IncrementalSubscription) blackboard.subscribe(new WithdrawPredicate(supplyType));    projectWithdrawTaskSubscription = (IncrementalSubscription) blackboard.subscribe(new ProjectWithdrawPredicate(supplyType));    MIExpansionSubscription = (IncrementalSubscription) blackboard.subscribe(new MIExpansionPredicate(supplyType, taskUtils));    MITopExpansionSubscription = (IncrementalSubscription) blackboard.subscribe(new MITopExpansionPredicate());    DetReqInvExpansionSubscription = (IncrementalSubscription) blackboard.subscribe(new DetReqInvExpansionPredicate(taskUtils));    if (getAgentIdentifier() == null && logger.isErrorEnabled()) {      logger.error("No agentIdentifier ... subscriptions need this info!!  In plugin: " + this);    }    refillAllocationSubscription = (IncrementalSubscription) blackboard.        subscribe(new RefillAllocPredicate(supplyType, getAgentIdentifier().toString(), taskUtils));    expansionSubscription = (IncrementalSubscription) blackboard.        subscribe(new ExpansionPredicate(supplyType, getAgentIdentifier().toString(), taskUtils));    refillSubscription = (IncrementalSubscription) blackboard.        subscribe(new RefillPredicate(supplyType, getAgentIdentifier().toString(), taskUtils));    nonrefillSubscription = (IncrementalSubscription) blackboard.        subscribe(new NonRefillPredicate(supplyType, getAgentIdentifier().toString(), taskUtils));    // Setup TaskSchedulers    String taskScheduler = (String)pluginParams.get(TASK_SCHEDULER_ON);    turnOnTaskSched = new Boolean(taskScheduler).booleanValue();    QuiescenceReportService qrs = (QuiescenceReportService)        getServiceBroker().getService(this, QuiescenceReportService.class, null);    AgentIdentificationService ais = (AgentIdentificationService)        getServiceBroker().getService(this, AgentIdentificationService.class, null);    qrs.setAgentIdentificationService(ais);    QuiescenceAccumulator q = new QuiescenceAccumulator (qrs);    String id = getAgentIdentifier().toString();    if (turnOnTaskSched) {      if (logger.isDebugEnabled())        logger.debug("TASK SCHEDULER ON for "+id);      java.io.InputStream is = null;      try {        is = getConfigFinder().open ("supplyTaskPolicy.xml");      } catch (Exception e) {        logger.error ("Could not find file supplyTaskPolicy.xml");      }      supplyTaskScheduler = new TaskScheduler          (new SupplyTaskPredicate(supplyType, id, taskUtils),           TaskSchedulingPolicy.fromXML (is, this, getAlarmService()),           blackboard, q, logger, "supplyTasks for " + getBlackboardClientName());      try {        is = getConfigFinder().open ("projectionTaskPolicy.xml");      } catch (Exception e) {        logger.error ("Could not find file projectionTaskPolicy.xml");      }      projectionTaskScheduler = new TaskScheduler          (new ProjectionTaskPredicate(supplyType, id, taskUtils),           TaskSchedulingPolicy.fromXML (is, this, getAlarmService()),           blackboard, q, logger, "projTasks for " + getBlackboardClientName());    } else { // TaskScheduler OFF      supplyTaskScheduler = new TaskScheduler          (new SupplyTaskPredicate(supplyType, id, taskUtils),           new TaskSchedulingPolicy (new TaskSchedulingPolicy.Predicate[]           {TaskSchedulingPolicy.PASSALL}),           blackboard, q, logger, "supplyTasks for " + getBlackboardClientName());      projectionTaskScheduler = new TaskScheduler          (new ProjectionTaskPredicate(supplyType, id, taskUtils),           new TaskSchedulingPolicy (new TaskSchedulingPolicy.Predicate[]           {TaskSchedulingPolicy.PASSALL}),           blackboard, q, logger, "projTasks for " + getBlackboardClientName());    }//    supplyTaskSubscription = (IncrementalSubscription) blackboard.//        subscribe(new SupplyTaskPredicate(supplyType, id, taskUtils));//    projectionTaskSubscription = (IncrementalSubscription) blackboard.//        subscribe(new ProjectionTaskPredicate(supplyType, id, taskUtils));  }