XML_Loader.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    XML_Loader.h
00006  *
00007  *  XML_Loader.h,v 1.5 2006/03/14 06:14:34 jtc Exp
00008  *
00009  *  A topology saver class that outputs XML.
00010  *
00011  *  @author Jonathan Pollack <pollack_j@ociweb.com>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef XML_LOADER_H
00016 #define XML_LOADER_H
00017 #include /**/ "ace/pre.h"
00018 #include /**/ "ace/config-all.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 #pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 #include "orbsvcs/Notify/Topology_Loader.h"
00025 
00026 #include "ACEXML/common/DefaultHandler.h"
00027 #include "ACEXML/parser/parser/Parser.h"
00028 #include "ACEXML/common/FileCharStream.h"
00029 
00030 #include "ace/streams.h"
00031 
00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 namespace TAO_Notify
00035 {
00036  /// \brief Load Notification Service Topology from an XML file.
00037 class XML_Loader : public ACEXML_DefaultHandler , public Topology_Loader
00038 {
00039 public:
00040   /// The constructor.
00041   XML_Loader ();
00042 
00043   virtual ~XML_Loader ();
00044 
00045   /// Open a file and perform preliminary validation to determine whether
00046   /// the file is complete and valid.
00047   bool open (const ACE_CString & file_name);
00048 
00049   ///////////////////////////////////
00050   // Override Topology_Loader methods
00051   // see Topology_Loader.h for documentation
00052   virtual void load (Topology_Object *root ACE_ENV_ARG_DECL);
00053 
00054 
00055   /////////////////////////////////////////
00056   // Override ACEXML_DefaultHandler methods
00057 
00058   virtual void startElement (const ACEXML_Char* namespaceURI,
00059     const ACEXML_Char* localName,
00060     const ACEXML_Char* qName,
00061     ACEXML_Attributes* atts ACEXML_ENV_ARG_DECL)
00062     ACE_THROW_SPEC ((ACEXML_SAXException));
00063 
00064   virtual void endElement (const ACEXML_Char*,
00065     const ACEXML_Char*,
00066     const ACEXML_Char* name ACEXML_ENV_ARG_DECL_NOT_USED)
00067     ACE_THROW_SPEC ((ACEXML_SAXException));
00068 
00069 
00070 private:
00071   /// The name of the file from which data is read.
00072   ACE_CString file_name_;
00073   /// A stream representing our current output.
00074   FILE * input_;
00075 
00076   typedef ACE_Unbounded_Stack<Topology_Object*> TopoStack;
00077   TopoStack object_stack_;
00078   // if false, then we're just checking syntax of topology file.
00079   bool live_;
00080 };
00081 
00082 } // namespace TAO_Notify
00083 
00084 TAO_END_VERSIONED_NAMESPACE_DECL
00085 
00086 #include /**/ "ace/post.h"
00087 #endif /* XML_LOADER_H */

Generated on Thu Nov 9 13:24:17 2006 for TAO_CosNotification by doxygen 1.3.6