Java Code Examples for org.apache.cxf.message.Exchange#getBus()

The following examples show how to use org.apache.cxf.message.Exchange#getBus() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractMessageResponseTimeInterceptor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void increaseCounter(Exchange ex, MessageHandlingTimeRecorder mhtr) {
    Bus bus = ex.getBus();
    if (null == bus) {
        LOG.log(Level.INFO, "CAN_NOT_GET_BUS_FROM_EXCHANGE");
        bus = BusFactory.getThreadDefaultBus();
    }
    CounterRepository cr = bus.getExtension(CounterRepository.class);

    if (null == cr) {
        LOG.log(Level.WARNING, "NO_COUNTER_REPOSITORY");
        return;
    }
    ObjectName serviceCountername = this.getServiceCounterName(ex);
    cr.increaseCounter(serviceCountername, mhtr);

    ObjectName operationCounter = this.getOperationCounterName(ex, serviceCountername);
    cr.increaseCounter(operationCounter, mhtr);
}
 
Example 2
Source File: MAPAggregatorTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private Exchange getExchange() {
    Bus bus = control.createMock(Bus.class);
    bus.getExtension(PhaseManager.class);
    EasyMock.expectLastCall().andReturn(new PhaseManagerImpl()).anyTimes();

    Exchange exchange = control.createMock(Exchange.class);
    exchange.getBus();
    EasyMock.expectLastCall().andReturn(bus).anyTimes();
    EasyMock.expect(exchange.isEmpty()).andReturn(true).anyTimes();
    return exchange;
}
 
Example 3
Source File: RedeliveryQueueImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private static InterceptorChain getRedeliveryInterceptorChain(Message m, String phase) {
    Exchange exchange = m.getExchange();
    Endpoint ep = exchange.getEndpoint();
    Bus bus = exchange.getBus();

    PhaseManager pm = bus.getExtension(PhaseManager.class);
    SortedSet<Phase> phases = new TreeSet<>(pm.getInPhases());
    for (Iterator<Phase> it = phases.iterator(); it.hasNext();) {
        Phase p = it.next();
        if (phase.equals(p.getName())) {
            break;
        }
        it.remove();
    }
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);
    List<Interceptor<? extends Message>> il = ep.getInInterceptors();
    addInterceptors(chain, il);
    il = ep.getService().getInInterceptors();
    addInterceptors(chain, il);
    il = ep.getBinding().getInInterceptors();
    addInterceptors(chain, il);
    il = bus.getInInterceptors();
    addInterceptors(chain, il);
    if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
        il = ((InterceptorProvider)ep.getService().getDataBinding()).getInInterceptors();
        addInterceptors(chain, il);
    }

    return chain;
}
 
Example 4
Source File: ColocUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static InterceptorChain getOutInterceptorChain(Exchange ex, SortedSet<Phase> phases) {
    Bus bus = ex.getBus();
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);

    Endpoint ep = ex.getEndpoint();
    List<Interceptor<? extends Message>> il = ep.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + il);
    }
    chain.add(il);
    il = ep.getService().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + il);
    }
    chain.add(il);
    il = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + il);
    }
    chain.add(il);

    if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
        il = ((InterceptorProvider)ep.getService().getDataBinding()).getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by databinding: " + il);
        }
        chain.add(il);
    }
    modifyChain(chain, ex, false);

    return chain;
}
 
Example 5
Source File: ColocUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static InterceptorChain getInInterceptorChain(Exchange ex, SortedSet<Phase> phases) {
    Bus bus = ex.getBus();
    PhaseInterceptorChain chain = new PhaseInterceptorChain(phases);

    Endpoint ep = ex.getEndpoint();
    List<Interceptor<? extends Message>> il = ep.getInInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + il);
    }
    chain.add(il);
    il = ep.getService().getInInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + il);
    }
    chain.add(il);
    il = bus.getInInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + il);
    }
    chain.add(il);

    if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
        il = ((InterceptorProvider)ep.getService().getDataBinding()).getInInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by databinding: " + il);
        }
        chain.add(il);
    }
    chain.setFaultObserver(new ColocOutFaultObserver(bus));
    modifyChain(chain, ex, true);
    return chain;
}
 
