Package org.apache.helix.manager.zk

Examples of org.apache.helix.manager.zk.ZKHelixDataAccessor


                                                  PropertyKey propertyKey) throws JsonGenerationException,
      JsonMappingException,
      IOException
  {

    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));

    HelixProperty property = accessor.getProperty(propertyKey);
    ZNRecord record = property == null ? null : property.getRecord();
    return ZNRecordToJson(record);
  }
View Full Code Here


                                                   PropertyKey propertyKey,
                                                   MediaType mediaType) throws JsonGenerationException,
      JsonMappingException,
      IOException
  {
    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));

    ZNRecord records = accessor.getProperty(propertyKey).getRecord();
    return ZNRecordToJson(records);
  }
View Full Code Here

                                                     MediaType mediaType) throws JsonGenerationException,
      JsonMappingException,
      IOException
  {
    zkClient.setZkSerializer(new ZNRecordSerializer());
    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));

    List<ZNRecord> records =
        HelixProperty.convertToList(accessor.getChildValues(propertyKey));
    return ObjectToJson(records);
  }
View Full Code Here

                                           PropertyKey propertyKey,
                                           MediaType mediaType) throws JsonGenerationException,
      JsonMappingException,
      IOException
  {
    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));

    ZNRecord record = EMPTY_ZNRECORD;
    HelixProperty property = accessor.getProperty(propertyKey);
    if (property != null)
    {
      record = property.getRecord();
    }
    return ObjectToJson(record);
View Full Code Here

  }

  public static HelixDataAccessor getClusterDataAccessor(ZkClient zkClient,
                                                         String clusterName)
  {
    return new ZKHelixDataAccessor(clusterName,
                                   new ZkBaseDataAccessor<ZNRecord>(zkClient));
  }
View Full Code Here

  public static String getInstanceSessionId(ZkClient zkClient,
                                            String clusterName,
                                            String instanceName)
  {
    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));
    Builder keyBuilder = accessor.keyBuilder();

    ZNRecord liveInstance =
        accessor.getProperty(keyBuilder.liveInstance(instanceName)).getRecord();

    return liveInstance.getSimpleField(LiveInstanceProperty.SESSION_ID.toString());
  }
View Full Code Here

    private void clearStatusUpdate(String clusterName, String instance,
      String resource, String partition) {
  // clear status update for error partition so verify() will not fail on
  // old
  // errors
  ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName,
    new ZkBaseDataAccessor<ZNRecord>(_gZkClient));
  Builder keyBuilder = accessor.keyBuilder();

  LiveInstance liveInstance = accessor.getProperty(keyBuilder
    .liveInstance(instance));
  accessor.removeProperty(keyBuilder.stateTransitionStatus(instance,
    liveInstance.getSessionId(), resource, partition));

    }
View Full Code Here

  {
    Builder keyBuilder = new PropertyKey.Builder(clusterName);
    ZkClient zkClient =
        (ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);

    ZKHelixDataAccessor accessor =
        new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<ZNRecord>(zkClient));

    ZNRecord record = null;
    LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
    if (leader != null)
    {
      record = leader.getRecord();
    }
    else
    {
      record = new ZNRecord("");
      DateFormat formatter = new SimpleDateFormat("yyyyMMdd-HHmmss.SSSSSS");
      String time = formatter.format(new Date());
      Map<String, String> contentMap = new TreeMap<String, String>();
      contentMap.put("AdditionalInfo", "No leader exists");
      record.setMapField(Level.HELIX_INFO + "-" + time, contentMap);
    }

    boolean paused = (accessor.getProperty(keyBuilder.pause()) == null ? false : true);
    record.setSimpleField(PropertyType.PAUSE.toString(), "" + paused);

    String retVal = ClusterRepresentationUtil.ZNRecordToJson(record);
    StringRepresentation representation =
        new StringRepresentation(retVal, MediaType.APPLICATION_JSON);
View Full Code Here

    public boolean verify()
    {
      try
      {
        HelixDataAccessor accessor =
            new ZKHelixDataAccessor(clusterName,
                                    new ZkBaseDataAccessor<ZNRecord>(zkClient));

        return ClusterStateVerifier.verifyBestPossAndExtView(accessor, errStates);
      }
      catch (Exception e)
View Full Code Here

    @Override
    public boolean verify()
    {
      try
      {
        ZKHelixDataAccessor accessor =
            new ZKHelixDataAccessor(clusterName,
                                    new ZkBaseDataAccessor<ZNRecord>(zkClient));

        return ClusterStateVerifier.verifyMasterNbInExtView(accessor);
      }
      catch (Exception e)
View Full Code Here

TOP

Related Classes of org.apache.helix.manager.zk.ZKHelixDataAccessor

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.