Java Code Examples for org.apache.tomcat.util.IntrospectionUtils#PropertySource

The following examples show how to use org.apache.tomcat.util.IntrospectionUtils#PropertySource . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Digester.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
public static void replaceSystemProperties() {
    Log log = LogFactory.getLog(Digester.class);
    if (propertySource != null) {
        IntrospectionUtils.PropertySource[] propertySources =
                new IntrospectionUtils.PropertySource[] { propertySource };
        Properties properties = System.getProperties();
        Set<String> names = properties.stringPropertyNames();
        for (String name : names) {
            String value = System.getProperty(name);
            if (value != null) {
                try {
                    String newValue = IntrospectionUtils.replaceProperties(value, null, propertySources, null);
                    if (!value.equals(newValue)) {
                        System.setProperty(name, newValue);
                    }
                } catch (Exception e) {
                    log.warn(sm.getString("digester.failedToUpdateSystemProperty", name, value), e);
                }
            }
        }
    }
}
 
Example 2
Source File: Digester.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public static void setPropertySource(IntrospectionUtils.PropertySource propertySource) {
    if (!propertySourceSet) {
        Digester.propertySource = propertySource;
        propertySourceSet = true;
    }
}
 
Example 3
Source File: Digester.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public Digester() {
    propertySourceSet = true;
    if (propertySource != null) {
        source = new IntrospectionUtils.PropertySource[] { propertySource, source[0] };
    }
}
 
Example 4
Source File: Digester.java    From tomcatsrc with Apache License 2.0 3 votes vote down vote up
/**
 * Construct a new Digester with default properties.
 */
public Digester() {

    super();

    if (propertySource != null) {
        source = new IntrospectionUtils.PropertySource[] { propertySource, source[0] };
    }

}
 
Example 5
Source File: Digester.java    From tomcatsrc with Apache License 2.0 3 votes vote down vote up
/**
 * Construct a new Digester, allowing a SAXParser to be passed in.  This
 * allows Digester to be used in environments which are unfriendly to
 * JAXP1.1 (such as WebLogic 6.0).  Thanks for the request to change go to
 * James House ([email protected]).  This may help in places where
 * you are able to load JAXP 1.1 classes yourself.
 */
public Digester(SAXParser parser) {

    super();

    this.parser = parser;

    if (propertySource != null) {
        source = new IntrospectionUtils.PropertySource[] { propertySource, source[0] };
    }

}
 
Example 6
Source File: Digester.java    From tomcatsrc with Apache License 2.0 3 votes vote down vote up
/**
 * Construct a new Digester, allowing an XMLReader to be passed in.  This
 * allows Digester to be used in environments which are unfriendly to
 * JAXP1.1 (such as WebLogic 6.0).  Note that if you use this option you
 * have to configure namespace and validation support yourself, as these
 * properties only affect the SAXParser and empty constructor.
 */
public Digester(XMLReader reader) {

    super();

    this.reader = reader;

    if (propertySource != null) {
        source = new IntrospectionUtils.PropertySource[] { propertySource, source[0] };
    }

}