Package com.linkedin.data.schema

Examples of com.linkedin.data.schema.NamedDataSchema


    {
      for (DataSchema schema : getSchemaResolver().bindings().values())
      {
        if (schema instanceof NamedDataSchema)
        {
          NamedDataSchema namedDataSchema = (NamedDataSchema) schema;
          String fullName = namedDataSchema.getFullName();
          File generatedFile = fileForAvroSchema(fullName, targetDirectory);
          generatedFile.getParentFile().mkdirs();
          if (_debug) out.println((generatedFile.exists() ? "exists " : "does not exist ") + generatedFile + " lastModified " + generatedFile.lastModified());
          FileOutputStream os = new FileOutputStream(generatedFile);
          os.write(schema.toString().getBytes(Data.UTF_8_CHARSET));
View Full Code Here


      String schemaText = (String) row[i++];
      Predicate predicate = (Predicate) row[i++];
      String avroSchemaText = (String) row[i++];

      RecordDataSchema schema = (RecordDataSchema) TestUtil.dataSchemaFromString(schemaText);
      NamedDataSchema filteredSchema = Filters.removeByPredicate(schema, predicate, new SchemaParser());
      Schema filteredAvroSchema = SchemaTranslator.dataToAvroSchema(filteredSchema);

      Schema expectedAvroSchema = Schema.parse(avroSchemaText);
      assertEquals(filteredAvroSchema, expectedAvroSchema);
View Full Code Here

        assertTrue(schema != null);
        String schemaText = schema.toString();
        if (debug) { out.println(schemaText); }
        assertFalse(parser.hasError());
        assertTrue(schema instanceof NamedDataSchema);
        NamedDataSchema namedSchema = (NamedDataSchema) schema;
        assertEquals(namedSchema.getFullName(), name);
        assertTrue(schemaText.contains(expected));
        assertTrue(resolver.bindings().containsKey(name));
        assertSame(resolver.bindings().get(name), namedSchema);
        String location = entry[3];
        DataSchemaLocation namedSchemalocation = resolver.nameToDataSchemaLocations().get(name);
View Full Code Here

  protected DataSchema schemaFromName(ValidatorContext context, String schemaName)
  {
    StringBuilder sb = new StringBuilder();
    Parameter parameter = getParameter(context.validationOptions());
    DataSchemaResolver resolver = parameter.resolver();
    NamedDataSchema schema;
    if (resolver == null)
    {
      schema = null;
      context.addResult(new Message(context.dataElement().path(schemaName),
                                    parameter.isValidSchema(),
View Full Code Here

    final DataSchemaResolver resolver = CompatibilityUtil.getDataSchemaResolver(resolverPath);

    for(Map.Entry<String, NamedDataSchema> entry: snapshot.getModels().entrySet())
    {
      Name name = new Name(entry.getKey());
      NamedDataSchema schema = entry.getValue();
      resolver.bindNameToSchema(name, schema, DataSchemaLocation.NO_LOCATION);
    }

    return resolver;
  }
View Full Code Here

        }

        final SchemaParser filterParser = new SchemaParser();
        filterParser.setValidationOptions(val);

        final NamedDataSchema filteredSchema = Filters.removeByPredicate((NamedDataSchema) originalSchema,
                                                                         predicate, filterParser);
        if (filterParser.hasError())
        {
          _log.error("Error applying predicate: " + filterParser.errorMessageBuilder().toString());
          exitCode = 1;
          continue;
        }

        final String relativePath = sourceDirectoryURI.relativize(sourceFile.toURI()).getPath();
        final String outputFilePath = outputDirectory.getPath() + File.separator + relativePath;
        final File outputFile = new File(outputFilePath);
        final File outputFileParent = outputFile.getParentFile();
        outputFileParent.mkdirs();
        if (!outputFileParent.exists())
        {
          _log.error("Unable to write filtered schema to " + outputFileParent.getPath());
          exitCode = 1;
          continue;
        }

        FileOutputStream fout = new FileOutputStream(outputFile);
        fout.write(filteredSchema.toString().getBytes(RestConstants.DEFAULT_CHARSET));
        fout.close();
      }
      catch (IOException e)
      {
        _log.error(e.getMessage());
View Full Code Here

TOP

Related Classes of com.linkedin.data.schema.NamedDataSchema

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.