本文整理了Java中org.switchyard.Property
类的一些代码示例,展示了Property
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property
类的具体详情如下:
包路径:org.switchyard.Property
类名称:Property
[英]Represents a context property consisting of a name, scope, and value.
[中]表示由名称、范围和值组成的上下文属性。
代码示例来源:origin: org.switchyard/switchyard-bus-camel
@Override
public Context setProperties(Set<Property> properties) {
for (Property property : properties) {
Set<String> labels = property.getLabels();
setProperty(property.getName(), property.getValue(), property.getScope())
.addLabels(labels.toArray(new String[labels.size()]));
}
return this;
}
代码示例来源:origin: org.switchyard/switchyard-transform
private void copyProperties(Context context, Exchange exchange) {
for (Property property : context.getProperties()) {
if (property.hasLabel(BehaviorLabel.TRANSIENT.label())
|| ContextPropertyUtil.isReservedProperty(property.getName(), property.getScope())) {
continue;
}
if (Scope.EXCHANGE.equals(property.getScope())) {
exchange.setProperty(property.getName(), property.getValue());
} else {
exchange.getIn().setHeader(property.getName(), property.getValue());
}
}
}
代码示例来源:origin: org.switchyard/switchyard-runtime
@Override
public Context setProperties(Set<Property> properties) {
for (Property property : properties) {
setProperty(property.getName(), property.getValue(), property.getScope());
}
return this;
}
代码示例来源:origin: org.switchyard/switchyard-runtime
@Override
public void removeProperty(Property property) {
checkScope(_scope, property.getScope());
_properties.remove(property.getName());
}
代码示例来源:origin: org.switchyard.quickstarts/switchyard-quickstart-http-binding
StringBuffer headers = new StringBuffer();
for (Property property : context.getProperties(Scope.MESSAGE)) {
if (property.hasLabel(EndpointLabel.HTTP.label()) && (property.getValue() instanceof String)) {
headers.append(property.getName());
headers.append("=");
headers.append(property.getValue());
return ((HttpRequestInfo)prop.getValue()).toString();
prop = context.getProperty("Content-type");
String contentType = (prop == null) ? null : (String)prop.getValue();
if (contentType != null) {
if (contentType.contains("text/plain")) {
代码示例来源:origin: org.switchyard/switchyard-runtime
@Override
@SuppressWarnings("unchecked")
public <T> T getPropertyValue(String name) {
Property prop = _properties.get(name);
if (prop != null) {
return (T) prop.getValue();
}
return null;
}
代码示例来源:origin: org.switchyard.components/switchyard-component-common-rules
/**
* {@inheritDoc}
*/
@Override
public Set<Entry<String, Object>> entrySet() {
Map<String, Object> entries = new HashMap<String, Object>();
for (Property property : getProperties(_scope)) {
entries.put(property.getName(), property.getValue());
}
return entries.entrySet();
}
代码示例来源:origin: org.switchyard.components/switchyard-component-soap
private void copyHttpHeadersToContext(Context context, String name, List<String> values) {
if (values.size() == 1) {
context.setProperty(name, values.get(0), Scope.EXCHANGE).addLabels(SOAP_MIME_LABELS);
} else {
context.setProperty(name, values, Scope.EXCHANGE).addLabels(SOAP_MIME_LABELS);
}
}
代码示例来源:origin: org.switchyard/switchyard-runtime
@Override
public void handleMessage(Exchange exchange) throws TransactionFailureException {
// if no TM is available, there's nothing to do
if (_transactionManager == null) {
return;
}
Property prop = exchange.getContext().getProperty(BEFORE_INVOKED_PROPERTY, Scope.EXCHANGE);
if (prop != null && Boolean.class.cast(prop.getValue())) {
// OUT phase in IN_OUT exchange or 2nd invocation in IN_ONLY exchange
handleAfter(exchange);
} else {
exchange.getContext().setProperty(BEFORE_INVOKED_PROPERTY, Boolean.TRUE, Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label());
handleBefore(exchange);
}
}
代码示例来源:origin: org.switchyard/switchyard-runtime
public int compare(Property p1, Property p2) {
return p1.getName().compareTo(p2.getName());
}
});
代码示例来源:origin: jboss-switchyard/release
@Override
public void onMessage(String name) {
if (!name.equals("onMessagetest")) {
throw new RuntimeException("expected content is 'onMessagetest' but was '" + name + "'");
}
final String val = _context.getProperty("testProp").getValue().toString();
if (!val.equals("testVal")) {
throw new RuntimeException("'testProp' property is '" + val + "' while it should be 'testVal'");
};
Property jmsMessageId = _context.getProperty(JMSContextMapper.HEADER_JMS_MESSAGE_ID);
if (jmsMessageId == null) {
throw new RuntimeException("Couldn't find javax.jms.JMSMessageID context property");
}
if (!jmsMessageId.hasLabel(PropertyLabel.HEADER.label())) {
throw new RuntimeException("javax.jmsJMSMessageID context property doesn't have HEADER label");
}
if (jmsMessageId.getValue().toString() == null) {
throw new RuntimeException("javax.jmsJMSMessageID context property has null value");
};
_storeResult.onMessage(name);
}
代码示例来源:origin: org.switchyard/switchyard-bus-camel
@Override
public Set<Property> getProperties(String label) {
Set<Property> properties = new HashSet<Property>();
for (Property property : getProperties()) {
if (property.hasLabel(label)) {
properties.add(property);
}
}
return properties;
}
代码示例来源:origin: org.switchyard/switchyard-runtime
@Override
public void removeProperty(Property property) {
for (Entry<Scope, Context> entry : _contexts.entrySet()) {
if (entry.getKey() == property.getScope()) {
entry.getValue().removeProperty(property);
}
}
}
代码示例来源:origin: jboss-switchyard/components
Map<String, List<String>> httpHeaders = target.getHeaders();
for (Property property : context.getProperties()) {
String name = property.getName();
Object value = property.getValue();
if ((value != null) && (matches(name) || property.hasLabel(EndpointLabel.HTTP.label()))) {
if (HTTP_RESPONSE_STATUS.equals(name)) {
target.setStatusCode((Integer)property.getValue());
} else {
if (value instanceof List) {
代码示例来源:origin: jboss-switchyard/core
@Override
@SuppressWarnings("unchecked")
public <T> T getPropertyValue(String name) {
Property prop = _properties.get(name);
if (prop != null) {
return (T) prop.getValue();
}
return null;
}
代码示例来源:origin: org.switchyard.components/switchyard-component-common-knowledge
/**
* {@inheritDoc}
*/
@Override
public Set<Entry<String, Object>> entrySet() {
Map<String, Object> entries = new HashMap<String, Object>();
for (Property property : getProperties(_scope)) {
entries.put(property.getName(), property.getValue());
}
return entries.entrySet();
}
代码示例来源:origin: jboss-switchyard/core
@Override
public Context setProperties(Set<Property> properties) {
for (Property property : properties) {
setProperty(property.getName(), property.getValue(), property.getScope());
}
return this;
}
代码示例来源:origin: org.switchyard.components/switchyard-component-soap
private void copySOAPHeadersToContext(Context context, String name, Object value) {
if (matches(name, getIncludeRegexes(), new ArrayList<Pattern>())) {
context.setProperty(name, value, Scope.EXCHANGE).addLabels(SOAP_HEADER_LABELS);
}
}
代码示例来源:origin: jboss-switchyard/core
public int compare(Property p1, Property p2) {
return p1.getName().compareTo(p2.getName());
}
});
代码示例来源:origin: org.switchyard.components/switchyard-component-http
if (target instanceof HttpResponseBindingData) {
Property responseCode = exchange.getContext().getProperty(HttpContextMapper.HTTP_RESPONSE_STATUS);
if (!((responseCode != null) && responseCode.hasLabel(EndpointLabel.HTTP.label()))) {
int status = HttpServletResponse.SC_ACCEPTED;
if (exchange.getState() == ExchangeState.FAULT) {
} else {
if (exchange.getContext().getProperty(SERVICE_REFERENCE_PROPERTY) != null) {
ServiceDomain domain = ((ServiceReference)exchange.getContext().getProperty(SERVICE_REFERENCE_PROPERTY).getValue()).getDomain();
TransformerRegistry registry = domain.getTransformerRegistry();
QName from = JavaTypes.toMessageType(content.getClass());
内容来源于网络,如有侵权,请联系作者删除!