00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Topology_Saver.h 00006 * 00007 * $Id: Topology_Saver.h 88796 2010-02-01 19:27:51Z johnnyw $ 00008 * 00009 * @author Jonathan Pollack <pollack_j@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TOPOLOGY_SAVER_H 00014 #define TOPOLOGY_SAVER_H 00015 #include /**/ "ace/pre.h" 00016 00017 #include "orbsvcs/Notify/Topology_Object.h" 00018 #include "orbsvcs/Notify/notify_serv_export.h" 00019 00020 #include "ace/SString.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 #pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 namespace TAO_Notify 00029 { 00030 /** 00031 * \brief An interface to be implemented by objects that save Topology. 00032 * 00033 * A persistent topology store must provide an implemention this interface. 00034 * 00035 */ 00036 class TAO_Notify_Serv_Export Topology_Saver 00037 { 00038 public: 00039 00040 /// The destructor. 00041 virtual ~Topology_Saver (); 00042 00043 /** \brief Begin the storage of an object. 00044 * 00045 * Call this function with the type and ID of an object to be stored. 00046 * This object may have children, and this will necessitate nested calls 00047 * to begin_object. 00048 * Design principle: 00049 * Names should be descriptive enough to allow the objects' parent to create 00050 * an instance of the desired class. This instance will be registered 00051 * with the poa using the id. 00052 * The instance itself should will load its own attributes. 00053 * Example <proxy type="push_supplier" events="any" id="20"...> is not a 00054 * good design because the name "proxy" is not descriptive enough. 00055 * "<structured_proxy_push_supplier id="20"...> is better because this 00056 * allows the parent to create the correct type of object without decoding 00057 * attributes. 00058 * \param id numeric id for this object 00059 * \param type string containing the unique type name for this class of objects 00060 * \param attrs a collection of name/value attributes 00061 * \param changed true if this object's attributes have changed. 00062 * \return bool want_all_children. If true even changed children should be saved. 00063 */ 00064 virtual bool begin_object (CORBA::Long id, 00065 const ACE_CString &type, 00066 const NVPList& attrs, 00067 bool changed) = 0; 00068 00069 /** \brief Report deleted children to the saver. 00070 * 00071 * Use the ID and "type" as passed in to determine which child we should 00072 * delete. A parent should call this function when one of its children 00073 * is deleted. 00074 * \param id numeric id for the deleted child 00075 * \param type the type name for the class of the deleted child. 00076 * 00077 */ 00078 virtual void delete_child (CORBA::Long id, const ACE_CString & type) 00079 { 00080 ACE_UNUSED_ARG (id); 00081 ACE_UNUSED_ARG (type); 00082 } 00083 00084 /** \brief End the storage of an object. 00085 * 00086 * This function should be called to end the scope of the current object 00087 * and commit it to the persistent store. 00088 */ 00089 virtual void end_object (CORBA::Long id, const ACE_CString &type) = 0; 00090 00091 /** 00092 * \brief Close the saver. 00093 * 00094 * This is not pure virtual. The default implementation does nothing. 00095 * 00096 * There should be a corresponding open, but the signature may 00097 * vary based on the type of saver, so we can't include it in the 00098 * interface. 00099 */ 00100 virtual void close (void); 00101 }; 00102 } // namespace TAO_Notify 00103 00104 TAO_END_VERSIONED_NAMESPACE_DECL 00105 00106 #include /**/ "ace/post.h" 00107 00108 #endif /* TOPOLOGY_SAVER */