Package org.apache.helix.model.ClusterConstraints

Examples of org.apache.helix.model.ClusterConstraints.ConstraintType


    if (clusterName == null || constraintType == null) {
      throw new IllegalArgumentException(
          "fail to get constraint. missing clusterName|constraintType");
    }

    ConstraintType type = ConstraintType.valueOf(constraintType);
    ClusterConstraints constraints = _admin.getConstraints(clusterName, type);
    ZNRecordSerializer serializer = new ZNRecordSerializer();
    return new String(serializer.serialize(constraints.getRecord()));
  }
View Full Code Here


    accessor.updateCluster(delta);
  }

  void getConstraints(String[] optValues) {
    String clusterName = optValues[0];
    ConstraintType constraintType = ConstraintType.valueOf(optValues[1]);
    ClusterAccessor accessor = clusterAccessor(clusterName);
    ClusterConstraints constraints = accessor.readConstraints(constraintType);
    System.out.println(constraints.toString());
  }
View Full Code Here

    System.out.println(constraints.toString());
  }

  void removeConstraint(String[] optValues) {
    String clusterName = optValues[0];
    ConstraintType constraintType = ConstraintType.valueOf(optValues[1]);
    ConstraintId constraintId = ConstraintId.from(optValues[2]);
    ClusterAccessor accessor = clusterAccessor(clusterName);
    accessor.removeConstraint(constraintType, constraintId);
  }
View Full Code Here

        || constraintAttributesMap == null) {
      throw new IllegalArgumentException(
          "fail to set constraint. missing clusterName|constraintType|constraintId|constraintAttributesMap");
    }

    ConstraintType type = ConstraintType.valueOf(constraintType);
    ConstraintItemBuilder builder = new ConstraintItemBuilder();
    Map<String, String> constraintAttributes =
        HelixUtil.parseCsvFormatedKeyValuePairs(constraintAttributesMap);
    ConstraintItem constraintItem = builder.addConstraintAttributes(constraintAttributes).build();
    _admin.setConstraint(clusterName, type, constraintId, constraintItem);
View Full Code Here

    if (clusterName == null || constraintType == null || constraintId == null) {
      throw new IllegalArgumentException(
          "fail to remove constraint. missing clusterName|constraintType|constraintId");
    }

    ConstraintType type = ConstraintType.valueOf(constraintType);
    _admin.removeConstraint(clusterName, type, constraintId);
  }
View Full Code Here

    if (clusterName == null || constraintType == null) {
      throw new IllegalArgumentException(
          "fail to get constraint. missing clusterName|constraintType");
    }

    ConstraintType type = ConstraintType.valueOf(constraintType);
    ClusterConstraints constraints = _admin.getConstraints(clusterName, type);
    ZNRecordSerializer serializer = new ZNRecordSerializer();
    return new String(serializer.serialize(constraints.getRecord()));
  }
View Full Code Here

    String clusterName = getValue("clusterName");
    String constraintTypeStr = getValue("constraintType").toUpperCase();
    String constraintId = getValue("constraintId");

    try {
      ConstraintType constraintType = ConstraintType.valueOf(constraintTypeStr);
      ZkClient zkClient =
          (ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
      // ClusterSetup setupTool = new ClusterSetup(zkClient);
      HelixAdmin admin = new ZKHelixAdmin(zkClient)// setupTool.getClusterManagementTool();
 
View Full Code Here

  public void setConstraint(String clusterName, String constraintType, String constraintId, String constraintAttributesMap) {
    if (clusterName == null || constraintType == null || constraintId == null || constraintAttributesMap == null) {
      throw new IllegalArgumentException("fail to set constraint. missing clusterName|constraintType|constraintId|constraintAttributesMap");
    }
   
    ConstraintType type = ConstraintType.valueOf(constraintType);
    ConstraintItemBuilder builder = new ConstraintItemBuilder();
    Map<String, String> constraintAttributes = HelixUtil.parseCsvFormatedKeyValuePairs(constraintAttributesMap);
    ConstraintItem constraintItem = builder.addConstraintAttributes(constraintAttributes).build();
    _admin.setConstraint(clusterName, type, constraintId, constraintItem);
  }
View Full Code Here

  public void removeConstraint(String clusterName, String constraintType, String constraintId) {
    if (clusterName == null || constraintType == null || constraintId == null) {
      throw new IllegalArgumentException("fail to remove constraint. missing clusterName|constraintType|constraintId");
    }

    ConstraintType type = ConstraintType.valueOf(constraintType);
    _admin.removeConstraint(clusterName, type, constraintId);
  }
View Full Code Here

  public String getConstraints(String clusterName, String constraintType) {
    if (clusterName == null || constraintType == null) {
      throw new IllegalArgumentException("fail to get constraint. missing clusterName|constraintType");
    }

    ConstraintType type = ConstraintType.valueOf(constraintType);
    ClusterConstraints constraints = _admin.getConstraints(clusterName, type);
    ZNRecordSerializer serializer = new ZNRecordSerializer();
    return new String(serializer.serialize(constraints.getRecord()));
  }
View Full Code Here

TOP

Related Classes of org.apache.helix.model.ClusterConstraints.ConstraintType

Copyright © 2018 www.massapicom. 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.