public StormMetadataService build() throws ServiceNotFoundException, ServiceComponentNotFoundException { return new StormMetadataService(newHttpClient(), getTopologySummaryRestUrl(), getMainPageUrl(), securityContext, getServiceConfig(AMBARI_JSON_CONFIG_STORM_ENV), subject, getComponent(AMBARI_JSON_COMPONENT_STORM_NIMBUS), getComponentProcesses(AMBARI_JSON_COMPONENT_STORM_NIMBUS), getComponent(AMBARI_JSON_COMPONENT_STORM_UI_SERVER), getComponentProcesses(AMBARI_JSON_COMPONENT_STORM_UI_SERVER)); }
public Stat setData(ZkPathFactory zkPathFactory, byte[] data) throws ZookeeperClientException { return setData(zkPathFactory.createPath(), data); }
public static ZookeeperClient newInstance(ZkConnectionStringFactory zkConnStrFactory) { return newInstance(zkConnStrFactory.createZkConnString(), DEFAULT_RETRY_POLICY); }
/** * Creates and starts a {@link ZookeeperClient} connection as part of the object construction process. * The connection must be closed. See {@link KafkaMetadataService} */ public static KafkaMetadataService newInstance( EnvironmentService environmentService, Long clusterId, SecurityContext securityContext) throws ServiceConfigurationNotFoundException, IOException, ServiceNotFoundException, ServiceComponentNotFoundException { final KafkaZkConnection kafkaZkConnection = KafkaZkConnection.newInstance( getZkStringRaw(environmentService, clusterId, AMBARI_JSON_CONFIG_KAFKA_BROKER)); final ZookeeperClient zkCli = ZookeeperClient.newInstance(kafkaZkConnection); zkCli.start(); return new KafkaMetadataService(zkCli, kafkaZkConnection, securityContext, getKafkaBrokerComponent(environmentService, clusterId), getKafkaBrokers(environmentService, clusterId), getServiceConfig(environmentService, clusterId, AMBARI_JSON_CONFIG_KAFKA_BROKER), getServiceConfig(environmentService, clusterId, AMBARI_JSON_CONFIG_KAFKA_ENV)); }
/** * Creates secure {@link HiveMetadataService}, which delegates to {@link HiveMetaStoreClient} instantiated with * default {@link HiveConf}, and {@code hivemetastore-site.xml} and {@code hive-site.xml} properties overridden * with the config for the cluster imported in the service pool (either manually or using Ambari) */ public static HiveMetadataService newInstance(EnvironmentService environmentService, Long clusterId, SecurityContext securityContext, Subject subject) throws MetaException, IOException, EntityNotFoundException, PrivilegedActionException { return newInstance(overrideConfig(environmentService, clusterId), securityContext, subject, getHiveMetastoreComponent(environmentService, clusterId), getHiveMetastores(environmentService, clusterId)); }
public KafkaBrokersInfo<KafkaBrokersInfo.BrokerId> getBrokerIdsFromZk() throws ZookeeperClientException, IOException { final List<String> brokerIds = zkCli.getChildren(kafkaZkConnection.buildZkRootPath(ZK_RELATIVE_PATH_KAFKA_BROKERS_IDS)); return KafkaBrokersInfo.brokerIds(brokerIds, getSecurity(), getKafkaBrokerListeners()); }
/** * Creates secure {@link HBaseMetadataService} which delegates to {@link Admin} instantiated with default * {@link HBaseConfiguration} and {@code hbase-site.xml} properties overridden with the config * for the cluster imported in the service pool (either manually or using Ambari) */ public static HBaseMetadataService newInstance(EnvironmentService environmentService, Long clusterId, SecurityContext securityContext, Subject subject) throws IOException, EntityNotFoundException { return newInstance( overrideConfig(HBaseConfiguration.create(), environmentService, clusterId), securityContext, subject, getHbaseMasterComponent(environmentService, clusterId), getHbaseMasterComponentProcesses(environmentService, clusterId)); }
@Override public Security getSecurity(Cluster cluster, SecurityContext securityContext, Subject subject) { try { StormMetadataService sms = new StormMetadataService .Builder(environmentService, cluster.getId(), securityContext, subject).build(); return sms.getSecurity(); } catch (Exception e) { throw new RuntimeException(e); } }
public KafkaTopics getTopicsFromZk() throws ZookeeperClientException, IOException { final Security security = getSecurity(); final List<String> topics = zkCli.getChildren(kafkaZkConnection.buildZkRootPath(ZK_RELATIVE_PATH_KAFKA_TOPICS)); return topics == null ? new KafkaTopics(Collections.emptyList(), security) : new KafkaTopics(topics, security); }
public KafkaBrokersInfo<HostPort> getBrokerHostPortFromStreamsJson() throws ServiceNotFoundException, ServiceComponentNotFoundException, IOException { return KafkaBrokersInfo.hostPort(kafkaBrokerProcesses, getSecurity(), getKafkaBrokerListeners()); }
public List<String> getChildren(ZkPathFactory zkPathFactory) throws ZookeeperClientException { return getChildren(zkPathFactory.createPath()); }
public String createPath(ZkPathFactory zkPathFactory) throws ZookeeperClientException { return createPath(zkPathFactory.createPath()); }
public byte[] getData(ZkPathFactory zkPathFactory) throws ZookeeperClientException { return getData(zkPathFactory.createPath()); }
private static Configuration overrideConfig(Configuration hbaseConfig, EnvironmentService environmentService, Long clusterId) throws IOException, ServiceConfigurationNotFoundException, ServiceNotFoundException { return OverrideHadoopConfiguration.override(environmentService, clusterId, ServiceConfigurations.HBASE, AMBARI_JSON_CONFIG_HBASE_SITE, hbaseConfig, getMaxHBaseClientRetries()); }
private <T, E extends Exception> T executeSecure(SupplierException<T, E> action) throws PrivilegedActionException, E, IOException, InterruptedException { return execute(action, securityContext, user); }
@Override public void close() throws Exception { zkCli.close(); }
public static ZookeeperClient newInstance(String zkConnString) { return newInstance(zkConnString, DEFAULT_RETRY_POLICY); }
private Map<String, Pair<Component, Collection<ComponentProcess>>> getServiceToComponent() { return new HashMap<String, Pair<Component, Collection<ComponentProcess>>>(){{ put("kafka", new Pair<>(kafkaBroker, kafkaBrokerProcesses)); }}; }
@Override public void close() throws Exception { executeSecure(() -> { metaStoreClient.close(); return null; }); }
public static ZookeeperClient newInstance(ZkConnectionStringFactory zkConnStrFactory, RetryPolicy retryPolicy) { return newInstance(zkConnStrFactory.createZkConnString(), retryPolicy); }