Search in sources :

Example 1 with NameValuePairDescriptor

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

the class WsCompile method createHandlerInfo.

private HandlerInfo createHandlerInfo(WebServiceHandler handler) {
    HandlerInfo handlerInfo = rpcFactory.createHandlerInfo();
    handlerInfo.setHandlerClassName(handler.getHandlerClass());
    for (Iterator iter = handler.getSoapHeaders().iterator(); iter.hasNext(); ) {
        QName next = (QName) iter.next();
        handlerInfo.addHeaderName(next);
    }
    Map properties = handlerInfo.getProperties();
    for (Iterator iter = handler.getInitParams().iterator(); iter.hasNext(); ) {
        NameValuePairDescriptor next = (NameValuePairDescriptor) iter.next();
        properties.put(next.getName(), next.getValue());
    }
    return handlerInfo;
}
Also used : NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) QName(javax.xml.namespace.QName) Iterator(java.util.Iterator) Map(java.util.Map) HandlerInfo(com.sun.xml.rpc.spi.tools.HandlerInfo)

Example 2 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 3 with NameValuePairDescriptor

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

the class NameValuePairNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node in the DOM tree
 * @param node name for the root element of this xml fragment
 * @param iterator on the descriptors to write
 * @return the DOM tree top node
 */
public void writeDescriptor(Node parent, String nodeName, Iterator props) {
    if (props == null)
        return;
    while (props.hasNext()) {
        NameValuePairDescriptor aProp = (NameValuePairDescriptor) props.next();
        writeDescriptor(parent, nodeName, aProp);
    }
}
Also used : NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor)

Example 4 with NameValuePairDescriptor

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

the class MessageDrivenHandler method setEjbDescriptorInfo.

/**
 * Set Annotation information to Descriptor.
 * This method will also be invoked for an existing descriptor with
 * annotation as user may not specific a complete xml.
 * @param ejbDesc
 * @param ainfo
 * @return HandlerProcessingResult
 */
protected HandlerProcessingResult setEjbDescriptorInfo(EjbDescriptor ejbDesc, AnnotationInfo ainfo) throws AnnotationProcessorException {
    MessageDriven mdAn = (MessageDriven) ainfo.getAnnotation();
    Class ejbClass = (Class) ainfo.getAnnotatedElement();
    EjbMessageBeanDescriptor ejbMsgBeanDesc = (EjbMessageBeanDescriptor) ejbDesc;
    HandlerProcessingResult procResult = setMessageListenerInterface(mdAn, ejbMsgBeanDesc, ejbClass, ainfo);
    doDescriptionProcessing(mdAn.description(), ejbMsgBeanDesc);
    doMappedNameProcessing(mdAn.mappedName(), ejbMsgBeanDesc);
    for (ActivationConfigProperty acProp : mdAn.activationConfig()) {
        EnvironmentProperty envProp = new EnvironmentProperty(acProp.propertyName(), TranslatedConfigView.expandValue(acProp.propertyValue()), "");
        // xml override
        switch(acProp.propertyName()) {
            case "resourceAdapter":
                ejbMsgBeanDesc.setResourceAdapterMid(envProp.getValue());
                break;
            case DescriptorConstants.MAX_POOL_SIZE:
                initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
                ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setMaxPoolSize(Integer.valueOf(envProp.getValue()));
                break;
            case DescriptorConstants.POOL_RESIZE_QTY:
                initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
                ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setPoolResizeQuantity(Integer.valueOf(envProp.getValue()));
                break;
            case DescriptorConstants.STEADY_POOL_SIZE:
                initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
                ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setSteadyPoolSize(Integer.valueOf(envProp.getValue()));
                break;
            case DescriptorConstants.MAX_WAIT_TIME:
                initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
                ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setMaxWaitTimeInMillis(Integer.valueOf(envProp.getValue()));
                break;
            case DescriptorConstants.POOL_IDLE_TIMEOUT:
                initialiseBeanPoolDescriptor(ejbMsgBeanDesc);
                ejbMsgBeanDesc.getIASEjbExtraDescriptors().getBeanPool().setPoolIdleTimeoutInSeconds(Integer.valueOf(envProp.getValue()));
                break;
            case "SingletonBeanPool":
                NameValuePairDescriptor singletonProperty = new NameValuePairDescriptor();
                singletonProperty.setName("singleton-bean-pool");
                singletonProperty.setValue(envProp.getValue());
                ejbMsgBeanDesc.getEjbBundleDescriptor().addEnterpriseBeansProperty(singletonProperty);
                break;
            default:
                if (ejbMsgBeanDesc.getActivationConfigValue(envProp.getName()) == null) {
                    ejbMsgBeanDesc.putActivationConfigProperty(envProp);
                }
                break;
        }
    }
    return procResult;
}
Also used : ActivationConfigProperty(javax.ejb.ActivationConfigProperty) EjbMessageBeanDescriptor(org.glassfish.ejb.deployment.descriptor.EjbMessageBeanDescriptor) NameValuePairDescriptor(com.sun.enterprise.deployment.NameValuePairDescriptor) HandlerProcessingResult(org.glassfish.apf.HandlerProcessingResult) EnvironmentProperty(com.sun.enterprise.deployment.EnvironmentProperty) MessageDriven(javax.ejb.MessageDriven)