Example 6
Source File: ColocInInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void handleMessage(Message msg) throws Fault {
    Exchange ex = msg.getExchange();
    if (ex.isOneWay()) {
        return;
    }

    Bus bus = ex.getBus();
    SortedSet<Phase> phases = new TreeSet<>(bus.getExtension(PhaseManager.class).getOutPhases());

    //TODO Set Coloc FaultObserver chain
    ColocUtil.setPhases(phases, Phase.SETUP, Phase.USER_LOGICAL);
    InterceptorChain chain = ColocUtil.getOutInterceptorChain(ex, phases);

    if (LOG.isLoggable(Level.FINER)) {
        LOG.finer("Processing Message at collocated endpoint.  Response message: " + msg);
    }

    //Initiate OutBound Processing
    BindingOperationInfo boi = ex.getBindingOperationInfo();
    Message outBound = ex.getOutMessage();
    if (boi != null) {
        outBound.put(MessageInfo.class,
                     boi.getOperationInfo().getOutput());
    }

    outBound.put(Message.INBOUND_MESSAGE, Boolean.FALSE);
    outBound.setInterceptorChain(chain);
    chain.doIntercept(outBound);
}
 
Example 7
Source File: AbstractMessageResponseTimeInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected boolean isServiceCounterEnabled(Exchange ex) {
    Bus bus = ex.getBus();
    CounterRepository counterRepo = bus.getExtension(CounterRepository.class);
    if (counterRepo == null) {
        return false;
    }
    ObjectName serviceCounterName = getServiceCounterName(ex);
    Counter serviceCounter = counterRepo.getCounter(serviceCounterName);
    //If serviceCounter is null, we need to wait ResponseTimeOutInterceptor to create it , hence set to true
    return serviceCounter == null || serviceCounter.isEnabled();
}
 
Example 8
Source File: OutgoingChainInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static InterceptorChain getOutInterceptorChain(Exchange ex) {
    Bus bus = ex.getBus();
    Binding binding = ex.getBinding();
    PhaseManager pm = bus.getExtension(PhaseManager.class);
    PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getOutPhases());

    Endpoint ep = ex.getEndpoint();
    List<Interceptor<? extends Message>> il = ep.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + il);
    }
    chain.add(il);
    il = ep.getService().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + il);
    }
    chain.add(il);
    il = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + il);
    }
    chain.add(il);
    if (binding != null) {
        il = binding.getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by binding: " + il);
        }
        chain.add(il);
    }
    modifyChain(chain, ex);
    chain.setFaultObserver(ep.getOutFaultObserver());
    return chain;
}
 
Example 9
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 10
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 11
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 12
Source File: NegotiationUtils.java    From steady with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message, 
    String namespace, 
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus, 
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(), 
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus, 
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(), 
                                                  policy,
                                                  null);
        } 
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors();
        for (Interceptor<? extends Message> i : interceptors) {
            message.getInterceptorChain().add(i);
        }

        Collection<Assertion> assertions = ep.getVocabulary();
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 13
Source File: NegotiationUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
static void recalcEffectivePolicy(
    SoapMessage message,
    String namespace,
    Policy policy,
    Invoker invoker,
    boolean secConv
) {
    Exchange ex = message.getExchange();
    Bus bus = ex.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }
    Destination destination = ex.getDestination();
    try {
        Endpoint endpoint = message.getExchange().getEndpoint();

        TokenStore store = TokenStoreUtils.getTokenStore(message);
        if (secConv) {
            endpoint = STSUtils.createSCEndpoint(bus,
                                                 namespace,
                                                 endpoint.getEndpointInfo().getTransportId(),
                                                 destination.getAddress().getAddress().getValue(),
                                                 message.getVersion().getBindingId(),
                                                 policy);
        } else {
            endpoint = STSUtils.createSTSEndpoint(bus,
                                                  namespace,
                                                  endpoint.getEndpointInfo().getTransportId(),
                                                  destination.getAddress().getAddress().getValue(),
                                                  message.getVersion().getBindingId(),
                                                  policy,
                                                  null);
        }
        endpoint.getEndpointInfo().setProperty(TokenStore.class.getName(), store);
        message.getExchange().put(TokenStore.class.getName(), store);

        EndpointPolicy ep = pe.getServerEndpointPolicy(endpoint.getEndpointInfo(), destination, message);
        List<Interceptor<? extends Message>> interceptors = ep.getInterceptors(message);
        message.getInterceptorChain().add(interceptors);

        Collection<Assertion> assertions = ep.getVocabulary(message);
        if (null != assertions) {
            message.put(AssertionInfoMap.class, new AssertionInfoMap(assertions));
        }
        endpoint.getService().setInvoker(invoker);
        ex.put(Endpoint.class, endpoint);
        ex.put(Service.class, endpoint.getService());
        ex.put(org.apache.cxf.binding.Binding.class, endpoint.getBinding());
        ex.remove(BindingOperationInfo.class);
        message.put(MAPAggregator.ACTION_VERIFIED, Boolean.TRUE);
    } catch (Exception exc) {
        throw new Fault(exc);
    }
}
 
