Package co.cask.cdap.internal.io

Examples of co.cask.cdap.internal.io.ReflectionSchemaGenerator


    throw new UnsupportedTypeException("Dataset neither implements RecordScannable not RecordWritable.");
  }

  static String hiveSchemaFor(Type type) throws UnsupportedTypeException {
    // This call will make sure that the type is not recursive
    new ReflectionSchemaGenerator().generate(type, false);

    ObjectInspector objectInspector = ObjectInspectorFactory.getReflectionObjectInspector(type);
    if (!(objectInspector instanceof StructObjectInspector)) {
      throw new UnsupportedTypeException(String.format("Type must be a RECORD, but is %s",
                                                       type.getClass().getName()));
View Full Code Here


  private static InputSupplier<InputStream> getInputSupplier(final ApplicationSpecification appSpec) {
    return new InputSupplier<InputStream>() {
      @Override
      public InputStream getInput() throws IOException {
        String json = ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator()).toJson(appSpec);
        return new ByteArrayInputStream(json.getBytes(Charsets.UTF_8));
      }
    };
  }
View Full Code Here

    ApplicationSpecification specification = configurer.createApplicationSpec();

    // Convert the specification to JSON.
    // We write the Application specification to output file in JSON format.
    // TODO: The SchemaGenerator should be injected
    return ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator()).toJson(specification);
  }
View Full Code Here

   */
  public LocalArchiveLoaderStage(Id.Account id, @Nullable String appId) {
    super(TypeToken.of(Location.class));
    this.id = id;
    this.appId = appId;
    this.adapter = ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator());
  }
View Full Code Here

      // We write the Application specification to output file in JSON format.
      try {
        Writer writer = Files.newWriter(outputFile, Charsets.UTF_8);
        try {
          // TODO: The SchemaGenerator should be injected.
          ApplicationSpecificationAdapter.create(new ReflectionSchemaGenerator()).toJson(specification, writer);
        } finally {
          writer.close();
        }
      } catch (IOException e) {
        LOG.error("Error writing to file {}. {}", outputFile, e.getMessage());
View Full Code Here

   * @return {@link DatasetProperties} for the dataset
   * @throws UnsupportedTypeException
   */
  public static DatasetProperties objectStoreProperties(Type type, DatasetProperties props)
    throws UnsupportedTypeException {
    Schema schema = new ReflectionSchemaGenerator().generate(type);
    TypeRepresentation typeRep = new TypeRepresentation(type);
    return DatasetProperties.builder()
      .add("schema", GSON.toJson(schema))
      .add("type", GSON.toJson(typeRep))
      .addAll(props.getProperties())
View Full Code Here

TOP

Related Classes of co.cask.cdap.internal.io.ReflectionSchemaGenerator

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.