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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
// **********************************************************************
//
// Copyright (c) 2001
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************
#include <Ice/RoutingTable.h>
#include <Glacier/ServerBlobject.h>
using namespace std;
using namespace Ice;
using namespace Glacier;
Glacier::ServerBlobject::ServerBlobject(const ObjectAdapterPtr& clientAdapter) :
_clientAdapter(clientAdapter),
_logger(_clientAdapter->getCommunicator()->getLogger())
{
PropertiesPtr properties = _clientAdapter->getCommunicator()->getProperties();
_traceLevel = atoi(properties->getProperty("Glacier.Trace.Server").c_str());
}
Glacier::ServerBlobject::~ServerBlobject()
{
assert(!_clientAdapter);
}
void
Glacier::ServerBlobject::destroy()
{
// No mutex protection necessary, destroy is only called after all
// object adapters have shut down.
_clientAdapter = 0;
_logger = 0;
}
void
Glacier::ServerBlobject::ice_invoke(const std::vector<Byte>& inParams, std::vector<Byte>& outParams,
const Current& current)
{
assert(_clientAdapter); // Destroyed?
try
{
ObjectPrx proxy = _clientAdapter->createReverseProxy(current.identity);
assert(proxy);
if (!current.facet.empty())
{
proxy = proxy->ice_newFacet(current.facet);
}
Context::const_iterator p = current.context.find("_fwd");
if (p != current.context.end())
{
for (unsigned int i = 0; i < p->second.length(); ++i)
{
char option = p->second[i];
switch (option)
{
case 't':
{
proxy = proxy->ice_twoway();
break;
}
case 'o':
{
proxy = proxy->ice_oneway();
break;
}
case 'd':
{
proxy = proxy->ice_datagram();
break;
}
case 's':
{
proxy = proxy->ice_secure(true);
break;
}
default:
{
ostringstream s;
s << "unknown forward option `" << option << "'";
_logger->warning(s.str());
break;
}
}
}
}
if (_traceLevel >= 2)
{
ostringstream s;
s << "reverse routing to:\n"
<< "proxy = " << _clientAdapter->getCommunicator()->proxyToString(proxy) << '\n'
<< "operation = " << current.operation << '\n'
<< "nonmutating = " << (current.nonmutating ? "true" : "false");
_logger->trace("Glacier", s.str());
}
proxy->ice_invoke(current.operation, current.nonmutating, inParams, outParams, current.context);
}
catch (const Exception& ex)
{
if (_traceLevel)
{
ostringstream s;
s << "reverse routing exception:\n" << ex;
_logger->trace("Glacier", s.str());
}
ex.ice_throw();
}
}
|