WonMessage.getEnvelopeType
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using won.protocol.message.WonMessage.getEnvelopeType (Showing top 13 results out of 315)

origin: at.researchstudio.sat/won-core

public static URI getParentEntityUri(final WonMessage message) {
 URI parentURI = null;
 WonMessageDirection direction = message.getEnvelopeType();
 if (direction == WonMessageDirection.FROM_EXTERNAL ){
  parentURI = getParentUriFromReceiverProperties(message);
 } else if (direction == WonMessageDirection.FROM_OWNER || direction == WonMessageDirection.FROM_SYSTEM){
  parentURI = getParentUriFromSenderProperties(message);
 }
 return parentURI;
}
origin: at.researchstudio.sat/won-core

/**
 * Returns the need that this message belongs to.
 * @param message
 * @return
  */
public static URI getParentNeedUri(final WonMessage message){
 WonMessageDirection direction = message.getEnvelopeType();
 if (direction == WonMessageDirection.FROM_EXTERNAL ){
  return message.getReceiverNeedURI();
 } else if (direction == WonMessageDirection.FROM_OWNER || direction == WonMessageDirection.FROM_SYSTEM){
  return message.getSenderNeedURI();
 } else {
  throw new IllegalArgumentException("Unexpected message direction: " + direction);
 }
}
origin: at.researchstudio.sat/won-core

 @Override
 public void process(Exchange exchange) throws Exception {
  Object msg = exchange.getIn().getHeader(WON_MESSAGE_HEADER);
  if (msg == null) {
   throw new IllegalArgumentException("expected a WonMessage object in the '"+ WON_MESSAGE_HEADER + " header but header was null");
  }
  if (! (msg instanceof WonMessage) ) {
   throw new IllegalArgumentException("expected a WonMessage object in the '"+ WON_MESSAGE_HEADER + " header but the object is of type " + msg.getClass());
  }
  if (logger.isDebugEnabled()){
   logger.debug("calling adaptee {} with message {} (type: {}, direction: {}, recipient: {})",  new Object[]{adaptee, msg, ((WonMessage) msg).getMessageType(), ((WonMessage) msg).getEnvelopeType(), ((WonMessage) msg).getReceiverURI()});
  }
  //call the process method
  WonMessage resultMsg = null;
  try {
   resultMsg = adaptee.process((WonMessage) msg);
    if (logger.isDebugEnabled()){
      logger.debug("returning from adaptee {} with message {} (type: {}, direction: {}, recipient: {})",  new Object[]{adaptee, msg, ((WonMessage) msg).getMessageType(), ((WonMessage) msg).getEnvelopeType(), ((WonMessage) msg).getReceiverURI()});
    }
  } catch (Exception e) {
   logger.info("re-throwing exception {} caught calling adaptee {} with message {} (type: {}, direction: {}, recipient:{})",  new Object[]{ e, adaptee, msg, ((WonMessage) msg).getMessageType(), ((WonMessage) msg).getEnvelopeType(), ((WonMessage) msg).getReceiverURI()});
   throw e;
  }
  //set the result of the call as the new message in the exchange's in
  exchange.getIn().setHeader(WON_MESSAGE_HEADER, resultMsg);
 }
}
origin: at.researchstudio.sat/won-node

  @Override
  public boolean matches(Exchange exchange) {
    WonMessage message = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.ORIGINAL_MESSAGE_HEADER);
    if (message == null) return false;
    if (message.getEnvelopeType() != WonMessageDirection.FROM_SYSTEM) return false;
    if (message.getSenderURI() != null) {
      return message.getSenderURI().equals(message.getReceiverURI());
    } else {
      if (message.getSenderNeedURI() == null) return false;
      return message.getSenderNeedURI().equals(message.getReceiverNeedURI());
    }
  }
}
origin: at.researchstudio.sat/won-node

if (WonMessageDirection.FROM_OWNER == originalMessage.getEnvelopeType()){
 sendSystemMessageToOwner(responseMessage);
} else if (WonMessageDirection.FROM_EXTERNAL == originalMessage.getEnvelopeType()){
 sendSystemMessage(responseMessage);
} else {
 logger.info(String.format("cannot resend response message for direction of original message, " +
               "expected FROM_OWNER or FROM_EXTERNAL, but found %s. Original cause is logged.",
              originalMessage.getEnvelopeType()), e);
origin: at.researchstudio.sat/won-node

 @Override
 public void process(final Exchange exchange) throws Exception {
  WonMessage originalMessage = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.MESSAGE_HEADER);
  if (originalMessage == null) throw new WonMessageProcessingException("did not find the original message in the " +
   "exchange header '" + WonCamelConstants.MESSAGE_HEADER +"'");
  //only send success message if the original message was sent on behalf of a need (otherwise we have to find out
  // with other means which ownerapplications to send the response to.
  if (originalMessage.getSenderNeedURI() == null) return;
   if (originalMessage.getMessageType() == WonMessageType.HINT_MESSAGE){
     //we don't want to send a SuccessResponse for a hint message as matchers
     //are not fully compatible messaging agents (needs), so sending this message will fail.
     logger.debug("suppressing success response for HINT message");
     return;
   }
  URI newMessageURI = this.wonNodeInformationService.generateEventURI();
  WonMessage responseMessage = WonMessageBuilder.setPropertiesForNodeResponse(originalMessage, true,
   newMessageURI).build();
  if (WonMessageDirection.FROM_OWNER == originalMessage.getEnvelopeType()){
   sendSystemMessageToOwner(responseMessage);
  } else if (WonMessageDirection.FROM_EXTERNAL == originalMessage.getEnvelopeType()){
   sendSystemMessage(responseMessage);
  }
 }
}
origin: at.researchstudio.sat/won-core

