Package org.kiji.schema.hbase

Examples of org.kiji.schema.hbase.HBaseFactory


  private HTableInterface mTable;
  private HBaseTableKeyValueDatabase mDb;

  @Before
  public final void setupHBaseTable() throws IOException {
    final HBaseFactory factory = HBaseFactory.Provider.get();

    mConf = super.getConf();
    mHBaseAdmin = factory.getHBaseAdminFactory(getKiji().getURI()).create(mConf);
    // Create an HBase table.
    HTableDescriptor tableDescriptor = new HTableDescriptor(TABLE_NAME);
    tableDescriptor.addFamily(new HColumnDescriptor(FAMILY_NAME));
    mHBaseAdmin.createTable(tableDescriptor);

    mTable = factory.getHTableInterfaceFactory(getKiji().getURI()).create(mConf, TABLE_NAME);

    // Fill it with some data.
    mDb = new HBaseTableKeyValueDatabase(mTable, FAMILY_NAME);
    mDb.putValue("table1", "config1", Bytes.toBytes("1one"));
    mDb.putValue("table1", "config2", Bytes.toBytes("1two"));
View Full Code Here


    final KijiURI hbaseURI = createTestHBaseURI();
    final String instanceName =
        String.format("%s_%s", getClass().getSimpleName(), mTestName.getMethodName());
    mKijiURI = KijiURI.newBuilder(hbaseURI).withInstanceName(instanceName).build();
    final HBaseFactory factory = HBaseFactory.Provider.get();
    HBaseMetaTable.install(factory.getHBaseAdminFactory(mKijiURI).create(getConf()), mKijiURI);

    final HTableInterface htable =
        HBaseMetaTable.newMetaTable(
            mKijiURI, getConf(), factory.getHTableInterfaceFactory(mKijiURI));
    final String family = "layout";
    mTableLayoutDatabase = new HBaseTableLayoutDatabase(mKijiURI, htable, family, schemaTable);
  }
View Full Code Here

    mTableLayoutDatabase = new HBaseTableLayoutDatabase(mKijiURI, htable, family, schemaTable);
  }

  @After
  public final void teardownTest() throws IOException {
    final HBaseFactory factory = HBaseFactory.Provider.get();
    HBaseMetaTable.uninstall(factory.getHBaseAdminFactory(mKijiURI).create(getConf()), mKijiURI);
  }
View Full Code Here

  public synchronized HBaseAdmin getHBaseAdmin() throws IOException {
    final State state = mState.get();
    Preconditions.checkState(state == State.OPEN,
        "Cannot get HBase admin for Kiji instance %s in state %s.", this, state);
    if (null == mAdmin) {
      final HBaseFactory hbaseFactory = HBaseFactory.Provider.get();
      mAdmin = hbaseFactory.getHBaseAdminFactory(mURI).create(getConf());
    }
    return mAdmin;
  }
View Full Code Here

    final KijiURI hbaseURI = createTestHBaseURI();
    final String instanceName =
        String.format("%s_%s", getClass().getSimpleName(), mTestName.getMethodName());
    mKijiURI = KijiURI.newBuilder(hbaseURI).withInstanceName(instanceName).build();
    final HBaseFactory factory = HBaseFactory.Provider.get();
    mAdmin = factory.getHBaseAdminFactory(mKijiURI).create(getConf());

    HBaseMetaTable.install(mAdmin, mKijiURI);

    mMetaTable = new HBaseMetaTable(
        mKijiURI, getConf(), schemaTable, factory.getHTableInterfaceFactory(mKijiURI));
  }
View Full Code Here

   * @param backup the deserialized backup of the metadata.
   * @param kiji the connected Kiji instance.
   * @throws IOException if there is an error communicating with HBase.
   */
  public void restoreTables(MetadataBackup backup, Kiji kiji) throws IOException {
    final HBaseFactory hbaseFactory = HBaseFactory.Provider.get();
    final HBaseAdmin hbaseAdmin =
        hbaseFactory.getHBaseAdminFactory(kiji.getURI()).create(kiji.getConf());

    final KijiMetaTable metaTable = kiji.getMetaTable();
    try {
      HBaseMetaTable.uninstall(hbaseAdmin, kiji.getURI());
      HBaseMetaTable.install(hbaseAdmin, kiji.getURI());
View Full Code Here

TOP

Related Classes of org.kiji.schema.hbase.HBaseFactory

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.