org.switchyard.Property.addLabels()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(82)

本文整理了Java中org.switchyard.Property.addLabels()方法的一些代码示例,展示了Property.addLabels()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.addLabels()方法的具体详情如下:
包路径:org.switchyard.Property
类名称:Property
方法名:addLabels

Property.addLabels介绍

[英]Adds a set of labels to the property.
[中]向属性添加一组标签。

代码示例

代码示例来源: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.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: org.switchyard/switchyard-api

/**
 * Associate this instance with the supplied message context.
 * @param message associate the transform to this message
 */
public void associateWith(Message message) {
  message.getContext().setProperty(TransformSequence.class.getName(), this)
    .addLabels(BehaviorLabel.TRANSIENT.label());
}

代码示例来源:origin: org.switchyard/switchyard-bus-camel

/**
 * Mark message as sent.
 */
public void sent() {
  getContext().setProperty(CamelExchange.MESSAGE_SENT, true)
    .addLabels(BehaviorLabel.TRANSIENT.label());
}

代码示例来源: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-api

/**
 * Indicate that a given policy is required for the exchange.
 * @param exchange require policy on this exchange
 * @param policy the policy to require
 */
public static void require(Exchange exchange, Policy policy) {
  Set<Policy> required = getPolicies(exchange, REQUIRED_PROPERTY);
  required.add(policy);
  exchange.getContext().setProperty(REQUIRED_PROPERTY, required, Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label());
}

代码示例来源:origin: org.switchyard/switchyard-api

/**
 * Indicate that a given policy is satisfied for the exchange.
 * @param exchange assert policy on this exchange
 * @param policy the policy to assert
 */
public static void provide(Exchange exchange, Policy policy) {
  Set<Policy> provided = getPolicies(exchange, PROVIDED_PROPERTY);
  provided.add(policy);
  exchange.getContext().setProperty(PROVIDED_PROPERTY, provided, Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label());
}

代码示例来源:origin: jboss-switchyard/core

/**
 * Mark message as sent.
 */
public void sent() {
  getContext().setProperty(CamelExchange.MESSAGE_SENT, true)
    .addLabels(BehaviorLabel.TRANSIENT.label());
}

代码示例来源:origin: jboss-switchyard/core

/**
 * Indicate that a given policy is satisfied for the exchange.
 * @param exchange assert policy on this exchange
 * @param policy the policy to assert
 */
public static void provide(Exchange exchange, Policy policy) {
  Set<Policy> provided = getPolicies(exchange, PROVIDED_PROPERTY);
  provided.add(policy);
  exchange.getContext().setProperty(PROVIDED_PROPERTY, provided, Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label());
}

代码示例来源:origin: jboss-switchyard/core

/**
 * Indicate that a given policy is required for the exchange.
 * @param exchange require policy on this exchange
 * @param policy the policy to require
 */
public static void require(Exchange exchange, Policy policy) {
  Set<Policy> required = getPolicies(exchange, REQUIRED_PROPERTY);
  required.add(policy);
  exchange.getContext().setProperty(REQUIRED_PROPERTY, required, Scope.EXCHANGE).addLabels(BehaviorLabel.TRANSIENT.label());
}

代码示例来源:origin: org.switchyard.quickstarts/switchyard-quickstart-http-binding

/**
 * {@inheritDoc}
 */
@Override
public HttpBindingData decompose(Exchange exchange, HttpBindingData target) throws Exception {
  Object content = exchange.getMessage().getContent();
  if ((content instanceof String) && (content.equals(""))) {
    exchange.getContext().setProperty(HttpContextMapper.HTTP_RESPONSE_STATUS, 404).addLabels(new String[]{EndpointLabel.HTTP.label()});
  }
  target = super.decompose(exchange, target);
  return target;
}

代码示例来源:origin: jboss-switchyard/core

