Package org.kiji.schema

Examples of org.kiji.schema.InternalKijiError


        // Perform actual validation between reader and writer schemas:
        return validateReaderWriterSchemas(readerSchemas, writerSchemas);
      }
      default:
        throw new InternalKijiError(
            "Unknown validation policy: " + cellSchema.getAvroValidationPolicy());
    }
  }
View Full Code Here


        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(
                "Consistent layout ID %s does not match current layout %s for table %s.",
                consistentLayoutId, currentLayout, mTableURI));
          }

          writeMetaTable(update);
View Full Code Here

    public void close() {
      try {
        mCache.release(mCacheKey);
      } catch (IOException e) {
        // Impossible since {@link CuratorFramework#close()} does not throw IOException.
        throw new InternalKijiError(e);
      } finally {
        DebugResourceTracker.get().unregisterResource(this);
      }
    }
View Full Code Here

    public void close() {
      try {
        mCache.release(mCacheKey);
      } catch (IOException e) {
        // Impossible since {@link CuratorFramework#close()} does not throw IOException.
        throw new InternalKijiError(e);
      } finally {
        DebugResourceTracker.get().unregisterResource(this);
      }
    }
View Full Code Here

      case JSON: {
        avroSchema.setUid(null);
        avroSchema.setJson(schema.toString());
        break;
      }
      default: throw new InternalKijiError("Unknown schema format: " + options.getSchemaFormat());
    }
  }
View Full Code Here

      } else if (mGetByHashFlag != null && !mGetByHashFlag.isEmpty()) {
        return getByHash();
      } else if (mListFlag) {
        return list();
      } else {
        throw new InternalKijiError("No operation specified.");
      }
    } finally {
      mKiji.release();
    }
  }
View Full Code Here

      }
      case COMPATIBLE: {
        message = READER_WRITER_COMPATIBLE_MESSAGE;
        break;
      }
      default: throw new InternalKijiError("Unknown compatibility: " + compatibility);
    }

    return new SchemaPairCompatibility(
        compatibility,
        reader,
View Full Code Here

            // Each schema in the writer union can be decoded with the reader:
            return SchemaCompatibilityType.COMPATIBLE;
          }

          default: {
            throw new InternalKijiError("Unknown schema type: " + reader.getType());
          }
        }

      } else {
        // Reader and writer have different schema types:

        // Handle the corner case where writer is a union of a singleton branch: { X } === X
        if ((writer.getType() == Schema.Type.UNION)
            && writer.getTypes().size() == 1) {
          return getCompatibility(reader, writer.getTypes().get(0));
        }

        switch (reader.getType()) {
          case NULL: return SchemaCompatibilityType.INCOMPATIBLE;
          case BOOLEAN: return SchemaCompatibilityType.INCOMPATIBLE;
          case INT: return SchemaCompatibilityType.INCOMPATIBLE;
          case LONG: {
            return (writer.getType() == Type.INT)
                ? SchemaCompatibilityType.COMPATIBLE
                : SchemaCompatibilityType.INCOMPATIBLE;
          }
          case FLOAT: {
            return ((writer.getType() == Type.INT)
                || (writer.getType() == Type.LONG))
                ? SchemaCompatibilityType.COMPATIBLE
                : SchemaCompatibilityType.INCOMPATIBLE;

          }
          case DOUBLE: {
            return ((writer.getType() == Type.INT)
                || (writer.getType() == Type.LONG)
                || (writer.getType() == Type.FLOAT))
                ? SchemaCompatibilityType.COMPATIBLE
                : SchemaCompatibilityType.INCOMPATIBLE;
          }
          case BYTES: return SchemaCompatibilityType.INCOMPATIBLE;
          case STRING: return SchemaCompatibilityType.INCOMPATIBLE;
          case ARRAY: return SchemaCompatibilityType.INCOMPATIBLE;
          case MAP: return SchemaCompatibilityType.INCOMPATIBLE;
          case FIXED: return SchemaCompatibilityType.INCOMPATIBLE;
          case ENUM: return SchemaCompatibilityType.INCOMPATIBLE;
          case RECORD: return SchemaCompatibilityType.INCOMPATIBLE;
          case UNION: {
            for (final Schema readerBranch : reader.getTypes()) {
              if (getCompatibility(readerBranch, writer) == SchemaCompatibilityType.COMPATIBLE) {
                return SchemaCompatibilityType.COMPATIBLE;
              }
            }
            // No branch in the reader union has been found compatible with the writer schema:
            return SchemaCompatibilityType.INCOMPATIBLE;
          }

          default: {
            throw new InternalKijiError("Unknown schema type: " + reader.getType());
          }
        }
      }
    }
View Full Code Here

        mCounter = new AtomicInteger(0);
        LOG.debug("Registering hook to log details of unclosed resources at shutdown.");
        Runtime.getRuntime().addShutdownHook(new ShutdownHook());
        break;
      }
      default: throw new InternalKijiError(String.format(
          "Unknown DebugResourceTracker.TrackingType: %s", TRACKING_LEVEL));
    }
  }
View Full Code Here

      }
      case REFERENCES: {
        message =  "Found {} unclosed resources.";
        break;
      }
      default: throw new InternalKijiError(String.format(
          "Illegal DebugResourceTracker.TrackingType: %s", TRACKING_LEVEL));
    }

    final int count = mCounter.get();
    if (0 != count) {
View Full Code Here

TOP

Related Classes of org.kiji.schema.InternalKijiError

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.