ModeShape Distribution 3.0.0.Beta4

org.infinispan.schematic.internal.schema
Class DocumentTransformer.SystemPropertiesTransformer

java.lang.Object
  extended by org.infinispan.schematic.internal.schema.DocumentTransformer.SystemPropertiesTransformer
All Implemented Interfaces:
Document.ValueTransformer
Enclosing class:
DocumentTransformer

public static final class DocumentTransformer.SystemPropertiesTransformer
extends Object
implements Document.ValueTransformer

An implementation of Document.ValueTransformer that replaces variables in the field values with values from the system properties. Only string values are considered, since other types cannot contain variables (and since the transformers are never called on Document or List values).

Variables may appear anywhere within a string value, and multiple variables can be used within the same value. Variables take the form:

    variable := '${' variableNames [ ':' defaultValue ] '}'
    
    variableNames := variableName [ ',' variableNames ]
    
    variableName := /* any characters except ',' and ':' and '}'
    
    defaultValue := /* any characters except
 
Note that variableName is the name used to look up a System property via System.getProperty(String).

Notice that the syntax supports multiple variables. The logic will process the variables from let to right, until an existing System property is found. And at that point, it will stop and will not attempt to find values for the other variables.


Constructor Summary
DocumentTransformer.SystemPropertiesTransformer()
           
 
Method Summary
 Object transform(String name, Object value)
          Transform the supplied field value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentTransformer.SystemPropertiesTransformer

public DocumentTransformer.SystemPropertiesTransformer()
Method Detail

transform

public Object transform(String name,
                        Object value)
Description copied from interface: Document.ValueTransformer
Transform the supplied field value.

Specified by:
transform in interface Document.ValueTransformer
Parameters:
name - the name of the field; never null
value - the existing value for the field
Returns:
the transformed value; never null but may be the same value object if no transformation should be made

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.