Package com.cloudera.cdk.data.spi

Examples of com.cloudera.cdk.data.spi.URIPattern


*/
public class Loader implements Loadable {

  @Override
  public void load() {
    Accessor.getDefault().registerDatasetRepository(new URIPattern(URI.create("hbase:*zk")),
        new OptionBuilder<DatasetRepository>() {
          @Override
          public DatasetRepository getFromOptions(Map<String, String> options) {
            Configuration conf = HBaseConfiguration.create();
            String[] hostsAndPort = parseHostsAndPort(options.get("zk"));
View Full Code Here


    // Hive-managed data sets
    final OptionBuilder<DatasetRepository> managedBuilder =
        new ManagedBuilder(conf);
    Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create("hive")), managedBuilder);
    Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create("hive://" + hiveAuthority + "/")),
        managedBuilder);

    // external data sets
    final OptionBuilder<DatasetRepository> externalBuilder =
        new ExternalBuilder(conf);

    String hdfsAuthority;
    try {
      // Use a HDFS URI with no authority and the environment's configuration
      // to find the default HDFS information
      final URI hdfs = FileSystem.get(URI.create("hdfs:/"), conf).getUri();
      hdfsAuthority = "&hdfs-host=" + hdfs.getHost() +
          "&hdfs-port=" + hdfs.getPort();
    } catch (IOException ex) {
      logger.warn(
          "Could not locate HDFS, hdfs-host and hdfs-port " +
          "will not be set by default for Hive repositories.");
      hdfsAuthority = "";
    }

    Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create("hive://" + hiveAuthority +
            "/*path?absolute=true" + hdfsAuthority)),
        externalBuilder);
    Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create("hive:*path")), externalBuilder);
  }
View Full Code Here

    final Configuration conf = new Configuration();
    final OptionBuilder<DatasetRepository> builder =
        new URIBuilder(conf);

    com.cloudera.cdk.data.impl.Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create("file:/*path?absolute=true")), builder);
    com.cloudera.cdk.data.impl.Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create("file:*path")), builder);

    String hdfsAuthority;
    try {
      // Use a HDFS URI with no authority and the environment's configuration
      // to find the default HDFS information
      final URI hdfs = FileSystem.get(URI.create("hdfs:/"), conf).getUri();
      hdfsAuthority = hdfs.getAuthority();
    } catch (IOException ex) {
      logger.warn(
          "Could not locate HDFS, host and port will not be set by default.");
      hdfsAuthority = "";
    }

    com.cloudera.cdk.data.impl.Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create(
            "hdfs://" + hdfsAuthority + "/*path?absolute=true")),
        builder);
    com.cloudera.cdk.data.impl.Accessor.getDefault().registerDatasetRepository(
        new URIPattern(URI.create("hdfs:*path")), builder);
  }
View Full Code Here

TOP

Related Classes of com.cloudera.cdk.data.spi.URIPattern

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.