Search in sources :

Example 11 with NameValuePairDescriptor

use of com.sun.enterprise.deployment.NameValuePairDescriptor in project Payara by payara.

the class ServiceInvocationHandler method setStubProperties.

private void setStubProperties(Stub stub, int methodType, Method method, Object[] args) {
    // Port info lookup will be based on SEI or port.
    QName port = null;
    String serviceEndpointInterface = null;
    switch(methodType) {
        case GET_PORT_CONTAINER_MANAGED:
            serviceEndpointInterface = ((Class) args[0]).getName();
            break;
        case GET_PORT_CLIENT_MANAGED:
            port = (QName) args[0];
            serviceEndpointInterface = ((Class) args[1]).getName();
            break;
        case GENERATED_SERVICE_METHOD:
            // java.rmi.Remote get<Name_of_wsdl:port>()
            String portLocalPart = method.getName().startsWith("get") ? method.getName().substring(3) : null;
            if (portLocalPart != null) {
                QName serviceName = serviceRef.getServiceName();
                port = new QName(serviceName.getNamespaceURI(), portLocalPart);
            }
            serviceEndpointInterface = method.getReturnType().getName();
            break;
        default:
            return;
    }
    ServiceRefPortInfo portInfo = null;
    // If port is known, it takes precedence in lookup.
    if (port != null) {
        portInfo = serviceRef.getPortInfoByPort(port);
    }
    if (portInfo == null) {
        portInfo = serviceRef.getPortInfoBySEI(serviceEndpointInterface);
    }
    if (portInfo != null) {
        Set properties = portInfo.getStubProperties();
        for (Iterator iter = properties.iterator(); iter.hasNext(); ) {
            NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next();
            stub._setProperty(next.getName(), next.getValue());
        }
        // precedence.
        if (portInfo.hasTargetEndpointAddress()) {
            if (!portInfo.hasStubProperty(Stub.ENDPOINT_ADDRESS_PROPERTY)) {
                stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, portInfo.getTargetEndpointAddress());
            }
        }
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) QName(javax.xml.namespace.QName) Iterator(java.util.Iterator) ServiceRefPortInfo(com.sun.enterprise.deployment.ServiceRefPortInfo)

Example 12 with NameValuePairDescriptor

use of com.sun.enterprise.deployment.NameValuePairDescriptor in project Payara by payara.

the class ServiceInvocationHandler method setCallProperties.

private void setCallProperties(Call call, Set callProperties) {
    for (Iterator iter = callProperties.iterator(); iter.hasNext(); ) {
        NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next();
        call.setProperty(next.getName(), next.getValue());
    }
}
Also used : NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) Iterator(java.util.Iterator)

Aggregations

NameValuePairDescriptor (com.sun.enterprise.deployment.NameValuePairDescriptor)12 Iterator (java.util.Iterator)9 QName (javax.xml.namespace.QName)6 Node (org.w3c.dom.Node)5 Set (java.util.Set)4 RuntimeNameValuePairNode (com.sun.enterprise.deployment.node.runtime.common.RuntimeNameValuePairNode)3 ServiceRefPortInfo (com.sun.enterprise.deployment.ServiceRefPortInfo)2 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)2 NameValuePairNode (com.sun.enterprise.deployment.node.NameValuePairNode)2 RuntimeDescriptorNode (com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode)2 MessageSecurityBindingNode (com.sun.enterprise.deployment.node.runtime.common.MessageSecurityBindingNode)2 ResourceReferenceDescriptor (com.sun.enterprise.deployment.ResourceReferenceDescriptor)1 WebServiceHandler (com.sun.enterprise.deployment.WebServiceHandler)1 DisplayableComponentNode (com.sun.enterprise.deployment.node.DisplayableComponentNode)1 PropertiesNode (com.sun.enterprise.deployment.node.PropertiesNode)1 XMLElement (com.sun.enterprise.deployment.node.XMLElement)1 DefaultResourcePrincipalNode (com.sun.enterprise.deployment.node.runtime.DefaultResourcePrincipalNode)1 MessageDestinationRuntimeNode (com.sun.enterprise.deployment.node.runtime.MessageDestinationRuntimeNode)1 WebServiceRuntimeNode (com.sun.enterprise.deployment.node.runtime.WebServiceRuntimeNode)1 MessageSecurityBindingDescriptor (com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor)1