KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > iiop > rmi > ir > ModuleDefImpl


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software 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 software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.iiop.rmi.ir;
23
24 import org.omg.CORBA.ModuleDefOperations JavaDoc;
25 import org.omg.CORBA.ModuleDefPOATie;
26 import org.omg.CORBA.Any JavaDoc;
27 import org.omg.CORBA.IRObject JavaDoc;
28 import org.omg.CORBA.Contained JavaDoc;
29 import org.omg.CORBA.ContainedOperations JavaDoc;
30 import org.omg.CORBA.ContainedPackage.Description;
31 import org.omg.CORBA.IDLType JavaDoc;
32 import org.omg.CORBA.DefinitionKind JavaDoc;
33 import org.omg.CORBA.StructMember JavaDoc;
34 import org.omg.CORBA.UnionMember JavaDoc;
35 import org.omg.CORBA.InterfaceDef JavaDoc;
36 import org.omg.CORBA.ConstantDef JavaDoc;
37 import org.omg.CORBA.EnumDef JavaDoc;
38 import org.omg.CORBA.ValueDef JavaDoc;
39 import org.omg.CORBA.ValueBoxDef JavaDoc;
40 import org.omg.CORBA.Initializer JavaDoc;
41 import org.omg.CORBA.StructDef JavaDoc;
42 import org.omg.CORBA.UnionDef JavaDoc;
43 import org.omg.CORBA.ModuleDef JavaDoc;
44 import org.omg.CORBA.AliasDef JavaDoc;
45 import org.omg.CORBA.NativeDef JavaDoc;
46 import org.omg.CORBA.ExceptionDef JavaDoc;
47 import org.omg.CORBA.ModuleDescription JavaDoc;
48 import org.omg.CORBA.ModuleDescriptionHelper;
49
50 /**
51  * Abstract base class for all contained IR entities.
52  *
53  * @author <a HREF="mailto:osh@sparre.dk">Ole Husgaard</a>
54  * @version $Revision: 37459 $
55  */

