KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > DeploymentExtensionDescriptor


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;
24
25 import java.util.Vector JavaDoc;
26 import java.util.Iterator JavaDoc;
27 import java.util.Observable JavaDoc;
28
29 /**
30  * This class contains all the information for the deployment extension
31  * elements found in deployment descriptors since J2EE 1.4
32  *
33  * @author Jerome Dochez
34  */

35 public class DeploymentExtensionDescriptor extends Observable JavaDoc {
36     
37     String JavaDoc nameSpace=null;
38     boolean mustUnderstand=false;
39     Vector JavaDoc elements;
40     
41     /** Creates a new instance of DeploymentExtensionDescriptor */
42     public DeploymentExtensionDescriptor() {
43         elements = new Vector JavaDoc();
44     }
45     
46     /**
47      * Sets the namespace for this deployment entension
48      * @param the namespace
49      */

50     public void setNameSpace(String JavaDoc nameSpace) {
51         this.nameSpace = nameSpace;
52         changed();
53     }
54     
55     /**
56      * @return the namespace for this deployment extension
57      */

58     public String JavaDoc getNameSpace() {
59         return nameSpace;
60     }
61     
62     /**
63      * Sets the mustUnderstand flag
64      */

65     public void setMustUnderstand(boolean mustUnderstand) {
66         this.mustUnderstand = mustUnderstand;
67         changed();
68     }
69     
70     /**
71      * @return true if this deployment extension must be understood
72      */

73     public boolean getMustUnderstand() {
74         return mustUnderstand;
75     }
76     
77     /**
78      * Add a deployment extension element to his deployment extension
79      *
80      * @param the new deployment extension
81      */

82     public void addElement(ExtensionElementDescriptor newElement) {
83         elements.add(newElement);
84         changed();
85     }
86     
87     /**
88      * @return an iterator on all the deployment extension elements
89      */

90     public Iterator JavaDoc elements() {
91         return elements.iterator();
92     }
93     
94     /**
95      * @return a meaningful string about myself
96      */

97     public void print(StringBuffer JavaDoc toStringBuffer) {
98         toStringBuffer.append("namespace ").append(nameSpace);
99         toStringBuffer.append("\nmustUnderstand = ").append(mustUnderstand);
100         for(Iterator JavaDoc itr = elements();itr.hasNext();) {
101             toStringBuffer.append("\nelement = ").append(itr.next());
102         }
103     }
104     
105     /**
106      * notify our observers we have changed
107      */

108     private void changed() {
109         setChanged();
110         notifyObservers();
111     }
112     
113 }
114
Popular Tags