System.out.println("HTC PACKER JAVA: Created comp.");
System.out.println("GenericPlugin: Created comp.");
  public boolean createAggregation(Iterator tasksToAgg, MPTask childTask, Plan plan,                                   AllocationResultDistributor distributor) {    // Save into a vector because we want to use the enumeration in multiple    // places    ArrayList parentTasks = new ArrayList();    while (tasksToAgg.hasNext()) {      parentTasks.add((Task)tasksToAgg.next());    }        if (DEBUG) {      System.out.println("HTC PACKER JAVA: Top of create Aggregation.");    }        // Create Composition    NewComposition comp = getFactory().newComposition();        comp.setCombinedTask(childTask);     comp.setDistributor(distributor);        if (DEBUG) {      System.out.println("HTC PACKER JAVA: Created comp.");    }        Iterator taskIterator = parentTasks.iterator();    while (taskIterator.hasNext()) {      Task parentTask = (Task) taskIterator.next();            if (plan == null) {        plan = parentTask.getPlan();                if (plan == null) {          plan = getFactory().getRealityPlan();                    if (plan == null ) {            System.err.println("HTC GenericPlugin: Unable to find plan for aggregation.");            return false;          }        }      }            if (DEBUG) {        System.out.println("HTC PACKER JAVA: Top of while loop.");      }            Aggregation aggregation =         getFactory().createAggregation(plan, parentTask, comp, null);            if (DEBUG) {        System.out.println("HTC PACKER JAVA: built the aggregation.");      }            if (!publishAdd(aggregation)) {        System.err.println("Error publishing aggregation - " +                            aggregation.getUID());      }            /* BOZO - Work around for persistence bug - need to publish the        * aggregation before adding it to the composition.  Should not be        * required since this all occurs inside of a single transaction.       */      comp.addAggregation(aggregation);          }    if (DEBUG) {      System.out.println("HTC PACKER JAVA: After the while loop.");    }        if (!publishAdd(comp)) {      System.err.println("Error publishing composition " +                          comp);    }        NewMPTask mpt = (NewMPTask)childTask;        mpt.setPlan(plan);    mpt.setComposition(comp);    //BOZO !!!    mpt.setParentTasks(new Vector(parentTasks).elements());        if (!publishAdd(childTask)) {      System.err.println("Error publishing mpt - " + mpt.getUID());    }        return true;  }