Go to the documentation of this file.00001 #ifndef INCLUDE_ORA_CONNECTIONPOOL_H
00002 #define INCLUDE_ORA_CONNECTIONPOOL_H
00003
00004
00005 #include <map>
00006
00007 #include <boost/shared_ptr.hpp>
00008 #include <boost/weak_ptr.hpp>
00009 #include "RelationalAccess/ConnectionService.h"
00010
00011 namespace coral {
00012 class ISessionProxy;
00013 }
00014
00015 namespace ora {
00016
00017 class SharedSession {
00018 public:
00019 SharedSession();
00020 SharedSession(boost::shared_ptr<coral::ISessionProxy>& coralSession);
00021 SharedSession( const SharedSession& rhs );
00022 ~SharedSession();
00023 SharedSession& operator=( const SharedSession& rhs );
00024 bool isValid();
00025 coral::ISessionProxy& get();
00026 void close();
00027 private:
00028 boost::shared_ptr<coral::ISessionProxy> m_proxy;
00029 };
00030
00032 class ConnectionPool {
00033
00034 public:
00035
00036 ConnectionPool();
00037
00038 virtual ~ConnectionPool();
00039
00040 coral::IConnectionService& connectionService();
00041 coral::IConnectionServiceConfiguration& configuration();
00042
00043 SharedSession connect( const std::string& connectionString, coral::AccessMode accessMode );
00044
00045 private:
00046
00047 static std::string lookupString( const std::string& connectionString, coral::AccessMode accessMode );
00048
00049 private:
00050
00051 coral::ConnectionService m_connectionService;
00052
00053 std::map<std::string,boost::weak_ptr<coral::ISessionProxy> > m_sessions;
00054 };
00055
00056
00057 }
00058
00059 #endif