class SchemaNamePropertyStrategy implements SchemaAccessStrategy {

    @Override
    public RecordSchema getSchema(final Map<String, String> variables, final InputStream contentStream, final RecordSchema readSchema) throws SchemaNotFoundException {
        final String schemaName = schemaNamePropertyValue.evaluateAttributeExpressions(variables).getValue();
        if (schemaName.trim().isEmpty()) {
            throw new SchemaNotFoundException(String.format("%s did not provide appropriate Schema Name", schemaNamePropertyValue));
        }

        try {
            final String schemaBranchName = schemaBranchNamePropertyValue.evaluateAttributeExpressions(variables).getValue();
            final String schemaVersion = schemaVersionPropertyValue.evaluateAttributeExpressions(variables).getValue();

            final SchemaIdentifier.Builder identifierBuilder = SchemaIdentifier.builder();
            identifierBuilder.name(schemaName);

            if (!StringUtils.isBlank(schemaBranchName)) {
                identifierBuilder.branch(schemaBranchName);
            }

            if (!StringUtils.isBlank(schemaVersion)) {
                try {
                    identifierBuilder.version(Integer.valueOf(schemaVersion));
                } catch (NumberFormatException nfe) {
                    throw new SchemaNotFoundException("Could not retrieve schema with name '" + schemaName
                            + "' because a non-numeric version was supplied '" + schemaVersion + "'", nfe);
                }
            }

            final RecordSchema recordSchema = schemaRegistry.retrieveSchema(identifierBuilder.build());
            if (recordSchema == null) {
                throw new SchemaNotFoundException("Could not find a schema with name '" + schemaName + "' in the configured Schema Registry");
            }

            return recordSchema;
        } catch (final SchemaNotFoundException snf) {
            throw snf;
        } catch (final Exception e) {
            throw new SchemaNotFoundException("Could not retrieve schema with name '" + schemaName + "' from the configured Schema Registry", e);
        }
    }

    public  SchemaNamePropertyStrategy(final SchemaRegistry schemaRegistry,
                                      final PropertyValue schemaNamePropertyValue,
                                      final PropertyValue schemaBranchNamePropertyValue,
                                      final PropertyValue schemaVersionPropertyValue);

}