56 class ModuleDefImpl
57    extends ContainedImpl
58    implements ModuleDefOperations JavaDoc, LocalContainer
59 {
60    // Constants -----------------------------------------------------
61

62    // Attributes ----------------------------------------------------
63

64    // Static --------------------------------------------------------
65

66    // Constructors --------------------------------------------------
67

68    ModuleDefImpl(String JavaDoc id, String JavaDoc name, String JavaDoc version,
69                  LocalContainer defined_in, RepositoryImpl repository)
70    {
71       super(id, name, version, defined_in,
72             DefinitionKind.dk_Module, repository);
73
74       this.delegate = new ContainerImplDelegate(this);
75    }
76
77    // Public --------------------------------------------------------
78

79    // LocalContainer implementation ---------------------------------
80

81    public LocalContained _lookup(String JavaDoc search_name)
82    {
83       return delegate._lookup(search_name);
84    }
85  
86    public LocalContained[] _contents(DefinitionKind JavaDoc limit_type,
87                                     boolean exclude_inherited)
88    {
89       return delegate._contents(limit_type, exclude_inherited);
90    }
91  
92    public LocalContained[] _lookup_name(String JavaDoc search_name,
93                                         int levels_to_search,
94                                         DefinitionKind JavaDoc limit_type,
95                                         boolean exclude_inherited)
96    {
97       return delegate._lookup_name(search_name, levels_to_search, limit_type,
98                                    exclude_inherited);
99    }
100  
101    public void add(String JavaDoc name, LocalContained contained)
102       throws IRConstructionException
103    {
104       delegate.add(name, contained);
105    }
106
107    // ContainerOperations implementation ----------------------------
108

109    public Contained JavaDoc lookup(String JavaDoc search_name)
110    {
111       return delegate.lookup(search_name);
112    }
113
114    public Contained JavaDoc[] contents(DefinitionKind JavaDoc limit_type,
115                                boolean exclude_inherited)
116    {
117       return delegate.contents(limit_type, exclude_inherited);
118    }
119
120    public Contained JavaDoc[] lookup_name(String JavaDoc search_name, int levels_to_search,
121                                   DefinitionKind JavaDoc limit_type,
122                                   boolean exclude_inherited)
123    {
124       return delegate.lookup_name(search_name, levels_to_search, limit_type,
125                                   exclude_inherited);
126    }
127
128    public org.omg.CORBA.ContainerPackage.Description[]
129                         describe_contents(DefinitionKind JavaDoc limit_type,
130                                           boolean exclude_inherited,
131                                           int max_returned_objs)
132    {
133       return delegate.describe_contents(limit_type, exclude_inherited,
134                                         max_returned_objs);
135    }
136
137    public ModuleDef JavaDoc create_module(String JavaDoc id, String JavaDoc name, String JavaDoc version)
138    {
139       return delegate.create_module(id, name, version);
140    }
141
142    public ConstantDef JavaDoc create_constant(String JavaDoc id, String JavaDoc name, String JavaDoc version,
143                                       IDLType JavaDoc type, Any JavaDoc value)
144    {
145       return delegate.create_constant(id, name, version, type, value);
146    }
147
148    public StructDef JavaDoc create_struct(String JavaDoc id, String JavaDoc name, String JavaDoc version,
149                                   StructMember JavaDoc[] members)
150    {
151       return delegate.create_struct(id, name, version, members);
152    }
153
154    public UnionDef JavaDoc create_union(String JavaDoc id, String JavaDoc name, String JavaDoc version,
155                                 IDLType JavaDoc discriminator_type,
156                                 UnionMember JavaDoc[] members)
157    {
158       return delegate.create_union(id, name, version, discriminator_type,
159                                    members);
160    }
161
162    public EnumDef JavaDoc create_enum(String JavaDoc id, String JavaDoc name, String JavaDoc version,
163                               String JavaDoc[] members)
164    {
165       return delegate.create_enum(id, name, version, members);
166    }
167
168    public AliasDef JavaDoc create_alias(String JavaDoc id, String JavaDoc name, String JavaDoc version,
169                                 IDLType JavaDoc original_type)
170    {
171       return delegate.create_alias(id, name, version, original_type);
172    }
173
174    public InterfaceDef JavaDoc create_interface(String JavaDoc id, String JavaDoc name, String JavaDoc version,
175                                         InterfaceDef JavaDoc[] base_interfaces,
176                                         boolean is_abstract)
177    {
178       return delegate.create_interface(id, name, version,
179                                        base_interfaces, is_abstract);
180    }
181
182    public ValueDef JavaDoc create_value(String JavaDoc id, String JavaDoc name, String JavaDoc version,
183                                 boolean is_custom, boolean is_abstract,
184                                 ValueDef JavaDoc base_value, boolean is_truncatable,
185                                 ValueDef JavaDoc[] abstract_base_values,
186                                 InterfaceDef JavaDoc[] supported_interfaces,
187                                 Initializer JavaDoc[] initializers)
188    {
189       return delegate.create_value(id, name, version, is_custom, is_abstract,
190                                    base_value, is_truncatable,
191                                    abstract_base_values, supported_interfaces,
192                                    initializers);
193    }
194
195    public ValueBoxDef JavaDoc create_value_box(String JavaDoc id, String JavaDoc name, String JavaDoc version,
196                                        IDLType JavaDoc original_type_def)
197    {
198       return delegate.create_value_box(id, name, version, original_type_def);
199    }
200
201    public ExceptionDef JavaDoc create_exception(String JavaDoc id, String JavaDoc name, String JavaDoc version,
202                                         StructMember JavaDoc[] members)
203    {
204       return delegate.create_exception(id, name, version, members);
205    }
206
207    public NativeDef JavaDoc create_native(String JavaDoc id, String JavaDoc name, String JavaDoc version)
208    {
209       return delegate.create_native(id, name, version);
210    }
211
212    // LocalIRObject implementation ----------------------------------
213

214    public IRObject JavaDoc getReference()
215    {
216       if (ref == null) {
217          ref = org.omg.CORBA.ModuleDefHelper.narrow(
218                                servantToReference(new ModuleDefPOATie(this)) );
219       }
220       return ref;
221    }
222
223    public void allDone()
224       throws IRConstructionException
225    {
226       getReference();
227       delegate.allDone();
228    }
229
230    public void shutdown()
231    {
232       delegate.shutdown();
233       super.shutdown();
234    }
235
236    // ContainedImpl implementation ----------------------------------
237

238    public Description describe()
239    {
240       String JavaDoc defined_in_id = "IR";
241  
242       if (defined_in instanceof ContainedOperations JavaDoc)
243          defined_in_id = ((ContainedOperations JavaDoc)defined_in).id();
244  
245       ModuleDescription JavaDoc md = new ModuleDescription JavaDoc(name, id, defined_in_id,
246                                                    version);
247  
248       Any JavaDoc any = getORB().create_any();
249
250       ModuleDescriptionHelper.insert(any, md);
251
252       return new Description(DefinitionKind.dk_Module, any);
253    }
254
255    // Y overrides ---------------------------------------------------
256

257    // Package protected ---------------------------------------------
258

259    // Protected -----------------------------------------------------
260

261    // Private -------------------------------------------------------
262

263    /**
264     * My delegate for Container functionality.
265     */

266    private ContainerImplDelegate delegate;
267
268    /**
269     * My CORBA reference.
270     */

271    private ModuleDef JavaDoc ref = null;
272
273    // Inner classes -------------------------------------------------
274
}
275
276
Popular Tags