Package org.kiji.schema

Examples of org.kiji.schema.Kiji


  private EntityId mEntityId;

  @BeforeClass
  public static void initShared() throws Exception {
    CLIENT_TEST_DELEGATE.setupKijiTest();
    Kiji kiji = CLIENT_TEST_DELEGATE.getKiji();
    kiji.createTable(KijiTableLayouts.getLayout(KijiTableLayouts.USER_TABLE_FORMATTED_EID));
    mTable = kiji.openTable("user");
  }
View Full Code Here


  }

  // Tests for KijiRowData.getReaderSchema() with layout-1.3 tables.
  @Test
  public void testGetReaderSchemaLayout13() throws Exception {
    final Kiji kiji = new InstanceBuilder(mKiji)
        .withTable(KijiTableLayouts.getLayout(TEST_LAYOUT_V1_3))
        .build();
    final KijiTable table = kiji.openTable("table");
    try {
      final KijiTableReader reader = table.getReaderFactory().openTableReader();
      try {
        final EntityId eid = table.getEntityId("row");
        final KijiDataRequest dataRequest = KijiDataRequest.builder()
View Full Code Here

  //
  //    TODO(SCHEMA-295) the user may force using the writer schemas by overriding the
  //        declared reader schemas. This test will be updated accordingly.
  @Test
  public void testWSchemaWhenSpecRecClassNF() throws Exception {
    final Kiji kiji = mKiji;
    kiji.createTable(KijiTableLayouts.getLayout(WRITER_SCHEMA_TEST));
    final KijiTable table = kiji.openTable("writer_schema");
    try {
      // Write a (generic) record:
      final Schema writerSchema = Schema.createRecord("Found", null, "class.not", false);
      writerSchema.setFields(Lists.newArrayList(
          new Field("field", Schema.create(Schema.Type.STRING), null, null)));
View Full Code Here

      return true;
    }
    if (!getClass().equals(obj.getClass())) {
      return false;
    }
    final Kiji other = (Kiji) obj;

    // Equal if the two instances have the same URI:
    return mURI.equals(other.getURI());
  }
View Full Code Here

  protected int run(List<String> nonFlagArgs) throws Exception {
    Preconditions.checkArgument(nonFlagArgs.isEmpty(),
        "Unexpected command-line argument: [%s]", Joiner.on(",").join(nonFlagArgs));
    getPrintStream().println("Deleting kiji instance: " + mKijiURI.toString());
    if (isInteractive())  {
      final Kiji kiji = Kiji.Factory.open(mKijiURI, getConf());
      try {
        getPrintStream().println("WARNING: This instance contains the table(s):");
        for (String name : kiji.getTableNames()) {
          getPrintStream().println(name);
        }
      } finally {
        kiji.release();
      }

      getPrintStream().println();
      if (!inputConfirmation("Are you sure? This action will delete all meta and user data "
          + "from hbase and cannot be undone!", mKijiURI.getInstance())) {
View Full Code Here

    getPrintStream().println("kiji client software version: " + clientSoftwareVersion);

    final ProtocolVersion clientDataVersion = VersionInfo.getClientDataVersion();
    getPrintStream().println("kiji client data version: " + clientDataVersion);

    final Kiji kiji = Kiji.Factory.open(mKijiURI, getConf());
    try {
      final ProtocolVersion clusterDataVersion = VersionInfo.getClusterDataVersion(kiji);
      getPrintStream().println("kiji cluster data version: " + clusterDataVersion);
    } finally {
      kiji.release();
    }

    ProtocolVersion minimumLayoutVersion = KijiTableLayout.getMinSupportedLayoutVersion();
    ProtocolVersion maximumLayoutVersion = KijiTableLayout.getMaxSupportedLayoutVersion();
    getPrintStream().println("layout versions supported: "
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public List<InputSplit> getSplits(JobContext context) throws IOException {
    final Configuration conf = context.getConfiguration();
    final KijiURI inputTableURI = getInputTableURI(conf);
    final Kiji kiji = Kiji.Factory.open(inputTableURI, conf);
    final KijiTable table = kiji.openTable(inputTableURI.getTable());

    final HTableInterface htable = HBaseKijiTable.downcast(table).openHTableConnection();
    try {
      final List<InputSplit> splits = Lists.newArrayList();
      for (KijiRegion region : table.getRegions()) {
View Full Code Here

      String endRow)
      throws IOException {

    final Configuration conf = job.getConfiguration();
    // As a precaution, be sure the table exists and can be opened.
    final Kiji kiji = Kiji.Factory.open(tableURI, conf);
    final KijiTable table = kiji.openTable(tableURI.getTable());
    ResourceUtils.releaseOrLog(table);
    ResourceUtils.releaseOrLog(kiji);

    // TODO: Check for jars config:
    // GenericTableMapReduceUtil.initTableInput(hbaseTableName, scan, job);
View Full Code Here

   * @param version Data version to use.
   * @throws IOException on I/O error.
   */
  private static void setDataVersion(final KijiURI uri, final ProtocolVersion version)
      throws IOException {
    final Kiji kiji = Kiji.Factory.open(uri);
    try {
      kiji.getSystemTable().setDataVersion(version);
    } finally {
      kiji.release();
    }
  }
View Full Code Here

  private static final Logger LOG = LoggerFactory.getLogger(TestHBaseKiji.class);

  /** Tests Kiji.openTable() on a table that doesn't exist. */
  @Test
  public void testOpenUnknownTable() throws Exception {
    final Kiji kiji = getKiji();

    try {
      final KijiTable table = kiji.openTable("unknown");
      Assert.fail("Should not be able to open a table that does not exist!");
    } catch (KijiTableNotFoundException ktnfe) {
      // Expected!
      LOG.debug("Expected error: {}", ktnfe);
      Assert.assertEquals("unknown", ktnfe.getTableURI().getTable());
View Full Code Here

TOP

Related Classes of org.kiji.schema.Kiji

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.