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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// $Id$
// ============================================================================
//
// = LIBRARY
// orbsvcs/tests/tests_svc_loader
//
// = FILENAME
// client.cpp
//
// = DESCRIPTION
// This directory contains a client that checks if a given object
// reference points to an existing object or not and prints a debug
// statement to reflect the same. This client is to be used in
// conjunction with testing the dynamically loadable services. If
// the service is loaded successfully, the object reference from the
// server would be a valid one and the corresponding debug statement
// is printed out. Or viceversa.
//
// = AUTHOR
// Priyanka Gontla <pgontla@ece.uci.edu>
//
// ============================================================================
#include "tao/ORB.h"
#include "tao/Object.h"
#include "tao/SystemException.h"
#include "ace/Service_Config.h"
#include "ace/Log_Msg.h"
#include "ace/CORBA_macros.h"
ACE_RCSID (tests_svc_loader,
tests_svc_loader,
"$Id$")
int main (int argc, char *argv [])
{
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
// First initialize the ORB, that will remove some arguments...
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv, 0 ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
// There must be at least one argument, the file that has to be
// retrieved
if (argc < 2)
{
ACE_DEBUG ((LM_DEBUG,
"Usage: %s <ior>\n",
argv[0]));
return -1;
}
// Use the first argument to create the object reference.
CORBA::Object_var object =
orb->string_to_object (argv[1] ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
// Check if this object reference is a valid one..
CORBA::Boolean not_exists =
object->_non_existent (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
if (not_exists)
{
// Object reference was not of an existing object
ACE_DEBUG ((LM_ERROR,
"The Object is non existent\n"));
}
else
{
// The Object exists
ACE_DEBUG ((LM_DEBUG,
"The object exists!!!\n"));
}
}
ACE_CATCH (CORBA::SystemException ,e)
{
ACE_DEBUG ((LM_ERROR,
"CORBA System Exception Raised!\n"));
}
ACE_ENDTRY;
ACE_CHECK_RETURN (-1);
return 0;
}
|