public final RecordSchema getSchema(final Map<String, String> variables, final InputStream contentStream, final RecordSchema readSchema) throws SchemaNotFoundException, IOException { final SchemaAccessStrategy accessStrategy = getSchemaAccessStrategy(); if (accessStrategy == null) { throw new SchemaNotFoundException("Could not determine the Schema Access Strategy for this service"); } return getSchemaAccessStrategy().getSchema(variables, contentStream, readSchema); }
@Override protected SchemaAccessStrategy getSchemaAccessStrategy(String strategy, SchemaRegistry schemaRegistry, ConfigurationContext context) { if (EMBEDDED_AVRO_SCHEMA.getValue().equals(strategy)) { return new EmbeddedAvroSchemaAccessStrategy(); } else { return super.getSchemaAccessStrategy(strategy, schemaRegistry, context); } }
@Override protected SchemaAccessStrategy getSchemaAccessStrategy(String allowableValue, SchemaRegistry schemaRegistry, ValidationContext context) { if (EMBEDDED_AVRO_SCHEMA.getValue().equals(allowableValue)) { return new EmbeddedAvroSchemaAccessStrategy(); } else { return super.getSchemaAccessStrategy(allowableValue, schemaRegistry, context); } }
@Override protected SchemaAccessStrategy getSchemaAccessStrategy(final String strategy, final SchemaRegistry schemaRegistry, final ValidationContext context) { if (strategy.equalsIgnoreCase(STRING_FIELDS_FROM_GROK_EXPRESSION.getValue())) { return createAccessStrategy(); } else { return super.getSchemaAccessStrategy(strategy, schemaRegistry, context); } }
@Override protected SchemaAccessStrategy getSchemaAccessStrategy(final String allowableValue, final SchemaRegistry schemaRegistry, final ValidationContext context) { if (allowableValue.equalsIgnoreCase(headerDerivedAllowableValue.getValue())) { return new CSVHeaderSchemaStrategy(context); } return super.getSchemaAccessStrategy(allowableValue, schemaRegistry, context); }
@Override protected SchemaAccessStrategy getSchemaAccessStrategy(final String strategy, final SchemaRegistry schemaRegistry, final ConfigurationContext context) { if (strategy.equalsIgnoreCase(headerDerivedAllowableValue.getValue())) { return new CSVHeaderSchemaStrategy(context); } return super.getSchemaAccessStrategy(strategy, schemaRegistry, context); }
@Override protected SchemaAccessStrategy getSchemaAccessStrategy(final String strategy, final SchemaRegistry schemaRegistry, final ConfigurationContext context) { if (strategy.equalsIgnoreCase(STRING_FIELDS_FROM_GROK_EXPRESSION.getValue())) { return createAccessStrategy(); } else { return super.getSchemaAccessStrategy(strategy, schemaRegistry, context); } }
protected Set<SchemaField> getSuppliedSchemaFields(final ValidationContext validationContext) { final String accessStrategyValue = validationContext.getProperty(getSchemaAcessStrategyDescriptor()).getValue(); final SchemaRegistry schemaRegistry = validationContext.getProperty(SCHEMA_REGISTRY).asControllerService(SchemaRegistry.class); final SchemaAccessStrategy accessStrategy = getSchemaAccessStrategy(accessStrategyValue, schemaRegistry, validationContext); if (accessStrategy == null) { return EnumSet.noneOf(SchemaField.class); } final Set<SchemaField> suppliedFields = accessStrategy.getSuppliedSchemaFields(); return suppliedFields; }
@OnEnabled public void storeSchemaAccessStrategy(final ConfigurationContext context) { this.configurationContext = context; final SchemaRegistry schemaRegistry = context.getProperty(SCHEMA_REGISTRY).asControllerService(SchemaRegistry.class); final PropertyDescriptor descriptor = getSchemaAcessStrategyDescriptor(); final String schemaAccess = context.getProperty(descriptor).getValue(); this.schemaAccessStrategy = getSchemaAccessStrategy(schemaAccess, schemaRegistry, context); }
public final RecordSchema getSchema(final Map<String, String> variables, final InputStream contentStream, final RecordSchema readSchema) throws SchemaNotFoundException, IOException { final SchemaAccessStrategy accessStrategy = getSchemaAccessStrategy(); if (accessStrategy == null) { throw new SchemaNotFoundException("Could not determine the Schema Access Strategy for this service"); } return getSchemaAccessStrategy().getSchema(variables, contentStream, readSchema); }
protected Set<SchemaField> getSuppliedSchemaFields(final ValidationContext validationContext) { final String accessStrategyValue = validationContext.getProperty(getSchemaAcessStrategyDescriptor()).getValue(); final SchemaRegistry schemaRegistry = validationContext.getProperty(SCHEMA_REGISTRY).asControllerService(SchemaRegistry.class); final SchemaAccessStrategy accessStrategy = getSchemaAccessStrategy(accessStrategyValue, schemaRegistry, validationContext); if (accessStrategy == null) { return EnumSet.noneOf(SchemaField.class); } final Set<SchemaField> suppliedFields = accessStrategy.getSuppliedSchemaFields(); return suppliedFields; }
@OnEnabled public void storeSchemaAccessStrategy(final ConfigurationContext context) { this.configurationContext = context; final SchemaRegistry schemaRegistry = context.getProperty(SCHEMA_REGISTRY).asControllerService(SchemaRegistry.class); final PropertyDescriptor descriptor = getSchemaAcessStrategyDescriptor(); final String schemaAccess = context.getProperty(descriptor).getValue(); this.schemaAccessStrategy = getSchemaAccessStrategy(schemaAccess, schemaRegistry, context); }