KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > node > runtime > MDBResourceAdapterNode


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.deployment.node.runtime;
24
25 import java.util.Map JavaDoc;
26 import java.util.HashMap JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import org.w3c.dom.Node JavaDoc;
29
30 import com.sun.enterprise.deployment.node.XMLElement;
31 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode;
32
33 import com.sun.enterprise.deployment.Descriptor;
34 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor;
35 import com.sun.enterprise.deployment.xml.RuntimeTagNames;
36
37 /**
38  * This class is responsible for handling the runtime resource
39  * adapter configuration for the message-driven bean
40  *
41  * @author Qingqing Ouyang
42  * @version
43  */

44 public class MDBResourceAdapterNode extends DeploymentDescriptorNode {
45
46     public MDBResourceAdapterNode() {
47         registerElementHandler(
48                 new XMLElement(RuntimeTagNames.ACTIVATION_CONFIG),
49                 ActivationConfigNode.class);
50                 //"setRuntimeActivationConfigDescriptor");
51
}
52     
53    /**
54     * @return the descriptor instance to associate with this XMLNode
55     */

56     public Object JavaDoc getDescriptor() {
57         return getParentNode().getDescriptor();
58     }
59     
60    
61     /**
62      * all sub-implementation of this class can use a dispatch table to
63      * map xml element to method name on the descriptor class for setting
64      * the element value.
65      *
66      * @return the map with the element name as a key, the setter method
67      * as a value
68      */

69     protected Map JavaDoc getDispatchTable() {
70         // no need to be synchronized for now
71
Map JavaDoc table = new HashMap JavaDoc();
72         table.put(RuntimeTagNames.RESOURCE_ADAPTER_MID, "setResourceAdapterMid");
73         return table;
74     }
75     
76     /**
77      * write the ejbmessage descriptor class to a DOM tree and return it
78      *
79      * @param parent node in the DOM tree
80      * @param node name for the root element of this xml fragment
81      * @param the descriptor to write
82      * @return the DOM tree top node
83      */

84     public Node JavaDoc writeDescriptor( Node JavaDoc parent,
85             String JavaDoc nodeName, EjbMessageBeanDescriptor descriptor) {
86
87         Node JavaDoc raNode = super.writeDescriptor(parent, nodeName, descriptor);
88         appendTextChild(raNode, RuntimeTagNames.RESOURCE_ADAPTER_MID,
89                 descriptor.getResourceAdapterMid());
90
91         ActivationConfigNode activationConfigNode = new ActivationConfigNode();
92         activationConfigNode.writeDescriptor
93             (raNode, RuntimeTagNames.ACTIVATION_CONFIG,
94              descriptor.getRuntimeActivationConfigDescriptor());
95         return raNode;
96     }
97 }
98
Popular Tags