private void initContentType(Message message) {
  QName exchangeInputType = _contract.getConsumerOperation().getInputType();
  if (exchangeInputType != null) {
    message.getContext().setProperty(Exchange.CONTENT_TYPE, exchangeInputType, Scope.MESSAGE)
      .addLabels(BehaviorLabel.TRANSIENT.label());
  }
}

代码示例来源:origin: jboss-switchyard/core

@Test
public void testGetPropertyLabel() {
  _context.setProperty("a", "a").addLabels(TRANSIENT);
  _context.setProperty("b", "b").addLabels(TRANSIENT);
  _context.setProperty("c", "c").addLabels(TRANSIENT);
  _context.setProperty("d", "d").addLabels("foo");
  Assert.assertEquals(3, _context.getProperties(TRANSIENT).size());
  Assert.assertEquals(1, _context.getProperties("foo").size());
}

代码示例来源:origin: org.switchyard/switchyard-runtime

private void initContentType(Message message) {
  QName exchangeInputType = _contract.getConsumerOperation().getInputType();
  if (exchangeInputType != null) {
    message.getContext().setProperty(Exchange.CONTENT_TYPE, exchangeInputType, Scope.MESSAGE)
      .addLabels(BehaviorLabel.TRANSIENT.label());
  }
}

代码示例来源:origin: org.switchyard/switchyard-runtime

private void initFaultContentType() {
  if (_contract.getProviderOperation() != null) {
    QName serviceOperationFaultType = _contract.getProviderOperation().getFaultType();
    if (serviceOperationFaultType != null) {
      _message.getContext().setProperty(Exchange.FAULT_TYPE, serviceOperationFaultType, Scope.MESSAGE)
        .addLabels(BehaviorLabel.TRANSIENT.label());
    }
  }
}

代码示例来源:origin: org.switchyard/switchyard-bus-camel

private void initInContentType() {
  QName exchangeInputType = getContract().getConsumerOperation().getInputType();
  if (exchangeInputType != null) {
    getContext().setProperty(Exchange.CONTENT_TYPE, exchangeInputType)
      .addLabels(BehaviorLabel.TRANSIENT.label());
  }
}

代码示例来源:origin: org.switchyard/switchyard-bus-camel

private void initOutContentType() {
  QName exchangeOutputType = getContract().getProviderOperation().getOutputType();
  if (exchangeOutputType != null) {
    getContext().setProperty(Exchange.CONTENT_TYPE, exchangeOutputType)
      .addLabels(BehaviorLabel.TRANSIENT.label());
  }
}

代码示例来源:origin: jboss-switchyard/core

private void initInContentType() {
  QName exchangeInputType = getContract().getConsumerOperation().getInputType();
  if (exchangeInputType != null) {
    getContext().setProperty(Exchange.CONTENT_TYPE, exchangeInputType)
      .addLabels(BehaviorLabel.TRANSIENT.label());
  }
}

代码示例来源:origin: org.switchyard/switchyard-runtime

private void setContentType(Exchange exchange) {
  QName currentType = TransformSequence.getCurrentMessageType(exchange);
  if (currentType != null) {
    exchange.getContext().setProperty(Exchange.CONTENT_TYPE, currentType).addLabels(BehaviorLabel.TRANSIENT.label());
  } else {
    // make sure no property is used for current scope
    Property p = exchange.getContext().getProperty(Exchange.CONTENT_TYPE);
    if (p != null) {
      exchange.getContext().removeProperty(p);
    }
  }
}

代码示例来源:origin: org.switchyard/switchyard-bus-camel

@Override
public void mergeInto(Context context) {
  for (Property property : getProperties()) {
    if (ContextPropertyUtil.isReservedProperty(property.getName(), property.getScope())
        || property.hasLabel(BehaviorLabel.TRANSIENT.label())) {
      continue;
    }
    context.setProperty(property.getName(), property.getValue(), property.getScope())
      .addLabels(property.getLabels());
  }
}

相关文章