Ejemplo n.º 1
0
 // Process Oplan subscription
 private void doUpdateOplans() {
   if (logger.isDebugEnabled()) {
     logger.debug("Updating the Oplans!");
   }
   Enumeration en;
   // Create new ClusterOPlan objects for each added Oplan
   if (oplans_.getAddedList().hasMoreElements()) {
     en = oplans_.getAddedList();
     while (en.hasMoreElements()) {
       Oplan oplan = (Oplan) en.nextElement();
       UID oplanUID = oplan.getUID();
       IncrementalSubscription oplanActivities =
           (IncrementalSubscription) orgActivitySubscriptionOfOPlanUID.get(oplanUID);
       if (oplanActivities == null) {
         oplanActivities =
             (IncrementalSubscription) subscribe(new OplanOrgActivitiesPredicate(oplanUID));
         monitorPluginSubscription(oplanActivities);
         orgActivitySubscriptionOfOPlanUID.put(oplanUID, oplanActivities);
       }
       ClusterOPlan coplan = (ClusterOPlan) ClusterOPlans_.get(oplanUID);
       if (coplan == null) {
         coplan = new ClusterOPlan(clusterId_, oplan);
         ClusterOPlans_.put(oplanUID, coplan);
         publishAdd(coplan);
       }
     }
   }
   // Remove ClusterOPlan objects that are no longer relevant
   if (oplans_.getRemovedList().hasMoreElements()) {
     en = oplans_.getRemovedList();
     while (en.hasMoreElements()) {
       Oplan oplan = (Oplan) en.nextElement();
       UID oplanUID = oplan.getUID();
       ClusterOPlan coplan = (ClusterOPlan) ClusterOPlans_.get(oplanUID);
       // Remove ClusterOPlan from array
       ClusterOPlans_.remove(oplanUID);
       // Cancel subscription
       IncrementalSubscription s =
           (IncrementalSubscription) orgActivitySubscriptionOfOPlanUID.remove(oplanUID);
       if (s != null) unsubscribe(s);
       publishRemove(coplan);
       break;
     }
   }
   if (ClusterOPlans_.isEmpty()) {
     if (logger.isErrorEnabled()) {
       logger.error(" updateOplans no OPLAN");
     }
   }
 }
Ejemplo n.º 2
0
 public ClusterOPlan findOPlan(Oplan oplan) {
   return findOPlan(oplan.getUID());
 }