KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > deployment > xml > JonasServiceRef


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

25
26 package org.objectweb.jonas_lib.deployment.xml;
27
28 /**
29  * This class defines the implementation of the element jonas-service-ref.
30  * @author Florent Benoit
31  */

32 public class JonasServiceRef extends AbsElement {
33
34     /**
35      * Name of this jonas-service-ref
36      */

37     private String JavaDoc serviceRefName = null;
38
39     /**
40      * URL pointing to an alternate WSDL Definition
41      */

42     private String JavaDoc altWsdl = null;
43
44     /**
45      * List of init parameters
46      */

47     private JLinkedList jonasInitParamList = null;
48
49     /**
50      * List of jonas-port-component-ref
51      */

52     private JLinkedList jonasPortComponentRefList = null;
53
54     /**
55      * Constructor : build a new JonasServiceRef object
56      */

57     public JonasServiceRef() {
58         jonasInitParamList = new JLinkedList("jonas-init-param");
59         jonasPortComponentRefList = new JLinkedList("jonas-port-component-ref");
60     }
61
62
63
64     // Setters
65

66     /**
67      * Sets the name
68      * @param serviceRefName the name to use
69      */

70     public void setServiceRefName(String JavaDoc serviceRefName) {
71         this.serviceRefName = serviceRefName;
72     }
73
74
75     /**
76      * Add a parameter
77      * @param jonasInitParam the JonasInitParam object to add to our list
78      */

79     public void addJonasInitParam(JonasInitParam jonasInitParam) {
80         jonasInitParamList.add(jonasInitParam);
81     }
82
83     /**
84      * Add a parameter
85      * @param jonasPortComponentRef the JonasPortComponentRef object to add to our list
86      */

87     public void addJonasPortComponentRef(JonasPortComponentRef jonasPortComponentRef) {
88         jonasPortComponentRefList.add(jonasPortComponentRef);
89     }
90
91     /**
92      * @param altWsdl The altWsdl to set.
93      */

94     public void setAltWsdl(String JavaDoc altWsdl) {
95         this.altWsdl = altWsdl;
96     }
97
98     // Getters
99

100     /**
101      * @return the name of the service-ref
102      */

103     public String JavaDoc getServiceRefName() {
104         return serviceRefName;
105     }
106
107
108     /**
109      * @return the list of init parameters
110      */

111     public JLinkedList getJonasInitParamList() {
112         return jonasInitParamList;
113     }
114
115     /**
116      * @return the list of jonas port component ref
117      */

118     public JLinkedList getJonasPortComponentRefList() {
119         return jonasPortComponentRefList;
120     }
121
122     /**
123      * @return Returns the altWsdl.
124      */

125     public String JavaDoc getAltWsdl() {
126         return altWsdl;
127     }
128
129     /**
130      * Represents this element by it's XML description.
131      * @param indent use this indent for prexifing XML representation.
132      * @return the XML description of this object.
133      */

134     public String JavaDoc toXML(int indent) {
135         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
136         sb.append(indent(indent));
137         sb.append("<jonas-service-ref>\n");
138
139         indent += 2;
140
141         // name
142
sb.append(xmlElement(serviceRefName, "service-ref-name", indent));
143
144         // jonas port component ref
145
sb.append(jonasPortComponentRefList.toXML(indent));
146
147         // alt-wsdl
148
sb.append(xmlElement(altWsdl, "alt-wsdl", indent));
149
150         // init parameters
151
sb.append(jonasInitParamList.toXML(indent));
152
153         indent -= 2;
154         sb.append(indent(indent));
155         sb.append("</jonas-service-ref>\n");
156         return sb.toString();
157     }
158
159
160 }
161
Popular Tags