Show
Ignore:
Timestamp:
01/30/10 15:53:00 (6 months ago)
Author:
mgray
Message:

Implemented getDatabaseConnection() in ApplicationServer?.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Enterprise/branches/0075_TR_SCRIPTING/AppServer/src/ApplicationServer.hpp

    r3331 r3336  
    33// 
    44// Copyright (C) 2001 - 2010 Tony Richards 
    5 // Copyright (C) 2008 - 2009 Matthew Alan Gray 
     5// Copyright (C) 2008 - 2010 Matthew Alan Gray 
    66// Copyright (C)        2009 Joshua Cassity 
    77// 
     
    3131#include "../I_ApplicationServer.hpp" 
    3232 
     33#include <Zen/Core/Threading/I_Thread.hpp> 
    3334#include <Zen/Core/Threading/ThreadPool.hpp> 
    3435 
     
    4041//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 
    4142namespace Zen { 
     43    namespace Database { 
     44        class I_DatabaseService; 
     45        class I_DatabaseConnection; 
     46    }   // namespace Database 
    4247namespace Enterprise { 
    4348namespace AppServer { 
     
    8691    virtual void handleRequest(pRequest_type _pRequest, pResponseHandler_type _pResponseHandler); 
    8792    virtual void handleSessionEvent(pSessionEvent_type _pSessionEvent); 
     93    virtual pDatabaseConnection_type getDatabaseConnection(const std::string& _database, Zen::Threading::I_Thread::ThreadId& _threadId); 
    8894    /// @} 
    8995 
     
    108114 
    109115    Threading::ThreadPool& getSharedThreadPool() { return m_sharedThreadPool; } 
     116    /// @} 
     117 
     118    /// @name Inner classes 
     119    /// @{ 
     120private: 
     121    class DatabaseConnections 
     122    { 
     123        /// @name Types 
     124        /// @{ 
     125    public: 
     126        typedef Zen::Memory::managed_ptr<Zen::Database::I_DatabaseService>              pDatabaseService_type; 
     127        typedef std::map<std::string,std::string>                                       config_type; 
     128        typedef Zen::Memory::managed_ptr<Zen::Database::I_DatabaseConnection>           pDatabaseConnection_type; 
     129        typedef std::map<Zen::Threading::I_Thread::ThreadId,pDatabaseConnection_type>   DatabaseConnections_type; 
     130        /// @} 
     131 
     132        /// @name DatabaseConnections implementation 
     133        /// @{ 
     134    public: 
     135        pDatabaseConnection_type getConnection(Zen::Threading::I_Thread::ThreadId& _threadId); 
     136        /// @} 
     137 
     138        /// @name 'Structors 
     139        /// @{ 
     140                 DatabaseConnections(pDatabaseService_type _pService, config_type _connectionConfig); 
     141                ~DatabaseConnections(); 
     142        /// @} 
     143 
     144        /// @name Member Variables 
     145        /// @{ 
     146    private: 
     147        pDatabaseService_type           m_pDatabaseService; 
     148        config_type                     m_connectionConfig; 
     149        DatabaseConnections_type        m_databaseConnections; 
     150        Zen::Threading::I_Mutex*        m_databaseConnectionsMutex; 
     151        /// @} 
     152 
     153    };  // class DatabaseConnections 
    110154    /// @} 
    111155 
     
    156200 
    157201    pMessageRegistry_type       m_pMessageRegistry_type; 
     202 
     203    typedef std::map<std::string, DatabaseConnections>  DatabaseConnectionsMap_type; 
     204    DatabaseConnectionsMap_type m_databaseConnectionsMap; 
    158205    /// @} 
    159206