Package org.kiji.schema.layout

Examples of org.kiji.schema.layout.KijiTableLayout


     * @param layoutDesc The layout descriptor of the Kiji table being added.
     * @return A builder to continue building with.
     * @throws InvalidLayoutException is the layout is invalid.
     */
    public TableBuilder withTable(TableLayoutDesc layoutDesc) throws InvalidLayoutException {
      final KijiTableLayout layout = KijiTableLayout.newLayout(layoutDesc);
      return withTable(layoutDesc.getName(), layout);
    }
View Full Code Here


  public void testSetTableLayoutAdd() throws Exception {
    getKiji().createTable(mLayoutDesc);

    mLayoutDescUpdate.setReferenceLayout(getLayout("table").getDesc().getLayoutId());

    final KijiTableLayout tableLayout = getKiji().modifyTableLayout(mLayoutDescUpdate);
    assertEquals(tableLayout.getFamilies().size(), getLayout("table").getFamilies().size());
  }
View Full Code Here

    final TableLayoutDesc newTableLayoutDesc = TableLayoutDesc.newBuilder(mLayoutDesc).build();
    assertEquals(3, (int) newTableLayoutDesc.getLocalityGroups().get(0).getMaxVersions());
    newTableLayoutDesc.getLocalityGroups().get(0).setMaxVersions(1);
    newTableLayoutDesc.setReferenceLayout(getLayout("table").getDesc().getLayoutId());

    final KijiTableLayout newTableLayout = getKiji().modifyTableLayout(newTableLayoutDesc);
    assertEquals(
        newTableLayout.getLocalityGroupMap().get("default").getDesc().getMaxVersions(),
        getLayout("table").getLocalityGroupMap().get("default").getDesc().getMaxVersions());
  }
View Full Code Here

  private KijiTableReader mReader;

  @Before
  public final void setupEnvironment() throws Exception {
    // Get the test table layouts.
    final KijiTableLayout layout = KijiTableLayout.newLayout(
        KijiTableLayouts.getLayout(KijiTableLayouts.COUNTER_TEST));

    // Populate the environment.
    mKiji = new InstanceBuilder(getKiji())
        .withTable("user", layout)
View Full Code Here

    final KijiTable table = kiji.openTable("table");
    try {
      final EntityId eid = table.getEntityId("row");

      final KijiTableLayout layout = table.getLayout();
      final KijiColumnName column = KijiColumnName.create("family", "column");
      final Map<KijiColumnName, CellSpec> overrides =
          ImmutableMap.<KijiColumnName, CellSpec>builder()
          .put(column, layout.getCellSpec(column)
              .setCellSchema(CellSchema.newBuilder()
                  .setType(SchemaType.INLINE)
                  .setStorage(SchemaStorage.FINAL)
                  .setValue("{\"type\": \"fixed\", \"size\": 4, \"name\": \"Int32\"}")
                  .build()))
View Full Code Here

  private KijiTableReader mReader;

  @Before
  public final void setupEnvironment() throws Exception {
    // Get the test table layouts.
    final KijiTableLayout layout = KijiTableLayout.newLayout(
        KijiTableLayouts.getLayout(KijiTableLayouts.COUNTER_TEST));

    // Populate the environment.
    mKiji = new InstanceBuilder(getKiji())
        .withTable("user", layout)
View Full Code Here

   * @throws Exception If there is an error.
   */
  public void createAndPopulateFooTable(KijiURI kijiURI) throws Exception {
    final Kiji kiji = Kiji.Factory.open(kijiURI, getConf());
    try {
      final KijiTableLayout layout = KijiTableLayouts.getTableLayout(KijiTableLayouts.FOO_TEST);
      final long timestamp = System.currentTimeMillis();

      new InstanceBuilder(kiji)
          .withTable(layout.getName(), layout)
              .withRow("gwu@usermail.example.com")
                  .withFamily("info")
                      .withQualifier("email").withValue(timestamp, "gwu@usermail.example.com")
                      .withQualifier("name").withValue(timestamp, "Garrett Wu")
              .withRow("aaron@usermail.example.com")
View Full Code Here

            .add(mFamily))
        .build();

    LOG.debug("HBaseMapPager data request: {} and page size {}", nextPageDataRequest, pageSize);

    final KijiTableLayout layout = mTable.getLayout();
    final HBaseColumnNameTranslator translator = HBaseColumnNameTranslator.from(layout);
    final HBaseDataRequestAdapter adapter =
        new HBaseDataRequestAdapter(nextPageDataRequest, translator);
    try {
      final Get hbaseGet = adapter.toGet(mEntityId, layout);
View Full Code Here

    lock.lock();
    try {
      final NavigableMap<Long, KijiTableLayout> layoutMap =
          metaTable.getTimedTableLayoutVersions(mTableURI.getTable(), Integer.MAX_VALUE);

      final KijiTableLayout currentLayout = layoutMap.lastEntry().getValue();
      final TableLayoutDesc update = mLayoutUpdate.apply(currentLayout);
      if (!Objects.equal(currentLayout.getDesc().getLayoutId(), update.getReferenceLayout())) {
        throw new InvalidLayoutException(String.format(
            "Reference layout ID %s does not match current layout ID %s.",
            update.getReferenceLayout(), currentLayout.getDesc().getLayoutId()));
      }

      final TableLayoutUpdateValidator validator = new TableLayoutUpdateValidator(mKiji);
      validator.validate(
          currentLayout,
          KijiTableLayout.createUpdatedLayout(update , currentLayout));

      final TableLayoutTracker layoutTracker =
          new TableLayoutTracker(mZKClient, mTableURI, mLayoutUpdateHandler);
      try {
        layoutTracker.start();
        final UsersTracker usersTracker =
            ZooKeeperUtils
                .newTableUsersTracker(mZKClient, mTableURI)
                .registerUpdateHandler(mUsersUpdateHandler);
        try {
          usersTracker.start();
          final String currentLayoutId = mLayoutUpdateHandler.getCurrentLayoutId();
          LOG.info("Table {} has current layout ID {}.", mTableURI, currentLayoutId);
          if (!Objects.equal(currentLayoutId, currentLayout.getDesc().getLayoutId())) {
            throw new InternalKijiError(String.format(
                "Inconsistency between meta-table and ZooKeeper: "
                + "meta-table layout has ID %s while ZooKeeper has layout ID %s.",
                currentLayout.getDesc().getLayoutId(), currentLayoutId));
          }

          final String consistentLayoutId = waitForConsistentView();
          if ((consistentLayoutId != null) && !Objects.equal(consistentLayoutId, currentLayoutId)) {
            throw new InternalKijiError(String.format(
View Full Code Here

import org.kiji.schema.layout.KijiTableLayouts;

public class TestInstanceBuilder extends KijiClientTest {
  @Test
  public void testBuilder() throws Exception {
    final KijiTableLayout layout =
        KijiTableLayout.newLayout(KijiTableLayouts.getLayout(KijiTableLayouts.SIMPLE));

    final Kiji kiji = new InstanceBuilder(getKiji())
        .withTable("table", layout)
            .withRow("row1")
View Full Code Here

TOP

Related Classes of org.kiji.schema.layout.KijiTableLayout

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.