KickJava   Java API By Example, From Geeks To Geeks.

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


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
24 package com.sun.enterprise.deployment.node.runtime;
25
26 import com.sun.enterprise.deployment.runtime.JavaWebStartAccessDescriptor;
27 import java.util.List JavaDoc;
28 import java.util.Map JavaDoc;
29 import java.util.Set JavaDoc;
30 import org.w3c.dom.Node JavaDoc;
31
32 import com.sun.enterprise.deployment.Descriptor;
33 import com.sun.enterprise.deployment.ApplicationClientDescriptor;
34 import com.sun.enterprise.deployment.Application;
35 import com.sun.enterprise.deployment.node.XMLElement;
36 import com.sun.enterprise.deployment.xml.ApplicationTagNames;
37 import com.sun.enterprise.deployment.xml.RuntimeTagNames;
38 import com.sun.enterprise.deployment.xml.WebServicesTagNames;
39 import com.sun.enterprise.deployment.xml.DTDRegistry;
40 import com.sun.enterprise.deployment.util.DOLUtils;
41
42 /**
43  * This node is responsible for saving all J2EE RI runtime
44  * information for app clients
45  *
46  * @author Jerome Dochez
47  * @version
48  */

49 public class AppClientRuntimeNode extends RuntimeBundleNode
50 {
51     
52     public AppClientRuntimeNode(Descriptor descriptor) {
53         super(descriptor);
54     }
55     
56     public AppClientRuntimeNode() {
57     }
58     
59     /**
60      * Initialize the child handlers
61      */

62     protected void Init() {
63         
64         // we do not care about our standard DDS handles
65
handlers = null;
66         
67         registerElementHandler(new XMLElement(RuntimeTagNames.RESOURCE_REFERENCE),
68                                ResourceRefNode.class);
69         registerElementHandler(new XMLElement(RuntimeTagNames.EJB_REFERENCE),
70                                EjbRefNode.class);
71         registerElementHandler(new XMLElement(RuntimeTagNames.RESOURCE_ENV_REFERENCE),
72                                ResourceEnvRefNode.class);
73         registerElementHandler(new XMLElement(RuntimeTagNames.MESSAGE_DESTINATION_REFERENCE),
74                                MessageDestinationRefNode.class);
75         registerElementHandler(new XMLElement(RuntimeTagNames.MESSAGE_DESTINATION),
76              MessageDestinationRuntimeNode.class);
77     registerElementHandler(new XMLElement(WebServicesTagNames.SERVICE_REF),
78                                ServiceRefNode.class);
79         registerElementHandler(new XMLElement(RuntimeTagNames.JAVA_WEB_START_ACCESS),
80                                JavaWebStartAccessNode.class);
81
82
83     }
84     
85    /**
86     * register this node as a root node capable of loading entire DD files
87     *
88     * @param publicIDToDTD is a mapping between xml Public-ID to DTD
89     * @return the doctype tag name
90     */

91    public static String JavaDoc registerBundle(Map JavaDoc publicIDToDTD) {
92        publicIDToDTD.put(DTDRegistry.SUN_APPCLIENT_130_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_130_DTD_SYSTEM_ID);
93        publicIDToDTD.put(DTDRegistry.SUN_APPCLIENT_140_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_140_DTD_SYSTEM_ID);
94        publicIDToDTD.put(DTDRegistry.SUN_APPCLIENT_141_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_141_DTD_SYSTEM_ID);
95        publicIDToDTD.put(DTDRegistry.SUN_APPCLIENT_500_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_500_DTD_SYSTEM_ID);
96        if (!restrictDTDDeclarations()) {
97            publicIDToDTD.put(DTDRegistry.SUN_APPCLIENT_140beta_DTD_PUBLIC_ID, DTDRegistry.SUN_APPCLIENT_140beta_DTD_SYSTEM_ID);
98        }
99        return RuntimeTagNames.S1AS_APPCLIENT_RUNTIME_TAG;
100    }
101     
102     /**
103      * @return the XML tag associated with this XMLNode
104      */

105     protected XMLElement getXMLRootTag() {
106         return new XMLElement(RuntimeTagNames.S1AS_APPCLIENT_RUNTIME_TAG);
107     }
108     
109     /**
110      * @return the DOCTYPE that should be written to the XML file
111      */

112     public String JavaDoc getDocType() {
113     return DTDRegistry.SUN_APPCLIENT_500_DTD_PUBLIC_ID;
114     }
115     
116     /**
117      * @return the SystemID of the XML file
118      */

119     public String JavaDoc getSystemID() {
120     return DTDRegistry.SUN_APPCLIENT_500_DTD_SYSTEM_ID;
121     }
122
123     /**
124      * @return NULL for all runtime nodes.
125      */

126     public List JavaDoc<String JavaDoc> getSystemIDs() {
127         return null;
128     }
129     
130     /**
131      * write the descriptor class to a DOM tree and return it
132      *
133      * @param parent node for the DOM tree
134      * @param the descriptor to write
135      * @return the DOM tree top node
136      */

137     public Node JavaDoc writeDescriptor(Node JavaDoc parent, Descriptor descriptor) {
138         if (! (descriptor instanceof ApplicationClientDescriptor)) {
139             throw new IllegalArgumentException JavaDoc(getClass() + " cannot handles descriptors of type " + descriptor.getClass());
140         }
141         
142         Node JavaDoc appClient = super.writeDescriptor(parent, descriptor);
143         ApplicationClientDescriptor bundleDescriptor = (ApplicationClientDescriptor) descriptor;
144         RuntimeDescriptorNode.writeCommonComponentInfo(appClient, descriptor);
145         RuntimeDescriptorNode.writeMessageDestinationInfo(appClient, bundleDescriptor);
146         JavaWebStartAccessNode.writeJavaWebStartInfo(appClient, bundleDescriptor.getJavaWebStartAccessDescriptor());
147         return appClient;
148     }
149 }
150
Popular Tags