Examples of CConfiguration


Examples of co.cask.cdap.common.conf.CConfiguration

   * inside cannot load program classes. It is used for the cases where only the application specification is needed,
   * but no need to load any class from it.
   */
  public synchronized BasicSparkContext get() {
    if (context == null) {
      CConfiguration conf = contextConfig.getConf();
      context = getBuilder(conf)
        .build(contextConfig.getRunId(),
               contextConfig.getLogicalStartTime(),
               contextConfig.getWorkflowBatch(),
               contextConfig.getArguments(),
View Full Code Here

Examples of co.cask.cdap.common.conf.CConfiguration

   * inside cannot load program classes. It is used for the cases where only the application specification is needed,
   * but no need to load any class from it.
   */
  public synchronized BasicMapReduceContext get() {
    if (context == null) {
      CConfiguration conf = contextConfig.getConf();
      context = getBuilder(conf)
        .build(type,
               contextConfig.getRunId(),
               contextConfig.getLogicalStartTime(),
               contextConfig.getWorkflowBatch(),
View Full Code Here

Examples of co.cask.cdap.common.conf.CConfiguration

    }

    // Initializing dataset context and hooking it up with Spark job transaction

    DatasetFramework datasetFramework = injector.getInstance(DatasetFramework.class);
    CConfiguration configuration = injector.getInstance(CConfiguration.class);

    ApplicationSpecification appSpec = program.getSpecification();

    //TODO: Change this when Spark starts supporting Metrics
    MetricsCollectionService metricsCollectionService = null;
View Full Code Here

Examples of co.cask.cdap.common.conf.CConfiguration

      hConf.clear();
      hConf.addResource(new File(configs.get("hConf")).toURI().toURL());

      UserGroupInformation.setConfiguration(hConf);

      CConfiguration cConf = CConfiguration.create();
      cConf.clear();
      cConf.addResource(new File(configs.get("cConf")).toURI().toURL());
      cConf.set(Constants.LogSaver.ADDRESS, context.getHost().getCanonicalHostName());

      // Initialize ZK client
      String zookeeper = cConf.get(Constants.Zookeeper.QUORUM);
      if (zookeeper == null) {
        LOG.error("No zookeeper quorum provided.");
        throw new IllegalStateException("No zookeeper quorum provided.");
      }

      Injector injector = createGuiceInjector(cConf, hConf);
      zkClientService = injector.getInstance(ZKClientService.class);
      kafkaClientService = injector.getInstance(KafkaClientService.class);
      logSaver = injector.getInstance(LogSaver.class);

      int numPartitions = Integer.parseInt(cConf.get(LoggingConfiguration.NUM_PARTITIONS,
                                                     LoggingConfiguration.DEFAULT_NUM_PARTITIONS));
      LOG.info("Num partitions = {}", numPartitions);
      multiElection = new MultiLeaderElection(zkClientService, "log-saver-partitions", numPartitions,
                                              createPartitionChangeHandler(logSaver));
View Full Code Here

Examples of co.cask.cdap.common.conf.CConfiguration

    new KafkaServerMain().doMain(args);
  }

  @Override
  public void init(String[] args) {
    CConfiguration cConf = CConfiguration.create();
    String zkConnectStr = cConf.get(Constants.Zookeeper.QUORUM);
    String zkNamespace = cConf.get(KafkaConstants.ConfigKeys.ZOOKEEPER_NAMESPACE_CONFIG);

    int port = cConf.getInt(KafkaConstants.ConfigKeys.PORT_CONFIG, -1);
    String hostname = cConf.get(KafkaConstants.ConfigKeys.HOSTNAME_CONFIG);

    InetAddress address = Networks.resolve(hostname, new InetSocketAddress("localhost", 0).getAddress());
    if (address.isAnyLocalAddress()) {
      try {
        address = InetAddress.getLocalHost();
      } catch (UnknownHostException e) {
        throw Throwables.propagate(e);
      }
    }
    if (address.isLoopbackAddress()) {
      LOG.warn("Binding to loopback address!");
    }
    hostname = address.getCanonicalHostName();

    int numPartitions = cConf.getInt(KafkaConstants.ConfigKeys.NUM_PARTITIONS_CONFIG,
                                     KafkaConstants.DEFAULT_NUM_PARTITIONS);
    String logDir = cConf.get(KafkaConstants.ConfigKeys.LOG_DIR_CONFIG);

    int replicationFactor = cConf.getInt(KafkaConstants.ConfigKeys.REPLICATION_FACTOR,
                                         KafkaConstants.DEFAULT_REPLICATION_FACTOR);
    LOG.info("Using replication factor {}", replicationFactor);

    if (zkNamespace != null) {
      ZKClientService client = ZKClientService.Builder.of(zkConnectStr).build();
View Full Code Here

Examples of co.cask.tigon.conf.CConfiguration

  private final ConsoleReader consoleReader;

  public DistributedMain(String zkQuorumString, String rootNamespace) throws IOException {
    localDataDir = Files.createTempDir();

    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.Zookeeper.QUORUM, zkQuorumString);
    cConf.set(Constants.Location.ROOT_NAMESPACE, rootNamespace);
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, localDataDir.getAbsolutePath());
    cConf.reloadConfiguration();
    Configuration hConf = HBaseConfiguration.create();

    Injector injector = Guice.createInjector(createModules(cConf, hConf));
    flowOperations = injector.getInstance(FlowOperations.class);
    consoleReader = new ConsoleReader();
View Full Code Here

Examples of co.cask.tigon.conf.CConfiguration

  public StandaloneMain() {
    runLatch = new CountDownLatch(1);
    jarUnpackDir = Files.createTempDir();
    localDataDir = Files.createTempDir();
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, localDataDir.getAbsolutePath());
    Configuration hConf = new Configuration();

    Injector injector = Guice.createInjector(createModules(cConf, hConf));
    txService = injector.getInstance(TransactionManager.class);
    metricsCollectionService = injector.getInstance(MetricsCollectionService.class);
View Full Code Here

Examples of co.cask.tigon.conf.CConfiguration

  }

  @BeforeClass
  public static void init() throws Exception {
    File localDataDir = tmpFolder.newFolder();
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, localDataDir.getAbsolutePath());

    Configuration hConf = new Configuration();

    Injector injector = Guice.createInjector(
      new DataFabricInMemoryModule(),
View Full Code Here

Examples of co.cask.tigon.conf.CConfiguration

    this.configTable = new ConfigurationTable(conf);
  }

  @Override
  protected Configuration getSnapshotConfiguration() throws IOException {
    CConfiguration cConf = configTable.read(ConfigurationTable.Type.DEFAULT, tableNamespace);
    Configuration txConf = HBaseConfiguration.create();
    cConf.copyTxProperties(txConf);
    return txConf;
  }
View Full Code Here

Examples of co.cask.tigon.conf.CConfiguration

   * @throws java.io.IOException If an error occurs while attempting to read the table or the table does not exist.
   */
  public CConfiguration read(Type type, String namespace) throws IOException {
    String tableName = getTableName(namespace);

    CConfiguration conf = null;
    HTable table = null;
    try {
      table = new HTable(hbaseConf, tableName);
      Get get = new Get(Bytes.toBytes(type.name()));
      get.addFamily(FAMILY);
      Result result = table.get(get);
      int propertyCnt = 0;
      if (result != null && !result.isEmpty()) {
        conf = CConfiguration.create();
        conf.clear();
        Map<byte[], byte[]> kvs = result.getFamilyMap(FAMILY);
        for (Map.Entry<byte[], byte[]> e : kvs.entrySet()) {
          conf.set(Bytes.toString(e.getKey()), Bytes.toString(e.getValue()));
          propertyCnt++;
        }
      }
      LOG.info("Read " + propertyCnt + " properties from configuration table = " +
                 tableName + ", row = " + type.name());
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.