@Override public boolean equals(final Object o) { if (this == o) return true; if (!(o instanceof MessageEventPlaceholder)) return false; final MessageEventPlaceholder that = (MessageEventPlaceholder) o; if (messageType != null ? !messageType.equals(that.messageType) : that.messageType != null) return false; if (messageURI != null ? !messageURI.equals(that.messageURI) : that.messageURI != null) return false; if (receiverURI != null ? !receiverURI.equals(that.receiverURI) : that.receiverURI != null) return false; if (senderURI != null ? !senderURI.equals(that.senderURI) : that.senderURI != null) return false; // if (signatures != null ? !signatures.equals(that.signatures) : that.signatures != null) return false; return true; }
public synchronized WonMessageType getMessageType() { if (this.messageType == null) { URI type = getEnvelopePropertyURIValue(WONMSG.HAS_MESSAGE_TYPE_PROPERTY); this.messageType = WonMessageType.getWonMessageType(type); } return this.messageType; }
public boolean isIdentifiedBy(URI uri){ if (uri == null) return false; return getResource().getURI().toString().equals(uri.toString()); }
if (WonMessageType.SUCCESS_RESPONSE.isIdentifiedBy(messageType)){ method = "onSuccessResponse"; direction = URI.create(WonMessageDirection.FROM_OWNER.getResource().toString()); throw new MissingMessagePropertyException(URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString())); messageType = origType.getURI(); } else if (WonMessageType.FAILURE_RESPONSE.isIdentifiedBy(messageType)){ URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString())); messageType = origType.getURI();
@Override public int hashCode() { int result = messageURI != null ? messageURI.hashCode() : 0; result = 31 * result + (messageType != null ? messageType.hashCode() : 0); result = 31 * result + (senderURI != null ? senderURI.hashCode() : 0); result = 31 * result + (receiverURI != null ? receiverURI.hashCode() : 0); return result; }
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() }); }
if (WonMessageType.SUCCESS_RESPONSE.isIdentifiedBy(messageType)){ method = "onSuccessResponse"; direction = URI.create(WonMessageDirection.FROM_OWNER.getResource().toString()); throw new MissingMessagePropertyException(URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString())); messageType = origType.getURI(); } else if (WonMessageType.FAILURE_RESPONSE.isIdentifiedBy(messageType)){ URI.create(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE.getURI().toString())); messageType = origType.getURI();
public synchronized WonMessageType getIsResponseToMessageType() { if (this.isResponseToMessageType == null) { URI typeURI = getEnvelopePropertyURIValue(WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE); if (typeURI != null) { this.isResponseToMessageType = WonMessageType.getWonMessageType(typeURI); } } return isResponseToMessageType; }
private EventContainer loadOrCreateEventContainer(final WonMessage wonMessage, final URI parent) { WonMessageType type = wonMessage.getMessageType(); if (WonMessageType.CREATE_NEED.equals(type)) { //create a need event container with null parent (because it will only be persisted at a later point in time) EventContainer container = needEventContainerRepository.findOneByParentUriForUpdate(parent); if (container != null) return container; NeedEventContainer nec = new NeedEventContainer (null, parent); needEventContainerRepository.saveAndFlush(nec); return nec; } else if (WonMessageType.CONNECT.equals(type) || WonMessageType.HINT_MESSAGE.equals(type)) { //create a connection event container witn null parent (because it will only be persisted at a later point in // time) EventContainer container = connectionEventContainerRepository.findOneByParentUriForUpdate(parent); if (container != null) return container; ConnectionEventContainer cec = new ConnectionEventContainer(null, parent); connectionEventContainerRepository.saveAndFlush(cec); return cec; } EventContainer container = needEventContainerRepository.findOneByParentUriForUpdate(parent); if (container != null) return container; container = connectionEventContainerRepository.findOneByParentUriForUpdate(parent); if (container != null) return container; //let's see if we can find the event conta throw new IllegalArgumentException( "Cannot store '" + type + "' event '" + wonMessage.getMessageURI() + "': unable to find " + "event container with parent URI '" + parent + "'"); }
public URI getURI(){ return URI.create(getResource().getURI().toString()); }
public static WonMessageType getWonMessageType(URI uri){ return getWonMessageType(WONMSG.toResource(uri)); }
WonNodeInfo senderNodeInfo = null; WonNodeInfo receiverNodeInfo = null; if (senderNode != null && ! WonMessageType.HINT_MESSAGE.equals(message.getMessageType())) {
WonCamelConstants.MESSAGE_HEADER +"' or in the body"); exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(wonMessage.getMessageType().getResource().getURI())); exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, wonMessage); exchange.getIn().setBody(null);
ret.setMessageType(WonMessageType.getWonMessageType(type));
messageEventResource.addProperty(WONMSG.HAS_MESSAGE_TYPE_PROPERTY, wonMessageType.getResource()); envelopeGraph.createResource(isResponseToMessageURI.toString())); messageEventResource.addProperty( WONMSG.IS_RESPONSE_TO_MESSAGE_TYPE, this.isResponseToMessageType.getResource()); if (isRemoteResponseToMessageURI != null) { messageEventResource.addProperty(
/** * Converts the specified hint message into a Match object. * @param wonMessage * @return a match object or null if the message is not a hint message. */ public static Match toMatch(final WonMessage wonMessage) { if (!WONMSG.TYPE_HINT.equals(wonMessage.getMessageType().getResource())){ return null; } Match match = new Match(); match.setFromNeed(wonMessage.getReceiverNeedURI()); Dataset messageContent = wonMessage.getMessageContent(); RDFNode score = findOnePropertyFromResource(messageContent, wonMessage.getMessageURI(), WON.HAS_MATCH_SCORE); if (!score.isLiteral()) return null; match.setScore(score.asLiteral().getDouble()); RDFNode counterpart = findOnePropertyFromResource(messageContent, wonMessage.getMessageURI(), WON.HAS_MATCH_COUNTERPART); if (!counterpart.isResource()) return null; match.setToNeed(URI.create(counterpart.asResource().getURI())); return match; }