60{
61 static bool first_call_configure = true;
62 if(first_call_configure){
63 first_call_configure = false;
64 }
65 else{
66 return true;
67 }
68
69
70
71
72
73
74
75 if(m_outLev<=3) std::cout<<"efpsc::SC::configure "<<"SC configuration started."<<std::endl;
77
78
79
80
81 if(m_outLev<=2) std::cout<<"efpsc::SC::configure "<<"---> Create Pesa Application Manager:"
82 <<m_isCreated<<std::endl;
83 if(!m_isCreated){
85 m_pesaAppMgr = Gaudi::createApplicationMgr(m_config->
dllName(),m_config->
factoryName());
86 if(m_outLev<=3)std::cout<<"Gaudi::createApplicationMgr(m_config->dllName(),m_config->factoryName())"
87 <<std::endl;
88 } else {
89 m_pesaAppMgr = Gaudi::createApplicationMgr();
90 if(m_outLev<=3)std::cout<<"Gaudi::createApplicationMgr()"<<std::endl;
91 }
92 }
93
94
95
96
97 if(m_outLev<=2) std::cout<<"efpsc::SC::configure "<<"---> Configure Pesa Property Manager"<<std::endl;
98 StatusCode sc ;
99 SmartIF<IProperty> propMgr ( m_pesaAppMgr );
100 SmartIF<IAppMgrUI> appMgr ( m_pesaAppMgr );
101 if( !appMgr.isValid() || !propMgr.isValid() ) {
102
103
104 if(m_outLev<=5) std::cout<<"efpsc::SC::configure "<<"While creating the ApplicationMgr"<<std::endl;
105 return false;
106 }
107
108
109 std::string opts = "jobOptions.txt";
110 ::setenv("efJobPath","",1);
113 if (opts.rfind("/") < opts.size()) {
114 ::setenv("efJobPath",opts.substr(0,opts.rfind("/")).c_str(),1);
115 }
116 }
117
118
119 if(m_outLev<=2) std::cout<<"efpsc::SC::configure "<<"---> Pesa JobOptions file is = " << opts<<std::endl
120 <<" "<<"---> Pesa JobOptions path = "
121 << ::getenv("efJobPath")<<std::endl;
122 propMgr->setProperty( "JobOptionsPath", opts );
123
124 propMgr->setProperty( "EventLoop",m_nameEventLoopMgr );
125
126
127
128
130 propMgr->setProperty(
"MessageSvcType", m_config->
messageSvcType());
131 }
132
133
134 if (m_config->
evtSel().size() != 0) {
135 propMgr->setProperty(
"EvtSel", m_config->
evtSel());
136 } else {
137 propMgr->setProperty( "EvtSel", "NONE" );
138 }
139
140
141
142 if(m_outLev<=3) std::cout<<"efpsc::SC::configure "<<"finish property set--->start configure"<<std::endl;
143 if(m_outLev<=2) std::cout<<"efpsc::SC::configure "<<"Configuring ApplicationMgr: "
144 << appMgr->FSMState() << " Status : " << sc.getCode()<<std::endl;
145
146 if( opts.substr( opts.length() - 3, 3 ) == ".py" ) {
147
148
149
150 if(m_outLev<=5) std::cout<<"efpsc::SC::configure "
151 <<"Error: Don't support python config files"<<std::endl;
152 return false;
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192 } else {
193
194
195
196 sc = appMgr->configure();
197 if( sc.isFailure() ) {
198
199
200 if(m_outLev<=5) std::cout<<"efpsc::SC::configure "<<"While configuring the ApplicationMgr"<<std::endl;
201 return false;
202 }
203 }
204
205
206 if(m_outLev<=2) std::cout<<"efpsc::SC::configure "<<"Configuring ApplicationMgr: "
207 << appMgr->FSMState() << " Status : " << sc.getCode()<<std::endl;
208
209 sc = appMgr->initialize();
210
211
212
213 if(m_outLev<=2) std::cout<<"efpsc::SC::configure "<<"Initialize ApplicationMgr : "
214 << appMgr->FSMState() << " Status : " << sc.getCode()<<std::endl;
215 if( sc.isFailure() ) {
216 EFPSC_ERROR(
"efpsc::SC::configure",
"While intializing the ApplicationMgr");
217 return false;
218 }
219
220
221 std::string value ;
222
223 sc = propMgr->getProperty( "EventLoop", value );
224
225 if( sc.isFailure() ) {
226
227 if(m_outLev<=4) std::cout<<"efpsc::SC::configure "<<"While retrieving Property EventLoop "<<std::endl;
228 } else {
229 m_nameEventLoopMgr.assign(value, value.find_first_of("\"")+1,
230 value.find_last_of("\"")-value.find_first_of("\"")-1) ;
231 }
232
233 SmartIF<ISvcLocator> svcLoc( m_pesaAppMgr );
234 if (svcLoc.isValid()) {
235
236 if(m_outLev<=2) std::cout<<"efpsc::SC::configure "<<"Name for EventLoopManager:"
237 <<m_nameEventLoopMgr<<std::endl;
238 StatusCode sc ;
239 IEventProcessor* processingMgr = 0 ;
240
241 sc = svcLoc->service( m_nameEventLoopMgr , processingMgr);
242 m_eventLoopMgr=processingMgr;
243
244 if( !sc.isSuccess() ) {
245
246 if(m_outLev<=5) std::cout<<"efpsc::SC::configure "<<"Error Retrieving Processing manager!"<<std::endl;
247 return false;
248 }
249
250 } else {
251
252 if(m_outLev<=5) std::cout<<"efpsc::SC::configure "<<"Error Retrieving Service Locator!"<<std::endl;
253 return false;
254 }
255
256 m_isCreated=true;
257
258 if(m_outLev<=3) std::cout<<"efpsc::SC::configure "<<"SC configuration finished."<<std::endl;
259 return true;
260}
#define EFPSC_ERROR(p, m)
const std::string & evtSel() const
const std::string & jobOptionsPath() const
const std::string & dllName() const
const std::string & factoryName() const
const std::string & messageSvcType() const