public TextRenderer(String avroSchemaStorePath, int dataSize) { if (avroSchemaStorePath != null) { schemaStore = new FileAvroSchemaStore(Paths.get(avroSchemaStorePath)); } else { schemaStore = null; } this.dataSize = dataSize; }
public FileAvroSchemaStore(Path schemaDirectoryPath) { this.schemaDirectoryPath = schemaDirectoryPath; File directory = schemaDirectoryPath.toFile(); if (directory.exists()) { if (!directory.isDirectory()) { throw new IllegalArgumentException("Invalid SchemaStore root path: " + schemaDirectoryPath); } loadSchemas(schemaDirectoryPath); } else { directory.mkdirs(); } }
/** * Load the avro schema from this file. */ public void loadSchema(Path schemaPath) { Schema schema; try { schema = new Schema.Parser().parse(schemaPath.toFile()); } catch (IOException e) { throw new IllegalArgumentException("Invalid schema file: " + schemaPath, e); } addSchema(schema); }
public MarkdownRenderer(String avroSchemaStorePath, int dataSize) { if (avroSchemaStorePath != null) { schemaStore = new FileAvroSchemaStore(Paths.get(avroSchemaStorePath)); } else { schemaStore = null; } this.dataSize = dataSize; }
public AvroServiceImpl(Collection<AvroReplacementDescriptor> replacements, Map<Class<?>, Class<AvroSchemaFactory<?>>> factories) { this.replacements = new ArrayList<>(replacements); this.factories = new HashMap<>(factories); String dataDir = Framework.getProperty(Environment.NUXEO_DATA_DIR); if (dataDir != null) { this.schemaStore = new FileAvroSchemaStore(Paths.get(dataDir, "avro")); } else { this.schemaStore = new FileAvroSchemaStore( Paths.get(Framework.getRuntime().getHome().getAbsolutePath(), "data", "avro")); } Collections.sort(this.replacements); // assert at creation that factories are valid createContext(); }