Package org.apache.helix

Examples of org.apache.helix.HelixDataAccessor.keyBuilder()


      schedulerMessage.setTgtSessionId("*");
      schedulerMessage.setTgtName("CONTROLLER");
      schedulerMessage.setSrcInstanceType(InstanceType.CONTROLLER);
     
      HelixDataAccessor accessor = ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
      accessor.setProperty(accessor.keyBuilder().controllerMessage(schedulerMessage.getMsgId()), schedulerMessage);
     
      Map<String, String> resultMap = new HashMap<String, String>();
      resultMap.put("StatusUpdatePath", PropertyPathConfig.getPath(PropertyType.STATUSUPDATES_CONTROLLER, clusterName, MessageType.SCHEDULER_MSG.toString(),schedulerMessage.getMsgId()));
      resultMap.put("MessageType", Message.MessageType.SCHEDULER_MSG.toString());
      resultMap.put("MsgId", schedulerMessage.getMsgId());
View Full Code Here


  @Override
  public void enableCluster(String clusterName, boolean enabled)
  {
    HelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(_zkClient));
    Builder keyBuilder = accessor.keyBuilder();

    if (enabled)
    {
      accessor.removeProperty(keyBuilder.pause());
    }
View Full Code Here

      {
        ZNRecord newIdealState = jsonParameters.getExtraParameter(JsonParameters.NEW_IDEAL_STATE);
        HelixDataAccessor accessor =
            ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);

        accessor.setProperty(accessor.keyBuilder().idealStates(resourceName),
                             new IdealState(newIdealState));

      }
      else if (command.equalsIgnoreCase(ClusterSetup.rebalance))
      {
View Full Code Here

      {
        ZNRecord newStateModel = jsonParameters.getExtraParameter(JsonParameters.NEW_STATE_MODEL_DEF);
        HelixDataAccessor accessor =
            ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);

        accessor.setProperty(accessor.keyBuilder().stateModelDef(newStateModel.getId()),
                             new StateModelDefinition(newStateModel));
      }
      else
      {
        throw new HelixException("Unsupported command: " + command
View Full Code Here

        setupTool.getClusterManagementTool().getStateModelDefs(clusterName);
    clusterSummayRecord.setListField("stateModelDefs", models);

    HelixDataAccessor accessor =
        ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
    Builder keyBuilder = accessor.keyBuilder();

    LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
    if (leader != null)
    {
      clusterSummayRecord.setSimpleField("LEADER", leader.getInstanceName());
View Full Code Here

        (ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);

    HelixDataAccessor accessor =
        ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
    Map<String, LiveInstance> liveInstancesMap =
        accessor.getChildValuesMap(accessor.keyBuilder().liveInstances());
    Map<String, InstanceConfig> instanceConfigsMap =
        accessor.getChildValuesMap(accessor.keyBuilder().instanceConfigs());

    for (String instanceName : instanceConfigsMap.keySet())
    {
View Full Code Here

    HelixDataAccessor accessor =
        ClusterRepresentationUtil.getClusterDataAccessor(zkClient, clusterName);
    Map<String, LiveInstance> liveInstancesMap =
        accessor.getChildValuesMap(accessor.keyBuilder().liveInstances());
    Map<String, InstanceConfig> instanceConfigsMap =
        accessor.getChildValuesMap(accessor.keyBuilder().instanceConfigs());

    for (String instanceName : instanceConfigsMap.keySet())
    {
      boolean isAlive = liveInstancesMap.containsKey(instanceName);
      instanceConfigsMap.get(instanceName)
View Full Code Here

      // model

      zkClient = new ZkClient(_zkAddr, ZkClient.DEFAULT_CONNECTION_TIMEOUT);
      zkClient.setZkSerializer(new ZNRecordSerializer());
      HelixDataAccessor accessor = new ZKHelixDataAccessor(_manager.getClusterName(), new ZkBaseDataAccessor(zkClient));
      Builder keyBuilder = accessor.keyBuilder();

      IdealState idealState = new IdealState(_resourceName);
      idealState.setIdealStateMode(IdealStateModeProperty.AUTO.toString());
      idealState.setReplicas(StateModelToken.ANY_LIVEINSTANCE.toString());
      idealState.setNumPartitions(1);
View Full Code Here

    }

//    DataAccessor accessor = manager.getDataAccessor();
    HelixDataAccessor accessor = manager.getHelixDataAccessor();
//    boolean retVal = accessor.setProperty(PropertyType.PERSISTENTSTATS, record);
    Builder keyBuilder = accessor.keyBuilder();
    boolean retVal = accessor.setProperty(keyBuilder.persistantStat(), new PersistentStats(record));
    if (retVal == false)
    {
      logger.error("attempt to persist derived stats failed");
    }
View Full Code Here

  try {
      if (changeContext.getType().equals(NotificationContext.Type.INIT)
        || changeContext.getType().equals(NotificationContext.Type.CALLBACK)) {
    // DataAccessor dataAccessor = manager.getDataAccessor();
    HelixDataAccessor accessor = manager.getHelixDataAccessor();
    Builder keyBuilder = accessor.keyBuilder();

    while (accessor.getProperty(keyBuilder.controllerLeader()) == null) {
        boolean success = tryUpdateController(manager);
        if (success) {
      updateHistory(manager);
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.