blob: fc7e4b88a56d9bd84240972f9ef744c099d70908 (
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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
// $Id$
#include "Utils/XML_Helper.h"
#include "SRD_Handler.h"
#include "CIAOServerResources.hpp"
#include "CLA_Handler.h"
#include "OC_Handler.h"
#include "ciao/ServerResourcesC.h"
namespace CIAO
{
namespace Config_Handlers
{
SRD_Handler::SRD_Handler (const ACE_TCHAR *file) :
idl_srd_(0),
srd_ (0),
retval_ (false)
{
XML_Helper helper;
XERCES_CPP_NAMESPACE::DOMDocument *dom =
helper.create_dom (file);
if (!dom)
throw SRD_Handler::NoSRD ();
this->srd_.reset (new ServerResourcesDef
(ServerResources (dom)));
if (!this->build_srd ())
throw NoSRD ();
}
SRD_Handler::SRD_Handler (ServerResourcesDef *srd):
idl_srd_(0),
srd_(srd),
retval_(false)
{
if(!this->build_srd())
throw NoSRD ();
}
SRD_Handler::SRD_Handler (::CIAO::DAnCE::ServerResource *srd):
idl_srd_(srd),
srd_(0),
retval_(false)
{
if(!this->build_xsc())
throw NoSRD ();
}
SRD_Handler::~SRD_Handler (void)
{
}
bool
SRD_Handler::build_srd ()
{
this->idl_srd_.reset ( new ::CIAO::DAnCE::ServerResource );
if(this->srd_->cmdline_p())
{
this->retval_ = CLA_Handler::commandline_arguments(*this->srd_,
this->idl_srd_->args);
}
if(this->srd_->svcconf_p())
{
this->idl_srd_->svcconf = (srd_->svcconf().uri().c_str());
}
this->retval_ = OC_Handler::orb_config (this->srd_->orbConfigs (),
this->idl_srd_->orb_config);
if (this->srd_->id_p ())
{
this->idl_srd_->Id = srd_->id ().c_str ();
}
return this->retval_;
}
bool
SRD_Handler::build_xsc ()
{
size_t len; //For checking the length of src data members
// Load the ORBConfigs and create the XSC structure for SRD
this->srd_.reset (new ServerResourcesDef (OC_Handler::orb_config (this->idl_srd_->orb_config)));
//Note: Why did we make the CmdlineOptions a separate class instead of a
// vector of strings???
ServerCmdlineOptions sco;
//First load up the CmdlineArgs if they exist
len = idl_srd_->args.length();
for(size_t i = 0; i < len; i++)
{
XMLSchema::string < ACE_TCHAR > curr ((this->idl_srd_->args[i]));
sco.add_arg(curr);
}
this->srd_->cmdline (sco);
//Then a similar thing for the svcconf
XMLSchema::string < ACE_TCHAR > curr (this->idl_srd_->svcconf);
ACESvcConf asc;
asc.uri(curr);
this->srd_->svcconf (asc);
XMLSchema::string < ACE_TCHAR > id (this->idl_srd_->Id.in ());
this->srd_->id (id);
return true;
}
::CIAO::DAnCE::ServerResource const *
SRD_Handler::srd_idl () const
throw (SRD_Handler::NoSRD)
{
if(!this->idl_srd_.get())
throw NoSRD ();
//else
return this->idl_srd_.get();
}
::CIAO::DAnCE::ServerResource *
SRD_Handler::srd_idl ()
throw (SRD_Handler::NoSRD)
{
if(!this->idl_srd_.get())
throw NoSRD();
//else
return this->idl_srd_.release();
}
ServerResourcesDef const *
SRD_Handler::srd_xsc () const
throw (SRD_Handler::NoSRD)
{
if(!this->srd_.get())
throw NoSRD ();
//else
return this->srd_.get();
}
ServerResourcesDef *
SRD_Handler::srd_xsc ()
throw (SRD_Handler::NoSRD)
{
if(!this->srd_.get())
throw NoSRD ();
//else
return this->srd_.release();
}
}
}
|