KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ear > deployment > xml > Application


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  *
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or 1any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * Initial developer: JOnAS team
23  * --------------------------------------------------------------------------
24  * $Id: Application.java,v 1.2 2004/05/10 10:02:12 sauthieg Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_ear.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsDescriptionElement;
30 import org.objectweb.jonas_lib.deployment.xml.DescriptionGroupXml;
31 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
32 import org.objectweb.jonas_lib.deployment.xml.TopLevelElement;
33
34 /**
35  * This class defines the implementation of the element application
36  *
37  * @author JOnAS team
38  */

39
40 public class Application
41     extends AbsDescriptionElement
42     implements TopLevelElement, DescriptionGroupXml {
43
44     /**
45      * module
46      */

47     private JLinkedList moduleList = null;
48
49     /**
50      * security-role
51      */

52     private JLinkedList securityRoleList = null;
53
54
55     /**
56      * Constructor
57      */

58     public Application() {
59         super();
60         moduleList = new JLinkedList("module");
61         securityRoleList = new JLinkedList("security-role");
62     }
63
64     /**
65      * Gets the module
66      * @return the module
67      */

68     public JLinkedList getModuleList() {
69         return moduleList;
70     }
71
72     /**
73      * Set the module
74      * @param moduleList module
75      */

76     public void setModuleList(JLinkedList moduleList) {
77         this.moduleList = moduleList;
78     }
79
80     /**
81      * Add a new module element to this object
82      * @param module the moduleobject
83      */

84     public void addModule(Module module) {
85         moduleList.add(module);
86     }
87
88     /**
89      * Gets the security-role
90      * @return the security-role
91      */

92     public JLinkedList getSecurityRoleList() {
93         return securityRoleList;
94     }
95
96     /**
97      * Set the security-role
98      * @param securityRoleList securityRole
99      */

100     public void setSecurityRoleList(JLinkedList securityRoleList) {
101         this.securityRoleList = securityRoleList;
102     }
103
104     /**
105      * Add a new security-role element to this object
106      * @param securityRole the securityRoleobject
107      */

108     public void addSecurityRole(SecurityRole securityRole) {
109         securityRoleList.add(securityRole);
110     }
111
112     /**
113      * Represents this element by it's XML description.
114      * @param indent use this indent for prexifing XML representation.
115      * @return the XML description of this object.
116      */

117     public String JavaDoc toXML(int indent) {
118         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
119         sb.append(indent(indent));
120         sb.append("<application>\n");
121         indent += 2;
122
123         // icon
124
sb.append(getIcon().toXML(indent));
125         // display-name
126
sb.append(xmlElement(getDisplayName(), "display-name", indent));
127         // description
128
sb.append(xmlElement(getDescription(), "description", indent));
129         // module
130
sb.append(moduleList.toXML(indent));
131         // security-role
132
sb.append(securityRoleList.toXML(indent));
133
134         indent -= 2;
135         sb.append(indent(indent));
136         sb.append("</application>\n");
137
138         return sb.toString();
139     }
140 }
141
Popular Tags