blob: a95c59b53489af3551a0a5938cad14c61c679ac4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// $Id$
#include "Test_i.h"
Test_i::Test_i (CORBA::ORB_ptr orb) :
orb_ (CORBA::ORB::_duplicate(orb)),
policies_ (1)
{
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
CORBA::Object_var obj =
orb_->resolve_initial_references ("RootPOA"
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
this->root_poa_ =
PortableServer::POA::_narrow (obj.in ()
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
policies_.length(1);
policies_[0] =
root_poa_->create_lifespan_policy (PortableServer::PERSISTENT
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
this->poa_mgr_ =
this->root_poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"Caught exception");
ACE_ASSERT (0); // Force termination!
}
ACE_ENDTRY;
}
Test_i::~Test_i (void)
{
this->policies_[0]->destroy ();
}
int
Test_i::try_and_create_POA (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
ACE_TRY
{
PortableServer::POA_var persistent_poa =
root_poa_->create_POA ("MyPoa",
poa_mgr_.in (),
this->policies_
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
}
ACE_CATCHANY
{
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"try_and_create_POA Exception ...");
return 1;
}
ACE_ENDTRY;
ACE_CHECK_RETURN (1);
return 0;
}
void
Test_i::shutdown (ACE_ENV_SINGLE_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException))
{
orb_->shutdown (0 ACE_ENV_ARG_PARAMETER);
}
|