Package org.kiji.schema.util

Examples of org.kiji.schema.util.ProtocolVersion


  @Test
  public void testStoreVersion() throws IOException {
    final Kiji kiji = getKiji();
    final KijiSystemTable systemTable = kiji.getSystemTable();
    final ProtocolVersion originalDataVersion = systemTable.getDataVersion();
    systemTable.setDataVersion(ProtocolVersion.parse("kiji-99"));

    assertEquals(ProtocolVersion.parse("kiji-99"), systemTable.getDataVersion());
    systemTable.setDataVersion(originalDataVersion);
  }
View Full Code Here


    conf.set(HConstants.ZOOKEEPER_QUORUM, Joiner.on(",").join(uri.getZookeeperQuorumOrdered()));
    conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, uri.getZookeeperClientPort());

    LOG.info(String.format("Removing the kiji instance '%s'.", uri.getInstance()));

    final ProtocolVersion systemVersion = getSystemVersion(uri, conf, htableFactory);
    if (systemVersion.compareTo(Versions.SYSTEM_2_0) < 0) {
      uninstallSystem_1_0(uri, conf, adminFactory);
    } else if (systemVersion.compareTo(Versions.SYSTEM_2_0) == 0) {
      uninstallSystem_2_0(uri, conf, adminFactory);
    } else {
      throw new InternalKijiError(String.format("Unknown System version %s.", systemVersion));
    }
View Full Code Here

public class TestVersionTool extends KijiToolTest {

  @Test
  public void testVersionTool() throws Exception {
    final ProtocolVersion clientDataVersion = VersionInfo.getClientDataVersion();
    final Kiji kiji = getKiji();

    final int exitCode =
        runTool(new VersionTool(), "--debug", String.format("--kiji=%s", kiji.getURI()));

    final ProtocolVersion clusterDataVersion = kiji.getSystemTable().getDataVersion();

    assertEquals(
        "kiji client software version: " + VersionInfo.getSoftwareVersion() + "\n"
        + "kiji client data version: " + clientDataVersion + "\n"
        + "kiji cluster data version: " + clusterDataVersion + "\n"
View Full Code Here

   * @param layout the table layout for which to ensure compatibility.
   * @throws IOException in case of an error reading from the system table.
   * @throws InvalidLayoutException if the layout and system versions are incompatible.
   */
  private void ensureValidationCompatibility(TableLayoutDesc layout) throws IOException {
    final ProtocolVersion layoutVersion = ProtocolVersion.parse(layout.getVersion());
    final ProtocolVersion systemVersion = getSystemTable().getDataVersion();

    if ((layoutVersion.compareTo(Versions.LAYOUT_VALIDATION_VERSION) >= 0)
        && (systemVersion.compareTo(Versions.MIN_SYS_VER_FOR_LAYOUT_VALIDATION) < 0)) {
      throw new InvalidLayoutException(
          String.format("Layout version: %s not supported by system version: %s",
              layoutVersion, systemVersion));
    }
  }
View Full Code Here

   * @throws java.io.IOException in case of an error reading from the system table.
   * @throws org.kiji.schema.layout.InvalidLayoutException if the layout and system versions are
   * incompatible.
   */
  private void ensureValidationCompatibility(TableLayoutDesc layout) throws IOException {
    final ProtocolVersion layoutVersion = ProtocolVersion.parse(layout.getVersion());
    final ProtocolVersion systemVersion = getSystemTable().getDataVersion();

    if ((layoutVersion.compareTo(Versions.LAYOUT_VALIDATION_VERSION) >= 0)
        && (systemVersion.compareTo(Versions.MIN_SYS_VER_FOR_LAYOUT_VALIDATION) < 0)) {
      throw new InvalidLayoutException(
          String.format("Layout version: %s not supported by system version: %s",
              layoutVersion, systemVersion));
    }
  }
View Full Code Here

   *
   * @param version Layout version string.
   * @return the effective layout ProtocolVersion.
   */
  private static ProtocolVersion computeLayoutVersion(String version) {
    final ProtocolVersion pversion = ProtocolVersion.parse(version);
    if (Objects.equal(pversion, Versions.LAYOUT_KIJI_1_0_0_DEPRECATED)) {
      // Deprecated "kiji-1.0" is compatible with "layout-1.0.0"
      return Versions.LAYOUT_1_0_0;
    } else {
      return pversion;
View Full Code Here

  @Override
  protected int run(List<String> nonFlagArgs) throws Exception {
    final String clientSoftwareVersion = VersionInfo.getSoftwareVersion();
    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: "
        + minimumLayoutVersion + " to " + maximumLayoutVersion);

    return SUCCESS;
  }
View Full Code Here

   * @throws IOException on I/O error.
   *     In particular, throws InvalidLayoutException if validation is not supported.
   */
  public TableLayoutBuilder(TableLayoutDesc tableLayoutDesc, Kiji kiji)
      throws IOException {
    final ProtocolVersion layoutVersion = ProtocolVersion.parse(tableLayoutDesc.getVersion());
    if (Versions.LAYOUT_VALIDATION_VERSION.compareTo(layoutVersion) > 0) {
      throw new InvalidLayoutException("Schema validation is available from "
          + Versions.LAYOUT_VALIDATION_VERSION + " and up; this layout is " + layoutVersion);
    }
    mSchemaTable = kiji.getSchemaTable();
View Full Code Here

  @Test
  public void testStoreVersion() throws IOException {
    final Kiji kiji = getKiji();
    final KijiSystemTable systemTable = kiji.getSystemTable();
    final ProtocolVersion originalDataVersion = systemTable.getDataVersion();
    systemTable.setDataVersion(ProtocolVersion.parse("kiji-99"));

    assertEquals(ProtocolVersion.parse("kiji-99"), systemTable.getDataVersion());
    systemTable.setDataVersion(originalDataVersion);
  }
View Full Code Here

   * @throws IOException in case of an IO Error reading from the schema table.
   *     Throws InvalidLayoutException if the layouts are incompatible.
   */
  public void validate(KijiTableLayout reference, KijiTableLayout layout) throws IOException {

    final ProtocolVersion layoutVersion = ProtocolVersion.parse(layout.getDesc().getVersion());

    if (layoutVersion.compareTo(Versions.LAYOUT_VALIDATION_VERSION) < 0) {
      // Layout versions older than layout-1.3.0 do not require validation
      return;
    }

    // Accumulator for error messages which will be used to create an exception if errors occur.
View Full Code Here

TOP

Related Classes of org.kiji.schema.util.ProtocolVersion

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.