public static BeanRepository getBeanRepository(ExecutionContext executionContext) { BeanRepository beanRepository = (BeanRepository) executionContext.getAttribute(BEAN_REPOSITORY_CONTEXT_KEY); if(beanRepository == null) { beanRepository = new BeanRepository(executionContext.getBeanContext()); executionContext.setAttribute(BEAN_REPOSITORY_CONTEXT_KEY, beanRepository); } return beanRepository; }
public static DaoRegister<?> getDAORegister(final ExecutionContext executionContext) { return (DaoRegister<?>) executionContext.getAttribute(PersistenceUtil.getDAORegisterAttributeName(executionContext.getDeliveryConfig())) ; }
public Node filter(Document doc) { Node deliveryNode; // Apply assembly phase... if (doc.getDocumentElement() == null) { logger.debug("Empty Document [" + executionContext.getDocumentSource() + "]. Not performaing any processing."); return doc; } deliveryNode = filter(doc.getDocumentElement()); if (deliveryNode == null) { deliveryNode = doc; } return deliveryNode; }
public static void setResults(ExecutionContext executionContext, Result... results) { if(results != null) { executionContext.setAttribute(CONTEXT_KEY, results); } else { executionContext.removeAttribute(CONTEXT_KEY); } }
public static Map<String, String> getNamespacePrefixMappings(ExecutionContext executionContext) { Map<String, String> namespacePrefixMappings = (Map<String, String>) executionContext.getAttribute(NamespaceReaper.class); if(namespacePrefixMappings == null) { namespacePrefixMappings = new LinkedHashMap<String, String>(); executionContext.setAttribute(NamespaceReaper.class, namespacePrefixMappings); } return namespacePrefixMappings; } }
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; }
/** * Add a bean instance to the specified request under the specified beanId. * * @param executionContext The execution context within which the bean is created. * @param beanId The beanId under which the bean is to be stored. * @param bean The bean instance to be stored. */ public static void addBean(ExecutionContext executionContext, String beanId, Object bean) { warnUsingDeprecatedMethod(); AssertArgument.isNotNull(executionContext, "executionContext"); AssertArgument.isNotNullAndNotEmpty(beanId, "beanId"); AssertArgument.isNotNull(bean, "bean"); BeanId beanIdObj = getBeanId(executionContext.getContext().getBeanIdStore(), beanId); executionContext.getBeanContext().addBean(beanIdObj, bean, null); }
@SuppressWarnings("unchecked") public void visitAfter(SAXElement saxElement, ExecutionContext executionContext) throws SmooksException, IOException { Map<String, SAXSerializer> fragmentSerializers = (Map<String, SAXSerializer>) executionContext.getAttribute(FragmentSerializer.class); SAXSerializer serializer = fragmentSerializers.get(bindTo); try { executionContext.getBeanContext().addBean(bindTo, serializer.fragmentWriter.toString().trim(), new Fragment(saxElement)); } finally { DynamicSAXElementVisitorList.removeDynamicVisitor(serializer, executionContext); } }
private DataDecoder getDecoder(ExecutionContext executionContext) throws DataDecodeException { return getDecoder(executionContext.getDeliveryConfig()); }
/** * Get the {@link ExtensionContext} from the {@link org.milyn.container.ExecutionContext}. * @param executionContext Execution Context. * @return Extension Context. */ public static ExtensionContext getExtensionContext(ExecutionContext executionContext) { return (ExtensionContext) executionContext.getAttribute(EXEC_CONTEXT_KEY); }
public static void setDAORegister(final ExecutionContext executionContext, final DaoRegister<?> registery) { executionContext.setAttribute(getDAORegisterAttributeName(executionContext.getDeliveryConfig()), registery) ; }
public static void initializeParameterContainer(int id, ParameterListType type, ExecutionContext executionContext) { ParameterContainer<?> container = getParameterContainer(id, executionContext); if(container == null) { switch (type) { case NAMED: container = new NamedParameterContainer((NamedParameterIndex) getParameterIndex(id, executionContext.getContext())); break; case POSITIONAL: container = new PositionalParameterContainer((PositionalParameterIndex) getParameterIndex(id, executionContext.getContext())); break; default: throw new IllegalStateException("Unknown ParameterListType '" + type + "'."); } executionContext.setAttribute(getParameterContainerName(id), container); } else { container.clear(); } }
/** * Set the {@link ExtensionContext} on the {@link org.milyn.container.ExecutionContext}. * @param extensionContext Extension Context. * @param executionContext Execution Context. */ public static void setExtensionContext(ExtensionContext extensionContext, ExecutionContext executionContext) { executionContext.setAttribute(EXEC_CONTEXT_KEY, extensionContext); }
public static StandaloneBeanContext create(ExecutionContext executionContext) { StandaloneBeanContext beanContext; BeanIdStore beanIdStore = executionContext.getContext().getBeanIdStore(); Map<String, Object> beanMap = createBeanMap(executionContext, beanIdStore); beanContext = new StandaloneBeanContext(executionContext, beanIdStore, beanMap); return beanContext; }
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); }
/** * Add a bean instance to the specified request under the specified beanId. * * @param executionContext The execution context within which the bean is created. * @param beanId The beanId under which the bean is to be stored. * @param bean The bean instance to be stored. */ public static void addBean(ExecutionContext executionContext, String beanId, Object bean) { warnUsingDeprecatedMethod(); AssertArgument.isNotNull(executionContext, "executionContext"); AssertArgument.isNotNullAndNotEmpty(beanId, "beanId"); AssertArgument.isNotNull(bean, "bean"); BeanId beanIdObj = getBeanId(executionContext.getContext().getBeanIdStore(), beanId); executionContext.getBeanContext().addBean(beanIdObj, bean, null); }
private static Map<String, ElementToNodeModel> getElementToNodeModelMap(ExecutionContext executionContext) { @SuppressWarnings("unchecked") Map<String, ElementToNodeModel> map = (Map<String, ElementToNodeModel>) executionContext.getAttribute(ElementToNodeModel.class); if(map == null) { map = new HashMap<String, ElementToNodeModel>(); executionContext.setAttribute(ElementToNodeModel.class, map); } return map; }
@SuppressWarnings("unchecked") public void visitAfter(SAXElement saxElement, ExecutionContext executionContext) throws SmooksException, IOException { Map<String, SAXSerializer> fragmentSerializers = (Map<String, SAXSerializer>) executionContext.getAttribute(FragmentSerializer.class); SAXSerializer serializer = fragmentSerializers.get(bindTo); try { executionContext.getBeanContext().addBean(bindTo, serializer.fragmentWriter.toString().trim(), new Fragment(saxElement)); } finally { DynamicSAXElementVisitorList.removeDynamicVisitor(serializer, executionContext); } }
public AbstractParser(ExecutionContext execContext) { this(execContext, getSAXParserConfiguration(execContext.getDeliveryConfig())); }
public static void setSource(ExecutionContext executionContext, Source source) { if(source != null) { executionContext.setAttribute(CONTEXT_KEY, source); } else { executionContext.removeAttribute(CONTEXT_KEY); } }