From 66af4eaefa801c7fb573e5a584b935e16a22efc2 Mon Sep 17 00:00:00 2001 From: nanbor Date: Thu, 25 Apr 2002 05:51:51 +0000 Subject: ChangeLogTag:Thu Apr 25 00:31:57 2002 Nanbor Wang --- ACEXML/apps/XML_Apps.dsw | 29 ++ ACEXML/apps/svcconf/README | 4 + ACEXML/apps/svcconf/Svcconf.cpp | 95 ++++++ ACEXML/apps/svcconf/Svcconf.h | 46 +++ ACEXML/apps/svcconf/Svcconf_Handler.cpp | 495 ++++++++++++++++++++++++++++ ACEXML/apps/svcconf/Svcconf_Handler.h | 305 +++++++++++++++++ ACEXML/apps/svcconf/Svcconf_Handler.i | 133 ++++++++ ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp | 119 +++++++ ace/OS.h | 20 +- ace/Service_Config.cpp | 47 ++- ace/Service_Config.h | 5 + ace/XML_Svc_Conf.cpp | 7 + ace/XML_Svc_Conf.h | 53 +++ ace/ace_dll.dsp | 22 +- ace/ace_lib.dsp | 16 +- ace/config-all.h | 9 + tests/Service_Config_Test.conf.xml | 27 ++ tests/Service_Config_Test.cpp | 6 +- 18 files changed, 1418 insertions(+), 20 deletions(-) create mode 100644 ACEXML/apps/XML_Apps.dsw create mode 100644 ACEXML/apps/svcconf/README create mode 100644 ACEXML/apps/svcconf/Svcconf.cpp create mode 100644 ACEXML/apps/svcconf/Svcconf.h create mode 100644 ACEXML/apps/svcconf/Svcconf_Handler.cpp create mode 100644 ACEXML/apps/svcconf/Svcconf_Handler.h create mode 100644 ACEXML/apps/svcconf/Svcconf_Handler.i create mode 100644 ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp create mode 100644 ace/XML_Svc_Conf.cpp create mode 100644 ace/XML_Svc_Conf.h create mode 100644 tests/Service_Config_Test.conf.xml diff --git a/ACEXML/apps/XML_Apps.dsw b/ACEXML/apps/XML_Apps.dsw new file mode 100644 index 00000000000..0ed29a77e72 --- /dev/null +++ b/ACEXML/apps/XML_Apps.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "XML_Svc_Conf_Parser"=.\svcconf\XML_Svc_Conf_Parser.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/ACEXML/apps/svcconf/README b/ACEXML/apps/svcconf/README new file mode 100644 index 00000000000..8a39a40bfe3 --- /dev/null +++ b/ACEXML/apps/svcconf/README @@ -0,0 +1,4 @@ +$Id$ + +This directory implement a DLL that contains the parser for XML based +service configurator. diff --git a/ACEXML/apps/svcconf/Svcconf.cpp b/ACEXML/apps/svcconf/Svcconf.cpp new file mode 100644 index 00000000000..86b15fa65ac --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf.cpp @@ -0,0 +1,95 @@ +// $Id$ + + +#include "SvcConf.h" +#include "common/FileCharStream.h" +#include "common/StrCharStream.h" +#include "parser/parser/Parser.h" + +extern "C" ACE_Proper_Export_Flag ACE_XML_Svc_Conf * +_ACEXML_create_XML_Svc_Conf_Object (void) +{ + ACE_XML_Svc_Conf *retp = 0; + + ACE_NEW_RETURN (retp, + ACEXML_Svcconf_Parser (), + 0); + + return retp; +} + +ACEXML_Svcconf_Parser::ACEXML_Svcconf_Parser () +{ + this->parser_.setContentHandler (&this->svcconf_handler_); + this->parser_.setDTDHandler (&this->svcconf_handler_); + this->parser_.setErrorHandler (&this->svcconf_handler_); + this->parser_.setEntityResolver (&this->svcconf_handler_); +} + +ACEXML_Svcconf_Parser::~ACEXML_Svcconf_Parser () +{ + +} + +void * +ACEXML_Svcconf_Parser::operator new (size_t s) +{ + return ::new char[s]; +} + +void +ACEXML_Svcconf_Parser::operator delete (void *p) +{ + delete[] p; +} + +int +ACEXML_Svcconf_Parser::parse_file (const ACE_TCHAR file[]) +{ + if (file == 0) + ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: No filename specified\n"), -1); + + ACEXML_FileCharStream *fstm = 0; + ACE_NEW_RETURN (fstm, + ACEXML_FileCharStream (), + 1); + + if (fstm->open (file) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("ACEXML_Svcconf_Parser: Fail to open XML file: %s\n"), + file), + -1); + + this->input_stream_.setCharStream (fstm); + + this->parser_.parse (&this->input_stream_, this->env_); + if (this->env_.exception ()) + { + this->env_.exception ()->print (); + return -1; + } + return 0; +} + + +int +ACEXML_Svcconf_Parser::parse_string (const ACE_TCHAR str[]) +{ + if (str == 0) + ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: Can't parse a null string\n"), -1); + + ACEXML_StrCharStream *stm = 0; + ACE_NEW_RETURN (stm, + ACEXML_StrCharStream (str), + -1); + + this->input_stream_.setCharStream (stm); + + this->parser_.parse (&this->input_stream_, this->env_); + if (this->env_.exception ()) + { + this->env_.exception ()->print (); + return -1; + } + return 0; +} diff --git a/ACEXML/apps/svcconf/Svcconf.h b/ACEXML/apps/svcconf/Svcconf.h new file mode 100644 index 00000000000..0775658dac5 --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf.h @@ -0,0 +1,46 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Svcconf.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + + +#ifndef ACEXML_SVCCONF_H +#define ACEXML_SVCCONF_H + +#include "ace/pre.h" +#include "ace/XML_Svc_Conf.h" +#include "parser/parser/Parser.h" +#include "Svcconf_Handler.h" + + +class ACEXML_Svcconf_Parser : public ACE_XML_Svc_Conf +{ +public: + ACEXML_Svcconf_Parser (); + + virtual ~ACEXML_Svcconf_Parser (); + + virtual int parse_file (const ACE_TCHAR file[]); + + virtual int parse_string (const ACE_TCHAR str[]); + + void * operator new (size_t bytes); + + void operator delete (void *ptr); + +protected: + ACEXML_Parser parser_; + ACEXML_Svcconf_Handler svcconf_handler_; + ACEXML_InputSource input_stream_; + ACEXML_Env env_; +}; + +#include "ace/post.h" +#endif /* ACEXML_SVCCONF_H */ diff --git a/ACEXML/apps/svcconf/Svcconf_Handler.cpp b/ACEXML/apps/svcconf/Svcconf_Handler.cpp new file mode 100644 index 00000000000..8376c7e41d2 --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf_Handler.cpp @@ -0,0 +1,495 @@ +// -*- C++ -*- $Id$ + +#include "Svcconf_Handler.h" +#include "ace/ACE.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACEXML_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACEXML_INLINE__ */ + +ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler (void) + : in_stream_def_ (0), + in_module_ (0) +{ + // no-op +} + +ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler (void) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::characters (const ACEXML_Char *, + int, + int, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::endDocument (ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + if (this->in_stream_def_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"), + this->stream_info_.name ())); + } + else + { + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + if (this->in_stream_def_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create sttaic %s for stream\n"), + this->stream_info_.name ())); + } + else + { + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push static %s into stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply static %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_module_ = 0; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0 || + ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"), + this->stream_info_.name (), + this->stream_info_.name ())); + this->stream_info_.reset (); + } + else + { + } +} + +void +ACEXML_Svcconf_Handler::endPrefixMapping (const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *, + int, + int, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::processingInstruction (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::setDocumentLocator (ACEXML_Locator *, + ACEXML_Env &) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::skippedEntity (const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::startDocument (ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // no-op +} + +void +ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName, + ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0) + { + this->get_dynamic_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("initializer")) == 0) + { + this->get_initializer_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0) + { + this->get_static_attrs (alist, xmlenv); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0) + { + this->get_stream_id (alist, xmlenv); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Retrieve stream %s from repository\n"), + this->stream_info_.name ())); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0) + { + this->in_stream_def_ = 1; + // @@ Set up stream service object + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0) + { + this->in_stream_def_ = 0; + this->in_module_ = 1; + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("resume")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("suspend")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("remove")) == 0) + { + this->get_id (alist, xmlenv); + if (this->in_module_) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s in stream %s\n"), + this->parsed_info_.name (), + this->stream_info_.name ())); + } + else + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s\n"), + this->parsed_info_.name ())); + } + this->parsed_info_.reset (); + } + else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("ACE_Svc_Conf")) == 0) + { + // Main document tag. no-op. + ACE_DEBUG ((LM_INFO, ACE_TEXT ("ACE_Svc_Conf tag\n"))); + } + else + { + // @@ Error. Perhaps we should relay to user event handler here, if available. + } + + return; + + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT (" %s = \"%s\""), + alist->getQName (i), alist->getValue (i))); + } + ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT (">"))); +} + +void +ACEXML_Svcconf_Handler::startPrefixMapping (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// *** Methods inherit from ACEXML_DTDHandler. + +void +ACEXML_Svcconf_Handler::notationDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// Methods inherit from ACEXML_EnitityResolver. + +ACEXML_InputSource * +ACEXML_Svcconf_Handler::resolveEntity (const ACEXML_Char *, + const ACEXML_Char *, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. + return 0; +} + +// Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ +void +ACEXML_Svcconf_Handler::error (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::fatalError (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_Svcconf_Handler::warning (ACEXML_SAXParseException &, + ACEXML_Env &) + // ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +int +ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->stream_info_.name (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + this->parsed_info_.name (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0) + { + if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0) + { + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0) + { + } + else + { + // @@ error, invalid 'status' value. + } + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0) + { + if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0) + { + info->service_type (ACE_Parsed_Info::SERVICE_OBJECT_TYPE); + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("stream")) == 0) + { + info->service_type (ACE_Parsed_Info::STREAM_TYPE); + } + else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("module")) == 0) + { + info->service_type (ACE_Parsed_Info::MODULE_TYPE); + } + else + { + // @@ error, invalid 'type' value. + } + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0) + { + info->init_func (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0) + { + info->path (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} + +int +ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv) +{ + if (alist != 0) + { + ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ? + &this->parsed_info_ : + &this->stream_info_); + for (size_t i = 0; i < alist->getLength (); ++i) + { + if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0) + { + info->name (alist->getValue (i)); + } + else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0) + { + info->init_params (alist->getValue (i)); + } + else + { + // @@ Exception... + return -1; + } + } + } + return 0; +} diff --git a/ACEXML/apps/svcconf/Svcconf_Handler.h b/ACEXML/apps/svcconf/Svcconf_Handler.h new file mode 100644 index 00000000000..1cff80eee87 --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf_Handler.h @@ -0,0 +1,305 @@ +// $Id$ + +//============================================================================= +/** + * @file Svcconf_Handler.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + +#ifndef ACEXML_SVCCONF_HANDLER_H +#define ACEXML_SVCCONF_HANDLER_H + +#include "common/DefaultHandler.h" + +class ACE_Parsed_Info +{ +public: + typedef enum { + MODULE_TYPE, + SERVICE_OBJECT_TYPE, + STREAM_TYPE, + INVALID_TYPE + } Service_Type; + + ACE_Parsed_Info (); + ~ACE_Parsed_Info (); + + /** + * Set/get name of a parsed entity. + */ + int name (const ACEXML_Char *n); + const ACEXML_Char *name (void); + + /** + * Set/get type of a dynamic node. + */ + int service_type (Service_Type type); + Service_Type service_type (void); + + /** + * Set/Get active status. + */ + int active (int a); + int active (void); + + /** + * Set/get initializer path. + */ + int path (const ACEXML_Char *n); + const ACEXML_Char *path (void); + + /** + * Set/get initializer init function. + */ + int init_func (const ACEXML_Char *n); + const ACEXML_Char *init_func (void); + + /** + * Set/get initializer init parameter. + */ + int init_params (const ACEXML_Char *n); + const ACEXML_Char *init_params (void); + + /** + * Reset Parsed_Info. + */ + void reset (void); + +protected: + ACEXML_Char *name_; + Service_Type service_type_; + int active_; + ACEXML_Char *path_; + ACEXML_Char *init_func_; + ACEXML_Char *init_params_; +}; + +/** + * @class ACEXML_Svcconf_Handler + * + * @brief ACEXML_Svcconf_Handler is an example SAX event handler. + * + * This SAX event handler try to regenerate the XML document it + * reads with correct indentation. + */ +class ACEXML_Svcconf_Handler : public ACEXML_DefaultHandler +{ +public: + /* + * Default constructor. + */ + ACEXML_Svcconf_Handler (void); + + /* + * Default destructor. + */ + virtual ~ACEXML_Svcconf_Handler (void); + + // Methods inherit from ACEXML_ContentHandler. + + /* + * Receive notification of character data. + */ + virtual void characters (const ACEXML_Char *ch, + int start, + int length, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of a document. + */ + virtual void endDocument (ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * End the scope of a prefix-URI mapping. + */ + virtual void endPrefixMapping (const ACEXML_Char *prefix, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of ignorable whitespace in element content. + */ + virtual void ignorableWhitespace (const ACEXML_Char *ch, + int start, + int length, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a processing instruction. + */ + virtual void processingInstruction (const ACEXML_Char *target, + const ACEXML_Char *data, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive an object for locating the origin of SAX document events. + */ + virtual void setDocumentLocator (ACEXML_Locator *locator, + ACEXML_Env &xmlenv) ; + + /* + * Receive notification of a skipped entity. + */ + virtual void skippedEntity (const ACEXML_Char *name, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of a document. + */ + virtual void startDocument (ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Begin the scope of a prefix-URI Namespace mapping. + */ + virtual void startPrefixMapping (const ACEXML_Char *prefix, + const ACEXML_Char *uri, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // *** Methods inherit from ACEXML_DTDHandler. + + /* + * Receive notification of a notation declaration event. + */ + virtual void notationDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of an unparsed entity declaration event. + */ + virtual void unparsedEntityDecl (const ACEXML_Char *name, + const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + const ACEXML_Char *notationName, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_EnitityResolver. + + /* + * Allow the application to resolve external entities. + */ + virtual ACEXML_InputSource *resolveEntity (const ACEXML_Char *publicId, + const ACEXML_Char *systemId, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + // Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ + virtual void error (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a non-recoverable error. + */ + virtual void fatalError (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of a warning. + */ + virtual void warning (ACEXML_SAXParseException &exception, + ACEXML_Env &xmlenv) + // ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + +protected: + /** + * Get the only attribute in or . + */ + int get_stream_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the only attribute in , , + */ + int get_id (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the dynamic tag attributes. + */ + int get_dynamic_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the initializer tag attributes. + */ + int get_initializer_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + + /** + * Get the static tag attributes. + */ + int get_static_attrs (ACEXML_Attributes *alist, + ACEXML_Env &xmlenv); + +private: + /// We are parsing a stream definition + int in_stream_def_; + + /// We are defining a steam module + int in_module_; + + ACE_Parsed_Info parsed_info_; + + ACE_Parsed_Info stream_info_; +}; + +#if defined (__ACEXML_INLINE__) +# include "Svcconf_Handler.i" +#endif /* __ACEXML_INLINE__ */ +#endif /* ACEXML_SVCCONF_HANDLER_H */ diff --git a/ACEXML/apps/svcconf/Svcconf_Handler.i b/ACEXML/apps/svcconf/Svcconf_Handler.i new file mode 100644 index 00000000000..fb6ea3db2ce --- /dev/null +++ b/ACEXML/apps/svcconf/Svcconf_Handler.i @@ -0,0 +1,133 @@ +// -*- C++ -*- $Id$ + +ACE_INLINE +ACE_Parsed_Info::ACE_Parsed_Info () + : name_ (0), + service_type_ (INVALID_TYPE), + active_ (1), + path_ (0), + init_func_ (0), + init_params_ (0) +{ +} + +ACE_INLINE +ACE_Parsed_Info::~ACE_Parsed_Info () +{ + delete this->name_; + delete this->path_; + delete this->init_func_; + delete this->init_params_; +} + +ACE_INLINE int +ACE_Parsed_Info::name (const ACEXML_Char *n) +{ + if (this->name_ == 0) + { + this->name_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::name (void) +{ + return this->name_; +} + +ACE_INLINE int +ACE_Parsed_Info::service_type (Service_Type type) +{ + if (this->service_type_ == INVALID_TYPE) + { + this->service_type_ = type; + return 0; + } + return -1; +} + +ACE_INLINE ACE_Parsed_Info::Service_Type +ACE_Parsed_Info::service_type (void) +{ + return this->service_type_; +} + +ACE_INLINE int +ACE_Parsed_Info::active (int a) +{ + this->active_ = a; + return 0; +} + +ACE_INLINE int +ACE_Parsed_Info::active (void) +{ + return this->active_; +} + +ACE_INLINE int +ACE_Parsed_Info::path (const ACEXML_Char *p) +{ + if (this->path_ == 0) + { + this->path_ = ACE::strnew (p); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::path (void) +{ + return this->path_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_func (const ACEXML_Char *n) +{ + if (this->init_func_ == 0) + { + this->init_func_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_func (void) +{ + return this->init_func_; +} + +ACE_INLINE int +ACE_Parsed_Info::init_params (const ACEXML_Char *n) +{ + if (this->init_params_ == 0) + { + this->init_params_ = ACE::strnew (n); + return 0; + } + return -1; +} + +ACE_INLINE const ACEXML_Char * +ACE_Parsed_Info::init_params (void) +{ + return this->init_params_; +} + +ACE_INLINE void +ACE_Parsed_Info::reset (void) +{ + delete this->name_; + this->name_ = 0; + this->service_type_ = INVALID_TYPE; + delete this->path_; + this->path_ = 0; + delete this->init_func_; + this->init_func_ = 0; + delete this->init_params_; + this->init_params_ = 0; +} diff --git a/ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp b/ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp new file mode 100644 index 00000000000..1560ec4e6de --- /dev/null +++ b/ACEXML/apps/svcconf/XML_Svc_Conf_Parser.dsp @@ -0,0 +1,119 @@ +# Microsoft Developer Studio Project File - Name="XML_Svc_Conf_Parser" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=XML_Svc_Conf_Parser - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "XML_Svc_Conf_Parser.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "XML_Svc_Conf_Parser.mak" CFG="XML_Svc_Conf_Parser - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "XML_Svc_Conf_Parser - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "XML_Svc_Conf_Parser - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "XML_Svc_Conf_Parser - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_SVC_CONF_PARSER_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /I "..\.." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 ace.lib ACEXML.lib ACEXML_Parser.lib /nologo /dll /machine:I386 /out:"..\..\..\bin\ACEXML_XML_Svc_Conf_Parser.dll" /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser" + +!ELSEIF "$(CFG)" == "XML_Svc_Conf_Parser - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "XML_Svc_Conf_Parser___Win32_Debug" +# PROP BASE Intermediate_Dir "XML_Svc_Conf_Parser___Win32_Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_SVC_CONF_PARSER_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\.." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 aced.lib ACEXMLd.lib ACEXML_Parserd.lib /nologo /dll /debug /machine:I386 /out:"..\..\..\bin\ACEXML_XML_Svc_Conf_Parserd.dll" /pdbtype:sept /libpath:"..\..\..\ace" /libpath:"..\..\Common" /libpath:"..\..\parser\parser" + +!ENDIF + +# Begin Target + +# Name "XML_Svc_Conf_Parser - Win32 Release" +# Name "XML_Svc_Conf_Parser - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\Svcconf.cpp +# End Source File +# Begin Source File + +SOURCE=.\Svcconf_Handler.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\Svcconf.h +# End Source File +# Begin Source File + +SOURCE=.\Svcconf_Handler.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/ace/OS.h b/ace/OS.h index f545a3c64f5..58e8432eae6 100644 --- a/ace/OS.h +++ b/ace/OS.h @@ -389,7 +389,11 @@ typedef struct // Used for dynamic linking. # if !defined (ACE_DEFAULT_SVC_CONF) -# define ACE_DEFAULT_SVC_CONF "./svc.conf" +# if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF "./svc.conf" +# else +# define ACE_DEFAULT_SVC_CONF "./svc.conf.xml" +# endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF ==1 */ # endif /* ACE_DEFAULT_SVC_CONF */ # if !defined (ACE_DEFAULT_SEM_KEY) @@ -2584,7 +2588,7 @@ typedef unsigned int size_t; # if !defined (ACE_LACKS_NEW_H) # if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) # include /**/ -# else +# else # include /**/ # endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */ # endif /* ! ACE_LACKS_NEW_H */ @@ -2945,7 +2949,11 @@ typedef void (*ACE_SignalHandlerV)(...); // Used for dynamic linking # if !defined (ACE_DEFAULT_SVC_CONF) -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf") +# if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf") +# else +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT (".\\svc.conf.xml") +# endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF ==1 */ # endif /* ACE_DEFAULT_SVC_CONF */ // The following are #defines and #includes that are specific to @@ -3280,7 +3288,11 @@ typedef ACE_UINT64 ACE_hrtime_t; // Used for dynamic linking. # if !defined (ACE_DEFAULT_SVC_CONF) -# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf") +# if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf") +# else +# define ACE_DEFAULT_SVC_CONF ACE_LIB_TEXT ("./svc.conf.xml") +# endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF ==1 */ # endif /* ACE_DEFAULT_SVC_CONF */ // The following are #defines and #includes that are specific to UNIX. diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 7ed3629566c..499e86245de 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -14,6 +14,8 @@ #include "ace/Framework_Component.h" #include "ace/Service_Config.h" +#include "ace/XML_Svc_Conf.h" +#include "ace/Auto_Ptr.h" #if !defined (__ACE_INLINE__) #include "ace/Service_Config.i" @@ -323,6 +325,30 @@ ACE_Service_Config::process_directives_i (ACE_Svc_Conf_Param *param) else return 0; } +#else +ACE_XML_Svc_Conf * +ACE_Service_Config::get_xml_svc_conf (ACE_DLL &xmldll) +{ + xmldll.open (ACE_LIB_TEXT ("ACEXML_XML_Svc_Conf_Parser")); + + void *foo; + + // @@ Now this sucks.. Why can't we just pass the operation name to dll.symbol? + ACE_TCHAR *cdecl_str = ACE::ldname (ACE_TEXT ("_ACEXML_create_XML_Svc_Conf_Object")); + foo = xmldll.symbol (cdecl_str); + delete[] cdecl_str; + + // Cast the void* to long first. + long tmp = ACE_reinterpret_cast (long, foo); + ACE_XML_Svc_Conf::Factory factory = ACE_reinterpret_cast (ACE_XML_Svc_Conf::Factory, tmp); + if (factory == 0) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("%p\n"), + xmldll.error ()), + 0); + + return factory (); +} #endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ int @@ -357,9 +383,17 @@ ACE_Service_Config::process_file (const ACE_TCHAR file[]) (void) ACE_OS::fclose (fp); } -#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ - return result; +#else + ACE_DLL dll; + + auto_ptr xml_svc_conf (ACE_Service_Config::get_xml_svc_conf (dll)); + + if (xml_svc_conf.get () == 0) + return -1; + + return xml_svc_conf->parse_file (file); +#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ } int @@ -381,7 +415,14 @@ ACE_Service_Config::process_directive (const ACE_TCHAR directive[]) return result; #else - return -1; + ACE_DLL dll; + + auto_ptr xml_svc_conf (ACE_Service_Config::get_xml_svc_conf (dll)); + + if (xml_svc_conf.get () == 0) + return -1; + + return xml_svc_conf->parse_string (directive); #endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ } diff --git a/ace/Service_Config.h b/ace/Service_Config.h index 66c7d519158..5e2789e560e 100644 --- a/ace/Service_Config.h +++ b/ace/Service_Config.h @@ -24,6 +24,8 @@ #include "ace/Unbounded_Queue.h" #include "ace/Unbounded_Set.h" #include "ace/SString.h" +#include "ace/DLL.h" +#include "ace/XML_Svc_Conf.h" // Forward decl. class ACE_Service_Repository; @@ -362,6 +364,9 @@ protected: /// and process_directive() both call. Returns the number of errors /// that occurred. static int process_directives_i (ACE_Svc_Conf_Param *param); +#else + /// Helper function to dynamically link in the XML Service Configurator parser. + static ACE_XML_Svc_Conf *get_xml_svc_conf (ACE_DLL &d); #endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ /// Become a daemon. diff --git a/ace/XML_Svc_Conf.cpp b/ace/XML_Svc_Conf.cpp new file mode 100644 index 00000000000..d0ea8d3762e --- /dev/null +++ b/ace/XML_Svc_Conf.cpp @@ -0,0 +1,7 @@ +// $Id$ + +#include "ace/XML_Svc_Conf.h" + +ACE_XML_Svc_Conf::~ACE_XML_Svc_Conf (void) +{ +} diff --git a/ace/XML_Svc_Conf.h b/ace/XML_Svc_Conf.h new file mode 100644 index 00000000000..ae3f34ab1ae --- /dev/null +++ b/ace/XML_Svc_Conf.h @@ -0,0 +1,53 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file XML_Svc_Conf.h + * + * $Id$ + * + * @author Nanbor Wang + */ +//============================================================================= + + +#ifndef ACE_XML_SVC_CONF_H +#define ACE_XML_SVC_CONF_H + +#include "ace/pre.h" + +#include "ace/config-all.h" + +/** + * @class ACE_XML_Svc_Conf + * + * @brief This abstract class defines the common operations + * ACE_Service_Config expects when using the XML Service Config Parser. + * + * When implementing a concret XML_Svc_Conf class, be sure to overload + * the new/delete function so the dynamically created concret XML_Svc_Conf + * instance can be deleted from the original heap in the DLL/SO. The + * concret XML_Svc_Conf implementation will be put into a DLL/SO that + * ACE applications can link to dynamically using the ACE_DLL class. + * This DLL should include an operation as follow: + * + * extern "C" ACE_XML_Svc_Conf_Parser * _ACEXML_create_XML_Svc_Conf_Object (void); + * + * + */ +class ACE_Export ACE_XML_Svc_Conf +{ +public: + typedef ACE_XML_Svc_Conf *(*Factory)(void); + + virtual ~ACE_XML_Svc_Conf (void) = 0; + + virtual int parse_file (const ACE_TCHAR file[]) = 0; + + virtual int parse_string (const ACE_TCHAR str[]) = 0; +}; + + +#include "ace/post.h" + +#endif /* ACE_XML_SVC_CONF_H */ diff --git a/ace/ace_dll.dsp b/ace/ace_dll.dsp index 6a3fd01e911..3c5073f0d82 100644 --- a/ace/ace_dll.dsp +++ b/ace/ace_dll.dsp @@ -7,21 +7,21 @@ CFG=ACE DLL - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "ace_dll.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "ace_dll.mak" CFG="ACE DLL - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "ACE DLL - Win32 MFC Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "ACE DLL - Win32 MFC Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "ACE DLL - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "ACE DLL - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -149,7 +149,7 @@ LINK32=link.exe # ADD LINK32 advapi32.lib user32.lib /nologo /subsystem:windows /dll /pdb:".\aced.pdb" /debug /machine:I386 /out:"..\bin\aced.dll" # SUBTRACT LINK32 /pdb:none -!ENDIF +!ENDIF # Begin Target @@ -1050,6 +1050,10 @@ SOURCE=.\WIN32_Proactor.cpp # End Source File # Begin Source File +SOURCE=.\XML_Svc_Conf.cpp +# End Source File +# Begin Source File + SOURCE=.\XtReactor.cpp # End Source File # End Group @@ -2242,6 +2246,10 @@ SOURCE=.\WIN32_Proactor.h # End Source File # Begin Source File +SOURCE=.\XML_Svc_Conf.h +# End Source File +# Begin Source File + SOURCE=.\XtReactor.h # End Source File # End Group diff --git a/ace/ace_lib.dsp b/ace/ace_lib.dsp index 6b378b52099..13d376dc851 100644 --- a/ace/ace_lib.dsp +++ b/ace/ace_lib.dsp @@ -42,8 +42,8 @@ RSC=rc.exe # PROP Output_Dir "" # PROP Intermediate_Dir ".\LIB\Release" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /MD /W3 /GX /O1 /I "../" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c # SUBTRACT BASE CPP /YX # ADD CPP /nologo /MT /W3 /GX /O1 /I "../" /I "../PACE" /D ACE_OS_HAS_DLL=0 /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c @@ -69,8 +69,8 @@ LIB32=link.exe -lib # PROP Output_Dir "" # PROP Intermediate_Dir ".\LIB\Debug" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /FD /c # SUBTRACT BASE CPP /YX # ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /Gy /I "../" /I "../PACE" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D ACE_OS_HAS_DLL=0 /FD /c @@ -96,8 +96,8 @@ LIB32=link.exe -lib # PROP Output_Dir "" # PROP Intermediate_Dir ".\LIB\Release" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /G5 /MT /W3 /GX /O1 /I "../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /Zi /O1 /I "../" /I "../PACE" /D "_WINDOWS" /D "NDEBUG" /D "ACE_AS_STATIC_LIBS" /D "WIN32" /FD /c # SUBTRACT CPP /YX @@ -122,8 +122,8 @@ LIB32=link.exe -lib # PROP Output_Dir "" # PROP Intermediate_Dir ".\LIB\Debug" # PROP Target_Dir "" -MTL=midl.exe LINK32=link.exe -lib +MTL=midl.exe # ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /Zi /Od /Gy /I "../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D ACE_HAS_DLL=0 /D "ACE_NO_INLINE" /YX /FD /c # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /Gy /I "../" /I "../PACE" /D "_WINDOWS" /D "_DEBUG" /D "ACE_AS_STATIC_LIBS" /D "WIN32" /FD /c # SUBTRACT CPP /YX @@ -1041,6 +1041,10 @@ SOURCE=.\WIN32_Proactor.cpp # End Source File # Begin Source File +SOURCE=.\XML_Svc_Conf.cpp +# End Source File +# Begin Source File + SOURCE=.\XtReactor.cpp # End Source File # End Group @@ -2237,6 +2241,10 @@ SOURCE=.\WIN32_Proactor.h # End Source File # Begin Source File +SOURCE=.\XML_Svc_Conf.h +# End Source File +# Begin Source File + SOURCE=.\XtReactor.h # End Source File # End Group diff --git a/ace/config-all.h b/ace/config-all.h index 5f8551f38fc..d6423835c42 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -632,6 +632,15 @@ typedef void *(*ACE_THR_C_FUNC)(void *); # endif /* ACE_HAS_XML_SVC_CONF */ #endif /* ACE_USES_CLASSIC_SVC_CONF */ +// ============================================================================ +// Default svc.conf file extension. +// ============================================================================ +#if defined (ACE_USES_CLASSIC_SVC_CONF) && (ACE_USES_CLASSIC_SVC_CONF == 1) +# define ACE_DEFAULT_SVC_CONF_EXT ".conf" +#else +# define ACE_DEFAULT_SVC_CONF_EXT ".conf.xml" +#endif /* ACE_USES_CLASSIC_SVC_CONF && ACE_USES_CLASSIC_SVC_CONF == 1 */ + // ============================================================================ // Miscellaneous macros // ============================================================================ diff --git a/tests/Service_Config_Test.conf.xml b/tests/Service_Config_Test.conf.xml new file mode 100644 index 00000000000..7c5d2430a10 --- /dev/null +++ b/tests/Service_Config_Test.conf.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Service_Config_Test.cpp b/tests/Service_Config_Test.cpp index d47a0b661f9..69774d03c64 100644 --- a/tests/Service_Config_Test.cpp +++ b/tests/Service_Config_Test.cpp @@ -134,10 +134,12 @@ run_test (int argc, ACE_TCHAR *argv[]) // Byte ordering is also an issue, so we should be // generating this file on-the-fly from the UTF-8 encoded // file by using functions like iconv(1) or iconv(3). - ACE_TEXT ("Service_Config_Test.UTF-16.conf"); + ACE_TEXT ("Service_Config_Test.UTF-16") + ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); #else // ASCII (UTF-8) encoded Service Configurator file. - ACE_TEXT ("Service_Config_Test.conf"); + ACE_TEXT ("Service_Config_Test") + ACE_TEXT (ACE_DEFAULT_SVC_CONF_EXT); #endif /* ACE_USES_WCHAR */ // Process the Service Configurator directives in this test's -- cgit v1.2.1