public static URI convertMALInteractionToURI(final MALInteraction interaction) { if (interaction != null) { if (interaction.getMessageHeader() != null) { return interaction.getMessageHeader().getURITo(); } } return new URI(""); }
private MALMessage initiateAsynchronousInteraction(final MessageDetails details, MALMessage msg) throws MALInteractionException, MALException { try { msg = securityManager.check(msg); details.endpoint.sendMessage(msg); } catch (IllegalArgumentException ex) { throw new MALException("IllegalArgumentException", ex); } catch (MALException ex) { MALContextFactoryImpl.LOGGER.log(Level.WARNING, "Error with consumer : {0}", msg.getHeader().getURITo()); throw ex; } return msg; }
private MALMessage initiateOnewayInteraction(final MessageDetails details, MALMessage msg) throws MALInteractionException, MALException { try { msg = securityManager.check(msg); details.endpoint.sendMessage(msg); } catch (IllegalArgumentException ex) { throw new MALException("ERROR: Error with one way send : IllegalArgumentException : ", ex); } catch (MALException ex) { MALContextFactoryImpl.LOGGER.log(Level.WARNING, "Error with one way send : {0}", msg.getHeader().getURITo()); throw ex; } return msg; }
/** * This method is deprecated! The sourceURI should be explicitly stated. The * extraction of it from the interaction object should happen on the layers * above. The broker won't publish the event if the source is not correct. * Publishes an Event through the Event service. * * @param interaction Interaction object * @param objId Object instance identifier * @param objType Object type * @param related Related link * @param source Source link * @param eventBodies Bodies of the event * @throws java.io.IOException if it cannot publish the Event */ @Deprecated public void publishEvent(final MALInteraction interaction, final Long objId, final ObjectType objType, final Long related, final ObjectId source, final ElementList eventBodies) throws IOException { URI sourceURI = new URI(""); if (interaction != null) { if (interaction.getMessageHeader() != null) { sourceURI = interaction.getMessageHeader().getURITo(); } } // requirement: 3.3.2.1 this.publishEvent(sourceURI, objId, objType, related, source, eventBodies); }
/** * Constructor. * @param hdr Source message. */ public BrokerKey(final MALMessageHeader hdr) { this.uri = hdr.getURITo().getValue(); this.session = hdr.getSession().getOrdinal(); this.sessionName = hdr.getSessionName().getValue(); }
protected void internalHandleDeregister(final GENMessage msg, Session lqs) throws MALException, MALInteractionException { // get components parts of messsage IdentifierList subList = (IdentifierList) msg.getBody().getBodyElement(0, new IdentifierList()); final String strURL = msg.getHeader().getURITo().getValue(); final int iSecond = strURL.indexOf(JMSTransport.JMS_SERVICE_DELIM); final String providerExchangeName = strURL.substring(iSecond + 1); for (int i = 0; i < subList.size(); ++i) { String subscriptionKey = queueName + "::" + providerExchangeName + "::" + subList.get(i); if (consumeHandlerMap.containsKey(subscriptionKey)) { JMSConsumeHandler handler = consumeHandlerMap.get(subscriptionKey); consumeHandlerMap.remove(subscriptionKey); handler.deregister(true); } else { JMSTransport.RLOGGER.log(Level.WARNING, "JMS Error deregistering for unregistered subscription {0}", subscriptionKey); } } // create response and do callback GENMessage returnMsg = new GENMessage(false, createReturnHeader(msg, false), null, null, (Object[]) null); receiveMessage(returnMsg); }
private void generateAndPublishEvents(final ObjectType objType, final ObjectIdList sourceList, final MALInteraction interaction) { if (eventService == null) { return; } if (sourceList.isEmpty()) { // Don't store anything if the list is empty... return; } /* Just use it for debugging Logger.getLogger(ArchiveManager.class.getName()).log(Level.FINE, "\nobjType: " + objType.toString() + "\nDomain: " + ConfigurationProviderSingleton.getDomain().toString() + "\nSourceList: " + sourceList.toString()); */ // requirement: 3.4.2.4 final LongList eventObjIds = eventService.generateAndStoreEvents(objType, ConfigurationProviderSingleton.getDomain(), null, sourceList, interaction); /* Just use it for debugging Logger.getLogger(ArchiveManager.class.getName()).log(Level.FINE, "The eventObjIds are: " + eventObjIds.toString()); */ URI sourceURI = new URI(""); if (interaction != null) { if (interaction.getMessageHeader() != null) { sourceURI = interaction.getMessageHeader().getURITo(); } } try { eventService.publishEvents(sourceURI, eventObjIds, objType, null, sourceList, null); } catch (IOException ex) { Logger.getLogger(ArchiveManager.class.getName()).log(Level.SEVERE, null, ex); } }
public Long publishAcceptanceEventOperation(MALInteraction interaction, final URI uri, final Identifier network, boolean success, final Long related, final ObjectId source) throws MALInteractionException, MALException { // Create ActivityAcceptanceList ActivityAcceptanceList aal = new ActivityAcceptanceList(); aal.add(new ActivityAcceptance(success)); final Long objId; URI sourceURI = uri; if (interaction != null) { objId = eventService.generateAndStoreEvent(ActivityTrackingHelper.ACCEPTANCE_OBJECT_TYPE, ConfigurationProviderSingleton.getDomain(), aal, related, source, interaction); sourceURI = (interaction.getMessageHeader() != null) ? interaction.getMessageHeader().getURITo() : new URI(""); } else { objId = eventService.generateAndStoreEvent(ActivityTrackingHelper.ACCEPTANCE_OBJECT_TYPE, ConfigurationProviderSingleton.getDomain(), aal, related, source, uri, network); } try { eventService.publishEvent(sourceURI, objId, ActivityTrackingHelper.ACCEPTANCE_OBJECT_TYPE, null, source, aal); } catch (IOException ex) { Logger.getLogger(ActivityTrackingProviderServiceImpl.class.getName()).log(Level.SEVERE, null, "Could not publish the Event!"); } return objId; }
private Long publishTransferEventOperation(MALInteraction interaction, final URI uri, final Identifier network, final ObjectType objType, final boolean success, final Duration duration, final URI nextDestination, final ObjectId source) throws MALInteractionException, MALException { // Produce ActivityTransferList ActivityTransferList atl = new ActivityTransferList(); ActivityTransfer at = new ActivityTransfer(success, duration, nextDestination); atl.add(at); final Long objId; URI sourceURI = uri; if (interaction != null) { objId = eventService.generateAndStoreEvent(objType, ConfigurationProviderSingleton.getDomain(), atl, null, source, interaction); sourceURI = (interaction.getMessageHeader() != null) ? interaction.getMessageHeader().getURITo() : new URI(""); } else { objId = eventService.generateAndStoreEvent(objType, ConfigurationProviderSingleton.getDomain(), atl, null, source, uri, network); } try { eventService.publishEvent(sourceURI, objId, objType, null, source, atl); } catch (IOException ex) { Logger.getLogger(ActivityTrackingProviderServiceImpl.class.getName()).log(Level.SEVERE, null, "Could not publish the Event!"); } return objId; }
final ObjectKey key = new ObjectKey(ConfigurationProviderSingleton.getDomain(), actionInstId); URI uriTo = interaction.getMessageHeader().getURITo(); URI uriNextDestination = null; String[] nodes = uriTo.toString().split("@");
/** * Constructor. * * @param hdr Source message. */ public AddressKey(final MALMessageHeader hdr) { this.uri = hdr.getURITo().getValue(); this.domain = hdr.getDomain(); this.networkZone = hdr.getNetworkZone().getValue(); this.session = hdr.getSession().getOrdinal(); this.sessionName = hdr.getSessionName().getValue(); }
private ObjectId publishExecutionEventOperation(final MALInteraction interaction, final URI uri, final Identifier network, boolean success, int currentStageCount, int totalStageCount, final Long related, ObjectId source) throws MALInteractionException, MALException { // Produce ActivityExecutionList ActivityExecutionList ael = new ActivityExecutionList(1); ActivityExecution activityExecutionInstance = new ActivityExecution( success, new UInteger(currentStageCount), new UInteger(totalStageCount)); ael.add(activityExecutionInstance); final Long objId; URI sourceURI = uri; if (interaction != null) { objId = eventService.generateAndStoreEvent(ActivityTrackingHelper.EXECUTION_OBJECT_TYPE, ConfigurationProviderSingleton.getDomain(), ael, related, source, interaction); sourceURI = (interaction.getMessageHeader() != null) ? interaction.getMessageHeader().getURITo() : new URI(""); } else { objId = eventService.generateAndStoreEvent(ActivityTrackingHelper.EXECUTION_OBJECT_TYPE, ConfigurationProviderSingleton.getDomain(), ael, related, source, uri, network); } final ObjectKey key = new ObjectKey(ConfigurationProviderSingleton.getDomain(), objId); try { eventService.publishEvent(sourceURI, objId, ActivityTrackingHelper.EXECUTION_OBJECT_TYPE, related, source, ael); } catch (IOException ex) { Logger.getLogger(ActivityTrackingProviderServiceImpl.class.getName()).log(Level.SEVERE, null, ex); } return new ObjectId(ActivityTrackingHelper.EXECUTION_OBJECT_TYPE, key); }
final String strURL = msg.getHeader().getURITo().getValue(); final int iSecond = strURL.indexOf(JMSTransport.JMS_SERVICE_DELIM); final String providerExchangeName = strURL.substring(iSecond + 1);
public JMSMessageHeader(MALMessageHeader srcHeader, JMSUpdate update) { super(srcHeader.getURIFrom(), srcHeader.getAuthenticationId(), srcHeader.getURITo(), srcHeader.getTimestamp(), srcHeader.getQoSlevel(), srcHeader.getPriority(), update.getDomain(), update.getNetwork(), srcHeader.getSession(), srcHeader.getSessionName(), srcHeader.getInteractionType(), srcHeader.getInteractionStage(), srcHeader.getTransactionId(), update.getServiceArea(), update.getService(), update.getOperation(), srcHeader.getAreaVersion(), srcHeader.getIsErrorMessage()); } }
static GENMessageHeader createReturnHeader(MALMessage sourceMessage, boolean isError, short stage) { GENMessageHeader hdr = new GENMessageHeader(); MALMessageHeader srcHdr = sourceMessage.getHeader(); hdr.setURIFrom(srcHdr.getURITo()); hdr.setURITo(srcHdr.getURIFrom()); hdr.setAuthenticationId(new Blob(JMSTransport.authId)); hdr.setTimestamp(new Time(new java.util.Date().getTime())); hdr.setQoSlevel(srcHdr.getQoSlevel()); hdr.setPriority(srcHdr.getPriority()); hdr.setDomain(srcHdr.getDomain()); hdr.setNetworkZone(srcHdr.getNetworkZone()); hdr.setSession(srcHdr.getSession()); hdr.setSessionName(srcHdr.getSessionName()); hdr.setInteractionType(srcHdr.getInteractionType()); hdr.setInteractionStage(new UOctet(stage)); hdr.setTransactionId(srcHdr.getTransactionId()); hdr.setServiceArea(srcHdr.getServiceArea()); hdr.setService(srcHdr.getService()); hdr.setOperation(srcHdr.getOperation()); hdr.setAreaVersion(srcHdr.getAreaVersion()); hdr.setIsErrorMessage(isError); return hdr; }
MALContextFactoryImpl.LOGGER.log(Level.WARNING, "Error with consumer : {0}", msg.getHeader().getURITo()); throw ex;
final MALBrokerBindingImpl brokerHandler = brokerBindingMap.get(msg.getHeader().getURITo().getValue());
private void internalHandleDeregister(final MALMessage msg, final Address address) throws MALInteractionException final MALBrokerBindingImpl brokerHandler = brokerBindingMap.get(msg.getHeader().getURITo().getValue());
final MALBrokerBindingImpl brokerHandler = brokerBindingMap.get(msg.getHeader().getURITo().getValue());
final MALBrokerBindingImpl brokerHandler = brokerBindingMap.get(msg.getHeader().getURITo().getValue());