public final class DdlXMLParser extends Object
Model and converts the parsed into an X Configuration Script (XCS) that
can be used to seed the configuration repository.
The DDL property format can be derived from x-ddl schema by converting the xml format to a set of
hierarchical properties derived by concatenation the xml model child elements into a '.' separated
properties path prefixed by 'x.'. In cases where the a DDL element has a list of child elements the property
path is formed by using either the 'name' or 'id' attribute of the child element to
form a unique path. The following are examples of converting DDL XML to a properties:
For example:
<model>
<env>
<nv>
<checked>false</checked>
<optimizefor>latency</optimizefor>
</nv>
</env>
<apps>
<app name="OrderProcessing" mainClass="com.acme.OrderProcessingApp">
<disposeOnSend>true</disposeOnSend>
<performDuplicateChecking>false</performDuplicateChecking>
</app>
<app name="Shipping" mainClass="com.acme.ShippingApp">
<disposeOnSend>true</disposeOnSend>
<performDuplicateChecking>true</performDuplicateChecking>
<messaging>
<factories>
<factory>com.example.MessageFactory</factory>
<factory>com.example.AdminMessageFactory</factory>
</factories>
</messaging>
</app>
</env>
</model>
would translate to:
x.env.nv.checked = false x.env.nv.optimizefor = latency x.apps.OrderProcessing.mainClass=com.acme.OrderProcessingApp x.apps.OrderProcessing.disposeOnSend=true x.apps.OrderProcessing.performDuplicateChecking=false x.apps.Shipping.mainClass=com.acme.ShippingApp x.apps.Shipping.disposeOnSend=true x.apps.Shipping.performDuplicateChecking=false x.apps.Shipping.messaging.factories.1=com.example.MessageFactory x.apps.Shipping.messaging.factories.2=com.example.AdminMessageFactory
| Modifier and Type | Field and Description |
|---|---|
static boolean |
ESCAPE_SUBSTITUTION_VALUES_DEFAULT
Deprecated.
|
static String |
ESCAPE_SUBSTITUTION_VALUES_PROP
Deprecated.
|
static String |
PROP_VALIDATE_DDL
Deprecated.
|
static String |
PROP_VALIDATE_DDL_DEFAULT
Deprecated.
|
static String |
UNSUBSTITUTED_VARIABLE_VALUE
Deprecated.
This property is no longer used.
|
| Constructor and Description |
|---|
DdlXMLParser() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addProperties(com.neeve.ddl.jaxb.HierarchicalPropertySet ddlProperties,
Properties properties)
This method can be used to add properties to a
HierarchicalPropertySet. |
static com.neeve.ddl.jaxb.Model |
fromDdlProperties(Properties ddlProperties,
UtlTailoring.PropertySource overrides)
Converts to DDL model from DDL properties format.
|
static com.neeve.ddl.jaxb.Model |
fromDdlProperties(Properties ddlProperties,
UtlTailoring.PropertySource overrides,
boolean resolveProfileAndTemplates)
Converts to DDL model from DDL properties format.
|
static com.neeve.ddl.jaxb.Model |
parse(File ddl,
UtlTailoring.PropertySource substitutionsAndOverrides)
Parses the given File as a DDL
Model. |
static com.neeve.ddl.jaxb.Model |
parse(InputStream descriptorInput,
UtlTailoring.PropertySource substitutionsAndOverrides)
Parses the given InputStream as a DDL
Model. |
static com.neeve.ddl.jaxb.Model |
parse(String ddl,
UtlTailoring.PropertySource substitutionsAndOverrides)
Parses the given String into a DDL
Model. |
static void |
parseAndAppendJvmParams(com.neeve.ddl.jaxb.XvmConfig.Provisioning.Jvm jvmConfig,
Appendable target)
Given a JVM config, parse the JVM Parameters and parameter sets into a JVM Parameter
String.
|
static File |
parseAndConvertToXcs(InputStream descriptorInput,
boolean echo,
UtlTailoring.PropertySource substitutionsAndOverrides)
Parse the given
descriptorFile and converts its value to an xcs script that can be used to seed the configuration repository. |
static void |
set(com.neeve.ddl.jaxb.HierarchicalPropertySet ddlProperties,
Properties properties)
This method can be used to set the properties in a
HierarchicalPropertySet. |
static Properties |
toDdlProperties(com.neeve.ddl.jaxb.Model model)
Converts a DDL model to DDL properties format.
|
static File |
toXcs(com.neeve.ddl.jaxb.Model model)
Converts a DDL model to an XCS file to apply to an X config repo
|
static File |
toXcs(com.neeve.ddl.jaxb.Model model,
boolean echo)
Converts a DDL model to an XCS file to apply to an X config repo
|
static File |
toXcs(com.neeve.ddl.jaxb.Model model,
boolean echo,
UtlTailoring.PropertySource overrides)
Converts a DDL model to an XCS file to apply to an X config repo
|
static void |
toXcs(com.neeve.ddl.jaxb.Model model,
boolean echo,
UtlTailoring.PropertySource overrides,
Appendable out)
Converts a DDL model to an XCS file to apply to an X config repo
|
static void |
toXml(com.neeve.ddl.jaxb.Model model,
Appendable out)
Dumps the model to the given
Appendable as XML. |
static Properties |
unmarshalProperties(com.neeve.ddl.jaxb.HierarchicalPropertySet properties)
This method can be used to unmarshal a
HierarchicalPropertySet into java Properties. |
static void |
writeSystemDetails(File srcDdlFile,
File destDdlFile,
com.neeve.ddl.jaxb.SystemDetails systemDetails)
Rewrites systemInfo section of DDL XML with supplied map of values.
|
@Deprecated public static final String PROP_VALIDATE_DDL
DdlConfigConstants.VALIDATE_DDL_PROPNAME@Deprecated public static final String PROP_VALIDATE_DDL_DEFAULT
DdlConfigConstants.VALIDATE_DDL_DEFAULT@Deprecated public static final String ESCAPE_SUBSTITUTION_VALUES_PROP
DdlConfigConstants.VALIDATE_DDL_DEFAULT@Deprecated public static final boolean ESCAPE_SUBSTITUTION_VALUES_DEFAULT
DdlConfigConstants.ESCAPE_SUBSTITUTION_VALUES_DEFAULT@Deprecated public static final String UNSUBSTITUTED_VARIABLE_VALUE
public static final File parseAndConvertToXcs(InputStream descriptorInput, boolean echo, UtlTailoring.PropertySource substitutionsAndOverrides) throws Exception
descriptorFile and converts its value to an xcs script that can be used to seed the configuration repository.
This method is equivalent to calling:
parse(descriptorInput, substitutionResolver)
toDdlProperties(Model)
DdlPropertyParser#toXcs(properties, echo, substitutionResolver)
descriptorInput - The input DDLecho - Whether or not the XCS script has 'echo on' enabledsubstitutionsAndOverrides - The resolver for substitution variables and overrides in the DDL.Exceptionpublic static final File toXcs(com.neeve.ddl.jaxb.Model model, boolean echo) throws Exception
model - The DDL modelecho - Indicates whether the config xcs file should have 'echo on'
or 'echo off' as the starting commandExceptionpublic static final File toXcs(com.neeve.ddl.jaxb.Model model, boolean echo, UtlTailoring.PropertySource overrides) throws Exception
model - The DDL modelecho - Indicates whether the config xcs file should have 'echo on'
or 'echo off' as the starting commandoverrides - A PropertySource for overrides of xml parsed values. Override properties
take precedence over values supplied via xml.Exceptionpublic static final void toXcs(com.neeve.ddl.jaxb.Model model,
boolean echo,
UtlTailoring.PropertySource overrides,
Appendable out)
throws Exception
model - The DDL modelecho - Indicates whether the config xcs file should have 'echo on'
or 'echo off' as the starting command.overrides - A PropertySource for overrides of xml parsed values. Override properties
take precedence over values supplied via xml.out - The appendable to which to write the xcs script.Exceptionpublic static final void set(com.neeve.ddl.jaxb.HierarchicalPropertySet ddlProperties,
Properties properties)
HierarchicalPropertySet.
Examples of Properties objects in the jaxb model include:
Model.getEnv()
DiscoveryDescriptor.Properties
BusConfig.Properties
AppConfig.Storage.Icr.Bus.Properties
properties - The properties.public static final void addProperties(com.neeve.ddl.jaxb.HierarchicalPropertySet ddlProperties,
Properties properties)
HierarchicalPropertySet.
Examples of Properties objects in the jaxb model include:
Model.getEnv()
DiscoveryDescriptor.Properties
BusConfig.Properties
AppConfig.Storage.Icr.Bus.Properties
properties - The properties.public static final Properties unmarshalProperties(com.neeve.ddl.jaxb.HierarchicalPropertySet properties)
HierarchicalPropertySet into java Properties.
Examples of Properties objects in the jaxb model include:
Model.getEnv()
DiscoveryDescriptor.Properties
BusConfig.Properties
AppConfig.Storage.Icr.Bus.Properties
properties - The properties.public static final com.neeve.ddl.jaxb.Model fromDdlProperties(Properties ddlProperties, UtlTailoring.PropertySource overrides) throws Exception
This method is equivalent to calling fromDdlProperties(ddlProperties, overrides, true).
ddlProperties - The parsed model.overrides - the ddl override properties to apply to the model.Exceptionpublic static final com.neeve.ddl.jaxb.Model fromDdlProperties(Properties ddlProperties, UtlTailoring.PropertySource overrides, boolean resolveProfileAndTemplates) throws Exception
DdlConfigConstants.DDL_PREFIX_PROPNAME controls the prefix used to identify DDL properties. (See
DdlConfigConstants.DDL_PROPERTYNAME_VALIDATION_PROPNAME controls whether properties starting with the DDL prefix are checked for any
unknown property names.
DdlConfigConstants.DDL_PROFILES_PROPNAME controls which profiles should be activated when resolveProfileAndTemplates is set to true. This
property is only sourced from the provided overrides.
DdlConfigConstants.DDL_TARGETXVM_PROPNAME controls whether configuration should be resolved for a particular XVM in the model. This
property is only sourced from the provided overrides.
ddlProperties - The parsed model.overrides - These properties are used to override property values for properties in the resolved model, but do not
cause creation of new properties ... e.g. they are only used to augment the values of the ddlProperties
supplied when creating the returned model.resolveProfileAndTemplates - When true this method will apply and remove profiles and templates in the model.Exceptionpublic static final Properties toDdlProperties(com.neeve.ddl.jaxb.Model model) throws Exception
model - The parsed model.Exceptionpublic static final File toXcs(com.neeve.ddl.jaxb.Model model) throws Exception
Exceptionpublic static com.neeve.ddl.jaxb.Model parse(File ddl, UtlTailoring.PropertySource substitutionsAndOverrides) throws Exception
Model.
This is equivalent to calling #parse(String, PropertySource) with the file read as a utf-8 encoded string.
substitutionsAndOverrides - The resolver for substitution variables and overrides in the DDL.JAXBException - If there is an error loading parsing the ddl.Exceptionpublic static com.neeve.ddl.jaxb.Model parse(InputStream descriptorInput, UtlTailoring.PropertySource substitutionsAndOverrides) throws Exception
Model.
This is equivalent to calling #parse(String, PropertySource) with the input stream read as a utf-8 encoded string.
descriptorInput - The ddl xml input streamsubstitutionsAndOverrides - The resolver for substitution variables and overrides in the DDL.Exception - If there is an error parsing the DDL.public static com.neeve.ddl.jaxb.Model parse(String ddl, UtlTailoring.PropertySource substitutionsAndOverrides) throws Exception
Model.
Substitution variables in the ddl are substituted from the provided substitution resolver and the <env> properties in the ddl, with values from the substitution resolver taking higher precedence.
ddl - The ddl xml input streamsubstitutionsAndOverrides - The resolver for substitution variables and overrides in the DDL.Exception - If there is an error parsing the DDL.public static void writeSystemDetails(File srcDdlFile, File destDdlFile, com.neeve.ddl.jaxb.SystemDetails systemDetails) throws IOException
srcDdlFile - File to rewritedestDdlFile - Destination file into which to write. If null is given, source file will be rewritten.systemDetails - Map of values to write into systemDetails section in DDL. Keys are tag names in systemInfo section.IOException - If there is an error reading or writing the DDL.public static final void toXml(com.neeve.ddl.jaxb.Model model,
Appendable out)
throws DdlConfigException
Appendable as XML.model - The model.out - The appendable to append to.DdlConfigException - if their is an error generating the xml.public static void parseAndAppendJvmParams(com.neeve.ddl.jaxb.XvmConfig.Provisioning.Jvm jvmConfig,
Appendable target)
jvmConfig - The JVM Configuration.target - The target StringBuilder to which to appendCopyright © 2019 N5 Technologies, Inc. All Rights Reserved.