summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-09-15 04:53:00 +0000
committerMarc Laukien <marc@zeroc.com>2001-09-15 04:53:00 +0000
commit5570d5f046301e032bb7a83168eb264161b7a219 (patch)
tree600a21dfec9bbb259ca2d48ea62a4fc1962388d8 /cpp/src
parentfixes (diff)
downloadice-5570d5f046301e032bb7a83168eb264161b7a219.tar.bz2
ice-5570d5f046301e032bb7a83168eb264161b7a219.tar.xz
ice-5570d5f046301e032bb7a83168eb264161b7a219.zip
more Freeze stuff
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Freeze/DBI.cpp72
-rw-r--r--cpp/src/Freeze/DBI.h43
-rw-r--r--cpp/src/Freeze/Makefile3
3 files changed, 117 insertions, 1 deletions
diff --git a/cpp/src/Freeze/DBI.cpp b/cpp/src/Freeze/DBI.cpp
new file mode 100644
index 00000000000..1874803d7fd
--- /dev/null
+++ b/cpp/src/Freeze/DBI.cpp
@@ -0,0 +1,72 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#include <Ice/Communicator.h>
+#include <Ice/Properties.h>
+#include <Ice/Logger.h>
+#include <Ice/LocalException.h>
+#include <Freeze/DBI.h>
+
+using namespace std;
+using namespace Ice;
+using namespace Freeze;
+
+DBPtr
+Freeze::DBFactoryI::createDB()
+{
+ JTCSyncT<JTCMutex> sync(*this);
+
+ if (_destroy)
+ {
+ throw ObjectNotExistException(__FILE__, __LINE__);
+ }
+
+ return 0;
+}
+
+void
+Freeze::DBFactoryI::destroy()
+{
+ JTCSyncT<JTCMutex> sync(*this);
+
+ if (_destroy)
+ {
+ throw ObjectNotExistException(__FILE__, __LINE__);
+ }
+
+ _destroy = true;
+}
+
+Freeze::DBFactoryI::DBFactoryI(const CommunicatorPtr& communicator, const PropertiesPtr& properties) :
+ _communicator(communicator),
+ _properties(properties),
+ _destroy(false)
+{
+}
+
+Freeze::DBFactoryI::~DBFactoryI()
+{
+ if (!_destroy)
+ {
+ _communicator->getLogger()->warning("database factory object has not been destroyed");
+ }
+}
+
+DBFactoryPtr
+Freeze::initialize(const CommunicatorPtr& communicator)
+{
+ return new DBFactoryI(communicator, communicator->getProperties());
+}
+
+DBFactoryPtr
+Freeze::initializeWithProperties(const CommunicatorPtr& communicator, const PropertiesPtr& properties)
+{
+ return new DBFactoryI(communicator, properties);
+}
diff --git a/cpp/src/Freeze/DBI.h b/cpp/src/Freeze/DBI.h
new file mode 100644
index 00000000000..2c8c7f7ec3e
--- /dev/null
+++ b/cpp/src/Freeze/DBI.h
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+#ifndef FREEZE_DB_FACTORY_I_H
+#define FREEZE_DB_FACTORY_I_H
+
+#include <Freeze/Initialize.h>
+#include <Freeze/DB.h>
+
+namespace Freeze
+{
+
+class DBFactoryI : public DBFactory, public JTCMutex
+{
+public:
+
+ virtual DBPtr createDB();
+ virtual void destroy();
+
+private:
+
+ DBFactoryI(const ::Ice::CommunicatorPtr&, const ::Ice::PropertiesPtr&);
+ virtual ~DBFactoryI();
+
+ friend FREEZE_API DBFactoryPtr initialize(const ::Ice::CommunicatorPtr&);
+ friend FREEZE_API DBFactoryPtr initializeWithProperties(const ::Ice::CommunicatorPtr&,
+ const ::Ice::PropertiesPtr&);
+
+ ::Ice::CommunicatorPtr _communicator;
+ ::Ice::PropertiesPtr _properties;
+ bool _destroy;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Freeze/Makefile b/cpp/src/Freeze/Makefile
index 8bdd14d853b..cfec4712aed 100644
--- a/cpp/src/Freeze/Makefile
+++ b/cpp/src/Freeze/Makefile
@@ -18,7 +18,8 @@ VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE)
TARGETS = $(NAME) $(VERSIONED_NAME)
-OBJS = DB.o
+OBJS = DB.o \
+ DBI.o
SRCS = $(OBJS:.o=.cpp)