public Object getValue(ExecutionContext context) throws ExpressionEvaluationException { Map<String, Object> beans = context.getBeanContext().getBeanMap(); Object value = exec(beans); if(logger.isDebugEnabled()) { logger.debug("Expression value evaluation:==============================================================="); logger.debug("\tExpression='" + getExpression() + "'"); logger.debug("\tBean Map='" + beans + "'"); logger.debug("\tValue='" + value + "'"); logger.debug("==========================================================================================="); } return value; }
public Object getValue(ExecutionContext context) throws ExpressionEvaluationException { Map<String, Object> beans = context.getBeanContext().getBeanMap(); Object value = exec(beans); if(logger.isDebugEnabled()) { logger.debug("Expression value evaluation:==============================================================="); logger.debug("\tExpression='" + getExpression() + "'"); logger.debug("\tBean Map='" + beans + "'"); logger.debug("\tValue='" + value + "'"); logger.debug("==========================================================================================="); } return value; }
private Object getBeanFromExecutionContext(final ExecutionContext execContext, final String beanId) { final Object bean = execContext.getBeanContext().getBean(beanId); if (bean == null) { throw new SmooksException("Exception routing beanId '" + beanId + "'. The bean was not found in the Smooks ExceutionContext."); } return bean; }
private void bindExpressionValue(String mapPropertyName, String dataString, ExecutionContext executionContext, Fragment source) { Map<String, Object> beanMap = executionContext.getBeanContext().getBeanMap(); Map<String, Object> variables = new HashMap<String, Object>(); if(expressionHasDataVariable) { variables.put(EXPRESSION_VALUE_VARIABLE_NAME, dataString); } Object dataObject = expressionEvaluator.exec(beanMap, variables); decodeAndSetPropertyValue(mapPropertyName, dataObject, executionContext, source); }
private void bindExpressionValue(String mapPropertyName, String dataString, ExecutionContext executionContext, Fragment source) { Map<String, Object> beanMap = executionContext.getBeanContext().getBeanMap(); Map<String, Object> variables = new HashMap<String, Object>(); if(expressionHasDataVariable) { variables.put(EXPRESSION_VALUE_VARIABLE_NAME, dataString); } Object dataObject = expressionEvaluator.exec(beanMap, variables); decodeAndSetPropertyValue(mapPropertyName, dataObject, executionContext, source); }
public Message createJMSMessage( final String beanId, final ExecutionContext context, final Session jmsSession ) throws SmooksException { final Object bean = context.getBeanContext().getBean( beanId ); if(bean == null) { throw new SmooksException("Bean beandId '" + beanId + "' not available in the bean repository of this execution context. Check the order in which your resources are being applied (in Smooks configuration)."); } return createTextMessage( bean.toString(), jmsSession ); }
public void executeVisitLifecycleCleanup(Fragment fragment, ExecutionContext executionContext) { BeanContext beanContext = executionContext.getBeanContext(); BeanId beanId = beanContext.getBeanId(bindTo); Object bean = beanContext.getBean(beanId); beanContext.notifyObservers(new BeanContextLifecycleEvent(executionContext, fragment, BeanLifecycle.END_FRAGMENT, beanId, bean)); if(!retain) { executionContext.getBeanContext().removeBean(beanId, null); } }
/** * Get the bean map associated with the supplied request instance. * @param executionContext The execution context. * @return The bean map associated with the supplied request. */ public static Map<String, Object> getBeanMap(ExecutionContext executionContext) { warnUsingDeprecatedMethod(); AssertArgument.isNotNull(executionContext, "executionContext"); return executionContext.getBeanContext().getBeanMap(); }
/** * Get the bean map associated with the supplied request instance. * @param executionContext The execution context. * @return The bean map associated with the supplied request. */ public static Map<String, Object> getBeanMap(ExecutionContext executionContext) { warnUsingDeprecatedMethod(); AssertArgument.isNotNull(executionContext, "executionContext"); return executionContext.getBeanContext().getBeanMap(); }
private void wireObject(ExecutionContext executionContext) { BeanContext beanContext = executionContext.getBeanContext(); Map<String, Object> beanMap = beanContext.getBeanMap(); Object key = keyExtractor.getValue(beanMap); @SuppressWarnings("unchecked") //TODO: Optimize to use the BeanId object Map<Object, Object> map = (Map<Object, Object>) beanContext.getBean(mapBindingKey); Object record = beanContext.getBean(RECORD_BEAN); map.put(key, record); }
private void wireObject(ExecutionContext executionContext) { BeanContext beanContext = executionContext.getBeanContext(); Map<String, Object> beanMap = beanContext.getBeanMap(); Object key = keyExtractor.getValue(beanMap); @SuppressWarnings("unchecked") // TODO: Optimize to use the BeanId object Map<Object, Object> map = (Map<Object, Object>) beanContext.getBean(mapBindingKey); Object record = beanContext.getBean(RECORD_BEAN); map.put(key, record); }
private void wireObject(ExecutionContext executionContext) { BeanContext beanContext = executionContext.getBeanContext(); Map<String, Object> beanMap = beanContext.getBeanMap(); Object key = keyExtractor.getValue(beanMap); @SuppressWarnings("unchecked") //TODO: Optimize to use the BeanId object Map<Object, Object> map = (Map<Object, Object>) beanContext.getBean(mapBindingKey); Object record = beanContext.getBean(RECORD_BEAN); map.put(key, record); }
private void bindValue(String dataString, ExecutionContext executionContext, Fragment source) { Object valueObj = decodeDataString(dataString, executionContext); BeanContext beanContext = executionContext.getBeanContext(); if(valueObj == null) { beanContext.removeBean(beanId, source); } else { beanContext.addBean(beanId, valueObj, source); } }
private Object convert(ExecutionContext executionContext, Object bean, Fragment source) { bean = BeanUtils.convertListToArray((List<?>)bean, beanRuntimeInfo.getArrayType()); executionContext.getBeanContext().changeBean(beanId, bean, source); return bean; }
/** * Get the bean map associated with the supplied request instance. * @param executionContext The execution context. * @return The bean map associated with the supplied request. */ public static Map<String, Object> getBeanMap(ExecutionContext executionContext) { warnUsingDeprecatedMethod(); AssertArgument.isNotNull(executionContext, "executionContext"); return executionContext.getBeanContext().getBeanMap(); }
private void bindValue(String dataString, ExecutionContext executionContext, Fragment source) { Object valueObj = decodeDataString(dataString, executionContext); BeanContext beanContext = executionContext.getBeanContext(); if(valueObj == null) { beanContext.removeBean(beanId, source); } else { beanContext.addBean(beanId, valueObj, source); } }
public void visitAfter(Element element, ExecutionContext executionContext) throws SmooksException { String serializedFragment; if(childContentOnly) { serializedFragment = XmlUtil.serialize(element.getChildNodes(), false); } else { serializedFragment = XmlUtil.serialize(element, true); } if(!omitXMLDeclaration) { serializedFragment = "<?xml version=\"1.0\"?>\n" + serializedFragment; } executionContext.getBeanContext().addBean(bindTo, serializedFragment, new Fragment(element)); }
public void executeVisitLifecycleCleanup(Fragment fragment, ExecutionContext executionContext) { BeanContext beanContext = executionContext.getBeanContext(); Object bean = beanContext.getBean(beanId); beanContext.notifyObservers(new BeanContextLifecycleEvent(executionContext, fragment, BeanLifecycle.END_FRAGMENT, beanId, bean)); if(!retain) { beanContext.removeBean(beanId, null); } } }
private void bindExpressionValue(ExecutionContext executionContext) { Map<String, Object> beanMap = executionContext.getBeanContext().getBeanMap(); Object dataObject = expression.getValue(beanMap); if(dataObject instanceof String) { populateAndSetPropertyValue((String) dataObject, executionContext); } else { populateAndSetPropertyValue(dataObject, executionContext); } }
public void onBeanLifecycleEvent(BeanContextLifecycleEvent event) { if(event.getBeanId() == watchedBean && event.getLifecycle() == BeanLifecycle.CHANGE) { ExecutionContext executionContext = event.getExecutionContext(); // Set the array on the object, via the populator... populator.setPropertyValue(property, event.getBean(), executionContext, event.getSource()); // Remove this observer... executionContext.getBeanContext().removeObserver(this); } } }