Java Code Examples for org.apache.helix.ConfigAccessor#getResourceConfig()

The following examples show how to use org.apache.helix.ConfigAccessor#getResourceConfig() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ResourceAccessor.java    From helix with Apache License 2.0 5 votes vote down vote up
@GET
@Path("{resourceName}/configs")
public Response getResourceConfig(@PathParam("clusterId") String clusterId,
    @PathParam("resourceName") String resourceName) {
  ConfigAccessor accessor = getConfigAccessor();
  ResourceConfig resourceConfig = accessor.getResourceConfig(clusterId, resourceName);
  if (resourceConfig != null) {
    return JSONRepresentation(resourceConfig.getRecord());
  }

  return notFound();
}
 
Example 2
Source File: ControllerTest.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
public void enableResourceConfigForLeadControllerResource(boolean enable) {
  ConfigAccessor configAccessor = _helixManager.getConfigAccessor();
  ResourceConfig resourceConfig =
      configAccessor.getResourceConfig(getHelixClusterName(), LEAD_CONTROLLER_RESOURCE_NAME);
  if (Boolean.parseBoolean(resourceConfig.getSimpleConfig(LEAD_CONTROLLER_RESOURCE_ENABLED_KEY)) != enable) {
    resourceConfig.putSimpleConfig(LEAD_CONTROLLER_RESOURCE_ENABLED_KEY, Boolean.toString(enable));
    configAccessor.setResourceConfig(getHelixClusterName(), LEAD_CONTROLLER_RESOURCE_NAME, resourceConfig);
  }
}
 
Example 3
Source File: LeadControllerUtils.java    From incubator-pinot with Apache License 2.0 5 votes vote down vote up
/**
 * Checks from ZK if resource config of leadControllerResource is enabled.
 * @param helixManager helix manager
 */
public static boolean isLeadControllerResourceEnabled(HelixManager helixManager) {
  ConfigAccessor configAccessor = helixManager.getConfigAccessor();
  ResourceConfig resourceConfig =
      configAccessor.getResourceConfig(helixManager.getClusterName(), Helix.LEAD_CONTROLLER_RESOURCE_NAME);
  String resourceEnabled = resourceConfig.getSimpleConfig(Helix.LEAD_CONTROLLER_RESOURCE_ENABLED_KEY);
  return Boolean.parseBoolean(resourceEnabled);
}