Example 14
Source File: PolicyVerificationInInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
/**
 * Determines the effective policy, and checks if one of its alternatives
 * is supported.
 *
 * @param message
 * @throws PolicyException if none of the alternatives is supported
 */
protected void handle(Message message) {

    AssertionInfoMap aim = message.get(AssertionInfoMap.class);
    if (null == aim) {
        return;
    }

    Exchange exchange = message.getExchange();
    BindingOperationInfo boi = exchange.getBindingOperationInfo();
    if (null == boi) {
        LOG.fine("No binding operation info.");
        return;
    }

    Endpoint e = exchange.getEndpoint();
    if (null == e) {
        LOG.fine("No endpoint.");
        return;
    }

    Bus bus = exchange.getBus();
    PolicyEngine pe = bus.getExtension(PolicyEngine.class);
    if (null == pe) {
        return;
    }

    if (MessageUtils.isPartialResponse(message)) {
        LOG.fine("Not verifying policies on inbound partial response.");
        return;
    }

    getTransportAssertions(message);

    EffectivePolicy effectivePolicy = message.get(EffectivePolicy.class);
    if (effectivePolicy == null) {
        EndpointInfo ei = e.getEndpointInfo();
        if (MessageUtils.isRequestor(message)) {
            effectivePolicy = pe.getEffectiveClientResponsePolicy(ei, boi, message);
        } else {
            effectivePolicy = pe.getEffectiveServerRequestPolicy(ei, boi, message);
        }
    }
    try {
        List<List<Assertion>> usedAlternatives = aim.checkEffectivePolicy(effectivePolicy.getPolicy());
        if (usedAlternatives != null && !usedAlternatives.isEmpty() && message.getExchange() != null) {
            message.getExchange().put("ws-policy.validated.alternatives", usedAlternatives);
        }
    } catch (PolicyException ex) {
        LOG.log(Level.SEVERE, "Inbound policy verification failed: " + ex.getMessage());
        //To check if there is ws addressing policy violation and throw WSA specific
        //exception to pass jaxws2.2 tests
        if (ex.getMessage().indexOf("Addressing") > -1) {
            throw new Fault("A required header representing a Message Addressing Property "
                                + "is not present", LOG)
                .setFaultCode(new QName("http://www.w3.org/2005/08/addressing",
                                          "MessageAddressingHeaderRequired"));
        }
        throw ex;
    }
    LOG.fine("Verified policies for inbound message.");
}
 
Example 15
Source File: OutgoingChainInterceptor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private static PhaseInterceptorChain getChain(Exchange ex, PhaseChainCache chainCache) {
    Bus bus = ex.getBus();
    Binding binding = ex.getBinding();

    Endpoint ep = ex.getEndpoint();

    List<Interceptor<? extends Message>> i1 = bus.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by bus: " + i1);
    }
    List<Interceptor<? extends Message>> i2 = ep.getService().getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by service: " + i2);
    }
    List<Interceptor<? extends Message>> i3 = ep.getOutInterceptors();
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Interceptors contributed by endpoint: " + i3);
    }
    List<Interceptor<? extends Message>> i4 = null;
    if (binding != null) {
        i4 = binding.getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by binding: " + i4);
        }
    }
    List<Interceptor<? extends Message>> i5 = null;
    if (ep.getService().getDataBinding() instanceof InterceptorProvider) {
        i5 = ((InterceptorProvider)ep.getService().getDataBinding()).getOutInterceptors();
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Interceptors contributed by databinding: " + i5);
        }
        if (i4 == null) {
            i4 = i5;
            i5 = null;
        }
    }
    PhaseInterceptorChain chain;
    if (i5 != null) {
        chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(),
                               i1, i2, i3, i4, i5);
    } else if (i4 != null) {
        chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(),
                               i1, i2, i3, i4);
    } else {
        chain = chainCache.get(bus.getExtension(PhaseManager.class).getOutPhases(),
                               i1, i2, i3);
    }

    modifyChain(chain, ex);
    chain.setFaultObserver(ep.getOutFaultObserver());
    return chain;
}