private void checkDirection(final WonMessage message, final URI ownNode) {
 WonMessageDirection direction = message.getEnvelopeType();
 URI receiverNode = message.getReceiverNodeURI();
 URI senderNode = message.getSenderNodeURI();
 URI node;
 switch (direction) {
  case FROM_EXTERNAL:
   // my node should be a receiver node
   if (!ownNode.equals(receiverNode)) {
    throw new UriNodePathException(receiverNode + " is expected to be " + ownNode);
   }
   break;
  case FROM_OWNER:
   // my node should be a sender node
   if (!ownNode.equals(senderNode)) {
    throw new UriNodePathException(senderNode + " is expected to be " + ownNode);
   }
   break;
  case FROM_SYSTEM:
   // my node should be a sender node
   if (!ownNode.equals(senderNode)) {
    throw new UriNodePathException(senderNode + " is expected to be " + ownNode);
   }
   break;
 }
}
origin: at.researchstudio.sat/won-core

 /**
  * If the message is a ResponseMessage (SuccessResponse or FailureResponse)
  * this method returns the message that was responded to and that belongs to the same parent as
  * the specified message.
  * @param message
  * @return the URI of the message that was responded to, or null if the specified message is not a ResponseMessage.
   */
 public static URI getLocalIsResponseToURI(WonMessage message){
  WonMessageType messageType = message.getMessageType();
  if (messageType == SUCCESS_RESPONSE || messageType == FAILURE_RESPONSE) {
   WonMessageDirection direction = message.getEnvelopeType();
   if (direction == WonMessageDirection.FROM_EXTERNAL){
    return message.getIsRemoteResponseToMessageURI();
   } else {
    return message.getIsResponseToMessageURI();
   }
  }else {
    return null;
  }
 }
}
origin: at.researchstudio.sat/won-node

if (WonMessageDirection.FROM_OWNER == originalMessage.getEnvelopeType()){
 String ownerApplicationId = (String) exchange.getIn().getHeader(WonCamelConstants.OWNER_APPLICATION_ID);
 sendSystemMessageToOwner(responseMessage, ownerApplicationId);
} else if (WonMessageDirection.FROM_EXTERNAL == originalMessage.getEnvelopeType()){
 sendSystemMessage(responseMessage);
} else {
 logger.info(String.format("cannot route failure message for direction of original message, " +
   "expected FROM_OWNER or FROM_EXTERNAL, but found %s. Original cause is logged on log level DEBUG.",
  originalMessage.getEnvelopeType()));
 logger.debug("original cause", exception);
origin: at.researchstudio.sat/won-node

private void logRouteStart(Exchange exchange) {
  //UnitOfWork -> getRouteContext -> Route -> Id.
  String routeId = exchange.getUnitOfWork().getRouteContext().getRoute().getId();
  WonMessage message = (WonMessage) exchange.getIn().getHeader(WonCamelConstants.MESSAGE_HEADER);
  if (message == null){
    logger.debug("starting route {}: [no WoNMessage]", routeId);
    return;
  }
  logger.debug("starting route {}: {} type:{}, dir:{}, resp:{}, rem: {}",
      new String[]{
        routeId,
        message.getMessageURI().toString(),
        message.getMessageType().toString(),
        message.getEnvelopeType().toString(),
        message.getIsResponseToMessageURI() == null ?
            "[not a response]"
            : message.getIsResponseToMessageURI().toString(),
        message.getCorrespondingRemoteMessageURI() == null ?
            "[no remote message uri]"
            : message.getCorrespondingRemoteMessageURI().toString()
  });
}
origin: at.researchstudio.sat/won-core

/**
 * Adds the complete message content to the message that will be built,
 * referencing toWrap's envelope in the envelope of the new message.
 * The message that will be built has the same messageURI as the wrapped message.
 *
 * @param
 * @return
 */
public static WonMessageBuilder wrap(WonMessage toWrap){
 WonMessageBuilder builder = new WonMessageBuilder(toWrap.getMessageURI())
 .setWonMessageDirection(toWrap.getEnvelopeType());
 //make a copy to avoid modification in current message in case wrapped message
 //is modified externally
 builder.wrappedMessage = WonRdfUtils.MessageUtils.copyByDatasetSerialization(toWrap);
 return builder;
}
origin: at.researchstudio.sat/won-node

 processedMessage.getRefersTo().containsAll(message.getRefersTo())
 &&
 equalsOrBothNull(processedMessage.getEnvelopeType(), message.getEnvelopeType())
) {
return true;
origin: at.researchstudio.sat/won-core

 .FAILURE_RESPONSE);
WonMessageDirection origDirection = originalMessage.getEnvelopeType();
if (WonMessageDirection.FROM_EXTERNAL == origDirection){
won.protocol.messageWonMessagegetEnvelopeType

Popular methods of WonMessage

  • getCompleteDataset
  • getMessageType
  • getMessageURI
  • getSenderNeedURI
  • <init>
  • getContentGraphURIs
  • getCorrespondingRemoteMessageURI
  • getIsResponseToMessageURI
  • getMessageContent
    Creates a copy of the message dataset where all traces of the envelope graph are deleted.
  • getOuterEnvelopeGraphURI
  • getReceiverNeedURI
  • getReceiverNodeURI
  • getReceiverNeedURI,
  • getReceiverNodeURI,
  • getReceiverURI,
  • getSenderURI,
  • addMessageProperty,
  • getEnvelopePropertyURIValue,
  • getInnermostMessageURI,
  • getIsRemoteResponseToMessageURI,
  • getIsResponseToMessageType

Popular in Java

  • Running tasks concurrently on multiple threads
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onCreateOptionsMenu (Activity)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • Runner (org.openjdk.jmh.runner)

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)