KickJava   Java API By Example, From Geeks To Geeks.

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


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.OutboundResourceAdapter;
30 import com.sun.enterprise.deployment.AuthMechanism;
31 import com.sun.enterprise.deployment.SecurityPermission;
32 import com.sun.enterprise.deployment.xml.ConnectorTagNames;
33 import com.sun.enterprise.deployment.xml.TagNames;
34 import com.sun.enterprise.deployment.EnvironmentProperty;
35 import com.sun.enterprise.deployment.node.DescriptorFactory;
36 import com.sun.enterprise.deployment.node.DeploymentDescriptorNode;
37 import com.sun.enterprise.deployment.node.ConfigurableNode;
38 import com.sun.enterprise.deployment.node.XMLElement;
39
40 import com.sun.enterprise.deployment.ConnectorDescriptor;
41
42 import org.xml.sax.Attributes JavaDoc;
43 import org.w3c.dom.Node JavaDoc;
44
45
46 /**
47  * This node is responsible for handling the Connector DTD related security-permission XML tag
48  *
49  * @author Sheetal Vartak
50  * @version
51  */

52 public class SecurityPermissionNode extends DeploymentDescriptorNode {
53     
54     /**
55      * all sub-implementation of this class can use a dispatch table to map xml element to
56      * method name on the descriptor class for setting the element value.
57      *
58      * @return the map with the element name as a key, the setter method as a value
59      */

60     protected Map getDispatchTable() {
61         Map table = super.getDispatchTable();
62         table.put(ConnectorTagNames.SECURITY_PERMISSION_SPEC, "setPermission");
63     return table;
64     }
65
66     /**
67      * write the descriptor class to a DOM tree and return it
68      *
69      * @param parent node for the DOM tree
70      * @param the descriptor to write
71      * @return the DOM tree top node
72      */

73     public Node writeDescriptor(Node parent, ConnectorDescriptor descriptor) {
74
75     Iterator secPerms = descriptor.getSecurityPermissions().iterator();
76
77     //auth mechanism info
78
for (;secPerms.hasNext();) {
79
80         //for (Iterator secPerms = ((OutboundResourceAdapter)descriptor).getSecurityPermissions().iterator(); secPerms.hasNext();) {
81
SecurityPermission secPerm = (SecurityPermission) secPerms.next();
82         Node secNode = appendChild(parent, ConnectorTagNames.SECURITY_PERMISSION);
83             writeLocalizedDescriptions(secNode, secPerm);
84             appendTextChild(secNode, ConnectorTagNames.SECURITY_PERMISSION_SPEC, secPerm.getPermission());
85     }
86     return null;
87     }
88 }
89
Popular Tags