00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Topology_Saver.h 00006 * 00007 * $Id: Topology_Saver.h 76589 2007-01-25 18:04:11Z elliott_c $ 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) = 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 ( 00079 CORBA::Long id, 00080 const ACE_CString & type) 00081 { 00082 ACE_UNUSED_ARG (id); 00083 ACE_UNUSED_ARG (type); 00084 } 00085 00086 /** \brief End the storage of an object. 00087 * 00088 * This function should be called to end the scope of the current object 00089 * and commit it to the persistent store. 00090 */ 00091 virtual void end_object (CORBA::Long id, 00092 const ACE_CString &type) = 0; 00093 00094 /** 00095 * \brief Close the saver. 00096 * 00097 * This is not pure virtual. The default implementation does nothing. 00098 * 00099 * There should be a corresponding open, but the signature may 00100 * vary based on the type of saver, so we can't include it in the 00101 * interface. 00102 */ 00103 virtual void close (void); 00104 }; 00105 } // namespace TAO_Notify 00106 00107 TAO_END_VERSIONED_NAMESPACE_DECL 00108 00109 #include /**/ "ace/post.h" 00110 00111 #endif /* TOPOLOGY_SAVER */