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

The following examples show how to use org.apache.cxf.service.model.EndpointInfo#getExtensor() . 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: CorbaDestination.java    From cxf with Apache License 2.0 6 votes vote down vote up
public CorbaDestination(EndpointInfo ei, OrbConfig config, CorbaTypeMap tm) {
    address = ei.getExtensor(AddressType.class);
    binding = ei.getBinding();
    reference = new EndpointReferenceType();
    AttributedURIType addr = new AttributedURIType();
    addr.setValue(address.getLocation());
    reference.setAddress(addr);
    endpointInfo = ei;
    orbConfig = config;
    if (tm != null) {
        typeMap = tm;
    } else {
        typeMap = TypeMapCache.get(binding.getService());
    }
    PolicyType policy = ei.getExtensor(PolicyType.class);
    if (policy != null) {
        poaName = policy.getPoaname();
        isPersistent = policy.isPersistent();
        serviceId = policy.getServiceid();
    }
}
 
Example 2
Source File: LocalTransportFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected LocalDestination getDestination(EndpointInfo ei,
                                     EndpointReferenceType reference,
                                     Bus bus)
    throws IOException {
    String addr = reference.getAddress().getValue();
    if (addr == null) {
        AddressType tp = ei.getExtensor(AddressType.class);
        if (tp != null) {
            addr = tp.getLocation();
        }
    }
    if (addr == null) {
        addr = NULL_ADDRESS;
    }
    LocalDestination d = destinations.get(addr);
    if (d == null) {
        d = createDestination(ei, reference, bus);
        LocalDestination tmpD = destinations.putIfAbsent(addr, d);
        if (tmpD != null) {
            d = tmpD;
        }
    }
    return d;
}
 
Example 3
Source File: JMSEndpointWSDLUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static <T> T getWSDLExtensor(EndpointInfo ei, Class<T> cls) {
    ServiceInfo si = ei.getService();
    BindingInfo bi = ei.getBinding();

    Object o = ei.getExtensor(cls);
    if (o == null && si != null) {
        o = si.getExtensor(cls);
    }
    if (o == null && bi != null) {
        o = bi.getExtensor(cls);
    }

    if (o == null) {
        return null;
    }
    if (cls.isInstance(o)) {
        return cls.cast(o);
    }
    return null;
}
 
Example 4
Source File: HttpHandlerImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public void handle(HttpExchange exchange) throws IOException {
    try {
        //Update address in EndpointInfo; this can only happen here,
        //as the contextPath is provided in the HttpExchange only
        EndpointInfo ei = destination.getEndpointInfo();
        if (ei != null) {
            String ad = ei.getAddress();
            String path = exchange.getHttpContext().getPath();
            if (ad != null && ad.equals(path)) {
                synchronized (ei) {
                    String contextPath = exchange.getContextPath();
                    ei.setAddress(contextPath + path);
                    if (ei.getExtensor(AddressType.class) != null) {
                        ei.getExtensor(AddressType.class).setLocation(contextPath + path);
                    } else if (ei.getExtensor(SoapAddress.class) != null) {
                        ei.getExtensor(SoapAddress.class).setLocationURI(contextPath + path);
                    }
                }
            }
        }
        //service request
        destination.doService(new HttpServletRequestAdapter(exchange),
                              new HttpServletResponseAdapter(exchange));
    } finally {
        exchange.close();
    }
}
 
Example 5
Source File: ServiceProcessor.java    From cxf with Apache License 2.0 4 votes vote down vote up
private JavaPort processPort(JavaModel model, ServiceInfo si, EndpointInfo port) throws ToolException {
    BindingInfo binding = port.getBinding();
    String portType = binding.getInterface().getName().getLocalPart();
    JavaInterface intf = PortTypeProcessor.getInterface(context, si, binding.getInterface());
    JavaPort jport = new JavaPort(NameUtil.mangleNameToClassName(port.getName().getLocalPart()));
    jport.setPackageName(intf.getPackageName());

    jport.setPortName(port.getName().getLocalPart());
    jport.setBindingAdress(port.getAddress());
    jport.setBindingName(binding.getName().getLocalPart());


    jport.setPortType(portType);


    jport.setInterfaceClass(intf.getName());
    bindingType = getBindingType(binding);

    if (bindingType == null) {
        org.apache.cxf.common.i18n.Message msg =
            new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL",
                                                   LOG,
                                                   binding.getName());
        throw new ToolException(msg);
    }

    if (isSoapBinding()) {
        SoapBinding spbd = SOAPBindingUtil.getProxy(SoapBinding.class, this.bindingObj);
        jport.setStyle(SOAPBindingUtil.getSoapStyle(spbd.getStyle()));
        jport.setTransURI(spbd.getTransportURI());
    }

    Collection<BindingOperationInfo> operations = binding.getOperations();
    for (BindingOperationInfo bop : operations) {
        processOperation(model, bop, binding);
    }
    jport.setJavaDoc(port.getDocumentation());
    JAXWSBinding bind = port.getExtensor(JAXWSBinding.class);
    if (bind != null) {
        jport.setMethodName(bind.getMethodName());
        jport.setJavaDoc(bind.getMethodJavaDoc());
    }

    return jport;
}
 
Example 6
Source File: ServiceModelPolicyProvider.java    From cxf with Apache License 2.0 4 votes vote down vote up
public Policy getEffectivePolicy(EndpointInfo ei, Message m) {
    return ei.getExtensor(Policy.class);
}