Examples of MessageExchangeImpl


Examples of org.apache.servicemix.jbi.messaging.MessageExchangeImpl

            me.getRole() == Role.CONSUMER &&
            me.getMessage("out") == null &&
            me.getFault() == null &&
            me instanceof MessageExchangeImpl)
        {
            MessageExchangeImpl mei = (MessageExchangeImpl) me;
            String source = (String) me.getProperty(JbiConstants.SENDER_ENDPOINT);
            if (source == null) {
                source = mei.getSourceId().getName();
                ComponentStats stats = (ComponentStats) componentStats.get(source);
                stats.incrementOutbound();
            } else {
                ServiceEndpoint[] ses = getContainer().getRegistry().getEndpointRegistry().getAllEndpointsForComponent(mei.getSourceId());
                for (int i = 0; i < ses.length; i++) {
                    if (EndpointSupport.getKey(ses[i]).equals(source)) {
                        source = EndpointSupport.getUniqueKey(ses[i]);
                        EndpointStats stats = (EndpointStats) endpointStats.get(source);
                        stats.incrementOutbound();
View Full Code Here

Examples of org.apache.servicemix.jbi.messaging.MessageExchangeImpl

    }
   
    public void exchangeSent(ExchangeEvent event) {
        MessageExchange me = event.getExchange();
        if (me.getEndpoint() instanceof AbstractServiceEndpoint && me instanceof MessageExchangeImpl) {
            MessageExchangeImpl mei = (MessageExchangeImpl) me;
            String source = (String) me.getProperty(JbiConstants.SENDER_ENDPOINT);
            if (source == null) {
                source = mei.getSourceId().getName();
                componentsAsConsumer.add(source);
            } else {
                ServiceEndpoint[] ses = getContainer().getRegistry().getEndpointRegistry().getAllEndpointsForComponent(mei.getSourceId());
                for (int i = 0; i < ses.length; i++) {
                    if (EndpointSupport.getKey(ses[i]).equals(source)) {
                        source = EndpointSupport.getUniqueKey(ses[i]);
                        break;
                    }
                }
            }
            usedComponents.add(mei.getSourceId().getName());
            if (((AbstractServiceEndpoint) mei.getEndpoint()).getComponentNameSpace() != null) {
                usedComponents.add(((AbstractServiceEndpoint) mei.getEndpoint()).getComponentNameSpace().getName());
            }
            String dest = EndpointSupport.getUniqueKey(mei.getEndpoint());
            Map componentFlow = createSource(source);
            if (componentFlow.put(dest, Boolean.TRUE) == null) {
                flowLinks.add(encode(source) + " -> " + encode(dest));
                viewIsDirty(mei.getEndpoint());
            }
        }
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.messaging.MessageExchangeImpl

     *
     * @param exchange
     * @throws JBIException
     */
    public void sendExchangePacket(MessageExchange me) throws JBIException {
        MessageExchangeImpl exchange = (MessageExchangeImpl) me;
        if (exchange.getRole() == Role.PROVIDER && exchange.getDestinationId() == null) {
            resolveAddress(exchange);
        }

        boolean foundRoute = false;
        // If we found a destination, or this is a reply
        if (exchange.getEndpoint() != null || exchange.getRole() == Role.CONSUMER) {
            foundRoute = true;
            Flow flow = defaultFlowChooser.chooseFlow(flows, exchange);
            if (flow == null) {
                throw new MessagingException("Unable to choose a flow for exchange: " + exchange);
            }
            flow.send(exchange);
        }

        if (exchange.getRole() == Role.PROVIDER) {
          getSubscriptionManager().dispatchToSubscribers(exchange);
        }
       
        if (!foundRoute) {
            boolean throwException = true;
            ActivationSpec activationSpec = exchange.getActivationSpec();
            if (activationSpec != null) {
                throwException = activationSpec.isFailIfNoDestinationEndpoint();
            }
            if (throwException) {
                throw new MessagingException("Could not find route for exchange: " + exchange + " for service: " + exchange.getService() + " and interface: "
                        + exchange.getInterfaceName());
            } else if (exchange.getMirror().getSyncState() == MessageExchangeImpl.SYNC_STATE_SYNC_SENT) {
                exchange.handleAccept();
                ComponentContextImpl ctx = (ComponentContextImpl) getSubscriptionManager().getContext();
                exchange.setDestinationId(ctx.getComponentNameSpace());
                // TODO: this will fail if exchange is InOut
                getSubscriptionManager().done(exchange);
            }
        }
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.messaging.MessageExchangeImpl

        Boolean sync = (Boolean) me.getProperty(JbiConstants.SEND_SYNC);
        return sync != null && sync.booleanValue();
    }

    protected boolean isClustered(MessageExchange me) {
        MessageExchangeImpl mei = (MessageExchangeImpl) me;
        if (mei.getDestinationId() == null) {
            ServiceEndpoint se = me.getEndpoint();
            if (se instanceof InternalEndpoint) {
                return ((InternalEndpoint) se).isClustered();
            // Unknown: assume this is not clustered
            } else {
                return false;
            }
        } else {
            String destination = mei.getDestinationId().getContainerName();
            String source = mei.getSourceId().getContainerName();
            return !source.equals(destination);
        }
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.messaging.MessageExchangeImpl

    public void setAuthorizationMap(AuthorizationMap authorizationMap) {
        this.authorizationMap = authorizationMap;
    }

    public void sendExchangePacket(MessageExchange me) throws JBIException {
        MessageExchangeImpl exchange = (MessageExchangeImpl) me;
        if (exchange.getRole() == Role.PROVIDER && exchange.getDestinationId() == null) {
            resolveAddress(exchange);
            ServiceEndpoint se = exchange.getEndpoint();
            if (se != null) {
                Set acls = authorizationMap.getAcls(se, me.getOperation());
                if (!acls.contains(GroupPrincipal.ANY)) {
                    Subject subject = exchange.getMessage("in").getSecuritySubject();
                    if (subject == null) {
                        throw new SecurityException("User not authenticated");
                    }
                    acls.retainAll(subject.getPrincipals());
                    if (acls.size() == 0) {
View Full Code Here

Examples of org.apache.servicemix.jbi.runtime.impl.MessageExchangeImpl

public class MessageExchangeImplTest extends TestCase {

    public void testMep() {
        MessageExchange me;

        me = new MessageExchangeImpl(new ExchangeImpl(Pattern.InOnly));
        assertEquals("http://www.w3.org/2004/08/wsdl/in-only", me.getPattern().toString());

        me = new MessageExchangeImpl(new ExchangeImpl(Pattern.InOut));
        assertEquals("http://www.w3.org/2004/08/wsdl/in-out", me.getPattern().toString());

        me = new MessageExchangeImpl(new ExchangeImpl(Pattern.InOptionalOut));
        assertEquals("http://www.w3.org/2004/08/wsdl/in-opt-out", me.getPattern().toString());

        me = new MessageExchangeImpl(new ExchangeImpl(Pattern.RobustInOnly));
        assertEquals("http://www.w3.org/2004/08/wsdl/robust-in-only", me.getPattern().toString());
    }
View Full Code Here

Examples of org.servicemix.jbi.messaging.MessageExchangeImpl

        //assertExpression(new XMLBeansStringXPathExpression("$name"), "James", "<foo><bar xyz='cheese'/></foo>");
        //assertExpression(new XMLBeansStringXPathExpression("foo/bar/text()"), "cheese", "<foo><bar>cheese</bar></foo>");
    }

    protected void assertExpression(Expression expression, String expected, String xml) throws MessagingException {
        MessageExchangeImpl exchange = new InOnlyImpl("dummy");
        NormalizedMessage message = new NormalizedMessageImpl(exchange);
        message.setProperty("name", "James");
        message.setContent(new StringSource(xml));
        Object value = expression.evaluate(exchange, message);
        assertEquals("Expression: " + expression, expected, value);
View Full Code Here

Examples of org.servicemix.jbi.messaging.MessageExchangeImpl

    /**
     * do processing
     */
    public void run() {
        while (running.get()) {
            final MessageExchangeImpl me;
            try {
                synchronized (started) {
                    while (running.get() && !started.get()) {
                        started.wait(500);
                    }
View Full Code Here

Examples of org.servicemix.jbi.messaging.MessageExchangeImpl

                        ComponentPacketEvent event = (ComponentPacketEvent) obj;
                        String containerName = event.getPacket().getComponentNameSpace().getContainerName();
                        processInBoundPacket(containerName, event);
                    }
                    else if (obj instanceof MessageExchangeImpl) {
                        MessageExchangeImpl me = (MessageExchangeImpl) obj;
                        TransactionManager tm = (TransactionManager) getTransactionManager();
                        if (tm != null) {
                            me.setTransactionContext(tm.getTransaction());
                        }
                        super.doRouting(me);
                    }
                }
            }
View Full Code Here

Examples of org.servicemix.jbi.messaging.MessageExchangeImpl

                        if (obj instanceof ComponentPacketEvent) {
                            ComponentPacketEvent event = (ComponentPacketEvent) obj;
                            processInBoundPacket(replyTo, event);
                        }
                        else if (obj instanceof MessageExchangeImpl) {
                            MessageExchangeImpl me = (MessageExchangeImpl) obj;
                            super.doRouting(me);
                        }
                    }
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.