Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Svcconf_Handler.cpp

Go to the documentation of this file.
00001 // -*- C++ -*-  $Id: Svcconf_Handler.cpp,v 1.1.1.1 2003/02/21 18:36:32 chad Exp $
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 
00013 #if (ACE_USES_CLASSIC_SVC_CONF == 0)
00014 
00015 #if !defined (__ACEXML_INLINE__)
00016 # include "Svcconf_Handler.i"
00017 #endif /* __ACEXML_INLINE__ */
00018 
00019 ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler (void)
00020   : in_stream_def_ (0),
00021     in_module_ (0),
00022     stream_svc_type_ (0),
00023     stream_ (0)
00024 {
00025   // no-op
00026 }
00027 
00028 ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler (void)
00029 {
00030   // no-op
00031 }
00032 
00033 void
00034 ACEXML_Svcconf_Handler::characters (const ACEXML_Char *,
00035                                     int,
00036                                     int ACEXML_ENV_ARG_DECL_NOT_USED)
00037       ACE_THROW_SPEC ((ACEXML_SAXException))
00038 {
00039   // no-op
00040 }
00041 
00042 void
00043 ACEXML_Svcconf_Handler::endDocument ( ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
00044       ACE_THROW_SPEC ((ACEXML_SAXException))
00045 {
00046   // no-op
00047 }
00048 
00049 void
00050 ACEXML_Svcconf_Handler::endElement (const ACEXML_Char *,
00051                                     const ACEXML_Char *,
00052                                     const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
00053       ACE_THROW_SPEC ((ACEXML_SAXException))
00054 {
00055   if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0)
00056     {
00057       ACE_Parsed_Info *active_info = (this->in_stream_def_ == 0 ?
00058                                       &this->parsed_info_ :
00059                                       &this->stream_info_);
00060 
00061       ACE_DLL svc_dll;
00062 
00063       if (svc_dll.open (active_info->path ()) == -1)
00064         {
00065           ACEXML_THROW (ACEXML_SAXException (ACE_TEXT("Cannot locate DLL\n")));
00066         }
00067 
00068       void *(*func) (ACE_Service_Object_Exterminator *) = 0;
00069       ACE_Service_Object_Exterminator gobbler = 0;
00070       void *symbol = 0;
00071 
00072       long temp_ptr =
00073         ACE_reinterpret_cast(long, svc_dll.symbol (active_info->init_func ()));
00074       func = ACE_reinterpret_cast(void *(*)(ACE_Service_Object_Exterminator *),
00075                                   temp_ptr);
00076 
00077       if (func == 0)
00078         {
00079           ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Cannot locate init function\n")));
00080         }
00081       symbol = (*func)(&gobbler); // target object created in the loaded DLL.
00082 
00083       ACE_Service_Type_Impl *stp = ACE_Service_Config::create_service_type_impl
00084         (active_info->name (),
00085          active_info->service_type (),
00086          symbol,
00087          ACE_Service_Type::DELETE_THIS |
00088          ACE_Service_Type::DELETE_OBJ,
00089          gobbler);
00090 
00091       if (this->in_stream_def_)
00092         {
00093 //           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"),
00094 //                       this->stream_info_.name ()));
00095           if (active_info->service_type () == ACE_Service_Type::STREAM)
00096             {
00097               this->stream_ = (ACE_Stream_Type *) stp;
00098             }
00099           else
00100             {
00101               ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Expecting Stream type in stream header\n")));
00102             }
00103 
00104           this->stream_svc_type_ =
00105             ACE_Service_Config::create_service_type (this->stream_info_.name (),
00106                                                      this->stream_,
00107                                                      svc_dll,
00108                                                      this->stream_info_.active ());
00109 
00110         }
00111       else
00112         {
00113           if (this->in_module_)
00114             {
00115               ACE_ARGV args (active_info->init_params ());
00116 
00117               ACE_Module_Type *mt = (ACE_Module_Type *) stp;
00118 
00119               ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object ();
00120 
00121               if (ACE_OS::strcmp (mp->name (), active_info->name ()) != 0)
00122                 {
00123                   ACE_DEBUG ((LM_DEBUG,
00124                               ACE_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"),
00125                               active_info->name (),
00126                               mp->name ()));
00127                   mp->name (active_info->name ());
00128                 }
00129 
00130               if (mt->init (args.argc (), args.argv ()) == -1
00131                   || this->stream_->push (mt) == -1)
00132                 {
00133                   ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Error initializing module")));
00134                 }
00135 
00136 
00137 //               ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"),
00138 //                           this->parsed_info_.name (),
00139 //                           this->stream_info_.name ()));
00140             }
00141           else
00142             {
00143               ACE_Service_Type *stype =
00144                 ACE_Service_Config::create_service_type (active_info->name (),
00145                                                          stp,
00146                                                          svc_dll,
00147                                                          active_info->active ());
00148               // @@ Check error here.
00149 
00150               //               ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"),
00151 //                           this->parsed_info_.name ()));
00152               if (ACE_Service_Config::initialize (stype,
00153                                                   active_info->init_params ()) == -1)
00154                 {
00155                   ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Failed to initialize dynamic service\n")));
00156                 }
00157             }
00158           this->parsed_info_.reset ();
00159         }
00160     }
00161   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0)
00162     {
00163       if (this->in_stream_def_)
00164         {
00165           // @@ Couldn't make sense out of the original Svc_Conf.y.
00166           ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Create static %s for stream\n"),
00167                       this->stream_info_.name ()));
00168         }
00169       else
00170         {
00171           if (this->in_module_)
00172             {
00173               // @@ Couldn't make sense out of the original Svc_Conf.y.
00174               ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Push static %s into stream %s\n"),
00175                           this->parsed_info_.name (),
00176                           this->stream_info_.name ()));
00177             }
00178           else
00179             {
00180 //               ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply static %s\n"),
00181 //                           this->parsed_info_.name ()));
00182               if (ACE_Service_Config::initialize (this->parsed_info_.name (),
00183                                                   this->parsed_info_.init_params ()) == -1)
00184                 {
00185                   ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Failed to initialize static service\n")));
00186                 }
00187             }
00188           this->parsed_info_.reset ();
00189         }
00190     }
00191   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0)
00192     {
00193       this->in_module_ = 0;
00194     }
00195   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0)
00196     {
00197 //       ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"),
00198 //                   this->stream_info_.name (),
00199 //                   this->stream_info_.name ()));
00200       ACE_Service_Config::initialize (this->stream_svc_type_,
00201                                       this->stream_info_.init_params ());
00202 
00203       this->stream_info_.reset ();
00204       this->stream_svc_type_ = 0;
00205       this->stream_ = 0;
00206     }
00207   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0)
00208     {
00209 //       ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"),
00210 //                   this->stream_info_.name (),
00211 //                   this->stream_info_.name ()));
00212       this->stream_info_.reset ();
00213     }
00214   else
00215     {
00216     }
00217 }
00218 
00219 void
00220 ACEXML_Svcconf_Handler::endPrefixMapping (const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00221       ACE_THROW_SPEC ((ACEXML_SAXException))
00222 {
00223   // no-op
00224 }
00225 
00226 void
00227 ACEXML_Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *,
00228                                              int,
00229                                              int ACEXML_ENV_ARG_DECL_NOT_USED)
00230       ACE_THROW_SPEC ((ACEXML_SAXException))
00231 {
00232   // no-op
00233 }
00234 
00235 void
00236 ACEXML_Svcconf_Handler::processingInstruction (const ACEXML_Char *,
00237                                                const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00238       ACE_THROW_SPEC ((ACEXML_SAXException))
00239 {
00240   // no-op
00241 }
00242 
00243 void
00244 ACEXML_Svcconf_Handler::setDocumentLocator (ACEXML_Locator* locator)
00245 {
00246   this->locator_ = locator;
00247 }
00248 
00249 void
00250 ACEXML_Svcconf_Handler::skippedEntity (const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00251       ACE_THROW_SPEC ((ACEXML_SAXException))
00252 {
00253   // no-op
00254 }
00255 
00256 void
00257 ACEXML_Svcconf_Handler::startDocument ( ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
00258       ACE_THROW_SPEC ((ACEXML_SAXException))
00259 {
00260   // no-op
00261 }
00262 
00263 void
00264 ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *,
00265                                       const ACEXML_Char *,
00266                                       const ACEXML_Char *qName,
00267                                       ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00268       ACE_THROW_SPEC ((ACEXML_SAXException))
00269 {
00270   if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0)
00271     {
00272       this->get_dynamic_attrs (alist ACEXML_ENV_ARG_PARAMETER);
00273     }
00274   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("initializer")) == 0)
00275     {
00276       this->get_initializer_attrs (alist ACEXML_ENV_ARG_PARAMETER);
00277 
00278     }
00279   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0)
00280     {
00281       this->get_static_attrs (alist ACEXML_ENV_ARG_PARAMETER);
00282     }
00283   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0)
00284     {
00285       this->get_stream_id (alist ACEXML_ENV_ARG_PARAMETER);
00286 
00287       if (ACE_Service_Repository::instance()->find
00288           (this->stream_info_.name (),
00289            (const ACE_Service_Type **) &this->stream_svc_type_) == -1)
00290         {
00291           ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Cannot find stream\n")));
00292         }
00293       this->stream_ =   this->stream_svc_type_ == 0
00294         ? 0
00295         : ACE_dynamic_cast (ACE_Stream_Type *,
00296                             ACE_const_cast (ACE_Service_Type_Impl *,
00297                                             this->stream_svc_type_->type ()));
00298 
00299 //       ACE_DEBUG ((LM_INFO, ACE_TEXT ("Retrieve stream %s from repository\n"),
00300 //                   this->stream_info_.name ()));
00301     }
00302   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0)
00303     {
00304       this->in_stream_def_ = 1;
00305       // @@ Set up stream service object
00306     }
00307   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0)
00308     {
00309       this->in_stream_def_ = 0;
00310       this->in_module_ = 1;
00311     }
00312   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("resume")) == 0)
00313     {
00314       this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
00315       if (this->in_module_)
00316         {
00317 //           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s in stream %s\n"),
00318 //                       this->parsed_info_.name (),
00319 //                       this->stream_info_.name ()));
00320           ACE_Module_Type *mt = (this->stream_ == 0)
00321             ? 0
00322             : this->stream_->find (this->parsed_info_.name ());
00323 
00324           if (mt == 0)
00325             {
00326               ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Can't locate module\n")));
00327             }
00328 
00329           mt->resume ();
00330         }
00331       else
00332         {
00333 //           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s\n"),
00334 //                       this->parsed_info_.name ()));
00335           if (ACE_Service_Config::resume (this->parsed_info_.name ()) == -1)
00336             {
00337               ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Resume fail\n")));
00338             }
00339         }
00340       this->parsed_info_.reset ();
00341     }
00342   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("suspend")) == 0)
00343     {
00344       this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
00345       if (this->in_module_)
00346         {
00347 //           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s in stream %s\n"),
00348 //                       this->parsed_info_.name (),
00349 //                       this->stream_info_.name ()));
00350           ACE_Module_Type *mt = (this->stream_ == 0)
00351             ? 0
00352             : this->stream_->find (this->parsed_info_.name ());
00353 
00354           if (mt == 0)
00355             {
00356               ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Can't locate module\n")));
00357             }
00358 
00359           mt->suspend ();
00360         }
00361       else
00362         {
00363           //          ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s\n"),
00364           //                      this->parsed_info_.name ()));
00365           if (ACE_Service_Config::suspend (this->parsed_info_.name ()) == -1)
00366             {
00367               ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Suspend failed\n")));
00368             }
00369         }
00370       this->parsed_info_.reset ();
00371     }
00372   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("remove")) == 0)
00373     {
00374       this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
00375       if (this->in_module_)
00376         {
00377 //           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s in stream %s\n"),
00378 //                       this->parsed_info_.name (),
00379 //                       this->stream_info_.name ()));
00380           ACE_Module_Type *mt = (this->stream_ == 0)
00381             ? 0
00382             : this->stream_->find (this->parsed_info_.name ());
00383 
00384           if (mt == 0)
00385             {
00386               ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Can't locate module\n")));
00387             }
00388 
00389           this->stream_->remove (mt);
00390         }
00391       else
00392         {
00393 //           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s\n"),
00394 //                       this->parsed_info_.name ()));
00395           if (ACE_Service_Config::remove (this->parsed_info_.name ()) == -1)
00396             {
00397               ACEXML_THROW (ACEXML_SAXException (ACE_TEXT ("Remove failed\n")));
00398             }
00399         }
00400       this->parsed_info_.reset ();
00401     }
00402   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("ACE_Svc_Conf")) == 0)
00403     {
00404       // Main document tag. no-op.
00405 //       ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE_Svc_Conf tag\n")));
00406     }
00407   else
00408     {
00409       // @@ Error.  Perhaps we should relay to user event handler here, if available.
00410     }
00411 
00412   return;
00413 }
00414 
00415 void
00416 ACEXML_Svcconf_Handler::startPrefixMapping (const ACEXML_Char *,
00417                                             const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00418       ACE_THROW_SPEC ((ACEXML_SAXException))
00419 {
00420   // No-op.
00421 }
00422 
00423 // *** Methods inherit from ACEXML_DTDHandler.
00424 
00425 void
00426 ACEXML_Svcconf_Handler::notationDecl (const ACEXML_Char *,
00427                                       const ACEXML_Char *,
00428                                       const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00429       ACE_THROW_SPEC ((ACEXML_SAXException))
00430 {
00431   // No-op.
00432 }
00433 
00434 void
00435 ACEXML_Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *,
00436                                             const ACEXML_Char *,
00437                                             const ACEXML_Char *,
00438                                             const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00439       ACE_THROW_SPEC ((ACEXML_SAXException))
00440 {
00441   // No-op.
00442 }
00443 
00444 // Methods inherit from ACEXML_EnitityResolver.
00445 
00446 ACEXML_InputSource *
00447 ACEXML_Svcconf_Handler::resolveEntity (const ACEXML_Char *,
00448                                        const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00449       ACE_THROW_SPEC ((ACEXML_SAXException))
00450 {
00451   // No-op.
00452   return 0;
00453 }
00454 
00455 // Methods inherit from ACEXML_ErrorHandler.
00456 
00457   /*
00458    * Receive notification of a recoverable error.
00459    */
00460 void
00461 ACEXML_Svcconf_Handler::error (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
00462       ACE_THROW_SPEC ((ACEXML_SAXException))
00463 {
00464   ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
00465               this->locator_->getLineNumber(),
00466               this->locator_->getColumnNumber()));
00467   ex.print();
00468 }
00469 
00470 void
00471 ACEXML_Svcconf_Handler::fatalError (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
00472       ACE_THROW_SPEC ((ACEXML_SAXException))
00473 {
00474   ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
00475               this->locator_->getLineNumber(),
00476               this->locator_->getColumnNumber()));
00477   ex.print();
00478 }
00479 
00480 void
00481 ACEXML_Svcconf_Handler::warning (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
00482       ACE_THROW_SPEC ((ACEXML_SAXException))
00483 {
00484   ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
00485               this->locator_->getLineNumber(),
00486               this->locator_->getColumnNumber()));
00487   ex.print();
00488 }
00489 
00490 int
00491 ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00492 {
00493   if (alist != 0)
00494     for (size_t i = 0; i < alist->getLength (); ++i)
00495       {
00496         if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00497           {
00498             this->stream_info_.name (alist->getValue (i));
00499           }
00500         else
00501           {
00502             ACEXML_THROW_RETURN (ACEXML_SAXException (ACE_TEXT ("Invalid stream attribute\n")),
00503                                                                                                           -1);
00504           }
00505       }
00506   return 0;
00507 }
00508 
00509 int
00510 ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00511 {
00512   if (alist != 0)
00513     for (size_t i = 0; i < alist->getLength (); ++i)
00514       {
00515         if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00516           {
00517             this->parsed_info_.name (alist->getValue (i));
00518           }
00519         else
00520           {
00521             ACEXML_THROW_RETURN (ACEXML_SAXException (ACE_TEXT ("Invalid attribute, expecting 'id'\n")), -1);
00522           }
00523       }
00524   return 0;
00525 }
00526 
00527 int
00528 ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00529 {
00530   if (alist != 0)
00531     {
00532       ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00533                                &this->parsed_info_ :
00534                                &this->stream_info_);
00535       for (size_t i = 0; i < alist->getLength (); ++i)
00536         {
00537           if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00538             {
00539               info->name (alist->getValue (i));
00540             }
00541           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0)
00542             {
00543               if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0)
00544                 {
00545                   info->active (0);
00546                 }
00547               else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0)
00548                 {
00549                   info->active (1);
00550                 }
00551               else
00552                 {
00553                   ACEXML_THROW_RETURN (ACEXML_SAXException (ACE_TEXT ("Invalid attribute value, expecting 'active' or 'inactive'\n")), -1);
00554                 }
00555             }
00556           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0)
00557             {
00558               if (ACE_OS_String::strcasecmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0)
00559                 {
00560                   info->service_type (ACE_Service_Type::SERVICE_OBJECT);
00561                 }
00562               else if (ACE_OS_String::strcasecmp (alist->getValue (i), ACE_TEXT ("stream")) == 0)
00563                 {
00564                   info->service_type (ACE_Service_Type::STREAM);
00565                 }
00566               else if (ACE_OS_String::strcasecmp (alist->getValue (i), ACE_TEXT ("module")) == 0)
00567                 {
00568                   info->service_type (ACE_Service_Type::MODULE);
00569                 }
00570               else
00571                 {
00572                   ACEXML_THROW_RETURN (ACEXML_SAXException (ACE_TEXT ("Invalid Service_Object attribute value\n")), -1);
00573                 }
00574             }
00575           else
00576             {
00577               ACEXML_THROW_RETURN(ACEXML_SAXException(ACE_TEXT ("Invalid attribute\n")), -1);
00578             }
00579         }
00580     }
00581   return 0;
00582 }
00583 
00584 int
00585 ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00586 {
00587   if (alist != 0)
00588     {
00589       ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00590                                &this->parsed_info_ :
00591                                &this->stream_info_);
00592       for (size_t i = 0; i < alist->getLength (); ++i)
00593         {
00594           if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0)
00595             {
00596               info->init_func (alist->getValue (i));
00597             }
00598           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0)
00599             {
00600               info->path (alist->getValue (i));
00601             }
00602           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
00603             {
00604               info->init_params (alist->getValue (i));
00605             }
00606           else
00607             {
00608               ACEXML_THROW_RETURN (ACEXML_SAXException (ACE_TEXT ("Invalid initializer attribute.\n")), -1);
00609             }
00610         }
00611     }
00612   return 0;
00613 }
00614 
00615 int
00616 ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
00617 {
00618   if (alist != 0)
00619     {
00620       ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00621                                &this->parsed_info_ :
00622                                &this->stream_info_);
00623       for (size_t i = 0; i < alist->getLength (); ++i)
00624         {
00625           if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00626             {
00627               info->name (alist->getValue (i));
00628             }
00629           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
00630             {
00631               info->init_params (alist->getValue (i));
00632             }
00633           else
00634             {
00635               ACEXML_THROW_RETURN (ACEXML_SAXException (ACE_TEXT ("Invalid static attribute.\n")), -1);
00636             }
00637         }
00638     }
00639   return 0;
00640 }
00641 
00642 #endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */

Generated on Mon Jun 16 13:23:26 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002