KickJava   Java API By Example, From Geeks To Geeks.

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


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

22
23 package org.objectweb.petals.tools.jbicommon.descriptor;
24
25 import java.util.List 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  * Shared Library production is used to describe a shared library installation
33  * package.
34  *
35  * @version $Rev: 438 $ $Date: 2006-05-19 11:12:26Z $
36  * @since Petals 1.0
37  * @author <a HREF="mailto:rmarins@fossilec.com">Rafael Marins</a>
38  */

39 public class SharedLibrary {
40
41     /**
42      * Shared Library identification data.
43      */

44     private Identification identification;
45
46     /**
47      * Shared Library class loading delegation model: <code>"self-first"</code>
48      * or <code>"parent-first"</code>.
49      */

50     private String JavaDoc classLoaderDelegation; // NOPMD by gblondelle
51

52     /**
53      * Optional shared library version.
54      */

55     private String JavaDoc version;
56
57     /**
58      * Shared Library Class Path elements.
59      */

60     private List JavaDoc<String JavaDoc> sharedLibraryClassPath; // NOPMD by gblondelle
61

62     /**
63      * Default constructor.
64      */

65     public SharedLibrary() { // NOPMD by gblondelle
66
super();
67     }
68
69     @Override JavaDoc
70     public boolean equals(final Object JavaDoc other) {
71         if (!(other instanceof SharedLibrary)) {
72             return false; // NOPMD by gblondelle
73
}
74         SharedLibrary castOther = (SharedLibrary) other;
75         return new EqualsBuilder().append(identification,
76                 castOther.identification).append(classLoaderDelegation,
77                 castOther.classLoaderDelegation).append(version,
78                 castOther.version).append(sharedLibraryClassPath,
79                 castOther.sharedLibraryClassPath).isEquals();
80     }
81
82     /**
83      * Returns the class loading delegation model of this Shared Library. If
84      * <code>null</code> the "parent-first" default delegation model must be
85      * used.
86      *
87      *
88      *
89      * String</code> the delegation model: <code>"parent-first"</code> or
90      * <code>"self-first"</code>.
91      */

92     public String JavaDoc getClassLoaderDelegation() {
93         return classLoaderDelegation;
94     }
95
96     /**
97      * Returns component's identification data.
98      *
99      * @return <cod
100      *
101      * </code> the component's identification.
102      */

103     public Identification getIdentification() {
104         return identification;
105     }
106
107     //
108
// Getters and Setters
109
//
110

111     /**
112      * @return Returns the sharedLibraryClassPath.
113      */

114     public List JavaDoc<String JavaDoc> getSharedLibraryClassPath() {
115         return sharedLibraryClassPath;
116     }
117
118     /**
119      * @return Returns the version.
120      */

121     public String JavaDoc getVersion() {
122         return version;
123     }
124
125     @Override JavaDoc
126     public int hashCode() {
127         return new HashCodeBuilder().append(identification).append(
128                 classLoaderDelegation).append(version).append(
129                 sharedLibraryClassPath).toHashCode();
130     }
131
132     @Override JavaDoc
133     public String JavaDoc toString() {
134         return new ToStringBuilder(this).append("identification",
135                 identification).append("classLoaderDelegation",
136                 classLoaderDelegation).append("version", version).append(
137                 "sharedLibraryClassPath", sharedLibraryClassPath).toString();
138     }
139
140     /**
141      * Set the Shared Library class loading delegation model.
142      *
143      * @param deleg
144      * * the delegation model to set: <code>"parent-first"</code>
145      * or <code>"self-first"</code>.
146      */

147     protected void setClassLoaderDelegation(final String JavaDoc delegationModel) {
148         this.classLoaderDelegation = delegationModel;
149     }
150
151     /**
152      * Set the component identification data.
153      *
154      * @param identification
155      *
156      *
157      * e identification to set.
158      */

159     protected void setIdentification(final Identification identification) {
160         this.identification = identification;
161     }
162
163     /**
164      * @param sharedLibCP
165      * The sharedLibraryClassPath to set.
166      */

167     protected void setSharedLibraryClassPath(final List JavaDoc<String JavaDoc> sharedLibCP) {
168         this.sharedLibraryClassPath = sharedLibCP;
169     }
170
171     /**
172      * @param version
173      * The version to set.
174      */

175     protected void setVersion(final String JavaDoc version) {
176         this.version = version;
177     }
178 }
179
Popular Tags