3 * MICO --- an Open Source CORBA implementation
4 * Copyright (c) 1997-2001 by The Mico Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 * For more information, visit the MICO Home Page at
21 * http://www.mico.org/
24 #ifndef __mico_boa_impl_h__
25 #define __mico_boa_impl_h__
38 CORBA::BOA::ReferenceData _id;
39 CORBA::ImplementationDef * _impl;
40 CORBA::InterfaceDef * _iface;
41 CORBA::Object_ptr _local_obj;
42 CORBA::Object_ptr _remote_obj;
43 CORBA::ImplementationBase *_skel;
47 CORBA::Boolean _persistent;
50 ObjectRecord (CORBA::Object_ptr local, const CORBA::BOA::ReferenceData &,
51 CORBA::InterfaceDef *, CORBA::ImplementationDef *,
52 CORBA::ImplementationBase * = NULL);
53 ObjectRecord (CORBA::Object_ptr local, CORBA::Object_ptr remote,
54 const CORBA::BOA::ReferenceData &,
55 CORBA::InterfaceDef *, CORBA::ImplementationDef *,
56 CORBA::ImplementationBase * = NULL);
59 CORBA::BOA::ReferenceData *id ();
61 CORBA::ImplementationDef *impl ();
62 void impl (CORBA::ImplementationDef *);
64 CORBA::InterfaceDef *iface ();
65 void iface (CORBA::InterfaceDef *);
67 CORBA::Object_ptr local_obj ();
68 CORBA::Object_ptr remote_obj ();
70 CORBA::ImplementationBase *skel ();
71 void skel (CORBA::ImplementationBase *);
73 void save (CORBA::Boolean);
74 CORBA::Boolean save () const;
76 void persistent (CORBA::Boolean);
77 CORBA::Boolean persistent () const;
79 void state (BOAState);
80 BOAState state () const;
84 const CORBA::Octet *key;
87 BOAObjKey (CORBA::Object_ptr o)
89 key = o->_ior()->profile()->objectkey (len);
96 class BOAImpl : public CORBA::BOA, public CORBA::ObjectAdapter {
97 struct objcomp : std::binary_function<const BOAObjKey &, const BOAObjKey &, bool> {
98 bool operator() (const BOAObjKey &k1, const BOAObjKey &k2) const
100 if (k1.len != k2.len)
101 return k1.len < k2.len;
102 return mico_key_compare (k1.key, k2.key, k1.len) < 0;
105 typedef std::map<BOAObjKey, ObjectRecord *, objcomp> MapObjRec;
106 typedef std::list<MICO::SharedLib *> ListShlib;
108 MapObjRec _lobjs, _robjs;
112 CORBA::OAMediator *_oamed;
113 CORBA::OAServer *_oasrv;
114 CORBA::OAMediator::ServerId _oasrv_id;
115 CORBA::Object_ptr _active_obj;
116 CORBA::ImplementationDef::ActivationMode _amode;
117 std::string _impl_name;
118 CORBA::Boolean _restoring;
120 CORBA::Environment_ptr _curr_environ;
121 MICO::RequestQueue _queue;
122 CORBA::Long _queue_count;
123 CORBA::Octet _id_template[11];
127 CORBA::Boolean must_queue (CORBA::ORBMsgId);
128 CORBA::ImplementationDef *find_impl ();
129 CORBA::Object_ptr find_obj ();
130 void add_record (ObjectRecord *);
131 ObjectRecord *get_record (CORBA::Object_ptr);
132 void del_record (CORBA::Object_ptr);
133 void del_all_records ();
134 void unique_id (std::vector<CORBA::Octet> &id);
135 CORBA::Boolean is_builtin_invoke (const char *opname);
137 CORBA::Principal_ptr get_principal (CORBA::Object_ptr);
138 #endif /* USE_CSL2 */
139 void builtin_invoke (CORBA::Object_ptr,
140 CORBA::ServerRequest_ptr,
141 CORBA::Principal_ptr);
142 CORBA::Boolean activate (const char *repoid);
143 void shutdown_obj (CORBA::Object_ptr);
144 void shutdown_impl ();
145 void restore_internal (CORBA::Object_ptr);
147 CORBA::Boolean dobind (CORBA::ORBMsgId, const char *repoid,
148 const CORBA::ORB::ObjectTag &,
149 CORBA::Address *addr);
151 CORBA::Boolean is_active_object (CORBA::Object_ptr obj);
153 BOAImpl (CORBA::ORB_ptr, int &argc, char **argv);
156 CORBA::Object_ptr create (const ReferenceData &,
157 CORBA::InterfaceDef *,
158 CORBA::ImplementationDef *,
159 CORBA::ImplementationBase * = NULL,
160 const char *repoid = 0);
161 // begin-mico-extension
162 CORBA::Boolean restoring ();
163 CORBA::Object_ptr restore (CORBA::Object_ptr,
164 const ReferenceData &,
165 CORBA::InterfaceDef *,
166 CORBA::ImplementationDef *,
167 CORBA::ImplementationBase *);
168 CORBA::ORB_ptr orb ();
169 const char *impl_name ();
170 void save_objects ();
171 void save_object (ObjectRecord *rec);
172 void dispose_objects ();
173 void dispose_object (ObjectRecord *rec);
174 CORBA::Boolean load_object (ObjectRecord *rec);
175 void answer_invoke (CORBA::ORBMsgId, CORBA::Object_ptr,
177 CORBA::InvokeStatus);
178 // end-mico-extension
179 void dispose (CORBA::Object_ptr);
180 ReferenceData *get_id (CORBA::Object_ptr);
181 void change_implementation (CORBA::Object_ptr,
182 CORBA::ImplementationDef *);
183 CORBA::Principal_ptr get_principal (CORBA::Object_ptr,
184 CORBA::Environment_ptr);
186 void impl_is_ready (CORBA::ImplementationDef *);
187 void deactivate_impl (CORBA::ImplementationDef *);
188 void obj_is_ready (CORBA::Object_ptr, CORBA::ImplementationDef *);
189 void deactivate_obj (CORBA::Object_ptr);
192 const char *get_oaid () const;
193 CORBA::Boolean has_object (CORBA::Object_ptr);
194 CORBA::Boolean is_local () const;
196 CORBA::ImplementationDef *get_impl (CORBA::Object_ptr);
197 CORBA::InterfaceDef *get_iface (CORBA::Object_ptr);
199 CORBA::Boolean invoke (CORBA::ORBMsgId, CORBA::Object_ptr,
201 CORBA::Principal_ptr,
202 CORBA::Boolean response_exp = TRUE);
203 CORBA::Boolean bind (CORBA::ORBMsgId, const char *repoid,
204 const CORBA::ORB::ObjectTag &,
205 CORBA::Address *addr);
206 CORBA::Boolean locate (CORBA::ORBMsgId, CORBA::Object_ptr);
207 CORBA::Object_ptr skeleton (CORBA::Object_ptr);
208 void cancel (CORBA::ORBMsgId);
209 void shutdown (CORBA::Boolean wait_for_completion);
211 friend class BOAServImpl;
214 class BOAServImpl : virtual public CORBA::OAServer_skel {
217 BOAServImpl (BOAImpl *boa);
220 void restore_request (const CORBA::OAServer::ObjSeq &objs);
221 void obj_inactive (CORBA::Object_ptr obj);
222 void impl_inactive ();
227 #endif // __mico_boa_impl_h__