KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_client > deployment > xml > JonasClient


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: JonasClient.java,v 1.5 2004/08/04 06:58:34 benoitf Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_client.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsJonasEnvironmentElement;
30 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
31 import org.objectweb.jonas_lib.deployment.xml.JonasMessageDestination;
32 import org.objectweb.jonas_lib.deployment.xml.TopLevelElement;
33
34 /**
35  * This class defines the implementation of the element jonas-client
36  * @author jonas-team
37  */

38
39 public class JonasClient extends AbsJonasEnvironmentElement implements TopLevelElement {
40
41     /**
42      * Header (with right XSD version) for XML
43      */

44     private String JavaDoc header = null;
45
46     /**
47      * jonas-security
48      */

49     private JonasSecurity jonasSecurity = null;
50
51    /**
52      * jonas-message-destination
53      */

54     private JLinkedList jonasMessageDestinationList = null;
55
56
57     /**
58      * Default constructor
59      */

60     public JonasClient() {
61         super();
62         jonasMessageDestinationList = new JLinkedList("jonas-message-destination");
63     }
64
65     /**
66      * @return the jonas-security
67      */

68     public JonasSecurity getJonasSecurity() {
69         return jonasSecurity;
70     }
71
72     /**
73      * Set the jonas-security
74      * @param jonasSecurity jonasSecurity
75      */

76     public void setJonasSecurity(JonasSecurity jonasSecurity) {
77         this.jonasSecurity = jonasSecurity;
78     }
79
80     /**
81      * @return the list of all jonas-message-destination elements
82      */

83     public JLinkedList getJonasMessageDestinationList() {
84         return jonasMessageDestinationList;
85     }
86
87     /**
88      * Set the jonas-message-destination
89      * @param jonasMessageDestinationList jonasMessageDestination
90      */

91     public void setJonasMessageDestinationList(JLinkedList jonasMessageDestinationList) {
92         this.jonasMessageDestinationList = jonasMessageDestinationList;
93     }
94
95     /**
96      * Add a new jonas-message-destination element to this object
97      * @param jonasMessageDestination the jonas-message-destination object
98      */

99     public void addJonasMessageDestination(JonasMessageDestination jonasMessageDestination) {
100         jonasMessageDestinationList.add(jonasMessageDestination);
101     }
102
103     /**
104      * Represents this element by it's XML description.
105      * @param indent use this indent for prexifing XML representation.
106      * @return the XML description of this object.
107      */

108     public String JavaDoc toXML(int indent) {
109         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
110         sb.append(indent(indent));
111         if (header != null) {
112             sb.append(header);
113         } else {
114             sb.append("<jonas-client>\n");
115         }
116
117         indent += 2;
118
119         // jonas-ejb-ref
120
sb.append(getJonasEjbRefList().toXML(indent));
121         // jonas-resource
122
sb.append(getJonasResourceList().toXML(indent));
123         // jonas-resource-env
124
sb.append(getJonasResourceEnvList().toXML(indent));
125         // jonas-security
126
if (jonasSecurity != null) {
127             sb.append(jonasSecurity.toXML(indent));
128         }
129         // jonas-service-ref
130
sb.append(getJonasServiceRefList().toXML(indent));
131         // jonas-message-destination-ref
132
sb.append(getJonasMessageDestinationRefList().toXML(indent));
133         // jonas-message-destination
134
sb.append(jonasMessageDestinationList.toXML(indent));
135         indent -= 2;
136         sb.append(indent(indent));
137         sb.append("</jonas-client>\n");
138
139         return sb.toString();
140     }
141
142     /**
143      * @return the header.
144      */

145     public String JavaDoc getHeader() {
146         return header;
147     }
148
149     /**
150      * @param header The header to set.
151      */

152     public void setHeader(String JavaDoc header) {
153         this.header = header;
154     }
155 }
Popular Tags