00001
00002
00003 #include "Svcconf_Handler.h"
00004 #include "ace/ACE.h"
00005 #include "ace/Log_Msg.h"
00006 #include "ace/Service_Config.h"
00007 #include "ace/Service_Types.h"
00008 #include "ace/Service_Repository.h"
00009 #include "ace/DLL.h"
00010 #include "ace/ARGV.h"
00011 #include "ace/Module.h"
00012 #include "ace/OS_NS_strings.h"
00013 #include "ace/SString.h"
00014
00015 #if (ACE_USES_CLASSIC_SVC_CONF == 0)
00016
00017 #if !defined (__ACEXML_INLINE__)
00018 # include "Svcconf_Handler.i"
00019 #endif
00020
00021 ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler (void)
00022 : in_stream_def_ (0),
00023 in_module_ (0),
00024 stream_svc_type_ (0),
00025 stream_ (0)
00026 {
00027
00028 }
00029
00030 ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler (void)
00031 {
00032
00033 }
00034
00035 void
00036 ACEXML_Svcconf_Handler::characters (const ACEXML_Char *,
00037 int,
00038 int ACEXML_ENV_ARG_DECL_NOT_USED)
00039 ACE_THROW_SPEC ((ACEXML_SAXException))
00040 {
00041
00042 }
00043
00044 void
00045 ACEXML_Svcconf_Handler::endDocument ( ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
00046 ACE_THROW_SPEC ((ACEXML_SAXException))
00047 {
00048
00049 }
00050
00051 void
00052 ACEXML_Svcconf_Handler::endElement (const ACEXML_Char *,
00053 const ACEXML_Char *,
00054 const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00055 ACE_THROW_SPEC ((ACEXML_SAXException))
00056 {
00057 if (ACE_OS::strcmp (qName, ACE_TEXT ("dynamic")) == 0)
00058 {
00059 ACE_Parsed_Info *active_info = (this->in_stream_def_ == 0 ?
00060 &this->parsed_info_ :
00061 &this->stream_info_);
00062
00063 ACE_DLL svc_dll;
00064
00065 if (svc_dll.open (active_info->path ()) == -1)
00066 {
00067
00068 ACE_CString msg (ACE_TEXT ("Cannot locate DLL: '"));
00069 msg += ACE_CString (ACE_TEXT (active_info->path ()));
00070 msg += ACE_CString (ACE_TEXT ("' for entity '"));
00071 msg += ACE_CString (ACE_TEXT (active_info->name ()));
00072 msg += ACE_CString (ACE_TEXT ("'\n"));
00073
00074 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00075 }
00076
00077 void *(*func) (ACE_Service_Object_Exterminator *) = 0;
00078 ACE_Service_Object_Exterminator gobbler = 0;
00079 void *symbol = 0;
00080
00081 long temp_ptr =
00082 reinterpret_cast<long> (svc_dll.symbol (active_info->init_func ()));
00083 func = reinterpret_cast<void *(*)(ACE_Service_Object_Exterminator *)> (temp_ptr);
00084
00085 if (func == 0)
00086 {
00087
00088 ACE_CString msg (ACE_TEXT ("Cannot locate init function: '"));
00089 msg += ACE_CString (ACE_TEXT (active_info->init_func ()));
00090 msg += ACE_CString (ACE_TEXT ("' for entity '"));
00091 msg += ACE_CString (ACE_TEXT (active_info->name ()));
00092 msg += ACE_CString (ACE_TEXT ("'\n"));
00093
00094 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00095 }
00096 symbol = (*func)(&gobbler);
00097
00098 ACE_Service_Type_Impl *stp = ACE_Service_Config::create_service_type_impl
00099 (active_info->name (),
00100 active_info->service_type (),
00101 symbol,
00102 ACE_Service_Type::DELETE_THIS |
00103 ACE_Service_Type::DELETE_OBJ,
00104 gobbler);
00105
00106 if (this->in_stream_def_)
00107 {
00108
00109
00110 if (active_info->service_type () == ACE_Service_Type::STREAM)
00111 {
00112 this->stream_ = (ACE_Stream_Type *) stp;
00113 }
00114 else
00115 {
00116
00117 ACE_CString msg (ACE_TEXT ("Expecting Stream type in stream header"));
00118 msg += ACE_CString (ACE_TEXT (" for entity '"));
00119 msg += ACE_CString (ACE_TEXT (active_info->name ()));
00120 msg += ACE_CString (ACE_TEXT ("'\n"));
00121
00122 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00123 }
00124
00125 this->stream_svc_type_ =
00126 ACE_Service_Config::create_service_type (this->stream_info_.name (),
00127 this->stream_,
00128 svc_dll,
00129 this->stream_info_.active ());
00130
00131 }
00132 else
00133 {
00134 if (this->in_module_)
00135 {
00136 ACE_ARGV args (active_info->init_params ());
00137
00138 ACE_Module_Type *mt = (ACE_Module_Type *) stp;
00139
00140 ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object ();
00141
00142 if (ACE_OS::strcmp (mp->name (), active_info->name ()) != 0)
00143 {
00144 ACE_DEBUG ((LM_DEBUG,
00145 ACE_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"),
00146 active_info->name (),
00147 mp->name ()));
00148 mp->name (active_info->name ());
00149 }
00150
00151 if (mt->init (args.argc (), args.argv ()) == -1
00152 || this->stream_->push (mt) == -1)
00153 {
00154
00155 ACE_CString msg (ACE_TEXT ("Error initializing module"));
00156 msg += ACE_CString (ACE_TEXT (" for entity '"));
00157 msg += ACE_CString (ACE_TEXT (active_info->name ()));
00158 msg += ACE_CString (ACE_TEXT ("'\n"));
00159
00160 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00161 }
00162
00163
00164
00165
00166
00167 }
00168 else
00169 {
00170 ACE_Service_Type *stype =
00171 ACE_Service_Config::create_service_type (active_info->name (),
00172 stp,
00173 svc_dll,
00174 active_info->active ());
00175
00176
00177
00178
00179 if (ACE_Service_Config::initialize (stype,
00180 active_info->init_params ()) == -1)
00181 {
00182
00183 ACE_CString msg (ACE_TEXT ("Failed to initialize dynamic service"));
00184 msg += ACE_CString (ACE_TEXT (" for entity '"));
00185 msg += ACE_CString (ACE_TEXT (active_info->name ()));
00186 msg += ACE_CString (ACE_TEXT ("'\n"));
00187
00188 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00189 }
00190 }
00191 this->parsed_info_.reset ();
00192 }
00193 }
00194 else if (ACE_OS::strcmp (qName, ACE_TEXT ("static")) == 0)
00195 {
00196 if (this->in_stream_def_)
00197 {
00198
00199 ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Create static %s for stream\n"),
00200 this->stream_info_.name ()));
00201 }
00202 else
00203 {
00204 if (this->in_module_)
00205 {
00206
00207 ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Push static %s into stream %s\n"),
00208 this->parsed_info_.name (),
00209 this->stream_info_.name ()));
00210 }
00211 else
00212 {
00213
00214
00215 if (ACE_Service_Config::initialize (this->parsed_info_.name (),
00216 this->parsed_info_.init_params ()) == -1)
00217 {
00218
00219 ACE_CString msg (ACE_TEXT ("Failed to initialize static service"));
00220 msg += ACE_CString (ACE_TEXT (" for entity '"));
00221 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00222 msg += ACE_CString (ACE_TEXT ("'\n"));
00223
00224 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00225 }
00226 }
00227 this->parsed_info_.reset ();
00228 }
00229 }
00230 else if (ACE_OS::strcmp (qName, ACE_TEXT ("module")) == 0)
00231 {
00232 this->in_module_ = 0;
00233 }
00234 else if (ACE_OS::strcmp (qName, ACE_TEXT ("streamdef")) == 0)
00235 {
00236
00237
00238
00239 ACE_Service_Config::initialize (this->stream_svc_type_,
00240 this->stream_info_.init_params ());
00241
00242 this->stream_info_.reset ();
00243 this->stream_svc_type_ = 0;
00244 this->stream_ = 0;
00245 }
00246 else if (ACE_OS::strcmp (qName, ACE_TEXT ("stream")) == 0)
00247 {
00248
00249
00250
00251 this->stream_info_.reset ();
00252 }
00253 else
00254 {
00255 }
00256 }
00257
00258 void
00259 ACEXML_Svcconf_Handler::endPrefixMapping (const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00260 ACE_THROW_SPEC ((ACEXML_SAXException))
00261 {
00262
00263 }
00264
00265 void
00266 ACEXML_Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *,
00267 int,
00268 int ACEXML_ENV_ARG_DECL_NOT_USED)
00269 ACE_THROW_SPEC ((ACEXML_SAXException))
00270 {
00271
00272 }
00273
00274 void
00275 ACEXML_Svcconf_Handler::processingInstruction (const ACEXML_Char *,
00276 const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00277 ACE_THROW_SPEC ((ACEXML_SAXException))
00278 {
00279
00280 }
00281
00282 void
00283 ACEXML_Svcconf_Handler::setDocumentLocator (ACEXML_Locator* locator)
00284 {
00285 this->locator_ = locator;
00286 }
00287
00288 void
00289 ACEXML_Svcconf_Handler::skippedEntity (const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00290 ACE_THROW_SPEC ((ACEXML_SAXException))
00291 {
00292
00293 }
00294
00295 void
00296 ACEXML_Svcconf_Handler::startDocument ( ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
00297 ACE_THROW_SPEC ((ACEXML_SAXException))
00298 {
00299
00300 }
00301
00302 void
00303 ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *,
00304 const ACEXML_Char *,
00305 const ACEXML_Char *qName,
00306 ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00307 ACE_THROW_SPEC ((ACEXML_SAXException))
00308 {
00309 if (ACE_OS::strcmp (qName, ACE_TEXT ("dynamic")) == 0)
00310 {
00311 this->get_dynamic_attrs (alist ACEXML_ENV_ARG_PARAMETER);
00312 }
00313 else if (ACE_OS::strcmp (qName, ACE_TEXT ("initializer")) == 0)
00314 {
00315 this->get_initializer_attrs (alist ACEXML_ENV_ARG_PARAMETER);
00316
00317 }
00318 else if (ACE_OS::strcmp (qName, ACE_TEXT ("static")) == 0)
00319 {
00320 this->get_static_attrs (alist ACEXML_ENV_ARG_PARAMETER);
00321 }
00322 else if (ACE_OS::strcmp (qName, ACE_TEXT ("stream")) == 0)
00323 {
00324 this->get_stream_id (alist ACEXML_ENV_ARG_PARAMETER);
00325
00326 if (ACE_Service_Repository::instance()->find
00327 (this->stream_info_.name (),
00328 (const ACE_Service_Type **) &this->stream_svc_type_) == -1)
00329 {
00330
00331 ACE_CString msg (ACE_TEXT ("Cannot find stream '"));
00332 msg += ACE_CString (ACE_TEXT (this->stream_info_.name ()));
00333 msg += ACE_CString (ACE_TEXT ("'\n"));
00334
00335 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00336 }
00337 this->stream_ = this->stream_svc_type_ == 0
00338 ? 0
00339 : dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (this->stream_svc_type_->type ()));
00340
00341
00342
00343 }
00344 else if (ACE_OS::strcmp (qName, ACE_TEXT ("streamdef")) == 0)
00345 {
00346 this->in_stream_def_ = 1;
00347
00348 }
00349 else if (ACE_OS::strcmp (qName, ACE_TEXT ("module")) == 0)
00350 {
00351 this->in_stream_def_ = 0;
00352 this->in_module_ = 1;
00353 }
00354 else if (ACE_OS::strcmp (qName, ACE_TEXT ("resume")) == 0)
00355 {
00356 this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
00357 if (this->in_module_)
00358 {
00359
00360
00361
00362 ACE_Module_Type *mt = (this->stream_ == 0)
00363 ? 0
00364 : this->stream_->find (this->parsed_info_.name ());
00365
00366 if (mt == 0)
00367 {
00368
00369 ACE_CString msg (ACE_TEXT ("Can't locate module '"));
00370 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00371 msg += ACE_CString (ACE_TEXT ("'\n"));
00372
00373 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00374 }
00375
00376 mt->resume ();
00377 }
00378 else
00379 {
00380
00381
00382 if (ACE_Service_Config::resume (this->parsed_info_.name ()) == -1)
00383 {
00384
00385 ACE_CString msg (ACE_TEXT ("Resume failed"));
00386 msg += ACE_CString (ACE_TEXT (" for entity '"));
00387 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00388 msg += ACE_CString (ACE_TEXT ("'\n"));
00389
00390 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00391 }
00392 }
00393 this->parsed_info_.reset ();
00394 }
00395 else if (ACE_OS::strcmp (qName, ACE_TEXT ("suspend")) == 0)
00396 {
00397 this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
00398 if (this->in_module_)
00399 {
00400
00401
00402
00403 ACE_Module_Type *mt = (this->stream_ == 0)
00404 ? 0
00405 : this->stream_->find (this->parsed_info_.name ());
00406
00407 if (mt == 0)
00408 {
00409
00410 ACE_CString msg (ACE_TEXT ("Can't locate module '"));
00411 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00412 msg += ACE_CString (ACE_TEXT ("'\n"));
00413
00414 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00415 }
00416
00417 mt->suspend ();
00418 }
00419 else
00420 {
00421
00422
00423 if (ACE_Service_Config::suspend (this->parsed_info_.name ()) == -1)
00424 {
00425
00426 ACE_CString msg (ACE_TEXT ("Suspend failed"));
00427 msg += ACE_CString (ACE_TEXT (" for entity '"));
00428 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00429 msg += ACE_CString (ACE_TEXT ("'\n"));
00430
00431 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00432 }
00433 }
00434 this->parsed_info_.reset ();
00435 }
00436 else if (ACE_OS::strcmp (qName, ACE_TEXT ("remove")) == 0)
00437 {
00438 this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
00439 if (this->in_module_)
00440 {
00441
00442
00443
00444 ACE_Module_Type *mt = (this->stream_ == 0)
00445 ? 0
00446 : this->stream_->find (this->parsed_info_.name ());
00447
00448 if (mt == 0)
00449 {
00450
00451 ACE_CString msg (ACE_TEXT ("Can't locate module '"));
00452 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00453 msg += ACE_CString (ACE_TEXT ("'\n"));
00454
00455 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00456 }
00457
00458 this->stream_->remove (mt);
00459 }
00460 else
00461 {
00462
00463
00464 if (ACE_Service_Config::remove (this->parsed_info_.name ()) == -1)
00465 {
00466
00467 ACE_CString msg (ACE_TEXT ("Remove failed"));
00468 msg += ACE_CString (ACE_TEXT (" for entity '"));
00469 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00470 msg += ACE_CString (ACE_TEXT ("'\n"));
00471
00472 ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
00473 }
00474 }
00475 this->parsed_info_.reset ();
00476 }
00477 else if (ACE_OS::strcmp (qName, ACE_TEXT ("ACE_Svc_Conf")) == 0)
00478 {
00479
00480
00481 }
00482 else
00483 {
00484
00485 }
00486
00487 return;
00488 }
00489
00490 void
00491 ACEXML_Svcconf_Handler::startPrefixMapping (const ACEXML_Char *,
00492 const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00493 ACE_THROW_SPEC ((ACEXML_SAXException))
00494 {
00495
00496 }
00497
00498
00499
00500 void
00501 ACEXML_Svcconf_Handler::notationDecl (const ACEXML_Char *,
00502 const ACEXML_Char *,
00503 const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00504 ACE_THROW_SPEC ((ACEXML_SAXException))
00505 {
00506
00507 }
00508
00509 void
00510 ACEXML_Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *,
00511 const ACEXML_Char *,
00512 const ACEXML_Char *,
00513 const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00514 ACE_THROW_SPEC ((ACEXML_SAXException))
00515 {
00516
00517 }
00518
00519
00520
00521 ACEXML_InputSource *
00522 ACEXML_Svcconf_Handler::resolveEntity (const ACEXML_Char *,
00523 const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00524 ACE_THROW_SPEC ((ACEXML_SAXException))
00525 {
00526
00527 return 0;
00528 }
00529
00530
00531
00532
00533
00534
00535 void
00536 ACEXML_Svcconf_Handler::error (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
00537 ACE_THROW_SPEC ((ACEXML_SAXException))
00538 {
00539 ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
00540 this->locator_->getLineNumber(),
00541 this->locator_->getColumnNumber()));
00542 ex.print();
00543 }
00544
00545 void
00546 ACEXML_Svcconf_Handler::fatalError (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
00547 ACE_THROW_SPEC ((ACEXML_SAXException))
00548 {
00549 ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
00550 this->locator_->getLineNumber(),
00551 this->locator_->getColumnNumber()));
00552 ex.print();
00553 }
00554
00555 void
00556 ACEXML_Svcconf_Handler::warning (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
00557 ACE_THROW_SPEC ((ACEXML_SAXException))
00558 {
00559 ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
00560 this->locator_->getLineNumber(),
00561 this->locator_->getColumnNumber()));
00562 ex.print();
00563 }
00564
00565 int
00566 ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00567 {
00568 if (alist != 0)
00569 for (size_t i = 0; i < alist->getLength (); ++i)
00570 {
00571 if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00572 {
00573 this->stream_info_.name (alist->getValue (i));
00574 }
00575 else
00576 {
00577
00578 ACE_CString msg (ACE_TEXT ("Invalid stream attribute '"));
00579 msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
00580 msg += ACE_CString (ACE_TEXT ("' for entity '"));
00581 msg += ACE_CString (ACE_TEXT (this->stream_info_.name ()));
00582 msg += ACE_CString (ACE_TEXT ("'\n"));
00583
00584 ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
00585 -1);
00586 }
00587 }
00588 return 0;
00589 }
00590
00591 int
00592 ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00593 {
00594 if (alist != 0)
00595 for (size_t i = 0; i < alist->getLength (); ++i)
00596 {
00597 if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00598 {
00599 this->parsed_info_.name (alist->getValue (i));
00600 }
00601 else
00602 {
00603
00604 ACE_CString msg (ACE_TEXT ("Invalid attribute '"));
00605 msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
00606 msg += ACE_CString (ACE_TEXT ("', expecting 'id'"));
00607 msg += ACE_CString (ACE_TEXT (" for entity '"));
00608 msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
00609 msg += ACE_CString (ACE_TEXT ("'\n"));
00610
00611 ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
00612 -1);
00613 }
00614 }
00615 return 0;
00616 }
00617
00618 int
00619 ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00620 {
00621 if (alist != 0)
00622 {
00623 ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00624 &this->parsed_info_ :
00625 &this->stream_info_);
00626 for (size_t i = 0; i < alist->getLength (); ++i)
00627 {
00628 if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00629 {
00630 info->name (alist->getValue (i));
00631 }
00632 else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0)
00633 {
00634 if (ACE_OS::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0)
00635 {
00636 info->active (0);
00637 }
00638 else if (ACE_OS::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0)
00639 {
00640 info->active (1);
00641 }
00642 else
00643 {
00644
00645 ACE_CString msg (ACE_TEXT ("Invalid attribute value '"));
00646 msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
00647 msg += ACE_CString (ACE_TEXT ("', expecting 'active' or 'inactive'"));
00648 msg += ACE_CString (ACE_TEXT (" for entity '"));
00649 msg += ACE_CString (ACE_TEXT (info->name ()));
00650 msg += ACE_CString (ACE_TEXT ("'\n"));
00651
00652 ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
00653 -1);
00654 }
00655 }
00656 else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0)
00657 {
00658 if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0)
00659 {
00660 info->service_type (ACE_Service_Type::SERVICE_OBJECT);
00661 }
00662 else if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("stream")) == 0)
00663 {
00664 info->service_type (ACE_Service_Type::STREAM);
00665 }
00666 else if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("module")) == 0)
00667 {
00668 info->service_type (ACE_Service_Type::MODULE);
00669 }
00670 else
00671 {
00672
00673 ACE_CString msg (ACE_TEXT ("Invalid Service_Object attribute value'"));
00674 msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
00675 msg += ACE_CString (ACE_TEXT ("' for entity '"));
00676 msg += ACE_CString (ACE_TEXT (info->name ()));
00677 msg += ACE_CString (ACE_TEXT ("'\n"));
00678
00679 ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
00680 -1);
00681 }
00682 }
00683 else
00684 {
00685
00686 ACE_CString msg (ACE_TEXT ("Invalid attribute'"));
00687 msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
00688 msg += ACE_CString (ACE_TEXT ("' for entity '"));
00689 msg += ACE_CString (ACE_TEXT (info->name ()));
00690 msg += ACE_CString (ACE_TEXT ("'\n"));
00691
00692 ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()), -1);
00693 }
00694 }
00695 }
00696 return 0;
00697 }
00698
00699 int
00700 ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00701 {
00702 if (alist != 0)
00703 {
00704 ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00705 &this->parsed_info_ :
00706 &this->stream_info_);
00707 for (size_t i = 0; i < alist->getLength (); ++i)
00708 {
00709 if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0)
00710 {
00711 info->init_func (alist->getValue (i));
00712 }
00713 else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0)
00714 {
00715 info->path (alist->getValue (i));
00716 }
00717 else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
00718 {
00719 info->init_params (alist->getValue (i));
00720 }
00721 else
00722 {
00723
00724 ACE_CString msg (ACE_TEXT ("Invalid initializer attribute'"));
00725 msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
00726 msg += ACE_CString (ACE_TEXT ("' for entity '"));
00727 msg += ACE_CString (ACE_TEXT (info->name ()));
00728 msg += ACE_CString (ACE_TEXT ("'\n"));
00729
00730 ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()), -1);
00731 }
00732 }
00733 }
00734 return 0;
00735 }
00736
00737 int
00738 ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00739 {
00740 if (alist != 0)
00741 {
00742 ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00743 &this->parsed_info_ :
00744 &this->stream_info_);
00745 for (size_t i = 0; i < alist->getLength (); ++i)
00746 {
00747 if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00748 {
00749 info->name (alist->getValue (i));
00750 }
00751 else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
00752 {
00753 info->init_params (alist->getValue (i));
00754 }
00755 else
00756 {
00757
00758 ACE_CString msg (ACE_TEXT ("Invalid static attribute '"));
00759 msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
00760 msg += ACE_CString (ACE_TEXT ("' for entity '"));
00761 msg += ACE_CString (ACE_TEXT (info->name ()));
00762 msg += ACE_CString (ACE_TEXT ("'\n"));
00763
00764 ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()), -1);
00765 }
00766 }
00767 }
00768 return 0;
00769 }
00770
00771 #endif