Example 5 with NameValuePairDescriptor

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

the class WebServiceEndpointRuntimeNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param node name for the descriptor
 * @param the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, String nodeName, WebServiceEndpoint endpoint) {
    Node endpointNode = super.writeDescriptor(parent, nodeName, endpoint);
    appendTextChild(endpointNode, WebServicesTagNames.PORT_COMPONENT_NAME, endpoint.getEndpointName());
    appendTextChild(endpointNode, WebServicesTagNames.ENDPOINT_ADDRESS_URI, endpoint.getEndpointAddressUri());
    // this info is described in web application itself.
    if (endpoint.implementedByEjbComponent() && endpoint.hasAuthMethod()) {
        Node loginConfigNode = appendChild(endpointNode, RuntimeTagNames.LOGIN_CONFIG);
        appendTextChild(loginConfigNode, RuntimeTagNames.AUTH_METHOD, endpoint.getAuthMethod());
        appendTextChild(loginConfigNode, RuntimeTagNames.REALM, endpoint.getRealm());
    }
    // message-security-binding
    MessageSecurityBindingDescriptor messageSecBindingDesc = endpoint.getMessageSecurityBinding();
    if (messageSecBindingDesc != null) {
        MessageSecurityBindingNode messageSecBindingNode = new MessageSecurityBindingNode();
        messageSecBindingNode.writeDescriptor(endpointNode, WebServicesTagNames.MESSAGE_SECURITY_BINDING, messageSecBindingDesc);
    }
    appendTextChild(endpointNode, WebServicesTagNames.TRANSPORT_GUARANTEE, endpoint.getTransportGuarantee());
    QName serviceName = endpoint.getServiceName();
    if (serviceName != null) {
        Node serviceQnameNode = appendChild(endpointNode, WebServicesTagNames.SERVICE_QNAME);
        appendTextChild(serviceQnameNode, WebServicesTagNames.NAMESPACE_URI, serviceName.getNamespaceURI());
        appendTextChild(serviceQnameNode, WebServicesTagNames.LOCAL_PART, serviceName.getLocalPart());
    }
    appendTextChild(endpointNode, WebServicesTagNames.TIE_CLASS, endpoint.getTieClassName());
    if (endpoint.implementedByWebComponent() && (endpoint.getServletImplClass() != null)) {
        appendTextChild(endpointNode, WebServicesTagNames.SERVLET_IMPL_CLASS, endpoint.getServletImplClass());
    }
    // debugging-enabled?
    appendTextChild(endpointNode, WebServicesTagNames.DEBUGGING_ENABLED, endpoint.getDebugging());
    // property*
    Iterator properties = endpoint.getProperties();
    if (properties != null) {
        RuntimeNameValuePairNode propNode = new RuntimeNameValuePairNode();
        while (properties.hasNext()) {
            NameValuePairDescriptor aProp = (NameValuePairDescriptor) properties.next();
            propNode.writeDescriptor(endpointNode, RuntimeTagNames.PROPERTY, aProp);
        }
    }
    return endpointNode;
}
Also used : MessageSecurityBindingDescriptor(com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor) 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) RuntimeNameValuePairNode(com.sun.enterprise.deployment.node.runtime.common.RuntimeNameValuePairNode) MessageSecurityBindingNode(com.sun.enterprise.deployment.node.runtime.common.MessageSecurityBindingNode) Iterator(java.util.Iterator) RuntimeNameValuePairNode(com.sun.enterprise.deployment.node.runtime.common.RuntimeNameValuePairNode)

Aggregations

NameValuePairDescriptor (com.sun.enterprise.deployment.NameValuePairDescriptor)14 Iterator (java.util.Iterator)10 QName (javax.xml.namespace.QName)7 Node (org.w3c.dom.Node)6 RuntimeNameValuePairNode (com.sun.enterprise.deployment.node.runtime.common.RuntimeNameValuePairNode)4 Set (java.util.Set)4 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)3 ServiceRefPortInfo (com.sun.enterprise.deployment.ServiceRefPortInfo)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 MessageSecurityBindingDescriptor (com.sun.enterprise.deployment.runtime.common.MessageSecurityBindingDescriptor)2 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)1 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