27#ifdef HAVE_SYS_TYPES_H
28# include <sys/types.h>
33#elif defined(HAVE_PROCESS_H)
47#ifdef HAVE_STD_IOSTREAM
55 PortableServer::POA_ptr
poa,
61 PortableServer::ObjectId_var
oid =
62 PortableServer::string_to_ObjectId(
oidStr.in());
64 CORBA::Object_var
obj =
77 omni_thread::get_time(&
sec,&
nsec);
83 return CORBA::string_dup(
buf);
92#if OMNIEVENTS__DEBUG_SERVANT
93# define OMNIEVENTS__ADDR "["<<long(this)<<"] "
94int Servant::_objectCount =0;
96# define OMNIEVENTS__ADDR
103#if OMNIEVENTS__DEBUG_SERVANT
112#if OMNIEVENTS__DEBUG_SERVANT
121 return PortableServer::POA::_duplicate(
_poa.in());
127 using namespace PortableServer;
133 _poa->activate_object_with_id(
oid.in(),
this);
135 catch(CORBA::BAD_PARAM&
ex)
137 DB(0,
"Can't activate "<<
oidStr<<
": "
141 catch(POA::ServantAlreadyActive&
ex)
143 DB(0,
"Can't activate "<<
oidStr<<
": Servant is already active.")
146 catch(POA::ObjectAlreadyActive&
ex)
148 DB(0,
"Can't activate "<<
oidStr<<
": Object is already active.")
151 catch(POA::WrongPolicy&
ex)
154 <<
"' has wrong policy for activate_object_with_id().")
162 using namespace PortableServer;
170 catch(POA::ServantNotActive&
ex)
172 DB(0,
"Can't deactivate servant: POA '"<<
poaName.in()
173 <<
"' says it is not active.")
176 catch(POA::WrongPolicy&
ex)
178 DB(0,
"Can't deactivate servant: POA '"<<
poaName.in()
179 <<
"' has wrong policy for servant_to_id().")
188 catch(CORBA::BAD_PARAM&
ex)
190 DB(0,
"Can't deactivate servant. ObjectId looks bad: "
198 _poa->deactivate_object(
oid.in());
200 catch(POA::ObjectNotActive&
ex)
202 DB(0,
"Can't deactivate "<<
oidStr<<
": Object is not active.")
205 catch(POA::WrongPolicy&
ex)
208 <<
"' has wrong policy for deactivate_object().")
#define IF_OMNIORB4(omniORB4_code)
#define NP_MINORSTRING(systemException)
CORBA::Object_ptr createReference(PortableServer::POA_ptr poa, const char *repositoryId)
Helper method called by createNarrowedReference().
T::_ptr_type createNarrowedReference(PortableServer::POA_ptr poa, const char *repositoryId)
Helper method that creates a new CORBA object and then narrows it to the appropriate type.
char * newUniqueId()
Generates a unique object ID string, based upon the current PID and time.
virtual PortableServer::POA_ptr _default_POA()
PortableServer::POA_var _poa
void activateObjectWithId(const char *oidStr)
Calls activate_object_with_id() to activate this servant in its POA.
Servant()
No default constructor.
void deactivateObject()
Calls deactivate_object() to deactivate this servant in its POA.