Search in sources :

Example 6 with NameValuePairDescriptor

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

the class WebServiceHandlerNode method writeDescriptor.

/**
 * write the method descriptor class to a query-method DOM tree and
 * return it
 *
 * @param parent node in the DOM tree
 * @param nodeName name for the root element of this xml fragment
 * @param handler the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, String nodeName, WebServiceHandler handler) {
    Node wshNode = super.writeDescriptor(parent, nodeName, handler);
    writeDisplayableComponentInfo(wshNode, handler);
    appendTextChild(wshNode, WebServicesTagNames.HANDLER_NAME, handler.getHandlerName());
    appendTextChild(wshNode, WebServicesTagNames.HANDLER_CLASS, handler.getHandlerClass());
    for (Iterator iter = handler.getInitParams().iterator(); iter.hasNext(); ) {
        NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next();
        Node initParamNode = appendChild(wshNode, WebServicesTagNames.INIT_PARAM);
        appendTextChild(initParamNode, WebServicesTagNames.INIT_PARAM_NAME, next.getName());
        appendTextChild(initParamNode, WebServicesTagNames.INIT_PARAM_VALUE, next.getValue());
    }
    for (Iterator iter = handler.getSoapHeaders().iterator(); iter.hasNext(); ) {
        QName next = (QName) iter.next();
        // Append soap header QName.  NOTE : descriptor does not contain
        // a prefix so always generate one.
        appendQNameChild(WebServicesTagNames.SOAP_HEADER, wshNode, next.getNamespaceURI(), next.getLocalPart(), null);
    }
    for (Iterator iter = handler.getSoapRoles().iterator(); iter.hasNext(); ) {
        String next = (String) iter.next();
        appendTextChild(wshNode, WebServicesTagNames.SOAP_ROLE, next);
    }
    for (Iterator iter = handler.getPortNames().iterator(); iter.hasNext(); ) {
        String next = (String) iter.next();
        appendTextChild(wshNode, WebServicesTagNames.HANDLER_PORT_NAME, next);
    }
    return wshNode;
}
Also used : NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) QName(javax.xml.namespace.QName) Node(org.w3c.dom.Node) DisplayableComponentNode(com.sun.enterprise.deployment.node.DisplayableComponentNode) Iterator(java.util.Iterator)

Example 7 with NameValuePairDescriptor

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

the class CmpResourceNode method writeDescriptor.

@Override
public Node writeDescriptor(Node parent, String nodeName, ResourceReferenceDescriptor descriptor) {
    Node cmp = super.writeDescriptor(parent, nodeName, descriptor);
    appendTextChild(cmp, RuntimeTagNames.JNDI_NAME, descriptor.getJndiName());
    if (descriptor.getResourcePrincipal() != null) {
        DefaultResourcePrincipalNode drpNode = new DefaultResourcePrincipalNode();
        drpNode.writeDescriptor(cmp, RuntimeTagNames.DEFAULT_RESOURCE_PRINCIPAL, descriptor.getResourcePrincipal());
    }
    // properties*
    Iterator properties = descriptor.getProperties();
    if (properties != null) {
        RuntimeNameValuePairNode propNode = new RuntimeNameValuePairNode();
        while (properties.hasNext()) {
            NameValuePairDescriptor aProp = (NameValuePairDescriptor) properties.next();
            propNode.writeDescriptor(cmp, RuntimeTagNames.PROPERTY, aProp);
        }
    }
    // createTableAtDeploy, dropTableAtUndeploy
    if (descriptor.isCreateTablesAtDeploy()) {
        appendTextChild(cmp, RuntimeTagNames.CREATE_TABLES_AT_DEPLOY, RuntimeTagNames.TRUE);
    }
    if (descriptor.isDropTablesAtUndeploy()) {
        appendTextChild(cmp, RuntimeTagNames.DROP_TABLES_AT_UNDEPLOY, RuntimeTagNames.TRUE);
    }
    // database vendor name
    appendTextChild(cmp, RuntimeTagNames.DATABASE_VENDOR_NAME, descriptor.getDatabaseVendorName());
    // schema-generator-properties?
    Properties schemaGeneratorProps = descriptor.getSchemaGeneratorProperties();
    if (schemaGeneratorProps != null) {
        PropertiesNode pn = new PropertiesNode();
        pn.writeDescriptor(cmp, RuntimeTagNames.SCHEMA_GENERATOR_PROPERTIES, schemaGeneratorProps);
    }
    return cmp;
}
Also used : NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) PropertiesNode(com.sun.enterprise.deployment.node.PropertiesNode) RuntimeNameValuePairNode(com.sun.enterprise.deployment.node.runtime.common.RuntimeNameValuePairNode) Node(org.w3c.dom.Node) RuntimeDescriptorNode(com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode) DefaultResourcePrincipalNode(com.sun.enterprise.deployment.node.runtime.DefaultResourcePrincipalNode) DefaultResourcePrincipalNode(com.sun.enterprise.deployment.node.runtime.DefaultResourcePrincipalNode) Iterator(java.util.Iterator) RuntimeNameValuePairNode(com.sun.enterprise.deployment.node.runtime.common.RuntimeNameValuePairNode) Properties(java.util.Properties) PropertiesNode(com.sun.enterprise.deployment.node.PropertiesNode)

Example 8 with NameValuePairDescriptor

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

the class WLServiceRefPortInfoRuntimeNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent   node for the DOM tree
 * @param nodeName node name for the descriptor
 * @param desc     the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, String nodeName, ServiceRefPortInfo desc) {
    Node serviceRefPortInfoRuntimeNode = super.writeDescriptor(parent, nodeName, desc);
    QName port = desc.getWsdlPort();
    if (port != null) {
        appendTextChild(serviceRefPortInfoRuntimeNode, WLWebServicesTagNames.SERVICE_REFERENCE_PORT_NAME, port.getLocalPart());
        // stub-property*
        NameValuePairNode nameValueNode = new NameValuePairNode();
        Set stubProperties = desc.getStubProperties();
        for (Iterator iter = stubProperties.iterator(); iter.hasNext(); ) {
            NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next();
            nameValueNode.writeDescriptor(serviceRefPortInfoRuntimeNode, WebServicesTagNames.STUB_PROPERTY, next);
        }
        // call-property*
        for (Iterator iter = desc.getCallProperties().iterator(); iter.hasNext(); ) {
            NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next();
            nameValueNode.writeDescriptor(serviceRefPortInfoRuntimeNode, WebServicesTagNames.CALL_PROPERTY, next);
        }
    }
    return serviceRefPortInfoRuntimeNode;
}
Also used : Set(java.util.Set) NameValuePairNode(com.sun.enterprise.deployment.node.NameValuePairNode) NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) QName(javax.xml.namespace.QName) MessageSecurityBindingNode(com.sun.enterprise.deployment.node.runtime.common.MessageSecurityBindingNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) Node(org.w3c.dom.Node) NameValuePairNode(com.sun.enterprise.deployment.node.NameValuePairNode) Iterator(java.util.Iterator)

Example 9 with NameValuePairDescriptor

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

the class WebServiceHandlerNode method setElementValue.

/**
 * receives notification of the value for a particular tag
 *
 * @param element the xml element
 * @param value it's associated value
 */
