Search in sources :

Example 6 with InboundResourceAdapter

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

the class MessageListenerNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, Descriptor descriptor) {
    if (!(descriptor instanceof InboundResourceAdapter)) {
        throw new IllegalArgumentException(getClass() + " cannot handle descriptors of type " + descriptor.getClass());
    }
    Iterator msgListeners = ((InboundResourceAdapter) descriptor).getMessageListeners().iterator();
    if (!msgListeners.hasNext()) {
        throw new RuntimeException("There must be at least one messagelistener for this inbound resource adapter");
    }
    // message listeners
    for (; msgListeners.hasNext(); ) {
        MessageListener msgListener = (MessageListener) msgListeners.next();
        Node msgListenerNode = appendChild(parent, ConnectorTagNames.MSG_LISTENER);
        appendTextChild(msgListenerNode, ConnectorTagNames.MSG_LISTENER_TYPE, msgListener.getMessageListenerType());
        // activation spec node
        ActivationSpecNode actSpecNode = new ActivationSpecNode();
        msgListenerNode = actSpecNode.writeDescriptor(msgListenerNode, msgListener);
    }
    return parent;
}
Also used : InboundResourceAdapter(com.sun.enterprise.deployment.InboundResourceAdapter) Node(org.w3c.dom.Node) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) Iterator(java.util.Iterator) MessageListener(com.sun.enterprise.deployment.MessageListener)

Aggregations

InboundResourceAdapter (com.sun.enterprise.deployment.InboundResourceAdapter)6 MessageListener (com.sun.enterprise.deployment.MessageListener)6 Result (com.sun.enterprise.tools.verifier.Result)4 Iterator (java.util.Iterator)4 Set (java.util.Set)3 ConnectorDescriptor (com.sun.enterprise.deployment.ConnectorDescriptor)1 EnvironmentProperty (com.sun.enterprise.deployment.EnvironmentProperty)1 RarBundleContext (com.sun.enterprise.deployment.annotation.context.RarBundleContext)1 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)1 Method (java.lang.reflect.Method)1 Activation (javax.resource.spi.Activation)1 Node (org.w3c.dom.Node)1