KickJava   Java API By Example, From Geeks To Geeks.

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


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

22
23 package org.objectweb.petals.tools.jbicommon.descriptor;
24
25 import org.apache.commons.lang.builder.EqualsBuilder;
26 import org.apache.commons.lang.builder.HashCodeBuilder;
27 import org.apache.commons.lang.builder.ToStringBuilder;
28
29 /**
30  * The Service Unit production is used to describe a service component within a
31  * service assembly deployment package.
32  *
33  * @version $Rev: 438 $ $Date: 2006-05-19 11:12:26Z $
34  * @since Petals 1.0
35  * @author <a HREF="mailto:rmarins@fossilec.com">Rafael Marins</a>
36  */

37 public class ServiceUnit extends ExtensibleJbiElement {
38
39     /**
40      * Service Unit identification data.
41      */

42     private Identification identification;
43
44     /**
45      * Name of the artifact archive file.
46      */

47     private String JavaDoc targetArtifactsZip; // NOPMD by gblondelle
48

49     /**
50      * Component name.
51      */

52     private String JavaDoc targetComponentName; // NOPMD by gblondelle
53

54     /**
55      * Default constructor.
56      */

57     public ServiceUnit() { // NOPMD by gblondelle
58
super();
59     }
60
61     @Override JavaDoc
62     public boolean equals(final Object JavaDoc other) {
63         if (!(other instanceof ServiceUnit)) {
64             return false; // NOPMD by gblondelle
65
}
66         ServiceUnit castOther = (ServiceUnit) other;
67         return new EqualsBuilder().append(identification,
68                 castOther.identification).append(targetArtifactsZip,
69                 castOther.targetArtifactsZip).append(targetComponentName,
70                 castOther.targetComponentName).isEquals();
71     }
72
73     /**
74      * Returns service unit's identification data.
75      *
76      * @return <code>Identification</code> the SU's identification.
77      */

78     public Identification getIdentification() {
79         return identification;
80     }
81
82     /**
83      * Returns the name of the artifact archive file within the deployment
84      * package that will be deployed.
85      *
86      * @return <code>String</code> the artifact archive file.
87      */

88     public String JavaDoc getTargetArtifactsZip() {
89         return targetArtifactsZip;
90     }
91
92     //
93
// Getters and Setters
94
//
95

96     /**
97      * Returns the name of the component that will have the <i>artifacts zip</i>
98      * deployed to it.
99      *
100      * @return <code>String</code> the component name.
101      */

102     public String JavaDoc getTargetComponentName() {
103         return targetComponentName;
104     }
105
106     @Override JavaDoc
107     public int hashCode() {
108         return new HashCodeBuilder().append(identification).append(
109                 targetArtifactsZip).append(targetComponentName).toHashCode();
110     }
111
112     @Override JavaDoc
113     public String JavaDoc toString() {
114         return new ToStringBuilder(this).append("identification",
115                 identification)
116                 .append("targetArtifactsZip", targetArtifactsZip).append(
117                         "targetComponentName", targetComponentName).toString();
118     }
119
120     /**
121      * Set the service unit identification data.
122      *
123      * @param identification
124      * The identification to set.
125      */

126     protected void setIdentification(final Identification identification) {
127         this.identification = identification;
128     }
129
130     /**
131      * Set the target artifacts archive file within the deployment package.
132      *
133      * @param targetArtifactsZip
134      * <code>String</code> the archive file.
135      */

136     protected void setTargetArtifactsZip(final String JavaDoc targetZip) {
137         this.targetArtifactsZip = targetZip;
138     }
139
140     /**
141      * Set the target component name to which the artifacts archive file is to
142      * be deployed.
143      *
144      * @param targetComponentName
145      * <code>String</code> the component name.
146      */

147     protected void setTargetComponentName(final String JavaDoc targetCompName) {
148         this.targetComponentName = targetCompName;
149     }
150
151 }
152
Popular Tags