00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Topology_Saver.h 00006 * 00007 * Topology_Saver.h,v 1.4 2006/03/14 06:14:34 jtc Exp 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 change 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 00068 ACE_ENV_ARG_DECL) = 0; 00069 00070 /** \brief Report deleted children to the saver. 00071 * 00072 * Use the ID and "type" as passed in to determine which child we should 00073 * delete. A parent should call this function when one of its children 00074 * is deleted. 00075 * \param id numeric id for the deleted child 00076 * \param type the type name for the class of the deleted child. 00077 * 00078 */ 00079 virtual void delete_child ( 00080 CORBA::Long id, 00081 const ACE_CString & type 00082 ACE_ENV_ARG_DECL_NOT_USED) 00083 { 00084 ACE_UNUSED_ARG (id); 00085 ACE_UNUSED_ARG (type); 00086 } 00087 00088 /** \brief End the storage of an object. 00089 * 00090 * This function should be called to end the scope of the current object 00091 * and commit it to the persistent store. 00092 */ 00093 virtual void end_object (CORBA::Long id, 00094 const ACE_CString &type 00095 ACE_ENV_ARG_DECL) = 0; 00096 00097 /** 00098 * \brief Close the saver. 00099 * 00100 * This is not pure virtual. The default implementation does nothing. 00101 * 00102 * There should be a corresponding open, but the signature may 00103 * vary based on the type of saver, so we can't include it in the 00104 * interface. 00105 */ 00106 virtual void close (ACE_ENV_SINGLE_ARG_DECL); 00107 }; 00108 } // namespace TAO_Notify 00109 00110 TAO_END_VERSIONED_NAMESPACE_DECL 00111 00112 #include /**/ "ace/post.h" 00113 00114 #endif /* TOPOLOGY_SAVER */