KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > node > connector > LicenseNode


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.connector;
25
26 import java.util.*;
27 import org.xml.sax.Attributes JavaDoc;
28 import com.sun.enterprise.deployment.Descriptor;
29 import com.sun.enterprise.deployment.ConnectorDescriptor;
30 import com.sun.enterprise.deployment.LicenseDescriptor;
31 import com.sun.enterprise.deployment.xml.ConnectorTagNames;
32 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode;
33 import com.sun.enterprise.deployment.node.XMLElement;
34
35 import org.xml.sax.Attributes JavaDoc;
36 import org.w3c.dom.Node JavaDoc;
37
38
39 /**
40  * This node is responsible for handling license subtree.
41  *
42  */

43 public class LicenseNode extends DeploymentDescriptorNode {
44     
45     /**
46      * all sub-implementation of this class can use a dispatch table to
47      * map xml element to method name on the descriptor class for
48      * setting the element value.
49      *
50      * @return the map with the element name as a key, the setter method
51      * as a value
52      */

53     protected Map getDispatchTable() {
54         Map table = super.getDispatchTable();
55         table.put(ConnectorTagNames.LICENSE_REQUIRED, "setLicenseRequired");
56     return table;
57     }
58
59     /**
60      * write the descriptor class to a DOM tree and return it
61      *
62      * @param parent node for the DOM tree
63      * @param the descriptor to write
64      * @return the DOM tree top node
65      */

66     public Node writeDescriptor(Node parent, ConnectorDescriptor descriptor) {
67         LicenseDescriptor licenseDesc = descriptor.getLicenseDescriptor();
68         if (licenseDesc != null) {
69             Node licenseNode = appendChild(parent,
70                 ConnectorTagNames.LICENSE);
71             writeLocalizedDescriptions(licenseNode, licenseDesc);
72             appendTextChild(licenseNode, ConnectorTagNames.LICENSE_REQUIRED,
73                 licenseDesc.getLicenseRequiredValue());
74         }
75         return parent;
76     }
77 }
78
Popular Tags