KickJava   Java API By Example, From Geeks To Geeks.

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


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 /*
25  * IORConfigurationNode.java
26  *
27  * Created on March 12, 2002, 9:51 AM
28  */

29
30 package com.sun.enterprise.deployment.node.runtime;
31
32 import java.util.Map JavaDoc;
33 import org.w3c.dom.Node JavaDoc;
34
35 import com.sun.enterprise.deployment.node.XMLElement;
36 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode;
37 import com.sun.enterprise.deployment.EjbIORConfigurationDescriptor;
38 import com.sun.enterprise.deployment.xml.RuntimeTagNames;
39
40 /**
41  * This node handles all EJB IOR Configuration information
42  *
43  * @author Jerome Dochez
44  * @version
45  */

46 public class IORConfigurationNode extends DeploymentDescriptorNode {
47
48     EjbIORConfigurationDescriptor descriptor = new EjbIORConfigurationDescriptor();
49     
50     /**
51     * @return the descriptor instance to associate with this XMLNode
52     */

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

63     protected Map JavaDoc getDispatchTable() {
64         Map JavaDoc table = super.getDispatchTable();
65         
66         // transport-config
67
table.put(RuntimeTagNames.INTEGRITY, "setIntegrity");
68         table.put(RuntimeTagNames.CONFIDENTIALITY, "setConfidentiality");
69         table.put(RuntimeTagNames.ESTABLISH_TRUST_IN_TARGET, "setEstablishTrustInTarget");
70         table.put(RuntimeTagNames.ESTABLISH_TRUST_IN_CLIENT, "setEstablishTrustInClient");
71         
72         // as-context
73
table.put(RuntimeTagNames.AUTH_METHOD, "setAuthenticationMethod");
74         table.put(RuntimeTagNames.REALM, "setRealmName");
75         table.put(RuntimeTagNames.REQUIRED, "setAuthMethodRequired");
76         
77         // sas-context
78
table.put(RuntimeTagNames.CALLER_PROPAGATION, "setCallerPropagation");
79         
80         return table;
81     }
82     
83     /**
84      * write the descriptor class to a DOM tree and return it
85      *
86      * @param parent node for the DOM tree
87      * @param node name for
88      * @param the descriptor to write
89      * @return the DOM tree top node
90      */

91     public Node JavaDoc writeDescriptor(Node JavaDoc parent, String JavaDoc nodeName, EjbIORConfigurationDescriptor iorDesc) {
92         Node JavaDoc iorNode = appendChild(parent, nodeName);
93         Node JavaDoc transportNode = appendChild(iorNode, RuntimeTagNames.TRANSPORT_CONFIG);
94
95         appendTextChild(transportNode, RuntimeTagNames.INTEGRITY, iorDesc.getIntegrity());
96         appendTextChild(transportNode, RuntimeTagNames.CONFIDENTIALITY, iorDesc.getConfidentiality());
97         appendTextChild(transportNode, RuntimeTagNames.ESTABLISH_TRUST_IN_TARGET,
98                         iorDesc.getEstablishTrustInTarget());
99         appendTextChild(transportNode, RuntimeTagNames.ESTABLISH_TRUST_IN_CLIENT,
100                         iorDesc.getEstablishTrustInClient());
101
102         // These two sub-elements should only be added if needed.
103
Node JavaDoc asContextNode = appendChild(iorNode, RuntimeTagNames.AS_CONTEXT);
104         appendTextChild(asContextNode, RuntimeTagNames.AUTH_METHOD, iorDesc.getAuthenticationMethod());
105         appendTextChild(asContextNode, RuntimeTagNames.REALM, iorDesc.getRealmName());
106         appendTextChild(asContextNode, RuntimeTagNames.REQUIRED,
107                     (new Boolean JavaDoc(iorDesc.isAuthMethodRequired()).toString()));
108
109         Node JavaDoc sasContextNode = appendChild(iorNode, RuntimeTagNames.SAS_CONTEXT);
110         appendTextChild(sasContextNode, RuntimeTagNames.CALLER_PROPAGATION, iorDesc.getCallerPropagation());
111         return iorNode;
112     }
113 }
114
Popular Tags