summaryrefslogtreecommitdiff
path: root/ACE/ACEXML/apps
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/ACEXML/apps')
-rw-r--r--ACE/ACEXML/apps/Makefile.am13
-rw-r--r--ACE/ACEXML/apps/svcconf/ACEXML_XML_Svc_Conf_Parser.pc.in11
-rw-r--r--ACE/ACEXML/apps/svcconf/Makefile.am79
-rw-r--r--ACE/ACEXML/apps/svcconf/README4
-rw-r--r--ACE/ACEXML/apps/svcconf/Svcconf.cpp124
-rw-r--r--ACE/ACEXML/apps/svcconf/Svcconf.h44
-rw-r--r--ACE/ACEXML/apps/svcconf/Svcconf_Handler.cpp770
-rw-r--r--ACE/ACEXML/apps/svcconf/Svcconf_Handler.h276
-rw-r--r--ACE/ACEXML/apps/svcconf/Svcconf_Handler.inl133
-rw-r--r--ACE/ACEXML/apps/svcconf/svcconf.dtd60
-rw-r--r--ACE/ACEXML/apps/svcconf/svcconf.mpc6
11 files changed, 1520 insertions, 0 deletions
diff --git a/ACE/ACEXML/apps/Makefile.am b/ACE/ACEXML/apps/Makefile.am
new file mode 100644
index 00000000000..7f7bf963687
--- /dev/null
+++ b/ACE/ACEXML/apps/Makefile.am
@@ -0,0 +1,13 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
+
+SUBDIRS = \
+ svcconf
+
diff --git a/ACE/ACEXML/apps/svcconf/ACEXML_XML_Svc_Conf_Parser.pc.in b/ACE/ACEXML/apps/svcconf/ACEXML_XML_Svc_Conf_Parser.pc.in
new file mode 100644
index 00000000000..3cda818ca76
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/ACEXML_XML_Svc_Conf_Parser.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: ACEXML_XML_Svc_Conf_Parser
+Description: ACE XML Service Configurator Parser
+Requires: ACEXML_Parser
+Version: @VERSION@
+Libs: -L${libdir} -lACEXML_XML_Svc_Conf_Parser
+Cflags: -I${includedir}
diff --git a/ACE/ACEXML/apps/svcconf/Makefile.am b/ACE/ACEXML/apps/svcconf/Makefile.am
new file mode 100644
index 00000000000..2464ab3ad33
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/Makefile.am
@@ -0,0 +1,79 @@
+## Process this file with automake to create Makefile.in
+##
+## $Id$
+##
+## This file was generated by MPC. Any changes made directly to
+## this file will be lost the next time it is generated.
+##
+## MPC Command:
+## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
+
+includedir = @includedir@/ACEXML/apps/svcconf
+
+ACE_BUILDDIR = $(top_builddir)
+ACE_ROOT = $(top_srcdir)
+
+
+## Makefile.ACEXML_XML_Svc_Conf_Parser.am
+
+if BUILD_ACEXML
+if !BUILD_ACE_FOR_TAO
+
+lib_LTLIBRARIES = libACEXML_XML_Svc_Conf_Parser.la
+
+libACEXML_XML_Svc_Conf_Parser_la_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR) \
+ -I$(ACE_ROOT)/ACEXML/common
+
+if BUILD_ZLIB
+if BUILD_ZZIP
+libACEXML_XML_Svc_Conf_Parser_la_CPPFLAGS += \
+ $(ACE_ZZIP_CPPFLAGS) \
+ $(ACE_ZLIB_CPPFLAGS)
+endif BUILD_ZZIP
+endif BUILD_ZLIB
+
+libACEXML_XML_Svc_Conf_Parser_la_SOURCES = \
+ Svcconf.cpp \
+ Svcconf_Handler.cpp
+
+libACEXML_XML_Svc_Conf_Parser_la_LDFLAGS = \
+ -release @ACE_VERSION_NAME@
+
+if BUILD_ZLIB
+if BUILD_ZZIP
+libACEXML_XML_Svc_Conf_Parser_la_LDFLAGS += \
+ $(ACE_ZZIP_LDFLAGS) \
+ $(ACE_ZLIB_LDFLAGS)
+endif BUILD_ZZIP
+endif BUILD_ZLIB
+
+libACEXML_XML_Svc_Conf_Parser_la_LIBADD = \
+ $(ACE_BUILDDIR)/ACEXML/parser/parser/libACEXML_Parser.la \
+ $(ACE_BUILDDIR)/ACEXML/common/libACEXML.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+if BUILD_ZLIB
+if BUILD_ZZIP
+libACEXML_XML_Svc_Conf_Parser_la_LIBADD += \
+ $(ACE_ZZIP_LIBS) \
+ $(ACE_ZLIB_LIBS)
+endif BUILD_ZZIP
+endif BUILD_ZLIB
+
+nobase_include_HEADERS = \
+ Svcconf.h \
+ Svcconf_Handler.h \
+ Svcconf_Handler.inl
+
+endif !BUILD_ACE_FOR_TAO
+endif BUILD_ACEXML
+
+## Clean up template repositories, etc.
+clean-local:
+ -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
+ -rm -f gcctemp.c gcctemp so_locations *.ics
+ -rm -rf cxx_repository ptrepository ti_files
+ -rm -rf templateregistry ir.out
+ -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/ACEXML/apps/svcconf/README b/ACE/ACEXML/apps/svcconf/README
new file mode 100644
index 00000000000..8a39a40bfe3
--- /dev/null
+++ b/ACE/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/ACE/ACEXML/apps/svcconf/Svcconf.cpp b/ACE/ACEXML/apps/svcconf/Svcconf.cpp
new file mode 100644
index 00000000000..7fd69046ec3
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/Svcconf.cpp
@@ -0,0 +1,124 @@
+// $Id$
+
+
+#include "Svcconf.h"
+#include "ACEXML/common/FileCharStream.h"
+#include "ACEXML/common/StrCharStream.h"
+#include "ACEXML/parser/parser/Parser.h"
+
+#if (ACE_USES_CLASSIC_SVC_CONF == 0)
+
+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_TRY_NEW_ENV
+ {
+ this->parser_.setFeature (ACE_TEXT ("http://xml.org/sax/features/validation"),
+ 0
+ ACEXML_ENV_ARG_PARAMETER);
+ ACEXML_TRY_CHECK;
+ }
+ ACEXML_CATCH (ACEXML_SAXException, ex)
+ {
+ ex.print (); // Can't do much except printing the error.
+ return;
+ }
+ ACEXML_ENDTRY;
+}
+
+ACEXML_Svcconf_Parser::~ACEXML_Svcconf_Parser ()
+{
+
+}
+
+
+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);
+
+ ACEXML_TRY_NEW_ENV
+ {
+ this->parser_.parse (&this->input_stream_ ACEXML_ENV_ARG_PARAMETER);
+ ACEXML_TRY_CHECK;
+ }
+ ACEXML_CATCH (ACEXML_SAXException, ex)
+ {
+ ex.print ();
+ return -1;
+ }
+ ACEXML_ENDTRY;
+ 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, -1);
+ if (stm->open (str, ACE_TEXT ("Svcconf")) < 0)
+ ACE_ERROR_RETURN ((LM_ERROR, "ACEXML_Svcconf_Parser: Unable to create "
+ "input stream.\n"), -1);
+
+ this->input_stream_.setCharStream (stm);
+ ACEXML_TRY_NEW_ENV
+ {
+ this->parser_.parse (&this->input_stream_ ACEXML_ENV_ARG_PARAMETER);
+ ACEXML_TRY_CHECK;
+ }
+ ACEXML_CATCH (ACEXML_SAXException, ex)
+ {
+ // If there was a problem parsing the stream, set the errno
+ // to EINVAL to indicate to upper levels that the stream was
+ // invalid.
+ ACE_OS::last_error (EINVAL);
+ ex.print ();
+ return -1;
+ }
+ ACEXML_ENDTRY;
+ return 0;
+}
+
+#else
+
+# if defined (_AIX) && \
+ (defined (__IBMCPP__) && (__IBMCPP__ >= 500) && (__IBMCPP__ < 600))
+// This simply shuts up the AIX linker that complains there are no
+// csects or exported symbols when building with Visual Age C++ 5.
+extern "C" void ace_shut_up_aix_ld (void) {};
+# endif /* AIX && __IBMCPP__ == 500 */
+
+#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
diff --git a/ACE/ACEXML/apps/svcconf/Svcconf.h b/ACE/ACEXML/apps/svcconf/Svcconf.h
new file mode 100644
index 00000000000..9879776fce5
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/Svcconf.h
@@ -0,0 +1,44 @@
+/* -*- C++ -*- */
+
+//=============================================================================
+/**
+ * @file Svcconf.h
+ *
+ * $Id$
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+
+#ifndef ACEXML_SVCCONF_H
+#define ACEXML_SVCCONF_H
+
+#include /**/ "ace/pre.h"
+#include "ace/XML_Svc_Conf.h"
+#include "ACEXML/parser/parser/Parser.h"
+#include "Svcconf_Handler.h"
+
+#if (ACE_USES_CLASSIC_SVC_CONF == 0)
+
+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[]);
+
+protected:
+ ACEXML_Parser parser_;
+ ACEXML_Svcconf_Handler svcconf_handler_;
+ ACEXML_InputSource input_stream_;
+};
+
+#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
+
+#include /**/ "ace/post.h"
+#endif /* ACEXML_SVCCONF_H */
diff --git a/ACE/ACEXML/apps/svcconf/Svcconf_Handler.cpp b/ACE/ACEXML/apps/svcconf/Svcconf_Handler.cpp
new file mode 100644
index 00000000000..7bfc3a421ed
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/Svcconf_Handler.cpp
@@ -0,0 +1,770 @@
+// $Id$
+
+#include "Svcconf_Handler.h"
+#include "ace/ACE.h"
+#include "ace/Log_Msg.h"
+#include "ace/Service_Config.h"
+#include "ace/Service_Types.h"
+#include "ace/Service_Repository.h"
+#include "ace/Service_Gestalt.h"
+#include "ace/DLL.h"
+#include "ace/ARGV.h"
+#include "ace/Module.h"
+#include "ace/OS_NS_strings.h"
+#include "ace/SString.h"
+
+#if (ACE_USES_CLASSIC_SVC_CONF == 0)
+
+#if !defined (__ACEXML_INLINE__)
+# include "Svcconf_Handler.inl"
+#endif /* __ACEXML_INLINE__ */
+
+ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler (void)
+ : in_stream_def_ (0),
+ in_module_ (0),
+ stream_svc_type_ (0),
+ stream_ (0)
+{
+ // no-op
+}
+
+ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler (void)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::characters (const ACEXML_Char *,
+ int,
+ int ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::endDocument ( ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::endElement (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *qName ACEXML_ENV_ARG_DECL)
+{
+ if (ACE_OS::strcmp (qName, ACE_TEXT ("dynamic")) == 0)
+ {
+ ACE_Parsed_Info *active_info = (this->in_stream_def_ == 0 ?
+ &this->parsed_info_ :
+ &this->stream_info_);
+
+ // We must allocate a string here to ensure that the
+ // name is still available by the time the
+ // ACE_Service_Type_Dynamic_Guard is destructed.
+ ACE_TString name = active_info->name ();
+ ACE_Service_Type_Dynamic_Guard dummy (
+ *ACE_Service_Config::current ()->current_service_repository (),
+ name.c_str ());
+ ACE_DLL svc_dll;
+
+ if (svc_dll.open (active_info->path ()) == -1)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Cannot locate DLL: '"));
+ msg += ACE_CString (ACE_TEXT (active_info->path ()));
+ msg += ACE_CString (ACE_TEXT ("' for entity '"));
+ msg += ACE_CString (ACE_TEXT (active_info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+
+ void *(*func) (ACE_Service_Object_Exterminator *) = 0;
+ ACE_Service_Object_Exterminator gobbler = 0;
+ void *symbol = 0;
+
+ long temp_ptr =
+ reinterpret_cast<long> (svc_dll.symbol (active_info->init_func ()));
+ func = reinterpret_cast<void *(*)(ACE_Service_Object_Exterminator *)> (temp_ptr);
+
+ if (func == 0)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Cannot locate init function: '"));
+ msg += ACE_CString (ACE_TEXT (active_info->init_func ()));
+ msg += ACE_CString (ACE_TEXT ("' for entity '"));
+ msg += ACE_CString (ACE_TEXT (active_info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+ symbol = (*func)(&gobbler); // target object created in the loaded DLL.
+
+ ACE_Service_Type_Impl *stp = ACE_Service_Config::create_service_type_impl
+ (active_info->name (),
+ active_info->service_type (),
+ symbol,
+ ACE_Service_Type::DELETE_THIS |
+ ACE_Service_Type::DELETE_OBJ,
+ gobbler);
+
+ if (this->in_stream_def_)
+ {
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"),
+// this->stream_info_.name ()));
+ if (active_info->service_type () == ACE_Service_Type::STREAM)
+ {
+ this->stream_ = (ACE_Stream_Type *) stp;
+ }
+ else
+ {
+ // We will not retain this stream
+ delete stp;
+
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Expecting Stream type in stream header"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (active_info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+
+ this->stream_svc_type_ =
+ ACE_Service_Config::create_service_type (this->stream_info_.name (),
+ this->stream_,
+ svc_dll,
+ this->stream_info_.active ());
+
+ }
+ else
+ {
+ if (this->in_module_)
+ {
+ ACE_ARGV args (active_info->init_params ());
+
+ ACE_Module_Type *mt = (ACE_Module_Type *) stp;
+
+ ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object ();
+
+ if (ACE_OS::strcmp (mp->name (), active_info->name ()) != 0)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"),
+ active_info->name (),
+ mp->name ()));
+ mp->name (active_info->name ());
+ }
+
+ if (mt->init (args.argc (), args.argv ()) == -1
+ || this->stream_->push (mt) == -1)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Error initializing module"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (active_info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+
+
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"),
+// this->parsed_info_.name (),
+// this->stream_info_.name ()));
+ }
+ else
+ {
+ ACE_Service_Type *stype =
+ ACE_Service_Config::create_service_type (active_info->name (),
+ stp,
+ svc_dll,
+ active_info->active ());
+ // @@ Check error here.
+
+ // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"),
+// this->parsed_info_.name ()));
+ if (ACE_Service_Config::initialize (stype,
+ active_info->init_params ()) == -1)
+ {
+ // If it did not initialize correctly, the
+ // ACE_Service_Config doesn't own this object
+ delete stype;
+
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Failed to initialize dynamic service"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (active_info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+ }
+ this->parsed_info_.reset ();
+ }
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("static")) == 0)
+ {
+ if (this->in_stream_def_)
+ {
+ // @@ Couldn't make sense out of the original Svc_Conf.y.
+ ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Create static %s for stream\n"),
+ this->stream_info_.name ()));
+ }
+ else
+ {
+ if (this->in_module_)
+ {
+ // @@ Couldn't make sense out of the original Svc_Conf.y.
+ ACE_DEBUG ((LM_ERROR, 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 ()));
+ if (ACE_Service_Config::initialize (this->parsed_info_.name (),
+ this->parsed_info_.init_params ()) == -1)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Failed to initialize static service"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+ }
+ this->parsed_info_.reset ();
+ }
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("module")) == 0)
+ {
+ this->in_module_ = 0;
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("streamdef")) == 0)
+ {
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"),
+// this->stream_info_.name (),
+// this->stream_info_.name ()));
+ ACE_Service_Config::initialize (this->stream_svc_type_,
+ this->stream_info_.init_params ());
+
+ this->stream_info_.reset ();
+ this->stream_svc_type_ = 0;
+ this->stream_ = 0;
+ }
+ else if (ACE_OS::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_ARG_DECL_NOT_USED)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::ignorableWhitespace (const ACEXML_Char *,
+ int,
+ int ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::processingInstruction (const ACEXML_Char *,
+ const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::setDocumentLocator (ACEXML_Locator* locator)
+{
+ this->locator_ = locator;
+}
+
+void
+ACEXML_Svcconf_Handler::skippedEntity (const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::startDocument ( ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
+{
+ // no-op
+}
+
+void
+ACEXML_Svcconf_Handler::startElement (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *qName,
+ ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
+{
+ if (ACE_OS::strcmp (qName, ACE_TEXT ("dynamic")) == 0)
+ {
+ this->get_dynamic_attrs (alist ACEXML_ENV_ARG_PARAMETER);
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("initializer")) == 0)
+ {
+ this->get_initializer_attrs (alist ACEXML_ENV_ARG_PARAMETER);
+
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("static")) == 0)
+ {
+ this->get_static_attrs (alist ACEXML_ENV_ARG_PARAMETER);
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("stream")) == 0)
+ {
+ this->get_stream_id (alist ACEXML_ENV_ARG_PARAMETER);
+
+ if (ACE_Service_Repository::instance()->find
+ (this->stream_info_.name (),
+ (const ACE_Service_Type **) &this->stream_svc_type_) == -1)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Cannot find stream '"));
+ msg += ACE_CString (ACE_TEXT (this->stream_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+ this->stream_ = this->stream_svc_type_ == 0
+ ? 0
+ : dynamic_cast<ACE_Stream_Type *> (const_cast<ACE_Service_Type_Impl *> (this->stream_svc_type_->type ()));
+
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Retrieve stream %s from repository\n"),
+// this->stream_info_.name ()));
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("streamdef")) == 0)
+ {
+ this->in_stream_def_ = 1;
+ // @@ Set up stream service object
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("module")) == 0)
+ {
+ this->in_stream_def_ = 0;
+ this->in_module_ = 1;
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("resume")) == 0)
+ {
+ this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
+ if (this->in_module_)
+ {
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s in stream %s\n"),
+// this->parsed_info_.name (),
+// this->stream_info_.name ()));
+ ACE_Module_Type *mt = (this->stream_ == 0)
+ ? 0
+ : this->stream_->find (this->parsed_info_.name ());
+
+ if (mt == 0)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Can't locate module '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+
+ mt->resume ();
+ }
+ else
+ {
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Resume %s\n"),
+// this->parsed_info_.name ()));
+ if (ACE_Service_Config::resume (this->parsed_info_.name ()) == -1)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Resume failed"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+ }
+ this->parsed_info_.reset ();
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("suspend")) == 0)
+ {
+ this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
+ if (this->in_module_)
+ {
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s in stream %s\n"),
+// this->parsed_info_.name (),
+// this->stream_info_.name ()));
+ ACE_Module_Type *mt = (this->stream_ == 0)
+ ? 0
+ : this->stream_->find (this->parsed_info_.name ());
+
+ if (mt == 0)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Can't locate module '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+
+ mt->suspend ();
+ }
+ else
+ {
+ // ACE_DEBUG ((LM_INFO, ACE_TEXT ("Suspend %s\n"),
+ // this->parsed_info_.name ()));
+ if (ACE_Service_Config::suspend (this->parsed_info_.name ()) == -1)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Suspend failed"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+ }
+ this->parsed_info_.reset ();
+ }
+ else if (ACE_OS::strcmp (qName, ACE_TEXT ("remove")) == 0)
+ {
+ this->get_id (alist ACEXML_ENV_ARG_PARAMETER);
+ if (this->in_module_)
+ {
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s in stream %s\n"),
+// this->parsed_info_.name (),
+// this->stream_info_.name ()));
+ ACE_Module_Type *mt = (this->stream_ == 0)
+ ? 0
+ : this->stream_->find (this->parsed_info_.name ());
+
+ if (mt == 0)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Can't locate module '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+
+ this->stream_->remove (mt);
+ }
+ else
+ {
+// ACE_DEBUG ((LM_INFO, ACE_TEXT ("Remove %s\n"),
+// this->parsed_info_.name ()));
+ if (ACE_Service_Config::remove (this->parsed_info_.name ()) == -1)
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Remove failed"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW (ACEXML_SAXException (msg.c_str ()));
+ }
+ }
+ this->parsed_info_.reset ();
+ }
+ else if (ACE_OS::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;
+}
+
+void
+ACEXML_Svcconf_Handler::startPrefixMapping (const ACEXML_Char *,
+ const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // No-op.
+}
+
+// *** Methods inherit from ACEXML_DTDHandler.
+
+void
+ACEXML_Svcconf_Handler::notationDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // No-op.
+}
+
+void
+ACEXML_Svcconf_Handler::unparsedEntityDecl (const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char *,
+ const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // No-op.
+}
+
+// Methods inherit from ACEXML_EnitityResolver.
+
+ACEXML_InputSource *
+ACEXML_Svcconf_Handler::resolveEntity (const ACEXML_Char *,
+ const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ // No-op.
+ return 0;
+}
+
+// Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+void
+ACEXML_Svcconf_Handler::error (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
+ this->locator_->getLineNumber(),
+ this->locator_->getColumnNumber()));
+ ex.print();
+}
+
+void
+ACEXML_Svcconf_Handler::fatalError (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
+ this->locator_->getLineNumber(),
+ this->locator_->getColumnNumber()));
+ ex.print();
+}
+
+void
+ACEXML_Svcconf_Handler::warning (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
+{
+ ACE_DEBUG ((LM_DEBUG, "%s: line :%d col: %d ", this->locator_->getSystemId(),
+ this->locator_->getLineNumber(),
+ this->locator_->getColumnNumber()));
+ ex.print();
+}
+
+int
+ACEXML_Svcconf_Handler::get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
+{
+ if (alist != 0)
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
+ {
+ this->stream_info_.name (alist->getValue (i));
+ }
+ else
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Invalid stream attribute '"));
+ msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
+ msg += ACE_CString (ACE_TEXT ("' for entity '"));
+ msg += ACE_CString (ACE_TEXT (this->stream_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
+ -1);
+ }
+ }
+ return 0;
+}
+
+int
+ACEXML_Svcconf_Handler::get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
+{
+ if (alist != 0)
+ for (size_t i = 0; i < alist->getLength (); ++i)
+ {
+ if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
+ {
+ this->parsed_info_.name (alist->getValue (i));
+ }
+ else
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Invalid attribute '"));
+ msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
+ msg += ACE_CString (ACE_TEXT ("', expecting 'id'"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (this->parsed_info_.name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
+ -1);
+ }
+ }
+ return 0;
+}
+
+int
+ACEXML_Svcconf_Handler::get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
+{
+ 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::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
+ {
+ info->name (alist->getValue (i));
+ }
+ else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0)
+ {
+ if (ACE_OS::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0)
+ {
+ info->active (0);
+ }
+ else if (ACE_OS::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0)
+ {
+ info->active (1);
+ }
+ else
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Invalid attribute value '"));
+ msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
+ msg += ACE_CString (ACE_TEXT ("', expecting 'active' or 'inactive'"));
+ msg += ACE_CString (ACE_TEXT (" for entity '"));
+ msg += ACE_CString (ACE_TEXT (info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
+ -1);
+ }
+ }
+ else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0)
+ {
+ if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0)
+ {
+ info->service_type (ACE_Service_Type::SERVICE_OBJECT);
+ }
+ else if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("stream")) == 0)
+ {
+ info->service_type (ACE_Service_Type::STREAM);
+ }
+ else if (ACE_OS::strcasecmp (alist->getValue (i), ACE_TEXT ("module")) == 0)
+ {
+ info->service_type (ACE_Service_Type::MODULE);
+ }
+ else
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Invalid Service_Object attribute value'"));
+ msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
+ msg += ACE_CString (ACE_TEXT ("' for entity '"));
+ msg += ACE_CString (ACE_TEXT (info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()),
+ -1);
+ }
+ }
+ else
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Invalid attribute'"));
+ msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
+ msg += ACE_CString (ACE_TEXT ("' for entity '"));
+ msg += ACE_CString (ACE_TEXT (info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()), -1);
+ }
+ }
+ }
+ return 0;
+}
+
+int
+ACEXML_Svcconf_Handler::get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
+{
+ 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::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0)
+ {
+ info->init_func (alist->getValue (i));
+ }
+ else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0)
+ {
+ info->path (alist->getValue (i));
+ }
+ else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
+ {
+ info->init_params (alist->getValue (i));
+ }
+ else
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Invalid initializer attribute'"));
+ msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
+ msg += ACE_CString (ACE_TEXT ("' for entity '"));
+ msg += ACE_CString (ACE_TEXT (info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()), -1);
+ }
+ }
+ }
+ return 0;
+}
+
+int
+ACEXML_Svcconf_Handler::get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
+{
+ 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::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
+ {
+ info->name (alist->getValue (i));
+ }
+ else if (ACE_OS::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
+ {
+ info->init_params (alist->getValue (i));
+ }
+ else
+ {
+ // build the error message
+ ACE_CString msg (ACE_TEXT ("Invalid static attribute '"));
+ msg += ACE_CString (ACE_TEXT (alist->getQName (i)));
+ msg += ACE_CString (ACE_TEXT ("' for entity '"));
+ msg += ACE_CString (ACE_TEXT (info->name ()));
+ msg += ACE_CString (ACE_TEXT ("'\n"));
+
+ ACEXML_THROW_RETURN (ACEXML_SAXException (msg.c_str ()), -1);
+ }
+ }
+ }
+ return 0;
+}
+
+#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
diff --git a/ACE/ACEXML/apps/svcconf/Svcconf_Handler.h b/ACE/ACEXML/apps/svcconf/Svcconf_Handler.h
new file mode 100644
index 00000000000..b15e20d7426
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/Svcconf_Handler.h
@@ -0,0 +1,276 @@
+// $Id$
+
+//=============================================================================
+/**
+ * @file Svcconf_Handler.h
+ *
+ * $Id$
+ *
+ * @author Nanbor Wang <nanbor@cs.wustl.edu>
+ */
+//=============================================================================
+
+#ifndef ACEXML_SVCCONF_HANDLER_H
+#define ACEXML_SVCCONF_HANDLER_H
+
+#include "ACEXML/common/DefaultHandler.h"
+#include "ace/Service_Types.h"
+
+#if (ACE_USES_CLASSIC_SVC_CONF == 0)
+
+class ACE_Parsed_Info
+{
+public:
+ 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 (int type);
+ int 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_;
+ int 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_ARG_DECL)
+ ;
+
+ /*
+ * Receive notification of the end of a document.
+ */
+ virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL)
+ ;
+
+ /*
+ * 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_ARG_DECL)
+ ;
+
+ /*
+ * End the scope of a prefix-URI mapping.
+ */
+ virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL)
+ ;
+
+ /*
+ * Receive notification of ignorable whitespace in element content.
+ */
+ virtual void ignorableWhitespace (const ACEXML_Char *ch,
+ int start,
+ int length ACEXML_ENV_ARG_DECL)
+ ;
+
+ /*
+ * Receive notification of a processing instruction.
+ */
+ virtual void processingInstruction (const ACEXML_Char *target,
+ const ACEXML_Char *data ACEXML_ENV_ARG_DECL)
+ ;
+
+ /*
+ * Receive an object for locating the origin of SAX document events.
+ */
+ virtual void setDocumentLocator (ACEXML_Locator *locator) ;
+
+ /*
+ * Receive notification of a skipped entity.
+ */
+ virtual void skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL)
+ ;
+
+ /*
+ * Receive notification of the beginning of a document.
+ */
+ virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL)
+ ;
+
+ /*
+ * 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_ARG_DECL)
+ ;
+
+ /*
+ * Begin the scope of a prefix-URI Namespace mapping.
+ */
+ virtual void startPrefixMapping (const ACEXML_Char *prefix,
+ const ACEXML_Char *uri ACEXML_ENV_ARG_DECL)
+ ;
+
+ // *** 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_ARG_DECL)
+ ;
+
+ /*
+ * 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_ARG_DECL)
+ ;
+
+ // 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_ARG_DECL)
+ ;
+
+ // Methods inherit from ACEXML_ErrorHandler.
+
+ /*
+ * Receive notification of a recoverable error.
+ */
+ virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
+ ;
+
+ /*
+ * Receive notification of a non-recoverable error.
+ */
+ virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
+ ;
+
+ /*
+ * Receive notification of a warning.
+ */
+ virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL)
+ ;
+
+protected:
+ /**
+ * Get the only attribute in <stream> or <streamdef>.
+ */
+ int get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
+
+ /**
+ * Get the only attribute in <resume>, <suspend>, <remove>
+ */
+ int get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
+
+ /**
+ * Get the dynamic tag attributes.
+ */
+ int get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
+
+ /**
+ * Get the initializer tag attributes.
+ */
+ int get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
+
+ /**
+ * Get the static tag attributes.
+ */
+ int get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL);
+
+private:
+ /// We are parsing a stream definition
+ int in_stream_def_;
+
+ /// We are defining a steam module
+ int in_module_;
+
+ /// @a stream_ holds the actually Stream_Type object managed by @a stream_svc_type_.
+ ACE_Service_Type *stream_svc_type_;
+ ACE_Stream_Type *stream_;
+
+ //ACE_SHLIB_HANDLE dll_handle_;
+
+ ACE_Parsed_Info parsed_info_;
+
+ ACE_Parsed_Info stream_info_;
+
+ ACEXML_Locator* locator_;
+};
+
+#if defined (__ACEXML_INLINE__)
+# include "Svcconf_Handler.inl"
+#endif /* __ACEXML_INLINE__ */
+
+#endif /* ACE_USES_CLASSIC_SVC_CONF == 0 */
+
+#endif /* ACEXML_SVCCONF_HANDLER_H */
diff --git a/ACE/ACEXML/apps/svcconf/Svcconf_Handler.inl b/ACE/ACEXML/apps/svcconf/Svcconf_Handler.inl
new file mode 100644
index 00000000000..605dec5f2f7
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/Svcconf_Handler.inl
@@ -0,0 +1,133 @@
+// -*- C++ -*- $Id$
+
+ACE_INLINE
+ACE_Parsed_Info::ACE_Parsed_Info ()
+ : name_ (0),
+ service_type_ (ACE_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 (int type)
+{
+ if (this->service_type_ == -1)
+ {
+ this->service_type_ = type;
+ return 0;
+ }
+ return -1;
+}
+
+ACE_INLINE int
+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_ = -1;
+ 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/ACE/ACEXML/apps/svcconf/svcconf.dtd b/ACE/ACEXML/apps/svcconf/svcconf.dtd
new file mode 100644
index 00000000000..b9e6cc41c8e
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/svcconf.dtd
@@ -0,0 +1,60 @@
+<!-- $Id$ -->
+<!-- Document Type Definition for XML ACE Service Config files -->
+
+<!-- An ACE_Svc_Conf document contains zero or more entries -->
+<!-- The entries are processed in the order they appear -->
+<!-- in the ACE_Svc_Conf file. -->
+<!ELEMENT ACE_Svc_Conf (dynamic|static|suspend|resume|remove|stream|streamdef)*>
+
+<!-- Streams are separate into two elements. One defines how -->
+<!-- the stream should be constructed and the other defines -->
+<!-- what to do with it. The identity of a stream is defined -->
+<!-- in the first dynamic/static element. -->
+<!ELEMENT streamdef ((dynamic|static),module)>
+<!-- @@ Do we ever need to suspend/resume/remove modules when -->
+<!-- constructing a stream? Should we leave only dynamic -->
+<!-- and static here? -->
+<!ELEMENT module (dynamic|static|suspend|resume|remove)+>
+
+<!-- A 'stream' element controls the stream object -->
+<!-- @@ Likewise, we are reusing the 'module' element here. -->
+<!-- Do we ever need to insert new modules into a stream? -->
+<!-- Nanbor: I guess we can do that. -->
+<!ELEMENT stream (module)>
+<!ATTLIST stream id IDREF #REQUIRED>
+
+<!-- A 'dynamic' entry. -->
+<!-- @@ The kind of attributes the corresponding initializer -->
+<!-- should take seems to be determined by the 'type' -->
+<!-- attribute. Should we further partition the dynamic -->
+<!-- element definition into several elements? E.g. into -->
+<!-- dyn_service_object/dyn_module/dyn_stream? -->
+<!-- Nanbor: Will that be too confusing? -->
+<!ELEMENT dynamic (initializer)>
+<!ATTLIST dynamic id ID #REQUIRED
+ status (active|inactive) "active"
+ type (module|service_object|stream) #REQUIRED>
+
+<!-- Initializing function for dynamic entry. -->
+<!ELEMENT initializer EMPTY>
+<!ATTLIST initializer init CDATA #REQUIRED
+ path CDATA #IMPLIED
+ params CDATA #IMPLIED>
+
+<!-- A 'static' entry takes an ID attribute and an optional -->
+<!-- parameter lists. -->
+<!ELEMENT static EMPTY>
+<!ATTLIST static id ID #REQUIRED
+ params CDATA #IMPLIED>
+
+<!-- A 'suspend' entry takes an ID attribute. -->
+<!ELEMENT suspend EMPTY>
+<!ATTLIST suspend id IDREF #REQUIRED>
+
+<!-- A 'resume' entry takes an ID attribute. -->
+<!ELEMENT resume EMPTY>
+<!ATTLIST resume id IDREF #REQUIRED>
+
+<!-- A 'remove' entry takes an ID attribute. -->
+<!ELEMENT remove EMPTY>
+<!ATTLIST remove id IDREF #REQUIRED>
diff --git a/ACE/ACEXML/apps/svcconf/svcconf.mpc b/ACE/ACEXML/apps/svcconf/svcconf.mpc
new file mode 100644
index 00000000000..9f5ce8f091b
--- /dev/null
+++ b/ACE/ACEXML/apps/svcconf/svcconf.mpc
@@ -0,0 +1,6 @@
+// -*- MPC -*-
+// $Id$
+
+project(ACEXML_XML_Svc_Conf_Parser): ace_output, acelib, acexml, install {
+ sharedname = ACEXML_XML_Svc_Conf_Parser
+}