本文整理了Java中org.milyn.container.ExecutionContext
类的一些代码示例,展示了ExecutionContext
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecutionContext
类的具体详情如下:
包路径:org.milyn.container.ExecutionContext
类名称:ExecutionContext
[英]Smooks execution context interface definition.
[中]Smooks执行上下文接口定义。
代码示例来源:origin: org.virtuslab/milyn-smooks-core
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;
}
代码示例来源:origin: org.milyn/milyn-smooks-all
public static DaoRegister<?> getDAORegister(final ExecutionContext executionContext) {
return (DaoRegister<?>) executionContext.getAttribute(PersistenceUtil.getDAORegisterAttributeName(executionContext.getDeliveryConfig())) ;
}
代码示例来源:origin: org.virtuslab/milyn-smooks-core
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;
}
代码示例来源:origin: smooks/smooks
public static void setResults(ExecutionContext executionContext, Result... results) {
if(results != null) {
executionContext.setAttribute(CONTEXT_KEY, results);
} else {
executionContext.removeAttribute(CONTEXT_KEY);
}
}
代码示例来源:origin: smooks/smooks
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;
}
}
代码示例来源:origin: smooks/smooks
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;
}
代码示例来源:origin: smooks/smooks
/**
* 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);
}
代码示例来源:origin: org.milyn/milyn-smooks-all
@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);
}
}
代码示例来源:origin: smooks/smooks
private DataDecoder getDecoder(ExecutionContext executionContext) throws DataDecodeException {
return getDecoder(executionContext.getDeliveryConfig());
}
代码示例来源:origin: smooks/smooks
/**
* 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);
}
代码示例来源:origin: org.milyn/milyn-smooks-all
public static void setDAORegister(final ExecutionContext executionContext, final DaoRegister<?> registery) {
executionContext.setAttribute(getDAORegisterAttributeName(executionContext.getDeliveryConfig()), registery) ;
}
代码示例来源:origin: org.milyn/milyn-smooks-all
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();
}
}
代码示例来源:origin: smooks/smooks
/**
* 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);
}
代码示例来源:origin: smooks/smooks
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;
}
代码示例来源:origin: smooks/smooks
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);
}
代码示例来源:origin: org.milyn/milyn-smooks-javabean
/**
* 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);
}
代码示例来源:origin: smooks/smooks
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;
}
代码示例来源:origin: org.virtuslab/milyn-smooks-routing
@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);
}
}
代码示例来源:origin: smooks/smooks
public AbstractParser(ExecutionContext execContext) {
this(execContext, getSAXParserConfiguration(execContext.getDeliveryConfig()));
}
代码示例来源:origin: smooks/smooks
public static void setSource(ExecutionContext executionContext, Source source) {
if(source != null) {
executionContext.setAttribute(CONTEXT_KEY, source);
} else {
executionContext.removeAttribute(CONTEXT_KEY);
}
}
内容来源于网络,如有侵权,请联系作者删除!