public void setElementValue(XMLElement element, String value) {
    String qname = element.getQName();
    WebServiceHandler handler = (WebServiceHandler) getDescriptor();
    if (WebServicesTagNames.INIT_PARAM_NAME.equals(qname)) {
        initParam = new NameValuePairDescriptor();
        initParam.setName(value);
    } else if (WebServicesTagNames.INIT_PARAM_VALUE.equals(qname)) {
        initParam.setValue(value);
        handler.addInitParam(initParam);
    } else if (TagNames.DESCRIPTION.equals(qname)) {
        if (initParam != null) {
            // description for the init-param
            initParam.setDescription(value);
            initParam = null;
        } else {
            // must be the description element of the handler itself.
            super.setElementValue(element, value);
        }
    } else if (WebServicesTagNames.SOAP_HEADER.equals(qname)) {
        String prefix = getPrefixFromQName(value);
        String localPart = getLocalPartFromQName(value);
        String namespaceUri = resolvePrefix(element, prefix);
        if (namespaceUri == null) {
            logger.log(Level.SEVERE, LogUtils.INVALID_DESC_MAPPING_FAILURE, new Object[] { prefix, handler.getHandlerName() });
        } else {
            QName soapHeader = new QName(namespaceUri, localPart);
            handler.addSoapHeader(soapHeader);
        }
    } else
        super.setElementValue(element, value);
}
Also used : NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) QName(javax.xml.namespace.QName) WebServiceHandler(com.sun.enterprise.deployment.WebServiceHandler)

Example 10 with NameValuePairDescriptor

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

the class PortCreationCallbackImpl method postCreateProxy.

public void postCreateProxy(WSBindingProvider bp, Class<?> serviceEndpointInterface) {
    ServiceRefPortInfo portInfo = ref.getPortInfoBySEI(serviceEndpointInterface.getName());
    if (portInfo != null) {
        // Set MTOM for this port
        boolean mtomEnabled = false;
        if (portInfo.getMtomEnabled() != null && Boolean.valueOf(portInfo.getMtomEnabled())) {
            mtomEnabled = true;
        }
        if (mtomEnabled) {
            Binding bType = bp.getBinding();
            // enable mtom valid only for SOAPBindings
            if (SOAPBinding.class.isAssignableFrom(bType.getClass())) {
                ((SOAPBinding) bType).setMTOMEnabled(true);
            } else {
                logger.log(Level.SEVERE, LogUtils.INVALID_MTOM, portInfo.getName());
            }
        }
        // Set stub properties
        Set properties = portInfo.getStubProperties();
        for (Iterator iter = properties.iterator(); iter.hasNext(); ) {
            NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next();
            bp.getRequestContext().put(next.getName(), next.getValue());
        }
    }
}
Also used : Binding(javax.xml.ws.Binding) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Set(java.util.Set) NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) Iterator(java.util.Iterator) SOAPBinding(javax.xml.ws.soap.SOAPBinding) ServiceRefPortInfo(com.sun.enterprise.deployment.ServiceRefPortInfo)

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