KickJava   Java API By Example, From Geeks To Geeks.

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


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: ServiceAssembly.java 12:14:20 rmarins $
20  * -------------------------------------------------------------------------
21  */

22
23 package org.objectweb.petals.tools.jbicommon.descriptor;
24
25 import java.util.ArrayList JavaDoc;
26 import java.util.List JavaDoc;
27
28 import org.apache.commons.lang.builder.EqualsBuilder;
29 import org.apache.commons.lang.builder.HashCodeBuilder;
30 import org.apache.commons.lang.builder.ToStringBuilder;
31
32 /**
33  * The Service Assembly production is used to describe a service assembly
34  * deployment package. This deployment descriptor describes the contained
35  * service units, and to which components they are to be deployed.
36  *
37  * @version $Rev: 438 $ $Date: 2006-05-19 11:12:26Z $
38  * @since Petals 1.0
39  * @author <a HREF="mailto:rmarins@fossilec.com">Rafael Marins</a>
40  */

41 public class ServiceAssembly extends ExtensibleJbiElement {
42
43     /**
44      * Shared Library identification data.
45      */

46     private Identification identification;
47
48     /**
49      * Individual deployments to be made to components.
50      */

51     private List JavaDoc<ServiceUnit> serviceUnits;
52
53     /**
54      * Contains declarations of service interconnection metadata, used to map
55      * static service consumers to service providers.
56      */

57     private List JavaDoc<Connection> connections;
58
59     /**
60      * Default constructor.
61      */

62     public ServiceAssembly() {
63         super();
64         serviceUnits = new ArrayList JavaDoc<ServiceUnit>();
65     }
66
67     public void addServiceUnit(final ServiceUnit unit) {
68         serviceUnits.add(unit);
69
70     }
71
72     @Override JavaDoc
73     public boolean equals(final Object JavaDoc other) {
74         if (!(other instanceof ServiceAssembly)) {
75             return false; // NOPMD by gblondelle
76
}
77         ServiceAssembly castOther = (ServiceAssembly) other;
78         return new EqualsBuilder().append(identification,
79                 castOther.identification).append(serviceUnits,
80                 castOther.serviceUnits).append(connections,
81                 castOther.connections).isEquals();
82     }
83
84     /**
85      * Returns optional elements containing declarations of service
86      * interconnection metadata, used to map static service consumers to service
87      * providers.
88      *
89      * @return <code>List<Connection></code> the interconnections between
90      * service consumers and providers mapping.
91      */

92     public List JavaDoc<Connection> getConnections() {
93         return connections;
94     }
95
96     //
97
// Getters and Setters
98
//
99

100     /**
101      * Returns service assembly's identification data.
102      *
103      * @return <code>Identification</code> the SA's identification.
104      */

105     public Identification getIdentification() {
106         return identification;
107     }
108
109     @Override JavaDoc
110     public int hashCode() {
111         return new HashCodeBuilder().append(identification)
112                 .append(serviceUnits).append(connections).toHashCode();
113     }
114
115     @Override JavaDoc
116     public String JavaDoc toString() {
117         return new ToStringBuilder(this).append("identification",
118                 identification).append("serviceUnits", serviceUnits).append(
119                 "connections", connections).toString();
120     }
121
122     /**
123      * Set interconnections between service consumers and providers mapping.
124      *
125      * @param connections
126      * <code>List<Connection></code> the interconnection mapping
127      * list.
128      */

129     protected void setConnections(final List JavaDoc<Connection> connections) {
130         this.connections = connections;
131     }
132
133     /**
134      * Set the service assembly identification data.
135      *
136      * @param identification
137      * The identification to set.
138      */

139     protected void setIdentification(final Identification identification) {
140         this.identification = identification;
141     }
142
143     /**
144      * Set Service Assembly individual deployments.
145      *
146      * @param serviceUnits
147      * <code>List<ServiceUnit></code> the individual deployments.
148      */

149     protected void setServiceUnits(final List JavaDoc<ServiceUnit> serviceUnits) {
150         this.serviceUnits = serviceUnits;
151     }
152
153     /**
154      * Returns optional elements containing declarations of service units.
155      *
156      * @return <code>List<ServiceUnit></code> the services units configured
157      * by this service assembly
158      */

159     public List JavaDoc<ServiceUnit> getServiceUnits() {
160         return serviceUnits;
161     }
162
163
164 }
165
Popular Tags