3 #include "MessengerC.h"
5 #include "ace/Get_Opt.h"
7 const ACE_TCHAR
*ior
= ACE_TEXT("file://Messenger.ior");
10 parse_args (int argc
, ACE_TCHAR
*argv
[])
12 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
15 while ((c
= get_opts ()) != -1)
19 ior
= get_opts
.opt_arg ();
24 ACE_ERROR_RETURN ((LM_ERROR
,
31 // Indicates successful parsing of the command line
35 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
39 CORBA::ORB_var orb
= CORBA::ORB_init( argc
, argv
);
41 if (parse_args (argc
, argv
) != 0)
45 CORBA::Object_var obj
= orb
->string_to_object( ior
);
46 if (CORBA::is_nil(obj
.in())) {
47 std::cerr
<< "Nil Messenger reference" << std::endl
;
52 Messenger_var messenger
= Messenger::_narrow( obj
.in() );
53 if (CORBA::is_nil(messenger
.in())) {
54 std::cerr
<< "Argument is not a Messenger reference" << std::endl
;
58 CORBA::String_var message
= CORBA::string_dup(
59 "Implementing security policy now!" );
60 messenger
->send_message( "Chief of Security",
63 std::cout
<< "message was sent" << std::endl
;
66 catch(const CORBA::Exception
& ex
) {
67 std::cerr
<< "Caught CORBA excepti.o.n: " << ex
<< std::endl
;