summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Topology_Saver.h
blob: 781da2721b778a761c97502d4225aff22c10b22b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* -*- C++ -*- */

//=============================================================================
/**
*  @file    Topology_Saver.h
*
*  $Id$
*
*  @author Jonathan Pollack <pollack_j@ociweb.com>
*/
//=============================================================================

#ifndef TOPOLOGY_SAVER_H
#define TOPOLOGY_SAVER_H
#include /**/ "ace/pre.h"

#include "Topology_Object.h"
#include "notify_serv_export.h"

#include "tao/corba.h"
#include "ace/SString.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

namespace TAO_Notify
{
  /**
  * \brief An interface to be implemented by objects that save Topology.
  *
  * A persistent topology store must provide an implemention this interface.
  *
  */
  class TAO_Notify_Serv_Export Topology_Saver
  {
  public:

    /// The destructor.
    virtual ~Topology_Saver ();

    /** \brief Begin the storage of an object.
    *
    * Call this function with the type and ID of an object to be stored.
    * This object may have children, and this will necessitate nested calls
    * to begin_object.
    * Design principle:
    *   Names should be descriptive enough to allow the objects' parent to create
    *   an instance of the desired class.  This instance will be registered
    *   with the poa using the id.
    *   The instance itself should will load its own attributes.
    *    Example <proxy type="push_supplier" events="any" id="20"...> is not a
    *    good design because the name "proxy" is not descriptive enough.
    *    "<structured_proxy_push_supplier id="20"...> is better because this
    *    allows the parent to create the correct type of object without decoding
    *    attributes.
    * \param id numeric id for this object
    * \param type string containing the unique type name for this class of objects
    * \param attrs a collection of name/value attributes
    * \param change true if this object's attributes have changed.
    * \return bool want_all_children.  If true even changed children should be saved.
    */
    virtual bool begin_object (CORBA::Long id,
      const ACE_CString &type,
      const NVPList& attrs,
      bool changed
      ACE_ENV_ARG_DECL) = 0;

    /** \brief Report deleted children to the saver.
    *
    * Use the ID and "type" as passed in to determine which child we should
    * delete.  A parent should call this function when one of its children
    * is deleted.
    * \param id numeric id for the deleted child
    * \param type the type name for the class of the deleted child.
    *
    */
    virtual void delete_child (
      CORBA::Long id,
      const ACE_CString & type
      ACE_ENV_ARG_DECL_NOT_USED)
    {
      ACE_UNUSED_ARG (id);
      ACE_UNUSED_ARG (type);
    }

    /** \brief End the storage of an object.
    *
    * This function should be called to end the scope of the current object
    * and commit it to the persistent store.
    */
    virtual void end_object (CORBA::Long id,
      const ACE_CString &type
      ACE_ENV_ARG_DECL) = 0;

    /**
     * \brief Close the saver.
     *
     * This is not pure virtual.  The default implementation does nothing.
     *
     * There should be a corresponding open, but the signature may
     * vary based on the type of saver, so we can't include it in the
     * interface.
     */
    virtual void close (ACE_ENV_SINGLE_ARG_DECL);
  };
} // namespace TAO_Notify

#include /**/ "ace/post.h"

#endif /* TOPOLOGY_SAVER */