use of com.sun.enterprise.admin.servermgmt.xml.stringsubs.Defaults in project Payara by payara.
the class StringSubstitutionEngine method buildChangePairsMap.
/**
* Build's a HashMap containing an entry for each <change-pair> in the string-subs
* configuration file. The HashMap is created so that <change-pair> elements do not
* need to be re-analyzed each time they're referenced.
*/
private void buildChangePairsMap() {
if (_changePairsMap == null || _changePairsMap.isEmpty()) {
Defaults defaults = _root.getDefaults();
if (defaults != null) {
List<Property> properties = defaults.getProperty();
if (!properties.isEmpty()) {
_defaultProperties = new HashMap<String, Property>(properties.size(), 1);
for (Property prop : properties) {
_defaultProperties.put(prop.getKey(), prop);
}
}
}
List<? extends ChangePair> changePairList = _root.getChangePair();
_changePairsMap = new HashMap<String, Pair>(changePairList.size());
for (ChangePair pair : _root.getChangePair()) {
String id = pair.getId();
String beforeValue = pair.getBefore();
String afterValue = pair.getAfter();
if (id == null || beforeValue == null || afterValue == null) {
_logger.log(Level.INFO, SLogger.EMPTY_CHANGE_PAIR);
continue;
}
beforeValue = _attrPreprocessor.substituteBefore(beforeValue);
afterValue = _attrPreprocessor.substituteAfter(afterValue);
_changePairsMap.put(id, new Pair(beforeValue, afterValue));
}
}
}
use of com.sun.enterprise.admin.servermgmt.xml.stringsubs.Defaults in project Payara by payara.
the class StringSubstitutionEngine method getDefaultProperties.
@Override
public List<Property> getDefaultProperties(PropertyType type) {
Defaults defaults = _root.getDefaults();
if (defaults == null) {
return Collections.emptyList();
}
if (type == null) {
return defaults.getProperty();
}
List<Property> props = new ArrayList<Property>();
for (Property prop : defaults.getProperty()) {
if (prop.getType().equals(type)) {
props.add(prop);
}
}
return props;
}
Aggregations