本文整理汇总了Java中org.switchyard.Context.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getProperty方法的具体用法?Java Context.getProperty怎么用?Java Context.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.switchyard.Context
的用法示例。
在下文中一共展示了Context.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRegexPropagationList
import org.switchyard.Context; //导入方法依赖的package包/类
/**
* Set the list of regexes of properties that need to be propagated.
*
* @param context context
*/
protected void setRegexPropagationList(Context context) {
// ENTESB-6525: Ensure thread safe access to this list
if(_includeRegexes!=null) {
return;
} else {
_includeRegexes = new ArrayList<Pattern>();
if (!_prefixPropagationSet) {
if (context.getProperty(SERVICE_REFERENCE_PROPERTY) != null) {
ServiceDomain domain = ((ServiceReference)context.getProperty(SERVICE_REFERENCE_PROPERTY).getValue()).getDomain();
if (domain.getProperty(PropertyConstants.DOMAIN_PROPERTY_PROPAGATE_REGEX) != null) {
String regexList = (String) domain.getProperty(PropertyConstants.DOMAIN_PROPERTY_PROPAGATE_REGEX);
setPatternList(regexList, _includeRegexes);
}
}
_prefixPropagationSet = true;
}
Pattern rtGovResubmissionPattern = Pattern.compile(PropertyConstants.RTGOV_HEADER_RESUBMITTED_ID_PATTERN);
_includeRegexes.add(rtGovResubmissionPattern);
}
}
示例2: getTxEnabledFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected boolean getTxEnabledFromContext(Context ctx) {
String key = CONTEXT_PROPERTY_PREFIX + KEY_TRANSACTED;
if (ctx.getProperty(key) != null) {
boolean transacted = Boolean.parseBoolean(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("transacted is set to '" + transacted + "'");
}
return transacted;
}
return _defaultTxEnabled;
}
示例3: getAcknowledgeModeFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected int getAcknowledgeModeFromContext(Context ctx) {
String key = CONTEXT_PROPERTY_PREFIX + KEY_ACKNOWLEDGE_MODE;
if (ctx.getProperty(key) != null) {
int ackMode = Integer.parseInt(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Acknowledge Mode is set to '" + ackMode + "'");
}
return ackMode;
}
return _defaultAckMode;
}
示例4: getDestinationTypeFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected DestinationType getDestinationTypeFromContext(Context ctx) {
DestinationType destType = _defaultDestinationType;
String key = CONTEXT_PROPERTY_PREFIX + KEY_DESTINATION_TYPE;
if (ctx.getProperty(key) != null) {
String type = ctx.getPropertyValue(key);
DestinationType ctxType = parseDestinationType(type);
if (ctxType != null) {
destType = ctxType;
if (_logger.isDebugEnabled()) {
_logger.debug("Destination type is set to '" + destType.toString() + "'");
}
}
}
return destType;
}
示例5: getOutputMessageTypeFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected MessageType getOutputMessageTypeFromContext(Context ctx) {
String key = CONTEXT_PROPERTY_PREFIX + KEY_MESSAGE_TYPE;
if (ctx.getProperty(key) != null) {
MessageType msgType = MessageType.valueOf(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Output message type is set to '" + msgType.toString() + "'");
}
return msgType;
}
return _defaultOutMessageType;
}
示例6: getDeliveryModeFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected int getDeliveryModeFromContext(Context ctx, MessageProducer producer) throws JMSException {
String key = CONTEXT_PROPERTY_PREFIX + KEY_DELIVERY_MODE;
if (ctx.getProperty(key) != null) {
int deliveryMode = Integer.parseInt(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Delivery Mode is set to '" + deliveryMode + "'");
}
return deliveryMode;
}
return producer.getDeliveryMode();
}
示例7: getPriorityFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected int getPriorityFromContext(Context ctx, MessageProducer producer) throws JMSException {
String key = CONTEXT_PROPERTY_PREFIX + KEY_PRIORITY;
if (ctx.getProperty(key) != null) {
int priority = Integer.parseInt(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Priority is set to '" + priority + "'");
}
return priority;
}
return producer.getPriority();
}
示例8: getTimeToLiveFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected long getTimeToLiveFromContext(Context ctx, MessageProducer producer) throws JMSException {
String key = CONTEXT_PROPERTY_PREFIX + KEY_TIME_TO_LIVE;
if (ctx.getProperty(key) != null) {
long ttl = Long.parseLong(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Time to Live is set to '" + ttl + "'");
}
return ttl;
}
return producer.getTimeToLive();
}
示例9: getOutputMessageTypeFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected MessageType getOutputMessageTypeFromContext(Context ctx) {
String key = CONTEXT_PROPERTY_PREFIX + KEY_MESSAGE_TYPE;
if (ctx.getProperty(key) != null) {
MessageType type = MessageType.valueOf(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Output message type is set to '" + type.toString() + "'");
}
return type;
}
return _defaultOutMessageType;
}
示例10: getDeliveryModeFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected int getDeliveryModeFromContext(Context ctx, MessageProducer producer) throws Exception {
String key = CONTEXT_PROPERTY_PREFIX + KEY_DELIVERY_MODE;
if (ctx.getProperty(key) != null) {
int deliveryMode = Integer.parseInt(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Delivery Mode is set to '" + deliveryMode + "'");
}
return deliveryMode;
}
return producer.getDeliveryMode();
}
示例11: getPriorityFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected int getPriorityFromContext(Context ctx, MessageProducer producer) throws Exception {
String key = CONTEXT_PROPERTY_PREFIX + KEY_PRIORITY;
if (ctx.getProperty(key) != null) {
int priority = Integer.parseInt(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Priority is set to '" + priority + "'");
}
return priority;
}
return producer.getPriority();
}
示例12: getTimeToLiveFromContext
import org.switchyard.Context; //导入方法依赖的package包/类
protected long getTimeToLiveFromContext(Context ctx, MessageProducer producer) throws Exception {
String key = CONTEXT_PROPERTY_PREFIX + KEY_TIME_TO_LIVE;
if (ctx.getProperty(key) != null) {
long ttl = Long.parseLong(ctx.getPropertyValue(key).toString());
if (_logger.isDebugEnabled()) {
_logger.debug("Time to Live is set to '" + ttl + "'");
}
return ttl;
}
return producer.getTimeToLive();
}
示例13: getToAddress
import org.switchyard.Context; //导入方法依赖的package包/类
/**
* Get the To header if it is set.
*
* @param context The SwitchYard Context
* @return The To address
*/
public static String getToAddress(Context context) {
String address = null;
Property toProp = context.getProperty(WSA_TO_STR);
if (toProp == null) {
toProp = context.getProperty(WSA_TO_STR.toLowerCase());
}
if (toProp != null) {
Element toEl = (Element)toProp.getValue();
address = toEl.getFirstChild().getNodeValue();
}
return address;
}
示例14: copyProperties
import org.switchyard.Context; //导入方法依赖的package包/类
/**
* This method allows to copy the properties from the current context to
* the new exchange context
*
* @param newExchange
* the new exchange object where the properties will be
* copied
*/
private void copyProperties(Exchange newExchange) {
ContextProxy context = new ContextProxy();
Context contextNew = newExchange.getContext();
List<Pattern> _includeRegexes = new ArrayList<Pattern>();
if (_service.getDomain().getProperty(PropertyConstants.DOMAIN_PROPERTY_PROPAGATE_REGEX) != null) {
String regexList = (String) _service.getDomain().getProperty(PropertyConstants.DOMAIN_PROPERTY_PROPAGATE_REGEX);
Set<String> regexSet = Strings.uniqueSplitTrimToNull(regexList, ",");
for (String regex : regexSet) {
try {
Pattern pattern = Pattern.compile(regex);
_includeRegexes.add(pattern);
} catch (PatternSyntaxException pse) {
}
}
}
Pattern rtGovResubmissionPattern = Pattern.compile(PropertyConstants.RTGOV_HEADER_RESUBMITTED_ID_PATTERN);
_includeRegexes.add(rtGovResubmissionPattern);
for (org.switchyard.Property p : context.getProperties(Scope.EXCHANGE)) {
if (contextNew.getProperty(p.getName(), Scope.EXCHANGE) == null) {
for (Pattern include : _includeRegexes) {
if (include.matcher(p.getName()).matches()) {
Property newProp = newExchange.getContext().setProperty(p.getName(), p.getValue(), Scope.EXCHANGE);
if (p.getLabels() != null && !p.getLabels().isEmpty()) {
newProp.addLabels(p.getLabels());
}
}
}
}
}
}
示例15: composeAddress
import org.switchyard.Context; //导入方法依赖的package包/类
private String composeAddress(Context context) {
String uri;
if (context.getProperty(org.apache.camel.Exchange.HTTP_URI) != null) {
LOGGER.info("HTTP Outbound Handler Message Property Changed: URI="
+ context.getProperty(org.apache.camel.Exchange.HTTP_URI).getValue());
uri = (String)context.getProperty(org.apache.camel.Exchange.HTTP_URI).getValue();
} else {
uri = _baseAddress;
}
if (context.getProperty(org.apache.camel.Exchange.HTTP_QUERY) != null) {
LOGGER.info("HTTP Outbound Handler Message Property Changed: HttpQuery="
+ context.getProperty(org.apache.camel.Exchange.HTTP_QUERY).getValue());
String queryString = (String)context.getProperty(org.apache.camel.Exchange.HTTP_QUERY).getValue();
Map<String, String> params = new HashMap<String, String>();
// Get the parameters from the URI
if (uri.contains("?")) {
String uri_query = uri.substring(uri.lastIndexOf("?") + 1);
params.putAll(decomposeQueryParams(uri_query));
}
params.putAll(decomposeQueryParams(queryString));
// Build the uri again with these params
String baseUri;
if (uri.contains("?")) {
baseUri = uri.substring(0, uri.lastIndexOf("?"));
} else {
baseUri = uri;
}
if (params.size() > 0) {
uri = baseUri + "?";
int i = 0;
for (String param_key : params.keySet()) {
uri += param_key + "=" + params.get(param_key);
if (i < params.size() - 1) {
uri += "&";
}
i++;
}
} else {
uri = baseUri;
}
LOGGER.info("HTTP Outbound Handler Message Property Changed: ComposedURI=" + uri);
}
return uri;
}