KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > ant > CarolProtocol


1 /**
2  * CAROL: Common Architecture for RMI ObjectWeb Layer
3  *
4  * This library is developed inside the ObjectWeb Consortium,
5  * http://www.objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * --------------------------------------------------------------------------
23  * $Id: CarolProtocol.java,v 1.5 2005/05/14 00:03:58 rhs Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.carol.ant;
28
29 /**
30  * @author Vadim Nasardinov (vadimn@redhat.com)
31  */

32 final class CarolProtocol {
33
34     /**
35      * IIOP protocol
36      */

37     public static final CarolProtocol IIOP = protocol("iiop");
38
39     /**
40      * Jeremie protocol
41      */

42     public static final CarolProtocol JEREMIE = protocol("jeremie");
43
44     /**
45      * JRMP protocol (v 1.1)
46      */

47     public static final CarolProtocol JRMP11 = protocol("jrmp", "1.1", true);
48
49     /**
50      * JRMP protocol (v 1.2)
51      */

52     public static final CarolProtocol JRMP12 = protocol("jrmp", "1.2", true);
53
54     /**
55      * IRMI protocol (v 1.1)
56      */

57     public static final CarolProtocol IRMI11 = protocol("irmi", "1.1", true);
58
59     /**
60      * IRMI protocol (v 1.2)
61      */

62     public static final CarolProtocol IRMI12 = protocol("irmi", "1.2", true);
63
64     /**
65      * Name of the protocol
66      */

67     private final String JavaDoc name;
68
69     /**
70      * Version of the protocol (JRMP)
71      */

72     private final String JavaDoc version;
73
74     /**
75      * True if the protocol uses sun stubs
76      */

77     private final boolean sunStubs;
78
79     /**
80      * Build a new carol protocol with the given name and its version
81      * @param name of the protocol
82      * @param version of the protocol (JRMP)
83      * @param sunStubs true if the protocol uses sun stubs
84      */

85     private CarolProtocol(String JavaDoc name, String JavaDoc version, boolean sunStubs) {
86         this.name = name;
87         if (version == null) {
88             this.version = name;
89         } else {
90             this.version = name + version;
91         }
92         this.sunStubs = sunStubs;
93     }
94
95     /**
96      * Build a new carol protocol without specified version
97      * @param name name of the protocol
98      * @return the protocol built
99      */

100     private static CarolProtocol protocol(String JavaDoc name) {
101         return new CarolProtocol(name, null, false);
102     }
103
104     /**
105      * Build a new carol protocol with a given version
106      * @param name of the protocol
107      * @param version of the protocol
108      * @return the protocol built
109      */

110     private static CarolProtocol protocol(String JavaDoc name, String JavaDoc version) {
111         return new CarolProtocol(name, version, false);
112     }
113
114     /**
115      * Build a new carol protocol with a given version
116      * @param name of the protocol
117      * @param version of the protocol
118      * @param sunStubs true if the protocol uses sun stubs
119      * @return the protocol built
120      */

121     private static CarolProtocol protocol(String JavaDoc name, String JavaDoc version, boolean sunStubs) {
122         return new CarolProtocol(name, version, sunStubs);
123     }
124
125     /**
126      * @return name of the protocol
127      */

128     public String JavaDoc getName() {
129         return name;
130     }
131
132     /**
133      * @return version of the protocol
134      */

135     public String JavaDoc getNameVersion() {
136         return version;
137     }
138
139     /**
140      * @return true if this protocol requires sun stubs
141      */

142     public boolean useSunStubs() {
143         return sunStubs;
144     }
145 }
146
Popular Tags