KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > tools > jbicommon > descriptor > Connection


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: Connection.java 12:14:20 rmarins $
20  * -------------------------------------------------------------------------
21  */

22
23 package org.objectweb.petals.tools.jbicommon.descriptor;
24
25 import javax.xml.namespace.QName JavaDoc;
26
27 import org.apache.commons.lang.builder.EqualsBuilder;
28 import org.apache.commons.lang.builder.HashCodeBuilder;
29 import org.apache.commons.lang.builder.ToStringBuilder;
30
31 /**
32  * The connection element declares a mapping from consumer-provided service
33  * address to a provider's service endpoint address. This mapping applies to
34  * consumption of services by all components. The consumer subelement is used to
35  * declare the type of consumer address that is to be mapped (or <i>connected</i>).
36  * This declaration can take two forms:
37  * <ul>
38  * <li><b>service type.</b> This specifies a service type, by supplying an
39  * interface-name attribute. All applicable exchanges that are addressed to the
40  * given service type are to be sent to the given service provider endpoint
41  * instead.</li>
42  * <li><b>service endpoint.</b> This specifies a service endpoint, by
43  * supplying a service-name attribute and an endpoint-name attribute. All
44  * applicable exchanges that are addressed to the given service endpoint are to
45  * be sent to the given service provider endpoint instead.</li>
46  * </ul>
47  * The provider attributes is used to declare the service provider endpoint to
48  * which the consumer is to be connected.
49  *
50  * @version $Rev: 438 $ $Date: 2006-05-19 11:12:26Z $
51  * @since Petals 1.0
52  * @author <a HREF="mailto:rmarins@fossilec.com">Rafael Marins</a>
53  */

54 public class Connection {
55
56     /**
57      * Consumer Endpoint Name for a service endpoint connection.
58      */

59     private String JavaDoc consumerEndpointName; // NOPMD by gblondelle
60

61     /**
62      * Consumer Interface Name for a service type connection.
63      */

64     private QName JavaDoc consumerInterfaceName; // NOPMD by gblondelle
65

66     /**
67      * Consumer Service Name for a service endpoint connection.
68      */

69     private QName JavaDoc consumerServiceName; // NOPMD by gblondelle
70

71     /**
72      * Provider Endpoint Name to be mapped the connection.
73      */

74     private String JavaDoc providerEndpointName; // NOPMD by gblondelle
75

76     /**
77      * Provider Service Name to be mapped the connection.
78      */

79     private QName JavaDoc providerServiceName; // NOPMD by gblondelle
80

81     /**
82      * Default constructor.
83      */

84     public Connection() { // NOPMD by gblondelle
85
super();
86     }
87
88     @Override JavaDoc
89     public boolean equals(final Object JavaDoc other) {
90         if (!(other instanceof Connection)) {
91             return false; // NOPMD by gblondelle
92
}
93         Connection castOther = (Connection) other;
94         return new EqualsBuilder().append(consumerInterfaceName,
95                 castOther.consumerInterfaceName).append(consumerServiceName,
96                 castOther.consumerServiceName).append(consumerEndpointName,
97                 castOther.consumerEndpointName).append(providerServiceName,
98                 castOther.providerServiceName).append(providerEndpointName,
99                 castOther.providerEndpointName).isEquals();
100     }
101
102     /**
103      * Returns the consumer Endpoint Name for a <b>service endpoint</b>
104      * connection.
105      *
106      * @return <code>String</code> the endpoint name.
107      */

108     public String JavaDoc getConsumerEndpointName() {
109         return consumerEndpointName;
110     }
111
112     /**
113      * Returns the consumer Interface Name for a <b>service type</b>
114      * connection.
115      *
116      * @return <code>QName</code> the interface name.
117      */

118     public QName JavaDoc getConsumerInterfaceName() {
119         return consumerInterfaceName;
120     }
121
122     //
123
// Getters and Setters
124
//
125

126     /**
127      * Returns the consumer Service Name for a <b>service endpoint</b>
128      * connection.
129      *
130      * @return <code>QName</code> the service name.
131      */

132     public QName JavaDoc getConsumerServiceName() {
133         return consumerServiceName;
134     }
135
136     /**
137      * Returns the provider Endpoint Name which the connection is to be mapped.
138      *
139      * @return <code>String</code> the endpoint name.
140      */

141     public String JavaDoc getProviderEndpointName() {
142         return providerEndpointName;
143     }
144
145     /**
146      * Returns the provider Service Name which the connection is to be mapped.
147      *
148      * @return <code>QName</code> the service name.
149      */

150     public QName JavaDoc getProviderServiceName() {
151         return providerServiceName;
152     }
153
154     @Override JavaDoc
155     public int hashCode() {
156         return new HashCodeBuilder().append(consumerInterfaceName).append(
157                 consumerServiceName).append(consumerEndpointName).append(
158                 providerServiceName).append(providerEndpointName).toHashCode();
159     }
160
161     @Override JavaDoc
162     public String JavaDoc toString() {
163         return new ToStringBuilder(this).append("consumerInterfaceName",
164                 consumerInterfaceName).append("consumerServiceName",
165                 consumerServiceName).append("consumerEndpointName",
166                 consumerEndpointName).append("providerServiceName",
167                 providerServiceName).append("providerEndpointName",
168                 providerEndpointName).toString();
169     }
170
171     /**
172      * Set the consumer Endpoint Name for a <b>service endpoint</b> connection.
173      *
174      * @param endpointName
175      * the endpoint name.
176      */

177     protected void setConsumerEndpointName(final String JavaDoc endpointName) {
178         this.consumerEndpointName = endpointName;
179     }
180
181     /**
182      * Set the consumer Interface Name for a <b>service type</b> connection.
183      *
184      * @param interfaceName
185      * the interface name.
186      */

187     protected void setConsumerInterfaceName(final QName JavaDoc interfaceName) {
188         this.consumerInterfaceName = interfaceName;
189     }
190
191     /**
192      * Set the consumer Service Name for a <b>service endpoint</b> connection.
193      *
194      * @param serviceName
195      * the service name.
196      */

197     protected void setConsumerServiceName(final QName JavaDoc serviceName) {
198         this.consumerServiceName = serviceName;
199     }
200
201     /**
202      * Set the provider Endpoint Name to be mapped.
203      *
204      * @param endpointName
205      * the endpoint name.
206      */

207     protected void setProviderEndpointName(final String JavaDoc endpointName) {
208         this.providerEndpointName = endpointName;
209     }
210
211     /**
212      * Set the provder Service Name to be mapped.
213      *
214      * @param serviceName
215      * the service name.
216      */

217     protected void setProviderServiceName(final QName JavaDoc serviceName) {
218         this.providerServiceName = serviceName;
219     }
220
221 }
222
Popular Tags