@Override public void begin(InterpretationContext context, String elementName, Attributes attributes) throws ActionException { String name = attributes.getValue(NAME_ATTRIBUTE); String source = attributes.getValue(SOURCE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(attributes.getValue(SCOPE_ATTRIBUTE)); String defaultValue = attributes.getValue(DEFAULT_VALUE_ATTRIBUTE); if (OptionHelper.isEmpty(name) || OptionHelper.isEmpty(source)) { addError( "The \"name\" and \"source\" attributes of <springProperty> must be set"); } ActionUtil.setProperty(context, name, getValue(source, defaultValue), scope); }
} else { addInfo("Setting variable [" + asKey + "] to [" + envEntryValue + "] in [" + scope + "] scope"); ActionUtil.setProperty(ec, asKey, envEntryValue, scope);
ActionUtil.setProperty(ec, keyStr, val, scope);
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
ActionUtil.setProperty(ec, name, value, scope);
} else { addInfo("Setting variable ["+asKey+"] to ["+envEntryValue+"] in ["+scope+"] scope"); ActionUtil.setProperty(ec, asKey, envEntryValue, scope);
/** {@inheritDoc} */ @Override public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException { String key = attributes.getValue(NAME_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(attributes.getValue(SCOPE_ATTRIBUTE)); String source = attributes.getValue("source"); String defaultValue = attributes.getValue("defaultValue"); String value = environment.getProperty(source, defaultValue); ActionUtil.setProperty(ic, key, value, scope); }
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; } String datePatternStr = attributes.getValue(DATE_PATTERN_ATTRIBUTE); if (OptionHelper.isEmpty(datePatternStr)) { addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; } String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE); long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); } if (inError) return; String scopeStr = attributes.getValue(SCOPE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(scopeStr); CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, scope); }
ActionUtil.setProperty(ec, keyStr, val, scope);
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; } String datePatternStr = attributes.getValue(DATE_PATTERN_ATTRIBUTE); if (OptionHelper.isEmpty(datePatternStr)) { addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; } String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE); long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); } if (inError) return; String scopeStr = attributes.getValue(SCOPE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(scopeStr); CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, scope); }
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String keyStr = attributes.getValue(KEY_ATTRIBUTE); if (OptionHelper.isEmpty(keyStr)) { addError("Attribute named [" + KEY_ATTRIBUTE + "] cannot be empty"); inError = true; } String datePatternStr = attributes.getValue(DATE_PATTERN_ATTRIBUTE); if (OptionHelper.isEmpty(datePatternStr)) { addError("Attribute named [" + DATE_PATTERN_ATTRIBUTE + "] cannot be empty"); inError = true; } String timeReferenceStr = attributes.getValue(TIME_REFERENCE_ATTRIBUTE); long timeReference; if (CONTEXT_BIRTH.equalsIgnoreCase(timeReferenceStr)) { addInfo("Using context birth as time reference."); timeReference = context.getBirthTime(); } else { timeReference = System.currentTimeMillis(); addInfo("Using current interpretation time, i.e. now, as time reference."); } if (inError) return; String scopeStr = attributes.getValue(SCOPE_ATTRIBUTE); Scope scope = ActionUtil.stringToScope(scopeStr); CachingDateFormatter sdf = new CachingDateFormatter(datePatternStr); String val = sdf.format(timeReference); addInfo("Adding property to the context with key=\"" + keyStr + "\" and value=\"" + val + "\" to the " + scope + " scope"); ActionUtil.setProperty(ec, keyStr, val, scope); }
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if (propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if (propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if (propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
/** * Now property definer is initialized by all properties and we can put * property value to context */ public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != definer) { addWarn("The object at the of the stack is not the property definer for property named [" + propertyName + "] pushed earlier."); } else { addInfo("Popping property definer for property named [" + propertyName + "] from the object stack"); ec.popObject(); // let's put defined property and value to context but only if it is // not null String propertyValue = definer.getPropertyValue(); if(propertyValue != null) { ActionUtil.setProperty(ec, propertyName, propertyValue, scope); } } } }
} else { addInfo("Setting variable ["+asKey+"] to ["+envEntryValue+"] in ["+scope+"] scope"); ActionUtil.setProperty(ec, asKey, envEntryValue, scope);
} else { addInfo("Setting variable [" + asKey + "] to [" + envEntryValue + "] in [" + scope + "] scope"); ActionUtil.setProperty(ec, asKey, envEntryValue, scope);