KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ir3 > StringDef_impl


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@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 Initial developer(s): Philippe Merle.
23 Contributor(s): Mathieu Vadet, Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.ir3;
28
29 // Package dependencies
30
import org.omg.CORBA.*;
31
32 /**
33  * Implementation of the CORBA::StringDef interface.
34  *
35  * @author <a=href="Philippe.Merle@lifl.fr">Philippe Merle</a>
36  * <a=href="Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
37  *
38  * @version 0.3
39  */

40
41 public class StringDef_impl
42        extends AnonymousIDLType
43        implements StringDefOperations
44 {
45     // ==================================================================
46
//
47
// Constructor.
48
//
49
// ==================================================================
50

51     /**
52      * TODO
53      */

54     public
55     StringDef_impl(IFR ifr)
56     {
57         // call the AnonymousIDLType contructor.
58
super(ifr);
59
60         // set the TIE servant object.
61
setServant(new StringDefPOATie(this));
62
63         // set the bound to zero.
64
bound_ = 0;
65     }
66
67     // ==================================================================
68
//
69
// Internal state.
70
//
71
// ==================================================================
72

73     /**
74      * The string bound.
75      */

76     protected int bound_;
77
78     // ==================================================================
79
//
80
// Internal methods inherited from IROject_impl.
81
//
82
// ==================================================================
83

84     /**
85      * Warning : this operation must be implemented by subclasses.
86      * It allows us to avoid some casts while creating ::CORBA::TypeCode
87      */

88     protected TypeCode
89     recursiveType(java.util.List JavaDoc idSeq)
90     {
91         return type();
92     }
93
94     // ==================================================================
95
//
96
// Public methods.
97
//
98
// ==================================================================
99

100     /**
101      * Obtain its CORBA::StringDef object reference.
102      */

103     public StringDef
104     asStringDef()
105     {
106         return StringDefHelper.narrow(asObject());
107     }
108
109     // ==================================================================
110
//
111
// For CORBA::IRObject interface.
112
//
113
// ==================================================================
114

115     /**
116      * IDL:omg.org/CORBA/IRObject/def_kind:1.0
117      */

118     public DefinitionKind
119     def_kind()
120     {
121         return DefinitionKind.dk_String;
122     }
123
124     // ==================================================================
125
//
126
// For CORBA::IDLType interface.
127
//
128
// ==================================================================
129

130     /**
131      * IDL:omg.org/CORBA/IDLType/type:1.0
132      */

133     public TypeCode
134     type()
135     {
136         // delegates to the TypeCodeFactory.
137
return getIFR().getTCF().create_string_tc(bound());
138     }
139
140     // ==================================================================
141
//
142
// For CORBA::StringDef interface.
143
//
144
// ==================================================================
145

146     /**
147      * IDL:omg.org/CORBA/StringDef/bound:1.0
148      */

149     public int
150     bound()
151     {
152         return bound_;
153     }
154
155     /**
156      * IDL:omg.org/CORBA/StringDef/bound:1.0
157      */

158     public void
159     bound(int b)
160     {
161         if(b == 0)
162             throw exceptionBadParam("the string bound can't be set to zero");
163
164         bound_ = b;
165     }
166 }
167
Popular Tags