|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.config.VMConfigurer
public final class VMConfigurer
The Talon VM configurer.
A talon VM is configured using Domain Descriptor Language (ddl). The DDL is defined in x-ddl.xsd schema which can be alternately expressed as a set of hierarchical DDL properties as described below. The VMConfigurer uses the DDL to seed The X Platform's internal configuration repository which is consulted at startup to configure the system.
<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
The above allows allows applications to use the DDL xml directly to configure applications, while the property based format allows applications to bind to other configuration mechanisms by converting external config to a set of DDL properties that can be used to configure the platform.
Constructor Summary | |
---|---|
VMConfigurer()
|
Method Summary | |
---|---|
static void |
configure(File ddlDescriptorXml,
UtlStr.ISubstResolver valueResolver)
Deprecated. use configure(File, PropertySource) |
static void |
configure(File ddlDescriptorXml,
UtlTailoring.PropertySource valueResolver)
Configure the VM using a descriptor file localized using a user supplied value resolver. |
static void |
configure(InputStream ddlDescriptorXml,
UtlStr.ISubstResolver valueResolver)
Deprecated. use configure(File, PropertySource) |
static void |
configure(InputStream ddlDescriptorXml,
UtlTailoring.PropertySource valueResolver)
Configure the VM using a descriptor file from the given stream and the given valueResolver. |
static void |
configure(InputStream ddlDescriptorXml,
UtlTailoring.PropertySource valueResolver,
Properties ddlOverlayProperties)
Configure the VM using a descriptor file. |
static void |
configure(Properties ddlProperties)
Configure the VM using the given DDL properties. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VMConfigurer()
Method Detail |
---|
@Deprecated public static final void configure(InputStream ddlDescriptorXml, UtlStr.ISubstResolver valueResolver) throws Exception
This method is equivalent to call #configure(InputStream, PropertySource)
ddlDescriptorXml
- an InputStream
containing the contents of the x-ddl to localize.valueResolver
- The substitution values against which to localize the x-ddl.
Exception
public static final void configure(InputStream ddlDescriptorXml, UtlTailoring.PropertySource valueResolver) throws Exception
This method is equivalent to calling VMConfigurer#configure(ddlDescriptorXml, valueResolver, null)
Note: this call closes the provided stream.
ddlDescriptorXml
- an InputStream
containing the contents of the x-ddl to localize.valueResolver
- The substitution values against which to localize the x-ddl.
Exception
@Deprecated public static final void configure(File ddlDescriptorXml, UtlStr.ISubstResolver valueResolver) throws Exception
This method is equivalent to calling #configure(File, PropertySource)
ddlDescriptorXml
- The ddl xml file.valueResolver
- The resolver used as the property source for performing String substitution of ${propName::default}
values in the file for overridding element values.
Exception
public static final void configure(File ddlDescriptorXml, UtlTailoring.PropertySource valueResolver) throws Exception
This method is equivalent to calling VMConfigurer#configure(ddlDescriptorXml, valueResolver, null)
with file opened as an InputStream.
ddlDescriptorXml
- The ddl xml file.valueResolver
- The resolver used as the property source for performing String substitution of ${propName::default}
values in the file for overridding element values.
Exception
public static final void configure(InputStream ddlDescriptorXml, UtlTailoring.PropertySource valueResolver, Properties ddlOverlayProperties) throws Exception
This call localizes the provided ddl xml file using the provided value resolver to perform substitutions on the provided DDL. The ddl then parsed, converted to DDL properties that are augemented by overlaying the ddl Properties provided. The resulting set of properties is then used to configure the system.
ddlDescriptorXml
- The ddl xml file.valueResolver
- The resolver used as the property source for performing String substitution of ${propName::default}ddlOverlayProperties
- Additional ddl overlay properties (for example ddl configuration from system properties or the environment).
values in the file for overridding element values. s
Exception
public static final void configure(Properties ddlProperties) throws Exception
The provided DDL configuration properties (in DDL property format) are used to configure the system. This configuration method is provided as a means for supporting external configuration mechanisms by allowing an arbitrary configuration format to conform platform config to a set of hierarchical properties that can be translated to platform configuration.
The set of properties can contain values that use substitution variables in the form of ${propName::defaultValue}. For example:
troubleshooting.enabled=true x.apps.OrderProcessing.enableMessageTrace=${troubleshooting.enabled::false}would resolve to:
troubleshooting.enabled=true x.apps.OrderProcessing.enableMessageTrace=true
UtlEnv
is used to override values for
properties provided and to check for child element or attributes on properties that
are already specified in the set of properties passed in. But the environment is not consulted
for values that would be supplied as a child element list with a name or id attribute such as
a new app or a new bus. This prevents inadvertent addition of additional configuration elements
from the environment.
To use the environment properties as a source for new ddl elements such as app or buses it is up
to the caller to add those properties to the ddlProperties passed in here by calling
UtlEnv.getEnvPropsNoWarn()
and adding them to properties supplied here.
ddlProperties
- The DDL properties.
Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |