Package uk.co.real_logic.sbe
Class SbeTool
java.lang.Object
uk.co.real_logic.sbe.SbeTool
A tool for running the SBE parser, validator, and code generator.
Usage:
$ java -jar sbe.jar <filename.xml>
$ java -Doption=value -jar sbe.jar <filename.xml>
$ java -Doption=value -jar sbe.jar <filename.sbeir>
System Properties:
- sbe.validation.xsd: Use XSD to validate or not.
- sbe.validation.stop.on.error: Should the parser stop on first error encountered? Defaults to false.
- sbe.validation.warnings.fatal: Are warnings in parsing considered fatal? Defaults to false.
- sbe.validation.suppress.output: Should the parser suppress output during validation? Defaults to false.
- sbe.generate.stubs: Generate stubs or not. Defaults to true.
- sbe.target.language: Target language for code generation, defaults to Java.
- sbe.generate.ir: Generate IR or not. Defaults to false.
- sbe.output.dir: Target directory for code generation, defaults to current directory.
- sbe.java.generate.interfaces: Generate interface hierarchy or not. Defaults to false.
- sbe.java.encoding.buffer.type: Type of the Java interface for the encoding buffer to wrap.
- sbe.java.decoding.buffer.type: Type of the Java interface for the decoding buffer to wrap.
- sbe.target.namespace: Namespace for the generated code to override schema package.
- sbe.cpp.namespaces.collapse: Namespace for the generated code to override schema package.
- sbe.java.generate.group-order.annotation: Should the GroupOrder annotation be added to generated stubs.
- sbe.csharp.generate.namespace.dir: Should a directory be created for the namespace under the output directory? Defaults to true
- sbe.keyword.append.token: Token to be appended to keywords.
- sbe.decode.unknown.enum.values: Support unknown decoded enum values. Defaults to false.
- sbe.xinclude.aware: Is XInclude supported for the schema. Defaults to false.
- sbe.type.package.override: Is package attribute for types element supported (only for JAVA). Defaults to false.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringShould generate C++ DTOs.static final StringBoolean system property to toggle collapsing of nested namespaces in generated C++ stubs.static final StringBoolean system property to turn on or off generation of namespace directories during csharp code generation.static final StringShould unknown enum values be decoded to support extension.static final StringBoolean system property to turn on or off generation of IR.static final StringWhether to generate field precedence checks.static final StringBoolean system property to turn on or off generation of stubs.static final StringSpecifies the name of the Java read only buffer to wrap.static final StringDefault class to use as the buffer read only implementation in generated code.static final StringDefault class to use as the buffer mutable implementation in generated code.static final StringSpecifies the name of the Java mutable buffer to wrap.static final StringShould generate Java DTOs.static final StringBoolean system property to turn on or off generation of the interface hierarchy.static final StringShould theGroupOrderannotation be added to generated stubs.static final StringPackage in which the generated Java interfaces will be placed.static final StringThe name of the system property that enables access order checks at runtime in generated Java code.static final StringSpecifies token that should be appended to keywords to avoid compilation errors.static final StringOutput directory for generated code.static final StringThe name of the symbol or macro that enables access order checks when building generated C# or C++ code.static final StringVersion of the Rust crate to generate.static final StringThe default version of the Rust crate to generate, when not specified via the system property.static final StringConfiguration option used to manage sinceVersion based transformations.static final StringTarget language for generated code.static final StringString system property of the namespace for generated code.static final StringBoolean system property to control the support of package names in<types>elements.static final StringBoolean system property to control throwing exceptions on all errors.static final StringBoolean system property to control suppressing output on all errors and warnings.static final StringBoolean system property to control whether to consider warnings fatal and treat them as errors.static final StringSystem property to hold XSD to validate message specification against.static final StringBoolean system property to control is XInclude is supported. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidGenerate SBE encoding and decoding stubs for a target language.static voidMain entry point for the SBE Tool.static MessageSchemaparseSchema(String sbeSchemaFilename) Parse the message schema specification.static voidvalidateAgainstSchema(String sbeSchemaFilename, String xsdFilename) Validate the SBE Schema against the XSD.
-
Field Details
-
JAVA_INTERFACE_PACKAGE
Package in which the generated Java interfaces will be placed.- See Also:
-
JAVA_DEFAULT_ENCODING_BUFFER_TYPE
Default class to use as the buffer mutable implementation in generated code. -
JAVA_DEFAULT_DECODING_BUFFER_TYPE
Default class to use as the buffer read only implementation in generated code. -
VALIDATION_STOP_ON_ERROR
Boolean system property to control throwing exceptions on all errors.- See Also:
-
VALIDATION_WARNINGS_FATAL
Boolean system property to control whether to consider warnings fatal and treat them as errors.- See Also:
-
VALIDATION_XSD
System property to hold XSD to validate message specification against.- See Also:
-
VALIDATION_SUPPRESS_OUTPUT
Boolean system property to control suppressing output on all errors and warnings.- See Also:
-
GENERATE_STUBS
Boolean system property to turn on or off generation of stubs. Defaults to true.- See Also:
-
XINCLUDE_AWARE
Boolean system property to control is XInclude is supported. Defaults to false.- See Also:
-
TYPES_PACKAGE_OVERRIDE
Boolean system property to control the support of package names in<types>elements. Part of SBE v2-rc3. Defaults to false.- See Also:
-
TARGET_LANGUAGE
Target language for generated code.- See Also:
-
GENERATE_IR
Boolean system property to turn on or off generation of IR. Defaults to false.- See Also:
-
OUTPUT_DIR
Output directory for generated code.- See Also:
-
TARGET_NAMESPACE
String system property of the namespace for generated code.- See Also:
-
CPP_NAMESPACES_COLLAPSE
Boolean system property to toggle collapsing of nested namespaces in generated C++ stubs. Defaults to false.- See Also:
-
RUST_CRATE_VERSION
Version of the Rust crate to generate.- See Also:
-
RUST_DEFAULT_CRATE_VERSION
The default version of the Rust crate to generate, when not specified via the system property.- See Also:
-
JAVA_GENERATE_INTERFACES
Boolean system property to turn on or off generation of the interface hierarchy. Defaults to false.- See Also:
-
JAVA_ENCODING_BUFFER_TYPE
Specifies the name of the Java mutable buffer to wrap.- See Also:
-
JAVA_DECODING_BUFFER_TYPE
Specifies the name of the Java read only buffer to wrap.- See Also:
-
JAVA_GROUP_ORDER_ANNOTATION
Should theGroupOrderannotation be added to generated stubs.- See Also:
-
CSHARP_GENERATE_NAMESPACE_DIR
Boolean system property to turn on or off generation of namespace directories during csharp code generation. Defaults to true- See Also:
-
KEYWORD_APPEND_TOKEN
Specifies token that should be appended to keywords to avoid compilation errors.If none is supplied then use of keywords results in an error during schema parsing. The underscore character is a good example of a token to use.
- See Also:
-
DECODE_UNKNOWN_ENUM_VALUES
Should unknown enum values be decoded to support extension. Defaults to false.If an unknown enum value is decoded then a language specific SBE_UNKNOWN enum value will be returned rather than throwing an error.
- See Also:
-
CPP_GENERATE_DTOS
Should generate C++ DTOs. Defaults to false.- See Also:
-
JAVA_GENERATE_DTOS
Should generate Java DTOs. Defaults to false.- See Also:
-
SCHEMA_TRANSFORM_VERSION
Configuration option used to manage sinceVersion based transformations. When set, parsed schemas will be transformed to discard messages and types higher than the specified version. This can be useful when needing to generate older versions of a schema to do version compatibility testing.This field can contain a list of ordered pairs in the form:
((<schema id> | '*') ':' <schema id>)(',' ((<schema id> | '*') ':' <schema id>))*. E.g.123:5,*:6which means transform schema with id = 123 to version 5, all others to version 6.- See Also:
-
GENERATE_PRECEDENCE_CHECKS
Whether to generate field precedence checks. For example, whether to check that repeating groups are encoded in schema order.- See Also:
-
PRECEDENCE_CHECKS_FLAG_NAME
The name of the symbol or macro that enables access order checks when building generated C# or C++ code.- See Also:
-
JAVA_PRECEDENCE_CHECKS_PROPERTY_NAME
The name of the system property that enables access order checks at runtime in generated Java code.- See Also:
-
-
Constructor Details
-
SbeTool
public SbeTool()
-
-
Method Details
-
main
Main entry point for the SBE Tool.- Parameters:
args- command line arguments. A single filename is expected.- Throws:
Exception- if an error occurs during process of the message schema.
-
validateAgainstSchema
public static void validateAgainstSchema(String sbeSchemaFilename, String xsdFilename) throws Exception Validate the SBE Schema against the XSD.- Parameters:
sbeSchemaFilename- to be validated.xsdFilename- XSD against which to validate.- Throws:
Exception- if an error occurs while validating.
-
parseSchema
Parse the message schema specification.- Parameters:
sbeSchemaFilename- file containing the SBE specification to be parsed.- Returns:
- the parsed
MessageSchemafor the specification found in the file. - Throws:
Exception- if an error occurs when parsing the specification.
-
generate
Generate SBE encoding and decoding stubs for a target language.- Parameters:
ir- for the parsed specification.outputDirName- directory into which code will be generated.targetLanguage- for the generated code.- Throws:
Exception- if an error occurs while generating the code.
-