summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/DBI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Freeze/DBI.cpp')
-rw-r--r--cpp/src/Freeze/DBI.cpp72
1 files changed, 72 insertions, 0 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);
+}