Examples of ResourceAssignment


Examples of net.sourceforge.ganttproject.task.ResourceAssignment

    public void setCustomFieldVal(String title, Object val) {
      this.customFields.put(title,val);
    }

    public ResourceAssignment createAssignment(ResourceAssignment assignmentToTask) {
        ResourceAssignment result = super.createAssignment(assignmentToTask);
        fireAssignmentsChanged();
        return result;
    }   
View Full Code Here

Examples of net.sourceforge.ganttproject.task.ResourceAssignment

        }
    }

    private void deleteAssignments(ResourceAssignment[] context) {
        for (int i = 0; i < context.length; i++) {
            ResourceAssignment ra = context[i];
            ra.delete();
            ra.getTask().getAssignmentCollection().deleteAssignment(
                    ra.getResource());
        }
    }
View Full Code Here

Examples of net.sourceforge.ganttproject.task.ResourceAssignment

                    assignmentToTask.getTask())) {
                // throw new IllegalStateException("An attemp to assign resource
                // to the same task twice");
            }
        }
        ResourceAssignment result = new ResourceAssignmentImpl(assignmentToTask);
        myAssignments.add(result);
        resetLoads();
        return result;
    }
View Full Code Here

Examples of net.sourceforge.ganttproject.task.ResourceAssignment

    case 8: {
      ResourceAssignment[] tAssign = t.getAssignments();
      StringBuffer sb = new StringBuffer();
      int nb = 0;
      for (int i = 0; i < tAssign.length; i++) {
        ResourceAssignment resAss = tAssign[i];
        if (resAss.isCoordinator())
          sb.append(nb++ == 0 ? "" : ", ").append(
              resAss.getResource().getName());
      }
      // res = "Not implemented";
      res = sb.toString();
      break;
    }
View Full Code Here

Examples of org.apache.helix.controller.stages.ResourceAssignment

      LOG.debug("Processing resource:" + resource.getResourceName());
    }
    String stateModelDefName = idealState.getStateModelDefRef();
    StateModelDefinition stateModelDef = cache.getStateModelDef(stateModelDefName);
    calculateAutoBalancedIdealState(cache, idealState, stateModelDef);
    ResourceAssignment partitionMapping = new ResourceAssignment();
    for (Partition partition : resource.getPartitions()) {
      Map<String, String> currentStateMap =
          currentStateOutput.getCurrentStateMap(resource.getResourceName(), partition);
      Set<String> disabledInstancesForPartition =
          cache.getDisabledInstancesForPartition(partition.toString());
      List<String> preferenceList =
          ConstraintBasedAssignment.getPreferenceList(cache, partition, idealState, stateModelDef);
      Map<String, String> bestStateForPartition =
          ConstraintBasedAssignment.computeAutoBestStateForPartition(cache, stateModelDef,
              preferenceList, currentStateMap, disabledInstancesForPartition);
      partitionMapping.addReplicaMap(partition, bestStateForPartition);
    }
    return partitionMapping;
  }
View Full Code Here

Examples of org.apache.helix.controller.stages.ResourceAssignment

    String stateModelDefName = idealState.getStateModelDefRef();
    StateModelDefinition stateModelDef = cache.getStateModelDef(stateModelDefName);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Processing resource:" + resource.getResourceName());
    }
    ResourceAssignment partitionMapping = new ResourceAssignment();
    for (Partition partition : resource.getPartitions()) {
      Map<String, String> currentStateMap =
          currentStateOutput.getCurrentStateMap(resource.getResourceName(), partition);
      Set<String> disabledInstancesForPartition =
          cache.getDisabledInstancesForPartition(partition.toString());
      Map<String, String> idealStateMap =
          idealState.getInstanceStateMap(partition.getPartitionName());
      Map<String, String> bestStateForPartition =
          computeCustomizedBestStateForPartition(cache, stateModelDef, idealStateMap,
              currentStateMap, disabledInstancesForPartition);
      partitionMapping.addReplicaMap(partition, bestStateForPartition);
    }
    return partitionMapping;
  }
View Full Code Here

