KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005-2006 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$
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 provides elements is used to declare a service provided by a service
33  * unit. A provided service is declared with the following attributes:
34  * <ul>
35  * <li><b>interface-name.</b> This qualified name indicates the type of
36  * service to be provided.</li>
37  * <li><b>service-name and endpoint-name.</b>This pair of attributes declares
38  * the name of the endpoint that the service unit will, after deployment,
39  * activate with JBI.</li>
40  * </ul>
41  *
42  * @version $Rev: 438 $ $Date: 2006-05-19 11:12:26Z $
43  * @since Petals 1.0
44  * @author <a HREF="mailto:rmarins@fossilec.com">Rafael Marins</a>
45  */

46 public class Provides extends ExtensibleJbiElement {
47
48     /**
49      * Endpoint name to be provided.
50      */

51     private String JavaDoc endpointName;
52
53     /**
54      * Qualified interface name.
55      */

56     private QName JavaDoc interfaceName;
57
58     /**
59      * Service name to be provided.
60      */

61     private QName JavaDoc serviceName;
62
63     /**
64      * Default constructor.
65      */

66     public Provides() { // NOPMD by gblondelle
67
super();
68     }
69
70     @Override JavaDoc
71     public boolean equals(final Object JavaDoc other) {
72         if (!(other instanceof Provides)) {
73             return false; // NOPMD by gblondelle
74
}
75         Provides castOther = (Provides) other;
76         return new EqualsBuilder().append(endpointName, castOther.endpointName)
77                 .append(interfaceName, castOther.interfaceName).append(
78                         serviceName, castOther.serviceName).isEquals();
79     }
80
81     /**
82      * Returns the endpoint name that the service unit will, after deployment,
83      * activate with JBI.
84      *
85      * @return <code>String</code> the endpoint name.
86      */

87     public String JavaDoc getEndpointName() {
88         return endpointName;
89     }
90
91     /**
92      * Return the qualified name indicating the type of service to be provided.
93      *
94      * @return <code>QName</code> the interface name.
95      */

96     public QName JavaDoc getInterfaceName() {
97         return interfaceName;
98     }
99
100     /**
101      * Returns the service name that the service unit will, after deployment,
102      * activate with JBI.
103      *
104      * @return <code>QName</code> the service name.
105      */

106     public QName JavaDoc getServiceName() {
107         return serviceName;
108     }
109
110     //
111
// Getters and Setters
112
//
113

114     @Override JavaDoc
115     public int hashCode() {
116         return new HashCodeBuilder().append(endpointName).append(interfaceName)
117                 .append(serviceName).toHashCode();
118     }
119
120     @Override JavaDoc
121     public String JavaDoc toString() {
122         return new ToStringBuilder(this).append("endpointName", endpointName)
123                 .append("interfaceName", interfaceName).append("serviceName",
124                         serviceName).toString();
125     }
126
127     /**
128      * Set the endpoint name which will be activated in JBI.
129      *
130      * @param endpointName
131      * the endpoint name.
132      */

133     void setEndpointName(final String JavaDoc endpointName) {
134         this.endpointName = endpointName;
135     }
136
137     /**
138      * Set the interface name indicating the type of service to be provided.
139      *
140      * @param interfaceName
141      * the interface name.
142      */

143     void setInterfaceName(final QName JavaDoc interfaceName) {
144         this.interfaceName = interfaceName;
145     }
146
147     /**
148      * Set the service name which will be activated in JBI.
149      *
150      * @param serviceName
151      * the service name.
152      */

153     void setServiceName(final QName JavaDoc serviceName) {
154         this.serviceName = serviceName;
155     }
156 }
157
Popular Tags