KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ir3 > ComponentRepository_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 /**
30  * Implementation of the CORBA::Repository interface.
31  *
32  * @author <a=href="Philippe.Merle@lifl.fr">Philippe Merle</a>
33  * <a=href="Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
34  *
35  * @version 0.3
36  */

37
38 public class ComponentRepository_impl
39      extends Repository_impl
40   implements org.objectweb.openccm.ir3.api.ComponentRepositoryOperations
41 {
42     // ==================================================================
43
//
44
// Internal state.
45
//
46
// ==================================================================
47

48     // ==================================================================
49
//
50
// Constructor.
51
//
52
// ==================================================================
53

54     /**
55      * TODO
56      */

57     public
58     ComponentRepository_impl(IFR ifr)
59     {
60         // call the Contained_impl contructor.
61
this(ifr, false);
62     }
63
64     /**
65      * TODO
66      */

67     public
68     ComponentRepository_impl(IFR ifr,
69                              boolean enable_mappings)
70     {
71         // call the Contained_impl contructor.
72
super(ifr, enable_mappings);
73
74         // set the tie servant object.
75
setServant(new org.objectweb.openccm.ir3.api.ComponentRepositoryPOATie(this));
76
77         // Init internal state.
78
isIDL2Repository_ = false;
79     }
80
81     // ==================================================================
82
//
83
// Public methods.
84
//
85
// ==================================================================
86

87     /**
88      * Obtain its CORBA::ComponentIR::Repository object reference.
89      */

90     public org.omg.CORBA.ComponentIR.Repository
91     asComponentRepository()
92     {
93         super.isIDL2Repository_ = false;
94         return org.omg.CORBA.ComponentIR.RepositoryHelper.narrow(asObject());
95     }
96
97     // ==================================================================
98
//
99
// For CORBA::ComponentIR::Container interface.
100
//
101
// ==================================================================
102

103     /**
104      * IDL:omg.org/CORBA/ComponentIR/Container/create_component_module:1.0
105      */

106     public org.omg.CORBA.ComponentIR.ModuleDef
107     create_component_module(String JavaDoc id,
108                             String JavaDoc name,
109                             String JavaDoc version)
110     {
111         ComponentModuleDef_impl module = new ComponentModuleDef_impl(getIFR(), this);
112
113         try
114         {
115             addContained(module, id, name, version);
116         }
117         catch(org.omg.CORBA.SystemException JavaDoc exc)
118         {
119             module.destroy();
120             throw exc;
121         }
122
123         return module.asComponentModuleDef();
124     }
125
126     /**
127      * IDL:omg.org/CORBA/ComponentIR/Container/create_component:1.0
128      */

129     public org.omg.CORBA.ComponentIR.ComponentDef
130     create_component(String JavaDoc id,
131                      String JavaDoc name,
132                      String JavaDoc version,
133                      org.omg.CORBA.ComponentIR.ComponentDef base_component,
134                      org.omg.CORBA.InterfaceDef JavaDoc[] supported_interfaces)
135     {
136         ComponentDef_impl c = new ComponentDef_impl(getIFR(), this);
137         try
138         {
139             addContained(c, id, name, version);
140             c.base_component(base_component);
141             c.supported_interfaces(supported_interfaces);
142         }
143         catch(org.omg.CORBA.SystemException JavaDoc exc)
144         {
145             c.destroy();
146             throw exc;
147         }
148
149         c.whenCreated();
150         return c.asComponentDef();
151     }
152
153     /**
154      * IDL:omg.org/CORBA/ComponentIR/Container/create_home:1.0
155      */

156     public org.omg.CORBA.ComponentIR.HomeDef
157     create_home(String JavaDoc id,
158                 String JavaDoc name,
159                 String JavaDoc version,
160                 org.omg.CORBA.ComponentIR.HomeDef base_home,
161                 org.omg.CORBA.ComponentIR.ComponentDef managed_component,
162                 org.omg.CORBA.InterfaceDef JavaDoc[] supported_interfaces,
163                 org.omg.CORBA.ValueDef JavaDoc primary_key)
164     {
165         HomeDef_impl h = new HomeDef_impl(getIFR(), this);
166
167         try
168         {
169             addContained(h, id, name, version);
170             h.base_home(base_home);
171             h.managed_component(managed_component);
172             h.supported_interfaces(supported_interfaces);
173             h.primary_key(primary_key);
174         }
175         catch(org.omg.CORBA.SystemException JavaDoc exc)
176         {
177             h.destroy();
178             throw exc;
179         }
180
181         h.whenCreated();
182         return h.asHomeDef();
183     }
184
185     /**
186      * IDL:omg.org/CORBA/ComponentIR/Container/create_value:1.0
187      */

188     public org.omg.CORBA.ComponentIR.EventDef
189     create_event(String JavaDoc id,
190                  String JavaDoc name,
191                  String JavaDoc version,
192                  boolean is_custom,
193                  boolean is_abstract,
194                  org.omg.CORBA.ValueDef JavaDoc base_value,
195                  boolean is_truncatable,
196                  org.omg.CORBA.ValueDef JavaDoc[] abstract_base_values,
197                  org.omg.CORBA.InterfaceDef JavaDoc[] supported_interfaces,
198                  org.omg.CORBA.ExtInitializer[] initializers)
199     {
200         EventDef_impl event = new EventDef_impl(getIFR(), this);
201
202         try
203         {
204             addContained(event, id, name, version);
205             event.is_custom(is_custom);
206             event.is_abstract(is_abstract);
207             event.base_value(base_value);
208             event.is_truncatable(is_truncatable);
209             event.abstract_base_values(abstract_base_values);
210             event.supported_interfaces(supported_interfaces);
211             event.ext_initializers(initializers);
212         }
213         catch(org.omg.CORBA.SystemException JavaDoc exc)
214         {
215             event.destroy();
216             throw exc;
217         }
218
219         event.whenCreated();
220         return event.asEventDef();
221    }
222
223     // ==================================================================
224
//
225
// Methods for the OpenCCM::ComponentRepository interface.
226
//
227
// ==================================================================
228

229     //
230
// IDL:goal.lifl.fr/OpenCCM/ComponentRepository/as_IDL2_repository:1.0
231
//
232
/**
233      * To view the repository as an IDL2 repository.
234      * Note: the mappings of IDL3 declarations will be accessible.
235      */

236     public org.omg.CORBA.Repository JavaDoc
237     as_IDL2_repository()
238     {
239         super.isIDL2Repository_ = true;
240         return super.asRepository();
241     }
242
243     //
244
// IDL:goal.lifl.fr/OpenCCM/ComponentRepository/as_IDL3_repository:1.0
245
//
246
/**
247      * To view the repository as an IDL3 repository.
248      * Note: the mappings of IDL3 declarations will NOT be accessible.
249      */

250     public org.omg.CORBA.ComponentIR.Repository
251     as_IDL3_repository()
252     {
253         super.isIDL2Repository_ = false;
254         return asComponentRepository();
255     }
256
257     //
258
// IDL:goal.lifl.fr/OpenCCM/ComponentRepository/lookup_mapped_id:1.0
259
//
260
/**
261      * To obtain a Contained that comes from a mapping.
262      */

263     public org.omg.CORBA.Contained JavaDoc
264     lookup_mapped_id(String JavaDoc search_id)
265     {
266         Contained_impl contained = getMappedRID(search_id);
267
268         // If not found then returns a nil contained reference.
269
if (contained == null) return null;
270         
271         return contained.asContained();
272     }
273
274
275     // ==================================================================
276
//
277
// Methods for the OpenCCM::Shutdownable interface.
278
//
279
// ==================================================================
280

281     //
282
// IDL:goal.lifl.fr/OpenCCM/Shutdownable/shutdown:1.0
283
//
284
/**
285      * Shutdown an OpenCCM server.
286      */

287     public void
288     shutdown()
289     {
290     org.objectweb.openccm.corba.TheORB.shutdown(false);
291     }
292 }
293
Popular Tags