diff options
-rw-r--r-- | ACEXML/common/Attributes.h | 6 | ||||
-rw-r--r-- | ACEXML/common/LocatorImpl.cpp | 2 | ||||
-rw-r--r-- | ACEXML/common/Mem_Map_Stream.cpp | 66 | ||||
-rw-r--r-- | ACEXML/compass/Assembly.cpp | 31 | ||||
-rw-r--r-- | ACEXML/compass/Assembly.h | 41 | ||||
-rw-r--r-- | ACEXML/compass/AssemblyFactory.cpp | 18 | ||||
-rw-r--r-- | ACEXML/compass/AssemblyFactory.h | 43 | ||||
-rw-r--r-- | ACEXML/compass/CCMHome.h | 32 | ||||
-rw-r--r-- | ACEXML/compass/CompassTypes.h | 49 | ||||
-rw-r--r-- | ACEXML/compass/Compass_Export.h | 60 | ||||
-rw-r--r-- | ACEXML/compass/ComponentInstallation.h | 30 | ||||
-rw-r--r-- | ACEXML/compass/ComponentServer.cpp | 34 | ||||
-rw-r--r-- | ACEXML/compass/ComponentServer.h | 56 | ||||
-rw-r--r-- | ACEXML/compass/ComponentServer.inl | 8 | ||||
-rw-r--r-- | ACEXML/compass/Container.h | 44 | ||||
-rw-r--r-- | ACEXML/compass/Deployment.h | 43 | ||||
-rw-r--r-- | ACEXML/compass/PropertyFile_Handler.cpp | 240 | ||||
-rw-r--r-- | ACEXML/compass/PropertyFile_Handler.h | 175 | ||||
-rw-r--r-- | ACEXML/compass/PropertyFile_Handler.inl | 1 | ||||
-rw-r--r-- | ACEXML/compass/ServerActivator.h | 31 | ||||
-rw-r--r-- | ACEXML/examples/SAXPrint/main.cpp | 1 | ||||
-rw-r--r-- | ACEXML/parser/parser/Parser.cpp | 2 |
22 files changed, 979 insertions, 34 deletions
diff --git a/ACEXML/common/Attributes.h b/ACEXML/common/Attributes.h index ceff8fa0d2e..87937a5624c 100644 --- a/ACEXML/common/Attributes.h +++ b/ACEXML/common/Attributes.h @@ -14,6 +14,12 @@ #define _ACEXML_ATTRIBUTES_H_ #include "ace/pre.h" +#include "ACEXML/common/ACEXML_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + #include "ACEXML/common/XML_Types.h" /** diff --git a/ACEXML/common/LocatorImpl.cpp b/ACEXML/common/LocatorImpl.cpp index ec04b231512..06424a66564 100644 --- a/ACEXML/common/LocatorImpl.cpp +++ b/ACEXML/common/LocatorImpl.cpp @@ -34,7 +34,7 @@ ACEXML_LocatorImpl::ACEXML_LocatorImpl (const ACEXML_Locator& locator) ACEXML_LocatorImpl::~ACEXML_LocatorImpl (void) { - + this->reset(); } void diff --git a/ACEXML/common/Mem_Map_Stream.cpp b/ACEXML/common/Mem_Map_Stream.cpp index 2cef6b5f125..907cd6467fb 100644 --- a/ACEXML/common/Mem_Map_Stream.cpp +++ b/ACEXML/common/Mem_Map_Stream.cpp @@ -194,44 +194,44 @@ ACEXML_Mem_Map_Stream::grow_file_and_remap (void) // Copy the next chunk of bytes from the socket into the temporary // file. ACE_Time_Value tv (ACE_DEFAULT_TIMEOUT); -// ssize_t bytes = 0; -// ssize_t n = 0; -// while (1) -// { -// n = this->svc_handler_->peer ().recv (buf, sizeof buf, 0, &tv); -// if (n == -1) -// { -// if (errno != EWOULDBLOCK) -// { -// ACE_ERROR ((LM_ERROR, "%p\n", "recv")); -// return -1; -// } -// } -// bytes += n; -// if (n == 0 && !bytes) -// return -1; -// else if (n == 0) -// break; -// else if (ACE::write_n (this->mem_map_.handle (), buf, n) != n) -// ACE_ERROR_RETURN ((LM_ERROR, -// "%p\n", -// "write_n"), -// -1); -// } - - ssize_t n = this->svc_handler_->peer ().recv (buf, sizeof buf, 0, &tv); - if (n == -1) + ssize_t bytes = 0; + ssize_t n = 0; + while (1) { - ACE_ERROR ((LM_ERROR, "%p\n", "recv")); - return -1; - } - else if (n == 0) - return -1; - else if (ACE::write_n (this->mem_map_.handle (), buf, n) != n) + n = this->svc_handler_->peer ().recv (buf, sizeof buf, 0, &tv); + if (n == -1) + { + if (errno != EWOULDBLOCK) + { + ACE_ERROR ((LM_ERROR, "%p\n", "recv")); + return -1; + } + } + bytes += n; + if (n == 0 && !bytes) + return -1; + else if (n == 0) + break; + else if (ACE::write_n (this->mem_map_.handle (), buf, n) != n) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "write_n"), -1); + } + +// ssize_t n = this->svc_handler_->peer ().recv (buf, sizeof buf, 0, &tv); +// if (n == -1) +// { +// ACE_ERROR ((LM_ERROR, "%p\n", "recv")); +// return -1; +// } +// else if (n == 0) +// return -1; +// else if (ACE::write_n (this->mem_map_.handle (), buf, n) != n) +// ACE_ERROR_RETURN ((LM_ERROR, +// "%p\n", +// "write_n"), +// -1); // Grow the memory-mapping to encompass the entire temporary file. if (this->mem_map_.map (-1, diff --git a/ACEXML/compass/Assembly.cpp b/ACEXML/compass/Assembly.cpp new file mode 100644 index 00000000000..654b1cb80bc --- /dev/null +++ b/ACEXML/compass/Assembly.cpp @@ -0,0 +1,31 @@ +// $Id$ + +#include "ACEXML/compass/Assembly.h" + +using namespace Deployment; + +Assembly::Assembly() + : state_ (AssemblyState::INACTIVE), + stream_ (0) +{} + +Assembly::Assembly (const AssemblyState& state, ACEXML_CharStream* stream) + : state_ (state), + stream_ (stream) +{} + +Assembly::~Assembly() +{ + this->state_ = Assembly::INACTIVE; + delete this->stream; +} + +AssemblyState +Assembly::get_state() +{ + return this->state_; +} + +void +Assembly::build (void) +{ diff --git a/ACEXML/compass/Assembly.h b/ACEXML/compass/Assembly.h new file mode 100644 index 00000000000..bffca408504 --- /dev/null +++ b/ACEXML/compass/Assembly.h @@ -0,0 +1,41 @@ +// $Id$ + + +#ifndef COMPASS_ASSEMBLY_H +#define COMPASS_ASSEMBLY_H + +#include "ace/pre.h" +#include "ACEXML/common/Compass_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ACEXML/common/CharStream.h" +#include "ACEXML/compass/CompassTypes.h" + +namespace Deployment +{ + class Assembly + { + public: + Assembly(void); + Assembly (const AssemblyState& state, ACEXML_CharStream* stream); + ~Assembly(); + + AssemblyState get_state(); + + void build() + ACE_THROW_SPEC ((CreateFailure)); + + void tear_down() + ACE_THROW_SPEC ((RemoveFailure)); + + private: + AssemblyState state_; + ACEXML_CharStream* stream_; + }; +}; + + +#endif /* COMPASS_ASSEMBLY_H */ diff --git a/ACEXML/compass/AssemblyFactory.cpp b/ACEXML/compass/AssemblyFactory.cpp new file mode 100644 index 00000000000..db3d196b80a --- /dev/null +++ b/ACEXML/compass/AssemblyFactory.cpp @@ -0,0 +1,18 @@ +// $Id$ + +#include "AssemblyFactory.h" +#include "ACEXML/common/StreamFactory.h" + +using namespace Deployment; + +Cookie +AssemblyFactory::create (const Location& assembly_loc) +{ + ACEXML_StreamFactory factory; + ACEXML_CharStream* stream = factory.create_stream (assembly_loc.c_str()); + if (stream == 0) + ACE_THROW (InvalidLocation); + char cookie[10]; + ACE_OS::sprintf (cookie, "%x", stream); + + ACE_NEW_RETURN ( diff --git a/ACEXML/compass/AssemblyFactory.h b/ACEXML/compass/AssemblyFactory.h new file mode 100644 index 00000000000..407a1336e44 --- /dev/null +++ b/ACEXML/compass/AssemblyFactory.h @@ -0,0 +1,43 @@ +// $Id$ + + +#ifndef COMPASS_ASSEMBLY_FACTORY_H +#define COMPASS_ASSEMBLY_FACTORY_H + +#include "ace/pre.h" +#include "ACEXML/common/Compass_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Singleton.h" +#include "ace/Synch.h" +#include "ace/Unbounded_Set.h" +#include "ACEXML/compass/CompassTypes.h" + +namespace Deployment +{ + class AssemblyFactory + { + public: + friend class ACE_Singleton<AssemblyFactory, ACE_SYNCH_MUTEX>; + Cookie create(const Location& assembly_loc) + ACE_THROW_SPEC ((InvalidLocation, CreateFailure)); + + Assembly* lookup(const Cookie& c) + ACE_THROW_SPEC ((InvalidAssembly)); + + void destroy(const Cookie& c) + ACE_THROW_SPEC ((InvalidAssembly, RemoveFailure)); + protected: + AssemblyFactory (const AssemblyFactory&); + AssemblyFactory& operator= (const AssemblyFactory&); + private: + ACE_Unbounded_Set<ACEXML_String> cookies_; + }; + typedef ACE_Singleton<AssemblyFactory, ACE_SYNCH_MUTEX> ASSEMBLY_FACTORY; +}; + + +#endif /* COMPASS_ASSEMBLY_FACTORY_H */ diff --git a/ACEXML/compass/CCMHome.h b/ACEXML/compass/CCMHome.h new file mode 100644 index 00000000000..f23a415d587 --- /dev/null +++ b/ACEXML/compass/CCMHome.h @@ -0,0 +1,32 @@ +// $Id$ + + +#ifndef COMPASS_CCMHOME_H +#define COMPASS_CCMHOME_H + +#include "ace/pre.h" +#include "ACEXML/common/Compass_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ACEXML/compass/CompassTypes.h" +namespace Deployment +{ + class CCMHome + { + public: + Component* get_component_def(); + + void remove_component (const Component* comp) + ACE_THROW_SPEC ((RemoveFailure)); + private: + Component* comp_; + }; + + typedef vector<CCMHome*> CCMHomes; + +}; + +#endif /* COMPASS_CCMHOME_H */ diff --git a/ACEXML/compass/CompassTypes.h b/ACEXML/compass/CompassTypes.h new file mode 100644 index 00000000000..ba801af8ff3 --- /dev/null +++ b/ACEXML/compass/CompassTypes.h @@ -0,0 +1,49 @@ +// $Id$ + +#ifndef COMPASS_TYPES_H +#define COMPASS_TYPES_H + +#include "ace/pre.h" +#include "ACEXML/common/Compass_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/OS_String.h" + +// *************** Packaging and Deployment *************** + +namespace Deployment +{ + typedef ACEXML_String UUID; + typedef ACEXML_String Location; + typedef unsigned long FailureReason; + typedef ACEXML_String Cookie; + + enum AssemblyState + { + INACTIVE, + INSERVICE + }; + + typedef ACEXML_String FeatureName; + + struct ConfigValue + { + FeatureName name; + ACEXML_String value; + }; + typedef vector<ConfigValue*> ConfigValues; + + struct UnknownImplId {}; + struct InvalidLocation {}; + struct InstallationFailure { FailureReason reason; }; + struct InvalidAssembly {}; + struct RemoveFailure { FailureReason reason; }; + + struct ImplEntryPointNotFound {}; + +}; + +#endif /* COMPASS_TYPES_H */ diff --git a/ACEXML/compass/Compass_Export.h b/ACEXML/compass/Compass_Export.h new file mode 100644 index 00000000000..2c5cc50290b --- /dev/null +++ b/ACEXML/compass/Compass_Export.h @@ -0,0 +1,60 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl -f ACE_HAS_DLL -s Compass +// ------------------------------ +#ifndef COMPASS_EXPORT_H +#define COMPASS_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (COMPASS_HAS_DLL) +# define COMPASS_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && COMPASS_HAS_DLL */ + +#if defined (ACE_HAS_DLL) +# if !defined (COMPASS_HAS_DLL) +# define COMPASS_HAS_DLL 0 +# endif /* ! COMPASS_HAS_DLL */ +#else +# if !defined (COMPASS_HAS_DLL) +# define COMPASS_HAS_DLL 1 +# endif /* ! COMPASS_HAS_DLL */ +#endif + +#if defined (COMPASS_HAS_DLL) && (COMPASS_HAS_DLL == 1) +# if defined (COMPASS_BUILD_DLL) +# define Compass_Export ACE_Proper_Export_Flag +# define COMPASS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define COMPASS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* COMPASS_BUILD_DLL */ +# define Compass_Export ACE_Proper_Import_Flag +# define COMPASS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define COMPASS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* COMPASS_BUILD_DLL */ +#else /* COMPASS_HAS_DLL == 1 */ +# define Compass_Export +# define COMPASS_SINGLETON_DECLARATION(T) +# define COMPASS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* COMPASS_HAS_DLL == 1 */ + +// Set COMPASS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (COMPASS_NTRACE) +# if (ACE_NTRACE == 1) +# define COMPASS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define COMPASS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !COMPASS_NTRACE */ + +#if (COMPASS_NTRACE == 1) +# define COMPASS_TRACE(X) +#else /* (COMPASS_NTRACE == 1) */ +# define COMPASS_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (COMPASS_NTRACE == 1) */ + +#endif /* COMPASS_EXPORT_H */ + +// End of auto generated file. diff --git a/ACEXML/compass/ComponentInstallation.h b/ACEXML/compass/ComponentInstallation.h new file mode 100644 index 00000000000..f02a5f08c42 --- /dev/null +++ b/ACEXML/compass/ComponentInstallation.h @@ -0,0 +1,30 @@ +// $Id$ + + +#ifndef COMPASS_COMPONENT_INSTALLATION_H +#define COMPASS_COMPONENT_INSTALLATION_H + +#include "ACEXML/compass/CompassTypes.h" + +namespace Deployment +{ + + class ComponentInstallation + { + public: + void install(const UUID& implUUID, const Location& component_loc) + ACE_THROW_SPEC ((InvalidLocation,InstallationFailure)); + + void replace(const UUID& implUUID, const Location& component_loc) + ACE_THROW_SPEC ((InvalidLocation, InstallationFailure)); + + void remove(const UUID& implUUID) + ACE_THROW_SPEC ((UnknownImplId, RemoveFailure)); + + Location get_implementation (const UUID& implUUID) + ACE_THROW_SPEC ((UnknownImplId, InstallationFailure)); + }; + +}; + +#endif /* COMPASS_COMPONENT_INSTALLATION_H */ diff --git a/ACEXML/compass/ComponentServer.cpp b/ACEXML/compass/ComponentServer.cpp new file mode 100644 index 00000000000..cf36b9dc2ee --- /dev/null +++ b/ACEXML/compass/ComponentServer.cpp @@ -0,0 +1,34 @@ +// $Id$ + +#include "ACEXML/compass/ComponentServer.h" + +using namespace Deployment; + +ComponentServer::ComponentServer() + : containers_ (0), + activator_ (SERVER_ACTIVATOR::instance()) +{} + +ComponentServer::~ComponentServer() +{ + this->remove(); +} + +void +ComponentServer::remove() + ACE_THROW_SPEC ((RemoveFailure)) +{ + Container* entry = 0; + for (Containers::iterator iter (*this->containers_); + iter.next (entry) != 0; + iter->advance()) + delete entry; + this->activator_ = 0; +} + +ComponentServer::remove_container (const Container* cref) + ACE_THROW_SPEC ((RemoveFailure)); +{ + if (this->containers_->remove (cref) != 0) + ACE_THROW (RemoveFailure()); +} diff --git a/ACEXML/compass/ComponentServer.h b/ACEXML/compass/ComponentServer.h new file mode 100644 index 00000000000..1cc371fd167 --- /dev/null +++ b/ACEXML/compass/ComponentServer.h @@ -0,0 +1,56 @@ +// $Id$ + + +#ifndef COMPASS_COMPONENT_SERVER_H +#define COMPASS_COMPONENT_SERVER_H + +#include "ace/pre.h" +#include "ACEXML/common/Compass_Export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Unbounded_Set.h" +#include "ACEXML/compass/CompassTypes.h" + +namespace Deployment +{ + class Container; // Forward decl. + typedef ACE_Unbounded_Set<Container*> Containers; + + class Compass_Export ComponentServer + { + public: + ComponentServer(); + ~ComponentServer(); + + ServerActivator* get_server_activator (); + + Container* create_container (const ConfigValues* config) + ACE_THROW_SPEC ((CreateFailure, InvalidConfiguration)); + + void remove_container (const Container* cref) + ACE_THROW_SPEC ((RemoveFailure)); + + Containers* get_containers (); + + void remove () + ACE_THROW_SPEC ((RemoveFailure)); + + ConfigValues* get_configuration (void); + + void set_configuration (const ConfigValues* config); + + private: + Containers* containers_; + ServerActivator* activator_; + }; + +}; + +#if defined (__ACE_INLINE__) +#include "ComponentServer.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* COMPASS_COMPONENT_SERVER_H */ diff --git a/ACEXML/compass/ComponentServer.inl b/ACEXML/compass/ComponentServer.inl new file mode 100644 index 00000000000..10e9b9bed40 --- /dev/null +++ b/ACEXML/compass/ComponentServer.inl @@ -0,0 +1,8 @@ +// $Id$ + +using namespace Deployment; + +ComponentServer::get_server_activator (void) +{ + return this->activator_; +} diff --git a/ACEXML/compass/Container.h b/ACEXML/compass/Container.h new file mode 100644 index 00000000000..a3b7ff45fdb --- /dev/null +++ b/ACEXML/compass/Container.h @@ -0,0 +1,44 @@ +// $Id$ + +#ifndef COMPASS_CONTAINER_H +#define COMPASS_CONTAINER_H + +#include "ACEXML/compass/CompassTypes.h" +#include "ACEXML/compass/CCMHome.h" + +namespace Deployment +{ + class Container + { + public: + Container(ConfigValues* config = 0); + ~Container(); + + ComponentServer* get_component_server (); + + CCMHome* install_home (const UUID& id, const string& entrypt, + const ConfigValues* config) + ACE_THROW_SPEC ((UnknownImplId, ImplEntryPointNotFound, + InstallationFailure, InvalidConfiguration)); + + void remove_home (const CCMHome* href) + ACE_THROW_SPEC ((RemoveFailure)); + + CCMHomes* get_homes (); + + void remove () + ACE_THROW_SPEC ((RemoveFailure)); + + ConfigValues* get_configuration (void); + + void set_configuration (const ConfigValues* config); + + private: + ConfigValues* config_; + CCMHomes* homes_; + ComponentServer* comp_server_; + }; + +}; + +#endif /* COMPASS_CONTAINER_H */ diff --git a/ACEXML/compass/Deployment.h b/ACEXML/compass/Deployment.h new file mode 100644 index 00000000000..8c8473fffcb --- /dev/null +++ b/ACEXML/compass/Deployment.h @@ -0,0 +1,43 @@ +// $Id$ + +#ifndef COMPASS_DEPLOYMENT_H +#define COMPASS_DEPLOYMENT_H + +#include "ace/OS_String.h" +#include <vector> + +// *************** Packaging and Deployment *************** + +namespace Deployment +{ + typedef string UUID; + typedef string Location; + typedef unsigned long FailureReason; + typedef string Cookie; + + enum AssemblyState + { + INACTIVE, + INSERVICE + }; + + typedef string FeatureName; + + struct ConfigValue + { + FeatureName name; + string value; + }; + typedef vector<ConfigValue*> ConfigValues; + + struct UnknownImplId {}; + struct InvalidLocation {}; + struct InstallationFailure { FailureReason reason; }; + struct InvalidAssembly {}; + struct RemoveFailure { FailureReason reason; }; + + struct ImplEntryPointNotFound {}; + +}; + +#endif /* COMPASS_DEPLOYMENT_H */ diff --git a/ACEXML/compass/PropertyFile_Handler.cpp b/ACEXML/compass/PropertyFile_Handler.cpp new file mode 100644 index 00000000000..f556450d18e --- /dev/null +++ b/ACEXML/compass/PropertyFile_Handler.cpp @@ -0,0 +1,240 @@ +// -*- C++ -*- $Id$ + +#include "PropertyFile_Handler.h" +#include "ace/ACE.h" +#include "ace/Log_Msg.h" + +#if !defined (__ACEXML_INLINE__) +# include "PropertyFile_Handler.inl" +#endif /* __ACEXML_INLINE__ */ + +ACEXML_PropertyFile_Handler::ACEXML_PropertyFile_Handler (const ACEXML_Char* filename) + : fileName_(ACE::strnew (filename)), locator_ (0) +{ + // no-op +} + +ACEXML_PropertyFile_Handler::~ACEXML_PropertyFile_Handler (void) +{ + delete [] this->fileName_; +} + +void +ACEXML_PropertyFile_Handler::characters (const ACEXML_Char *cdata, + int start, + int length + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + ACE_UNUSED_ARG (start); + ACE_UNUSED_ARG (length); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("%s"), + cdata)); +} + +void +ACEXML_PropertyFile_Handler::endDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n"))); +} + +void +ACEXML_PropertyFile_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + this->dec_indent (); + this->print_indent (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("</%s>"), + qName)); +} + +void +ACEXML_PropertyFile_Handler::endPrefixMapping (const ACEXML_Char *prefix + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("* Event endPrefixMapping (%s) ***************\n"), + prefix)); +} + +void +ACEXML_PropertyFile_Handler::ignorableWhitespace (const ACEXML_Char *, + int, + int ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // ACE_DEBUG ((LM_DEBUG, + // ACE_TEXT ("* Event ignorableWhitespace () ***************\n"))); +} + +void +ACEXML_PropertyFile_Handler::processingInstruction (const ACEXML_Char *target, + const ACEXML_Char *data + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + this->print_indent (); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("<?%s %s>\n"), + target, data)); +} + +void +ACEXML_PropertyFile_Handler::setDocumentLocator (ACEXML_Locator * locator) +{ + + this->locator_ = locator; + //ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event setDocumentLocator () ***************\n"))); +} + +void +ACEXML_PropertyFile_Handler::skippedEntity (const ACEXML_Char *name + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("* Event skippedEntity (%s) ***************\n"), + name)); +} + +void +ACEXML_PropertyFile_Handler::startDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("* Event startDocument () ***************\n"))); +} + +void +ACEXML_PropertyFile_Handler::startElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName, + ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + + + this->print_indent (); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("<%s"), + qName)); + if (alist != 0) + for (size_t i = 0; i < alist->getLength (); ++i) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT (" %s = \"%s\""), + alist->getQName (i), alist->getValue (i))); + } + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (">"))); + this->inc_indent (); +} + +void +ACEXML_PropertyFile_Handler::startPrefixMapping (const ACEXML_Char * prefix, + const ACEXML_Char * uri ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("* Event startPrefixMapping () ***************\n"))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Prefix = %s, URI = %s\n"), prefix, uri)); + +} + +// *** Methods inherited from ACEXML_DTDHandler. + +void +ACEXML_PropertyFile_Handler::notationDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +void +ACEXML_PropertyFile_Handler::unparsedEntityDecl (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. +} + +// Methods inherited from ACEXML_EnitityResolver. + +ACEXML_InputSource * +ACEXML_PropertyFile_Handler::resolveEntity (const ACEXML_Char *, + const ACEXML_Char * + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + // No-op. + return 0; +} + +// Methods inherited from ACEXML_ErrorHandler. + +/* + * Receive notification of a recoverable error. + */ +void +ACEXML_PropertyFile_Handler::error (ACEXML_SAXParseException & ex + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", + (this->locator_->getSystemId() == 0 + ? this->fileName_ : this->locator_->getSystemId()), + this->locator_->getLineNumber(), + this->locator_->getColumnNumber())); + ex.print(); +} + +void +ACEXML_PropertyFile_Handler::fatalError (ACEXML_SAXParseException & ex + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", + (this->locator_->getSystemId() == 0 + ? this->fileName_ : this->locator_->getSystemId()), + this->locator_->getLineNumber(), + this->locator_->getColumnNumber())); + ex.print(); +} + +void +ACEXML_PropertyFile_Handler::warning (ACEXML_SAXParseException & ex + ACEXML_ENV_ARG_DECL_NOT_USED) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ", + (this->locator_->getSystemId() == 0 + ? this->fileName_ : this->locator_->getSystemId()), + this->locator_->getLineNumber(), + this->locator_->getColumnNumber())); + ex.print(); +} diff --git a/ACEXML/compass/PropertyFile_Handler.h b/ACEXML/compass/PropertyFile_Handler.h new file mode 100644 index 00000000000..6772dd1e047 --- /dev/null +++ b/ACEXML/compass/PropertyFile_Handler.h @@ -0,0 +1,175 @@ +// $Id$ + +//============================================================================= +/** + * @file PropertyFile_Handler.h + * + * $Id$ + * + * @author Krishnakumar B <kitty@cs.wustl.edu> + */ +//============================================================================= + +#ifndef ACEXML_PROPERTYFILE_HANDLER_H +#define ACEXML_PROPERTYFILE_HANDLER_H + +#include "ACEXML/common/DefaultHandler.h" + +/** + * @class ACEXML_PropertyFile_Handler + * + * @brief ACEXML_PropertyFile_Handler is an example SAX event handler. + * + * This SAX event handler try to regenerate the XML document it + * reads with correct indentation. + */ +class ACEXML_PropertyFile_Handler : public ACEXML_DefaultHandler +{ +public: + /* + * Default constructor. + */ + ACEXML_PropertyFile_Handler (const ACEXML_Char* name); + + /* + * Default destructor. + */ + virtual ~ACEXML_PropertyFile_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) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /* + * Receive notification of the end of a document. + */ + virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL) + 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_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /* + * End the scope of a prefix-URI mapping. + */ + virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL) + 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_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /* + * Receive notification of a processing instruction. + */ + virtual void processingInstruction (const ACEXML_Char *target, + const ACEXML_Char *data + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /* + * 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) + ACE_THROW_SPEC ((ACEXML_SAXException)) + ; + + /* + * Receive notification of the beginning of a document. + */ + virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL) + 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_ARG_DECL) + 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_ARG_DECL) + 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_ARG_DECL) + 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_ARG_DECL) + 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_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + // Methods inherit from ACEXML_ErrorHandler. + + /* + * Receive notification of a recoverable error. + */ + virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /* + * Receive notification of a non-recoverable error. + */ + virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /* + * Receive notification of a warning. + */ + virtual void warning (ACEXML_SAXParseException &exception + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + +private: + + ACEXML_Char* fileName_; + ACEXML_Locator* locator_; +}; + +#if defined (__ACEXML_INLINE__) +# include "PropertyFile_Handler.inl" +#endif /* __ACEXML_INLINE__ */ +#endif /* ACEXML_PROPERTYFILE_HANDLER_H */ diff --git a/ACEXML/compass/PropertyFile_Handler.inl b/ACEXML/compass/PropertyFile_Handler.inl new file mode 100644 index 00000000000..77b4466a3cb --- /dev/null +++ b/ACEXML/compass/PropertyFile_Handler.inl @@ -0,0 +1 @@ +// -*- C++ -*- $Id$ diff --git a/ACEXML/compass/ServerActivator.h b/ACEXML/compass/ServerActivator.h new file mode 100644 index 00000000000..cd7de0071fb --- /dev/null +++ b/ACEXML/compass/ServerActivator.h @@ -0,0 +1,31 @@ +// $Id$ + + +#ifndef COMPASS_SERVER_ACTIVATOR_H +#define COMPASS_SERVER_ACTIVATOR_H + +#include "ace/Unbounded_Set.h" +#include "ACEXML/compass/CompassTypes.h" + +namespace Deployment +{ + class ComponentServer; // Forward decl. + typedef ACE_Unbounded_Set<ComponentServer*> ComponentServers; + + class ServerActivator + { + public: + ComponentServer* create_component_server (const ConfigValues* config) + ACE_THROW_SPEC ((CreateFailure, InvalidConfiguration)); + + void remove_component_server (const ComponentServer* server) + ACE_THROW_SPEC (RemoveFailure); + + ComponentServers* get_component_servers (); + private: + ComponentServers* comp_servers_; + }; + typedef ACE_Singleton <ServerActivator, ACE_SYNCH_MUTEX> SERVER_ACTIVATOR; +}; + +#endif /* COMPASS_SERVER_ACTIVATOR_H */ diff --git a/ACEXML/examples/SAXPrint/main.cpp b/ACEXML/examples/SAXPrint/main.cpp index cc8fe841e22..8cb0865684e 100644 --- a/ACEXML/examples/SAXPrint/main.cpp +++ b/ACEXML/examples/SAXPrint/main.cpp @@ -146,5 +146,6 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Exception occurred. Exiting...\n"))); } ACEXML_ENDTRY; + delete handler; return 0; } diff --git a/ACEXML/parser/parser/Parser.cpp b/ACEXML/parser/parser/Parser.cpp index b01f0cea893..b84d8d01a8b 100644 --- a/ACEXML/parser/parser/Parser.cpp +++ b/ACEXML/parser/parser/Parser.cpp @@ -2806,6 +2806,7 @@ ACEXML_Parser::switch_input (ACEXML_InputSource* input, if (this->push_context (new_context) != 0) { ACE_ERROR ((LM_ERROR, "Unable to switch input streams")); + delete new_context; return -1; } this->current_ = new_context; @@ -2978,6 +2979,7 @@ ACEXML_Parser::warning (const ACEXML_Char* msg ACEXML_ENV_ARG_DECL) ACE_NEW_NORETURN (exception, ACEXML_SAXParseException (msg)); if (this->error_handler_) this->error_handler_->warning (*exception ACEXML_ENV_ARG_PARAMETER); + delete exception; return; } |