Java Code Examples for org.apache.cxf.service.model.EndpointInfo#getTransportId()

The following examples show how to use org.apache.cxf.service.model.EndpointInfo#getTransportId() . 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: RMEndpoint.java    From cxf with Apache License 2.0 5 votes vote down vote up
void createEndpoint(org.apache.cxf.transport.Destination d, ProtocolVariation protocol) {
    final QName bindingQName = new QName(protocol.getWSRMNamespace(), BINDING_NAME);
    WrappedService service = services.get(protocol);
    ServiceInfo si = service.getServiceInfo();
    buildBindingInfo(si, protocol);
    EndpointInfo aei = applicationEndpoint.getEndpointInfo();
    String transportId = aei.getTransportId();
    EndpointInfo ei = new EndpointInfo(si, transportId);
    if (d != null) {
        ei.setProperty(MAPAggregator.DECOUPLED_DESTINATION, d);
    }

    ei.setAddress(aei.getAddress());

    ei.setName(RMUtils.getConstants(protocol.getWSRMNamespace()).getPortName());
    ei.setBinding(si.getBinding(bindingQName));

    // if addressing was enabled on the application endpoint by means
    // of the UsingAddressing element extensor, use this for the
    // RM endpoint also

    Object ua = getUsingAddressing(aei);
    if (null != ua) {
        ei.addExtensor(ua);
    }
    si.addEndpoint(ei);
    ei.setProperty(SecurityConstants.TOKEN_STORE_CACHE_INSTANCE, tokenStore);

    Endpoint endpoint = new WrappedEndpoint(applicationEndpoint, ei, service);
    if (applicationEndpoint.getEndpointInfo() != null
        && applicationEndpoint.getEndpointInfo().getProperties() != null) {
        for (String key : applicationEndpoint.getEndpointInfo().getProperties().keySet()) {
            endpoint.getEndpointInfo()
                .setProperty(key, applicationEndpoint.getEndpointInfo().getProperty(key));
        }
    }
    service.setEndpoint(endpoint);
    endpoints.put(protocol, endpoint);
}
 
Example 2
Source File: SoapTransportFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Destination getDestination(EndpointInfo ei, Bus bus) throws IOException {
    String address = ei.getAddress();
    BindingInfo bi = ei.getBinding();
    String transId = ei.getTransportId();
    if (bi instanceof SoapBindingInfo) {
        transId = ((SoapBindingInfo)bi).getTransportURI();
        if (transId == null) {
            transId = ei.getTransportId();
        }
    }
    DestinationFactory destinationFactory;
    try {
        DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class);
        if (StringUtils.isEmpty(address)
            || address.startsWith("http")
            || address.startsWith("jms")
            || address.startsWith("soap.udp")
            || address.startsWith("/")) {
            destinationFactory = mgr.getDestinationFactory(mapTransportURI(transId, address));
        } else {
            destinationFactory = mgr.getDestinationFactoryForUri(address);
        }
        if (destinationFactory == null) {
            throw new IOException("Could not find destination factory for transport " + transId);
        }

        return destinationFactory.getDestination(ei, bus);
    } catch (BusException e) {
        IOException ex = new IOException("Could not find destination factory for transport " + transId);
        ex.initCause(e);
        throw ex;
    }
}
 
Example 3
Source File: SoapTransportFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target, Bus bus) throws IOException {
    String address = target == null ? ei.getAddress() : target.getAddress().getValue();
    BindingInfo bi = ei.getBinding();
    String transId = ei.getTransportId();
    if (bi instanceof SoapBindingInfo) {
        transId = ((SoapBindingInfo)bi).getTransportURI();
        if (transId == null) {
            transId = ei.getTransportId();
        }
    }
    ConduitInitiator conduitInit;
    try {
        ConduitInitiatorManager mgr = bus.getExtension(ConduitInitiatorManager.class);
        if (StringUtils.isEmpty(address)
            || address.startsWith("http")
            || address.startsWith("jms")
            || address.startsWith("soap.udp")) {
            conduitInit = mgr.getConduitInitiator(mapTransportURI(transId, address));
        } else {
            conduitInit = mgr.getConduitInitiatorForUri(address);
        }
        if (conduitInit == null) {
            throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId));
        }
        return conduitInit.getConduit(ei, target, bus);
    } catch (BusException e) {
        throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId));
    }
}
 
Example 4
Source File: AbstractConduitSelector.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Mechanics to actually get the Conduit from the ConduitInitiator
 * if necessary.
 *
 * @param message the current Message
 */
protected Conduit getSelectedConduit(Message message) {
    Conduit c = findCompatibleConduit(message);
    if (c == null) {
        Exchange exchange = message.getExchange();
        EndpointInfo ei = endpoint.getEndpointInfo();
        String transportID = ei.getTransportId();
        try {
            ConduitInitiatorManager conduitInitiatorMgr = exchange.getBus()
                .getExtension(ConduitInitiatorManager.class);
            if (conduitInitiatorMgr != null) {
                ConduitInitiator conduitInitiator =
                    conduitInitiatorMgr.getConduitInitiator(transportID);
                if (conduitInitiator != null) {
                    c = createConduit(message, exchange, conduitInitiator);
                } else {
                    getLogger().warning("ConduitInitiator not found: "
                                        + ei.getAddress());
                }
            } else {
                getLogger().warning("ConduitInitiatorManager not found");
            }
        } catch (BusException | IOException ex) {
            throw new Fault(ex);
        }
    }
    if (c != null && c.getTarget() != null && c.getTarget().getAddress() != null) {
        replaceEndpointAddressPropertyIfNeeded(message, c.getTarget().getAddress().getValue(), c);
    }
    //the search for the conduit could cause extra properties to be reset/loaded.
    message.resetContextCache();
    message.put(Conduit.class, c);
    return c;
}