Examples of org.apache.helix.controller.stages.ResourceAssignment

    String stateModelDefName = idealState.getStateModelDefRef();
    StateModelDefinition stateModelDef = cache.getStateModelDef(stateModelDefName);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Processing resource:" + resource.getResourceName());
    }
    ResourceAssignment partitionMapping = new ResourceAssignment();
    for (Partition partition : resource.getPartitions()) {
      Map<String, String> currentStateMap =
          currentStateOutput.getCurrentStateMap(resource.getResourceName(), partition);
      Set<String> disabledInstancesForPartition =
          cache.getDisabledInstancesForPartition(partition.toString());
      List<String> preferenceList =
          ConstraintBasedAssignment.getPreferenceList(cache, partition, idealState, stateModelDef);
      Map<String, String> bestStateForPartition =
          ConstraintBasedAssignment.computeAutoBestStateForPartition(cache, stateModelDef,
              preferenceList, currentStateMap, disabledInstancesForPartition);
      partitionMapping.addReplicaMap(partition, bestStateForPartition);
    }
    return partitionMapping;
  }
View Full Code Here

Examples of org.apache.helix.controller.stages.ResourceAssignment

    if (LOG.isDebugEnabled()) {
      LOG.debug("Processing resource:" + resource.getResourceName());
    }
    String stateModelDefName = idealState.getStateModelDefRef();
    StateModelDefinition stateModelDef = cache.getStateModelDef(stateModelDefName);
    ResourceAssignment partitionMapping = new ResourceAssignment();
    for (Partition partition : resource.getPartitions()) {
      Map<String, String> currentStateMap =
          currentStateOutput.getCurrentStateMap(resource.getResourceName(), partition);
      Set<String> disabledInstancesForPartition =
          cache.getDisabledInstancesForPartition(partition.toString());
      List<String> preferenceList =
          ConstraintBasedAssignment.getPreferenceList(cache, partition, idealState, stateModelDef);
      Map<String, String> bestStateForPartition =
          ConstraintBasedAssignment.computeAutoBestStateForPartition(cache, stateModelDef,
              preferenceList, currentStateMap, disabledInstancesForPartition);
      partitionMapping.addReplicaMap(partition, bestStateForPartition);
    }
    return partitionMapping;
  }
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment

      return null;
    }

    ExternalView externalView =
        _accessor.getProperty(_keyBuilder.externalView(resourceId.stringify()));
    ResourceAssignment resourceAssignment =
        _accessor.getProperty(_keyBuilder.resourceAssignment(resourceId.stringify()));
    return createResource(resourceId, config, idealState, externalView, resourceAssignment);
  }
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment

    IdealState newIdealState =
        rebalancer.computeResourceMapping(resourceId.stringify(), idealState, currentStateOutput,
            cache);

    // do the resource assignments
    ResourceAssignment assignment = new ResourceAssignment(resourceId);
    if (idealState.getRebalanceMode() == RebalanceMode.CUSTOMIZED) {
      // customized ideal state uses a map
      for (PartitionId partitionId : newIdealState.getPartitionIdSet()) {
        Set<ParticipantId> disabledParticipants =
            ConstraintBasedAssignment.getDisabledParticipants(cluster.getParticipantMap(),
                partitionId);
        Map<ParticipantId, State> replicaMap =
            ConstraintBasedAssignment.computeCustomizedBestStateForPartition(cluster
                .getLiveParticipantMap().keySet(), stateModelDef, newIdealState
                .getParticipantStateMap(partitionId), currentState.getCurrentStateMap(resourceId,
                partitionId), disabledParticipants, idealState.isEnabled());
        assignment.addReplicaMap(partitionId, replicaMap);
      }
    } else {
      // other modes use auto assignment
      Map<State, String> upperBounds =
          ConstraintBasedAssignment
              .stateConstraints(stateModelDef, resourceId, cluster.getConfig());
      for (PartitionId partitionId : newIdealState.getPartitionIdSet()) {
        Set<ParticipantId> disabledParticipants =
            ConstraintBasedAssignment.getDisabledParticipants(cluster.getParticipantMap(),
                partitionId);
        Map<ParticipantId, State> replicaMap =
            ConstraintBasedAssignment.computeAutoBestStateForPartition(upperBounds, cluster
                .getLiveParticipantMap().keySet(), stateModelDef, newIdealState
                .getPreferenceList(partitionId), currentState.getCurrentStateMap(resourceId,
                partitionId), disabledParticipants, idealState.isEnabled());
        assignment.addReplicaMap(partitionId, replicaMap);
      }
    }
    return assignment;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.