Class TupleSchemaFactory


  • public class TupleSchemaFactory
    extends Object

    A factory that creates an EventFlow tuple Schema object given an EventFlow tuple schema configuration as represented using JSON Schema. It can also perform the reverse process of converting a schema object to its JSON Schema form. The factory supports external schema references in JSON Schema reference form, loading and then validating the referenced HOCON configuration before converting.

    • Constructor Detail

      • TupleSchemaFactory

        public TupleSchemaFactory​(ClassLoader classLoader)

        Create a new tuple schema factory. The specified class loader is used to find schemas specified by JSON Schema reference URI.

        Parameters:
        classLoader - class loader to use when locating schemas identified by URI, null for current thread's context class loader
    • Method Detail

      • createSchema

        public Schema createSchema​(com.typesafe.config.Config sourceSchemaParent,
                                   String tupleSchemaPath,
                                   FlowValidationProblemList problems)

        Create a new EventFlow tuple schema given a HOCON configuration and a property name in that configuration that points to the schema. The property value is always a JSON Schema with OpenAPI 3.1 and TIBCO HCA extensions, either a full inline schema or a reference to an external schema.

        Parameters:
        sourceSchemaParent - HOCON configuration containing the incoming schema. Assumed to be valid.
        tupleSchemaPath - path within the above configuration whose value holds the schema or external schema reference. If null or empty, the above configuration is assumed to be an inline schema
        problems - problem list, added to with any validation problems if the desired schema is an external reference that needs loading and validating
        Returns:
        tuple schema, null if no value found at the specified path (optional schema), or errors were encountered while loading and validating referenced schemas
      • toJSONSchema

        public static com.typesafe.config.Config toJSONSchema​(Schema schema)

        Convert an EventFlow tuple schema to JSON Schema.

        Parameters:
        schema - schema to convert
        Returns:
        HOCON configuration
      • toSchemaXML

        public static String toSchemaXML​(Schema schema)

        Convert an EventFlow tuple schema object to its XML form.

        Parameters:
        schema - EventFlow tuple schema
        Returns:
        schema in XML form