summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorharrisb <harrisb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2012-11-26 18:22:17 +0000
committerharrisb <harrisb@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2012-11-26 18:22:17 +0000
commit720fc75bb2baaa3c18731fa1bb62a5f8a848ec47 (patch)
tree57f53db77059198d7549ce833056a61c914f4871
parent8d33367e6c3934851f19b56f58a9572bf2b63788 (diff)
downloadATCD-720fc75bb2baaa3c18731fa1bb62a5f8a848ec47.tar.gz
Mon Nov 26 18:16:39 UTC 2012 Byron Harris <harrisb@ociweb.com>
-rw-r--r--TAO/OCI_RE_OG_persist_ChangeLog32
-rw-r--r--TAO/orbsvcs/orbsvcs/CosNaming_Serv.mpc1
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp8
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.h6
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.h88
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Storable.h34
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Storable.inl43
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp6
-rw-r--r--TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h2
-rw-r--r--TAO/tao/Storable_Base.cpp18
-rw-r--r--TAO/tao/Storable_Base.h89
-rw-r--r--TAO/tao/Storable_Base.inl71
-rw-r--r--TAO/tao/Storable_File_Guard.cpp (renamed from TAO/orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.cpp)33
-rw-r--r--TAO/tao/Storable_File_Guard.h93
-rw-r--r--TAO/tao/tao.mpc1
15 files changed, 346 insertions, 179 deletions
diff --git a/TAO/OCI_RE_OG_persist_ChangeLog b/TAO/OCI_RE_OG_persist_ChangeLog
new file mode 100644
index 00000000000..64bdf0def5a
--- /dev/null
+++ b/TAO/OCI_RE_OG_persist_ChangeLog
@@ -0,0 +1,32 @@
+Mon Nov 26 18:16:39 UTC 2012 Byron Harris <harrisb@ociweb.com>
+
+ * tao/Storable_Base.h:
+ * tao/Storable_Base.inl:
+ * tao/Storable_Base.cpp:
+ * tao/Storable_File_Guard.h:
+ * tao/Storable_File_Guard.cpp:
+ * tao/tao.mpc:
+
+ Extracted storable base and file guard classes
+ from naming server so they can be used in
+ other contexts such as object group persistence.
+
+ * orbsvcs/orbsvcs/CosNaming_Serv.mpc:
+ * orbsvcs/orbsvcs/Naming/Storable.h:
+ * orbsvcs/orbsvcs/Naming/Storable.inl:
+ * orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h:
+ * orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp:
+
+ Updatd to use base classes given above.
+
+ * orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.h:
+ * orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.cpp:
+
+ Removed these files.
+
+
+Local Variables:
+mode: change-log
+add-log-time-format: (lambda () (progn (setq tz (getenv "TZ")) (set-time-zone-rule "UTC") (setq time (format-time-string "%a %b %e %H:%M:%S %Z %Y" (current-time))) (set-time-zone-rule tz) time))
+indent-tabs-mode: nil
+End:
diff --git a/TAO/orbsvcs/orbsvcs/CosNaming_Serv.mpc b/TAO/orbsvcs/orbsvcs/CosNaming_Serv.mpc
index c36637bfc23..9cd821e7bf3 100644
--- a/TAO/orbsvcs/orbsvcs/CosNaming_Serv.mpc
+++ b/TAO/orbsvcs/orbsvcs/CosNaming_Serv.mpc
@@ -17,7 +17,6 @@ project(CosNaming_Serv) : cosnaming_serv_persistence, orbsvcslib, orbsvcs_output
Naming/Naming_Context_Interface.cpp
Naming/Naming_Loader.cpp
Naming/Naming_Server.cpp
- Naming/Naming_Service_File_Guard.cpp
Naming/Storable_Naming_Context_Factory.cpp
Naming/Transient_Naming_Context.cpp
}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp
index dbc2f8b61fe..61858c716bf 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.cpp
@@ -11,6 +11,7 @@
//=============================================================================
#include "orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.h"
+#include "orbsvcs/Naming/Persistent_Naming_Context_Factory.h"
#include "orbsvcs/FT_NamingManagerC.h"
#include "orbsvcs/PortableGroup/PG_Property_Utils.h"
#include "orbsvcs/PortableGroup/PG_Property_Set.h"
@@ -685,5 +686,12 @@ TAO_FT_Naming_Manager::preprocess_properties (PortableGroup::Properties &)
}
+void
+TAO_FT_Naming_Manager::
+set_persistence_factory(TAO_Naming_Service_Persistence_Factory *
+ persistence_factory)
+{
+ // group_factory_.set_persistence_factory(persistence_factory);
+}
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.h b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.h
index 31952e8565f..fecfb8ff288 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.h
+++ b/TAO/orbsvcs/orbsvcs/Naming/FaultTolerant/FT_Naming_Manager.h
@@ -37,6 +37,8 @@
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+class TAO_Naming_Service_Persistence_Factory;
+
class TAO_FtNaming_Export TAO_FT_Naming_Manager
: public virtual POA_FT::NamingManager,
public ACE_Task_Base
@@ -237,6 +239,10 @@ public:
next_location (PortableGroup::ObjectGroup_ptr object_group,
PortableGroup::Location& loc);
+ /// Set the factory to use for persisting object groups.
+ void set_persistence_factory(TAO_Naming_Service_Persistence_Factory *
+ persistence_factory);
+
/// Destructor.
~TAO_FT_Naming_Manager (void);
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.h b/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.h
deleted file mode 100644
index ff1fc521e28..00000000000
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.h
+++ /dev/null
@@ -1,88 +0,0 @@
-// -*- C++ -*-
-
-//=============================================================================
-/**
- * @file Naming_Service_File_Guard.h
- *
- * $Id$
- *
- * @author Rich Seibel (seibelr@ociweb.com)
- * @author Byron Harris (harrisb@ociweb.com)
- */
-//=============================================================================
-
-#ifndef TAO_NAMING_SERVICE_FILE_GUARD_H
-#define TAO_NAMING_SERVICE_FILE_GUARD_H
-
-#include "tao/orbconf.h"
-#include "orbsvcs/Naming/naming_serv_export.h"
-
-TAO_BEGIN_VERSIONED_NAMESPACE_DECL
-
-class TAO_Storable_Base;
-
-/**
- * @class Naming_Service_File_Guard
- * @brief Bridge abstract class for TAO_Storable_Naming_Context that performs locking.
- *
- * A guard for TAO_Storable_Naming_Context that opens a file
- * for read/write and sets a lock on it. It then checks if the file has
- * changed and re-reads it if it has.
- *
- * The destructor releases the lock.
- */
-class TAO_Naming_Serv_Export Naming_Service_File_Guard
-{
-public:
-
- Naming_Service_File_Guard (bool redundant);
-
- virtual ~Naming_Service_File_Guard ();
-
- /// Releases the lock, closes the file, and deletes the I/O stream.
- void release (void);
-
- /// Returns the stream to read/write on
- TAO_Storable_Base & peer (void);
-
-protected:
-
- /// Should be called by constructors of derived classes
- /// since can't call virtual functions below in constructor
- /// of this class.
- void init (const char * mode);
-
- virtual void set_parent_last_changed (const time_t & time) = 0;
-
- virtual time_t get_parent_last_changed () = 0;
-
- virtual void create_child () = 0;
-
- virtual bool is_child_created () = 0;
-
- virtual TAO_Storable_Base * create_stream (const char * mode) = 0;
-
- /// The pointer to the actual file I/O (bridge pattern)
- TAO_Storable_Base *fl_;
-
-private:
-
- bool redundant_;
-
- /// Default constructor
- Naming_Service_File_Guard ();
-
- /// A flag to keep us from trying to close things more than once.
- int closed_;
-
- /// The flags that we were opened with
- int rwflags_;
-
- /// Symbolic values for the flags in the above
- enum { mode_write = 1, mode_read = 2, mode_create = 4 };
-
-};
-
-TAO_END_VERSIONED_NAMESPACE_DECL
-
-#endif
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable.h b/TAO/orbsvcs/orbsvcs/Naming/Storable.h
index 2dc14e4398e..98e0cba3400 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Storable.h
+++ b/TAO/orbsvcs/orbsvcs/Naming/Storable.h
@@ -21,7 +21,7 @@
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "tao/Versioned_Namespace.h"
+#include "tao/Storable_Base.h"
#include "ace/SString.h"
#include "orbsvcs/Naming/naming_serv_export.h"
@@ -79,7 +79,7 @@ class TAO_Naming_Serv_Export TAO_NS_Persistence_Global
unsigned int counter_;
};
-class TAO_Naming_Serv_Export TAO_Storable_Base
+class TAO_Naming_Serv_Export TAO_Storable_Base : public TAO::Storable_Base
{
public:
TAO_Storable_Base();
@@ -100,28 +100,6 @@ public:
virtual time_t last_changed(void) = 0;
- // Mimic a portion of the std::ios interface. We need to be able
- // to indicate error states from the extraction operators below.
- enum Storable_State { goodbit = 0,
- badbit = 1,
- eofbit = 2,
- failbit = 4
- };
-
- void clear (Storable_State state = goodbit);
-
- void setstate (Storable_State state);
-
- Storable_State rdstate (void) const;
-
- bool good (void) const;
-
- bool bad (void) const;
-
- bool eof (void) const;
-
- bool fail (void) const;
-
virtual TAO_Storable_Base& operator << (
const TAO_NS_Persistence_Header& header) = 0;
@@ -140,14 +118,10 @@ public:
virtual TAO_Storable_Base& operator >> (
TAO_NS_Persistence_Global& global) = 0;
- virtual TAO_Storable_Base& operator << (
- const ACE_CString& str) = 0;
+ virtual TAO_Storable_Base& operator << (const ACE_CString& str) = 0;
- virtual TAO_Storable_Base& operator >> (
- ACE_CString& str) = 0;
+ virtual TAO_Storable_Base& operator >> (ACE_CString& str) = 0;
-private:
- Storable_State state_;
};
class TAO_Naming_Serv_Export TAO_Naming_Service_Persistence_Factory
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable.inl b/TAO/orbsvcs/orbsvcs/Naming/Storable.inl
index 2df1d497262..fef38467714 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Storable.inl
+++ b/TAO/orbsvcs/orbsvcs/Naming/Storable.inl
@@ -112,7 +112,6 @@ TAO_Naming_Service_Persistence_Factory::~TAO_Naming_Service_Persistence_Factory(
ACE_INLINE
TAO_Storable_Base::TAO_Storable_Base()
- : state_ (goodbit)
{
}
@@ -121,47 +120,5 @@ TAO_Storable_Base::~TAO_Storable_Base()
{
}
-ACE_INLINE void
-TAO_Storable_Base::clear (TAO_Storable_Base::Storable_State state)
-{
- this->state_ = state;
-}
-
-ACE_INLINE void
-TAO_Storable_Base::setstate (TAO_Storable_Base::Storable_State state)
-{
- this->clear (static_cast <TAO_Storable_Base::Storable_State> (
- this->rdstate () | state));
-}
-
-ACE_INLINE TAO_Storable_Base::Storable_State
-TAO_Storable_Base::rdstate (void) const
-{
- return this->state_;
-}
-
-ACE_INLINE bool
-TAO_Storable_Base::good (void) const
-{
- return (this->state_ == goodbit);
-}
-
-ACE_INLINE bool
-TAO_Storable_Base::bad (void) const
-{
- return (this->state_ & badbit);
-}
-
-ACE_INLINE bool
-TAO_Storable_Base::eof (void) const
-{
- return (this->state_ & eofbit);
-}
-
-ACE_INLINE bool
-TAO_Storable_Base::fail (void) const
-{
- return (this->state_ & failbit);
-}
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp
index 8c7a9c98fb6..5f23a60e37d 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp
+++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp
@@ -411,6 +411,12 @@ File_Open_Lock_and_Check::File_Open_Lock_and_Check(
init(mode);
}
+TAO_Storable_Naming_Context::
+File_Open_Lock_and_Check::~File_Open_Lock_and_Check()
+{
+ this->release ();
+}
+
void
TAO_Storable_Naming_Context::
File_Open_Lock_and_Check::set_parent_last_changed (const time_t & time)
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h
index 3f743c44a17..613edd99d93 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h
+++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.h
@@ -410,6 +410,8 @@ public:
File_Open_Lock_and_Check(TAO_Storable_Naming_Context * context,
const char * mode);
+ ~File_Open_Lock_and_Check();
+
protected:
virtual void set_parent_last_changed (const time_t & time);
diff --git a/TAO/tao/Storable_Base.cpp b/TAO/tao/Storable_Base.cpp
new file mode 100644
index 00000000000..fc116a11620
--- /dev/null
+++ b/TAO/tao/Storable_Base.cpp
@@ -0,0 +1,18 @@
+//=============================================================================
+/**
+ * @file Storable_Base.cpp
+ *
+ * $Id$
+ *
+ * @author Bruce Trask <trask_b@ociweb.com>
+ * @author Chanaka Liyanaarachchi <chanaka@ociweb.com>
+ * @author Byron Harris <harrisb@ociweb.com>
+ */
+//=============================================================================
+
+#include "tao/Storable_Base.h"
+
+#if !defined (__ACE_INLINE__)
+#include "tao/Storable_Base.inl"
+#endif /* __ACE_INLINE__ */
+
diff --git a/TAO/tao/Storable_Base.h b/TAO/tao/Storable_Base.h
new file mode 100644
index 00000000000..e611c4e401f
--- /dev/null
+++ b/TAO/tao/Storable_Base.h
@@ -0,0 +1,89 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Storable_Base.h
+ *
+ * $Id$
+ *
+ * @author Bruce Trask <trask_b@ociweb.com>
+ * @author Chanaka Liyanaarachchi <chanaka@ociweb.com>
+ * @author Byron Harris <harrisb@ociweb.com>
+ */
+//=============================================================================
+
+#ifndef TAO_STORABLE_BASE_H
+#define TAO_STORABLE_BASE_H
+
+#include "tao/TAO_Export.h"
+#include "tao/orbconf.h"
+
+#include "ace/SString.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+ class TAO_Export Storable_Base
+ {
+ public:
+ Storable_Base();
+
+ virtual ~Storable_Base();
+
+ virtual void remove() = 0;
+
+ virtual int exists() = 0;
+
+ virtual int open () = 0;
+
+ virtual int close () = 0;
+
+ virtual int flock (int whence, int start, int len) = 0;
+
+ virtual int funlock (int whence, int start, int len) = 0;
+
+ virtual time_t last_changed(void) = 0;
+
+ // Mimic a portion of the std::ios interface. We need to be able
+ // to indicate error states from the extraction operators below.
+ enum Storable_State { goodbit = 0,
+ badbit = 1,
+ eofbit = 2,
+ failbit = 4
+ };
+
+ void clear (Storable_State state = goodbit);
+
+ void setstate (Storable_State state);
+
+ Storable_State rdstate (void) const;
+
+ bool good (void) const;
+
+ bool bad (void) const;
+
+ bool eof (void) const;
+
+ bool fail (void) const;
+
+ virtual Storable_Base& operator << (const ACE_CString& str) = 0;
+
+ virtual Storable_Base& operator >> (ACE_CString& str) = 0;
+
+ private:
+ Storable_State state_;
+
+ };
+
+}
+
+#if defined (__ACE_INLINE__)
+#include "tao/Storable_Base.inl"
+#endif
+
+#endif
diff --git a/TAO/tao/Storable_Base.inl b/TAO/tao/Storable_Base.inl
new file mode 100644
index 00000000000..ede6db13cdb
--- /dev/null
+++ b/TAO/tao/Storable_Base.inl
@@ -0,0 +1,71 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Storable_Base.inl
+ *
+ * $Id$
+ *
+ * @author Bruce Trask <trask_b@ociweb.com>
+ * @author Chanaka Liyanaarachchi <chanaka@ociweb.com>
+ * @author Byron Harris <harrisb@ociweb.com>
+ */
+//=============================================================================
+
+#include "tao/Storable_Base.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+ACE_INLINE
+TAO::Storable_Base::Storable_Base()
+ : state_ (goodbit)
+{
+}
+
+ACE_INLINE
+TAO::Storable_Base::~Storable_Base()
+{
+}
+
+ACE_INLINE void
+TAO::Storable_Base::clear (TAO::Storable_Base::Storable_State state)
+{
+ this->state_ = state;
+}
+
+ACE_INLINE void
+TAO::Storable_Base::setstate (TAO::Storable_Base::Storable_State state)
+{
+ this->clear (static_cast <TAO::Storable_Base::Storable_State> (
+ this->rdstate () | state));
+}
+
+ACE_INLINE TAO::Storable_Base::Storable_State
+TAO::Storable_Base::rdstate (void) const
+{
+ return this->state_;
+}
+
+ACE_INLINE bool
+TAO::Storable_Base::good (void) const
+{
+ return (this->state_ == goodbit);
+}
+
+ACE_INLINE bool
+TAO::Storable_Base::bad (void) const
+{
+ return (this->state_ & badbit);
+}
+
+ACE_INLINE bool
+TAO::Storable_Base::eof (void) const
+{
+ return (this->state_ & eofbit);
+}
+
+ACE_INLINE bool
+TAO::Storable_Base::fail (void) const
+{
+ return (this->state_ & failbit);
+}
diff --git a/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.cpp b/TAO/tao/Storable_File_Guard.cpp
index 80ecb1b2ced..7ca4d772c7d 100644
--- a/TAO/orbsvcs/orbsvcs/Naming/Naming_Service_File_Guard.cpp
+++ b/TAO/tao/Storable_File_Guard.cpp
@@ -1,6 +1,6 @@
//=============================================================================
/**
- * @file Naming_Service_File_Guard.cpp
+ * @file Storable_File_Guard.cpp
*
* $Id$
*
@@ -9,23 +9,23 @@
*/
//=============================================================================
-#include "orbsvcs/Naming/Naming_Service_File_Guard.h"
-#include "orbsvcs/Naming/Storable.h"
+#include "tao/Storable_File_Guard.h"
+#include "tao/Storable_Base.h"
#include "tao/SystemException.h"
-Naming_Service_File_Guard::
-Naming_Service_File_Guard (bool redundant)
+TAO::Storable_File_Guard::
+Storable_File_Guard (bool redundant)
: redundant_(redundant)
, closed_(1)
{
- ACE_TRACE("Naming_Service_File_Guard::Naming_Service_File_Guard");
+ ACE_TRACE("TAO::Storable_File_Guard::Storable_File_Guard");
}
void
-Naming_Service_File_Guard::init(const char * mode)
+TAO::Storable_File_Guard::init(const char * mode)
{
- ACE_TRACE("Naming_Service_File_Guard::init");
+ ACE_TRACE("TAO::Storable_File_Guard::init");
// We only accept a subset of mode argument, check it
rwflags_ = 0;
@@ -106,9 +106,9 @@ Naming_Service_File_Guard::init(const char * mode)
}
void
-Naming_Service_File_Guard::release (void)
+TAO::Storable_File_Guard::release (void)
{
- ACE_TRACE("Naming_Service_File_Guard::release");
+ ACE_TRACE("TAO::Storable_File_Guard::release");
if ( ! closed_ )
{
// If we updated the disk, save the time stamp
@@ -124,16 +124,15 @@ Naming_Service_File_Guard::release (void)
}
}
-Naming_Service_File_Guard::
-~Naming_Service_File_Guard ()
+TAO::Storable_File_Guard::
+~Storable_File_Guard ()
{
- ACE_TRACE("Naming_Service_File_Guard::~Naming_Service_File_Guard");
- this->release ();
+ ACE_TRACE("TAO::Storable_File_Guard::~Storable_File_Guard");
}
-TAO_Storable_Base &
-Naming_Service_File_Guard::peer ()
+TAO::Storable_Base &
+TAO::Storable_File_Guard::peer ()
{
- ACE_TRACE("Naming_Service_File_Guard::peer");
+ ACE_TRACE("TAO::Storable_File_Guard::peer");
return *fl_;
}
diff --git a/TAO/tao/Storable_File_Guard.h b/TAO/tao/Storable_File_Guard.h
new file mode 100644
index 00000000000..b062f9a8ad9
--- /dev/null
+++ b/TAO/tao/Storable_File_Guard.h
@@ -0,0 +1,93 @@
+// -*- C++ -*-
+
+//=============================================================================
+/**
+ * @file Storable_File_Guard.h
+ *
+ * $Id$
+ *
+ * @author Rich Seibel (seibelr@ociweb.com)
+ * @author Byron Harris (harrisb@ociweb.com)
+ */
+//=============================================================================
+
+#ifndef TAO_STORABLE_FILE_GUARD_H
+#define TAO_STORABLE_FILE_GUARD_H
+
+#include "tao/orbconf.h"
+#include "tao/TAO_Export.h"
+
+TAO_BEGIN_VERSIONED_NAMESPACE_DECL
+
+namespace TAO
+{
+
+ class Storable_Base;
+
+ /**
+ * @class Storable_File_Guard
+ * @brief Bridge abstract class for TAO_Storable_Base that performs locking.
+ *
+ * A guard for Storable_Base that opens a file
+ * for read/write and sets a lock on it. It then checks if the file has
+ * changed and re-reads it if it has.
+ *
+ * The destructor releases the lock.
+ */
+ class TAO_Export Storable_File_Guard
+ {
+ public:
+
+ Storable_File_Guard (bool redundant);
+
+ virtual ~Storable_File_Guard ();
+
+ /// Releases the lock, closes the file, and deletes the I/O stream.
+ void release (void);
+
+ /// Returns the stream to read/write on
+ Storable_Base & peer (void);
+
+ protected:
+
+ /// Should be called by constructors of derived classes
+ /// since can't call virtual functions below in constructor
+ /// of this class.
+ void init (const char * mode);
+
+ virtual void set_parent_last_changed (const time_t & time) = 0;
+
+ virtual time_t get_parent_last_changed () = 0;
+
+ virtual void create_child () = 0;
+
+ virtual bool is_child_created () = 0;
+
+ virtual Storable_Base * create_stream (const char * mode) = 0;
+
+ /// The pointer to the actual file I/O (bridge pattern)
+ Storable_Base *fl_;
+
+ private:
+
+ bool redundant_;
+
+ /// Default constructor
+ Storable_File_Guard ();
+
+ /// A flag to keep us from trying to close things more than once.
+ int closed_;
+
+ /// The flags that we were opened with
+ int rwflags_;
+
+ /// Symbolic values for the flags in the above
+ enum { mode_write = 1, mode_read = 2, mode_create = 4 };
+
+ };
+
+}
+
+TAO_END_VERSIONED_NAMESPACE_DECL
+
+#endif
diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc
index af79945534f..6973f260bfd 100644
--- a/TAO/tao/tao.mpc
+++ b/TAO/tao/tao.mpc
@@ -276,6 +276,7 @@ project(TAO) : acelib, install, tao_output, taodefaults, pidl, extra_core, taoid
ShortSeqC.cpp
String_Alloc.cpp
StringSeqC.cpp
+ Storable_Base.cpp
Stub.cpp
Stub_Factory.cpp
Synch_Invocation.cpp