Changes between Version 2 and Version 3 of FdoConnectionPooling


Ignore:
Timestamp:
Oct 17, 2007, 12:11:18 PM (17 years ago)
Author:
gregboone
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FdoConnectionPooling

    v2 v3  
    34345) Class OSGeo.FDO.!ClientServices.!ConnectionManager[[BR]]
    3535
     362.1 API
     37
     382.1.1 Unmanaged API
     39
     402.1.1.1 Class FdoConnectionCacheEntry (new)
     41
     42
     43{{{
     44/// \brief
     45/// 
     46/// FdoConnectionCacheEntry is a cache entry class that enables
     47/// FdoIConnection objects to be cached and exposed through FdoConnectionManager.
     48/// Instances of FdoConnectionCacheEntry are stored in an instance of
     49/// FdoConnectionCache and are accessible using an instance of
     50/// FdoConnectionCachePair.
     51///
     52class FdoConnectionCacheEntry
     53{
     54public:
     55    /// \brief
     56    /// 
     57    /// Constructs a default instance of a FdoConnectionCacheEntry object.
     58    FdoConnectionCacheEntry(void);
     59
     60    /// \brief
     61    /// 
     62    /// Default destructor for FdoConnectionCacheEntry objects.
     63    virtual ~FdoConnectionCacheEntry(void);
     64
     65public:
     66    /// \brief
     67    /// Determines if the cached FdoIConnection instance is being
     68    /// used by a client application
     69    ///
     70    /// \return
     71    /// Returns true if the cached connection is in use, otherwise false.
     72    /// Throws an instance of FdoClientServicesException if an error occurs.
     73    ///
     74    FDO_API virtual FdoBoolean InUse(void);
     75
     76    /// \brief
     77    /// Retrieves the FdoIConnection object contained in the cache entry object
     78    ///
     79    /// \return
     80    /// Returns the FdoIConnection object attached to the cahe entry. The
     81    /// returned connection object's reference count will be incremented.
     82    /// Callers are expected to Release the connection once finished with it.
     83    /// Throws an instance of FdoClientServicesException if an error occurs.
     84    ///
     85    FDO_API virtual FdoIConnection* GetConnection(void);
     86
     87    /// \brief
     88    /// Sets the FdoIConnection object contained in the cache entry object
     89    ///
     90    /// \param fdoConnection
     91    /// The FdoIConnection object to be attached to the cahe entry. The
     92    /// set connection object's reference count will be incremented by 1. The
     93    /// connection object will be Released once the the cache entry is deleted.
     94    /// Throws an instance of FdoClientServicesException if an error occurs.
     95    ///
     96    /// \return
     97    /// Returns nothing.
     98    /// Throws an instance of FdoClientServicesException if an error occurs.
     99    ///
     100    FDO_API virtual void SetConnection(FdoIConnection* fdoConnection);
     101
     102    /// \brief
     103    /// Gets the date and time the FdoIConnection object contained in the
     104    /// cache was last accessed from the cache. The DateTime will be used
     105    /// to determine when the connection has timed out and can be released
     106    /// from the cache.
     107    ///
     108    /// \return
     109    /// Returns an instance of FdoDateTime containing the date and time the
     110    /// FdoIConnection object was last accessed from the cache.
     111    /// Throws an instance of FdoClientServicesException if an error occurs.
     112    ///
     113    FDO_API virtual FdoDateTime GetLastTimeUsed(void);
     114
     115    /// \brief
     116    /// Sets the date and time the FdoIConnection object contained in the
     117    /// cache was last accessed from the cache. The DateTime will be used
     118    /// to determine when the connection has timed out and can be released
     119    /// from the cache.
     120    ///
     121    /// \param time
     122    /// An instance of FdoDateTime containing the date and time the
     123    /// FdoIConnection object was last accessed from the cache.
     124    /// Throws an instance of FdoClientServicesException * if an error occurs.
     125    ///
     126    /// \return
     127    /// Returns nothing.
     128    /// Throws an instance of FdoClientServicesException if an error occurs.
     129    ///
     130    FDO_API virtual void SetLastTimeUsed(FdoDateTime time);
     131
     132    /// \brief
     133    /// Gets the connection string used to initialize and identify the FdoIConnection
     134    /// when it was created and added to the cache.
     135    ///
     136    /// \return
     137    /// Returns an FdoString containing the connectionString used to initialize
     138    /// the FdoIConnection object and uniquely identify it in the cache.
     139    /// Throws an instance of FdoClientServicesException if an error occurs.
     140    ///
     141    FDO_API virtual FdoString* GetConnectionString(void);
     142
     143    /// \brief
     144    /// Sets the connection string used to initialize and identify the FdoIConnection
     145    /// when it was created and added to the cache.
     146    ///
     147    /// \param time
     148    /// An instance of FdoString containing the connection string used to initialize
     149    /// the FdoIConnection object and uniquely identify it in the cache.
     150    ///
     151    /// \return
     152    /// Returns nothing.
     153    /// Throws an instance of FdoClientServicesException if an error occurs.
     154    ///
     155    FDO_API virtual void SetConnectionString(FdoString* connectionString);
     156
     157    /// \brief
     158    /// Gets the configuration used to initialize and identify the FdoIConnection
     159    /// when it was created and added to the cache.
     160    ///
     161    /// \return
     162    /// Returns an FdoString containing the configuration string used to initialize
     163    /// the FdoIConnection object and uniquely identify it in the cache.
     164    /// Throws an instance of FdoClientServicesException if an error occurs.
     165    ///
     166    FDO_API virtual FdoString* GetConfiguration(void);
     167
     168    /// \brief
     169    /// Sets the configuration used to initialize and identify the FdoIConnection
     170    /// when it was created and added to the cache.
     171    ///
     172    /// \param time
     173    /// An instance of FdoString containing the configuration string used to initialize
     174    /// the FdoIConnection object and uniquely identify it in the cache.
     175    ///
     176    /// \return
     177    /// Returns nothing.
     178    /// Throws an instance of FdoClientServicesException if an error occurs.
     179    ///
     180    FDO_API virtual void SetConfiguration(FdoString* configuration);
     181
     182    /// \brief
     183    /// Gets the long transaction name used to initialize and identify the FdoIConnection
     184    /// when it was created and added to the cache.
     185    ///
     186    /// \return
     187    /// Returns an FdoString containing the long transaction name used to 
     188    /// initialize the FdoIConnection object and uniquely identify it in the cache.
     189    /// Throws an instance of FdoClientServicesException if an error occurs.
     190    ///
     191    FDO_API virtual FdoString* GetLongTransactionName(void);
     192
     193    /// \brief
     194    /// Sets the long transaction name used to initialize and identify the FdoIConnection
     195    /// when it was created and added to the cache.
     196    ///
     197    /// \param time
     198    /// An instance of FdoString containing the long transaction name used to initialize
     199    /// the FdoIConnection object and uniquely identify it in the cache.
     200    ///
     201    /// \return
     202    /// Returns nothing.
     203    /// Throws an instance of FdoClientServicesException if an error occurs.
     204    ///
     205    FDO_API virtual void SetLongTransactionName(FdoString* longTransaction);
     206
     207private:
     208    FdoIConnection* m_fdoConnection;
     209    FdoStringP m_connectionString;
     210    FdoStringP m_configuration;
     211    FdoStringP m_longTransactionName;
     212    FdoDateTime m_lastUsed;
     213};
     214}}}
     215
     2162.1.1.2 Class FdoConnectionCache (new)
     217
     218
     219{{{
     220/// \brief
     221/// 
     222/// The FdoConnectionCache class provides the storage mechanism for a map
     223/// of cached FdoIConnection objects. The Standard Template Library multimap
     224/// class is used for the storage and retrieval of data from a collection in which the
     225/// each element is a pair that has both a data value and a sort key. The value of the
     226/// key does not need to be unique and is used to order the data automatically.
     227/// The value of an element in a multimap, but not its associated key value, may be
     228/// changed directly. Instead, key values associated with old elements must be deleted
     229/// and new key values associated with new elements inserted.
     230///
     231/// Refer to http://msdn2.microsoft.com/en-us/library/1ka6hya8.aspx
     232/// for a detailed description of the std::multimap class.
     233///
     234typedef std::multimap<std::wstring, FdoConnectionCacheEntry*> FdoConnectionCache;
     235}}}
     236
     2372.1.1.3 Class FdoConnectionCachePair (new)
     238
     239
     240{{{
     241/// \brief
     242/// 
     243/// The FdoConnectionCachePair class provides the std pair object inserted into
     244/// the FdoConnectionCache. The Standard Template Library pair class provides for
     245/// the ability to treat two objects as a single object.
     246///
     247/// Refer to http://msdn2.microsoft.com/en-us/library/t9zb6cdt.aspx
     248/// for a detailed description of the std::pair class.
     249///
     250typedef std::pair<std::wstring, FdoConnectionCacheEntry*> FdoConnectionCachePair;
     251}}}
     252
     2532.1.1.4 Interface IConnectionManager (modified)
     254
     255The IConnectionManager Interface will be modified to support caching of FdoIConnection objects.
     256
     257
     258{{{
     259/// \brief
     260/// 
     261/// The IConnectionManager interface supports dynamic creation of connection objects
     262/// given a provider name, connection string, configuration and long transaction name. Newly
     263/// created connection objects will be initialized with the parameters supplied to the
     264/// CreateConnection methods.
     265///
     266/// If required, connections can be pooled and reused by the the calling application.
     267/// Applications requesting an FDO connection using the above connection
     268/// parameters will be returned a newly created connection if a previous connection has
     269/// not already been created with identical parameters. If an existing connection interface had
     270/// previously been created and is not currently in use by another process, it will be returned
     271/// to the calling application.
     272///
     273/// \remarks
     274/// 
     275/// In order for dynamic creation to work, each dynamic link library, shared library,
     276/// or assembly that implements a provider must supply a well-defined entry point function that
     277/// takes as input a provider name and returns an FdoIConnection instance. The definition of the
     278/// entry point function is language and platform dependent. For this release of FDO, on the
     279/// Windows platform, windows libraries supporting FDO providers will be expected to support the
     280/// following well-known entry point function which will create and returns an unitialized
     281/// connection object.
     282///
     283///         FdoIConnection * CreateConnection();
     284///
     285class IConnectionManager : public FdoIDisposable
     286{
     287public:
     288    /// \brief
     289    /// Ebables the caching of FDO Connections. If caching has previously been enabled,
     290    /// and the poolSize is greater than the previous value used to initialze the pool,
     291    /// the cache will be re-initialized with the new poolSize. If caching has previously
     292    /// been enabled, the value of timeout shall replace the previous value used to initialize
     293    /// the cache.
     294    ///
     295    /// \param poolSize
     296    /// Input The size of the FDO connection cache pool
     297    ///
     298    /// \param timeout
     299    /// Input The length of time in seconds a connection may remain unused before it is removed from
     300    /// the connection cache
     301    ///
     302    /// \return
     303    /// Returns nothing. Throws an instance of FdoClientServicesException * if an error occurs.
     304    ///
     305    FDO_API virtual void EnableCaching(FdoInt32 poolSize, FdoInt32 timeout) = 0;
     306
     307    /// \brief
     308    /// Disables the caching of FDO Connections. All FDO Connections will be removed from the cache.
     309    ///
     310    /// \return
     311    /// Returns nothing. Throws an instance of FdoClientServicesException * if an error occurs.
     312    ///
     313    FDO_API virtual void DisableCaching() = 0;
     314
     315    /// \brief
     316    /// Creates an unitialized connection object given the provider name. The connection
     317    /// can optionally be initialized with a connectionString.
     318    ///
     319    /// \param providerName
     320    /// Input The unique name of the feature provider. This name should be of the form
     321    /// [Company].[Provider].[Version].
     322    ///
     323    /// \param connectionString
     324    /// Input The connectionString that will be used to configure the FDO connection
     325    ///
     326    /// \return
     327    /// Returns an instance of an FdoIConnection object. Throws an instance of
     328    /// FdoClientServicesException if an error occurs.
     329    ///
     330    FDO_API virtual FdoIConnection* CreateConnection(FdoString* providerName,
     331                                                     FdoString* connectionString = NULL) = 0;
     332       
     333    /// \brief
     334    /// Creates a connection object given the provider name and configuration document.
     335    /// The connection can optionally be initialized with a connectionString and long
     336    /// transaction name.
     337    ///
     338    /// \param providerName
     339    /// Input The unique name of the feature provider. This name should be of the form
     340    /// [Company].[Provider].[Version].
     341    ///
     342    /// \param configStream
     343    /// Input The XML configuration stream that will be used to configure the FDO connection
     344    ///
     345    /// \param connectionString
     346    /// Input The connectionString that will be used to configure the FDO connection
     347    ///
     348    /// \param longTransactionName
     349    /// Input The longTransactionName that will be used to configure the FDO connection
     350    ///
     351    /// \return
     352    /// Returns an instance of an FdoIConnection object.
     353    /// Throws an instance of FdoClientServicesException if an error occurs.
     354    ///
     355    FDO_API virtual FdoIConnection* CreateConnection(FdoString* providerName,
     356                                                     FdoIoStream* configStream,
     357                                                     FdoString* connectionString = NULL,
     358                                                     FdoString* longTransactionName = NULL) = 0;
     359
     360    /// \brief
     361    /// Finds a cached connection in the connection pool by name.
     362    ///
     363    /// \param connectionName
     364    /// Input The name of the connection.
     365    ///
     366    /// \return
     367    /// Returns an instance of an FdoIConnection if the named connection
     368    /// exists in the connection pool. Throws an instance of
     369    /// FdoClientServicesException if an error occurs.
     370    ///
     371    FDO_API virtual FdoIConnection* FindConnection(FdoString* connectionName) = 0;
     372
     373    /// \brief
     374    /// Frees cached FDO connections that are not currently in use. The cleanup
     375    /// can be localized to freeing connections corresponding to providers identified
     376    /// by a combination of their provider name and connection string
     377    ///
     378    /// \param providerName
     379    /// Input The unique name of the feature provider. This name should be of the form
     380    /// [Company].[Provider].[Version].
     381    ///
     382    /// \return
     383    /// Returns nothing. Throws an instance of FdoClientServicesException if an error occurs.
     384    ///
     385    FDO_API virtual void FreeCachedConnections(FdoString* providerName = NULL) = 0;
     386
     387    /// \brief
     388    /// Frees all cached FDO connections that have expired pass their timeout value
     389    ///
     390    /// \return
     391    /// Returns nothing. Throws an instance of FdoClientServicesException if an error occurs.
     392    ///
     393    FDO_API virtual void FreeExpiredConnections() = 0;
     394
     395    /// \brief
     396    /// Frees a connection library reference given the provider name.
     397    ///
     398    /// \param providerName
     399    /// Input The unique name of the feature provider. This name should be of the form
     400    /// [Company].[Provider].[Version].
     401    ///
     402    /// \return
     403    /// Returns nothing. Throws an instance of FdoClientServicesException if an error occurs.
     404    ///
     405    FDO_API virtual void FreeLibrary(FdoString* providerName) = 0;
     406};
     407}}}
     408
     4092.1.1.5 Class FdoConnectionManager (modified)
     410
     411The FdoConnectionManager class, implmenets IConnectionManager will be modified to implement support for caching of FdoIConnection objects within the FDO API. This implementation will be available to all FDO clients.
     412
     413
     414{{{
     415/// \brief
     416/// 
     417/// The FdoConnectionManager class supports dynamic creation of connection objects
     418/// given a provider name, connection string, configuration and long transaction name. Newly
     419/// created connection objects will be initialized with the parameters supplied to the
     420/// CreateConnection methods.
     421///
     422/// If required, connections can be pooled and reused by the the calling application.
     423/// Applications requesting an FDO connection using the above connection
     424/// parameters will be returned a newly created connection if a previous connection has
     425/// not already been created with identical parameters. If an existing connection interface had
     426/// previously been created and is not currently in use by another process, it will be returned
     427/// to the calling application.
     428///
     429/// \remarks
     430///
     431/// In order for dynamic creation to work, each dynamic link library, shared library,
     432/// or assembly that implements a provider must supply a well-defined entry point function that
     433/// takes as input a provider name and returns an FdoIConnection instance. The definition of the
     434/// entry point function is language- and platform-dependent. For this release of FDO, the
     435/// windows libraries supporting FDO providers will be expected to support the following well-known
     436/// entry point function, which will create and return an unitialized connection object:
     437///
     438///        IConnection * CreateConnection();
     439///
     440class FdoConnectionManager : public IConnectionManager
     441{
     442    /// \brief
     443    /// Instances of interface FdoFeatureAccessManager are responsible for the
     444    /// lifespan of FdoConnectionManager
     445    ///
     446    friend class FdoFeatureAccessManager;
     447
     448protected:
     449    /// Constructs a default instance of a FdoProviderRegistry object.
     450    FdoConnectionManager();
     451
     452    /// Default destructor for FdoProviderRegistry object.
     453    virtual ~FdoConnectionManager();
     454
     455    /// Deletes instance of FdoConnectionManager. Called only when reference count equals 0
     456    virtual void Dispose();
     457
     458public:
     459    /// \brief
     460    /// Ebables the caching of FDO Connections. If caching has previously been enabled,
     461    /// and the poolSize is greater than the previous value used to initialze the pool,
     462    /// the cache will be re-initialized with the new poolSize. If caching has previously
     463    /// been enabled, the value of timeout shall replace the previous value used to initialize
     464    /// the cache.
     465    ///
     466    /// \param poolSize
     467    /// Input The size of the FDO connection cache pool
     468    ///
     469    /// \param timeout
     470    /// Input The length of time in seconds a connection may remain unused before it is removed from
     471    /// the connection cache
     472    ///
     473    /// \return
     474    /// Returns nothing..
     475    /// Throws an instance of FdoClientServicesException if an error occurs.
     476    ///
     477    FDO_API virtual void EnableCaching(FdoInt32 poolSize, FdoInt32 timeout);
     478
     479    /// \brief
     480    /// Disables the caching of FDO Connections. All FDO Connections will be removed from the cache.
     481    ///
     482    /// \return
     483    /// Returns nothing.
     484    /// Throws an instance of FdoClientServicesException if an error occurs.
     485    ///
     486    FDO_API virtual void DisableCaching();
     487
     488    /// \brief
     489    /// Creates an unitialized connection object given the provider name. The connection
     490    /// can optionally be initialized with a connectionString.
     491    ///
     492    /// \param providerName
     493    /// Input The unique name of the feature provider. This name should be of the form
     494    /// [Company].[Provider].[Version].
     495    ///
     496    /// \param connectionString
     497    /// Input The connectionString that will be used to configure the FDO connection
     498    ///
     499    /// \return
     500    /// Returns an instance of an FdoIConnection object.
     501    /// Throws an instance of FdoClientServicesException if an error occurs.
     502    ///
     503    FDO_API virtual FdoIConnection* CreateConnection(FdoString* providerName,
     504                                                     FdoString* connectionString = NULL);
     505       
     506    /// \brief
     507    /// Creates a connection object given the provider name and configuration document.
     508    /// The connection can optionally be initialized with a connectionString and long
     509    /// transaction name.
     510    ///
     511    /// \param providerName
     512    /// Input The unique name of the feature provider. This name should be of the form
     513    /// [Company].[Provider].[Version].
     514    ///
     515    /// \param configStream
     516    /// Input The XML configuration stream that will be used to configure the FDO connection
     517    ///
     518    /// \param connectionString
     519    /// Input The connectionString that will be used to configure the FDO connection
     520    ///
     521    /// \param longTransactionName
     522    /// Input The longTransactionName that will be used to configure the FDO connection
     523    ///
     524    /// \return
     525    /// Returns an instance of an FdoIConnection object.
     526    /// Throws an instance of FdoClientServicesException if an error occurs.
     527    ///
     528    FDO_API virtual FdoIConnection* CreateConnection(FdoString* providerName,
     529                                                     FdoIoStream* configStream,
     530                                                     FdoString* connectionString = NULL,
     531                                                     FdoString* longTransactionName = NULL);
     532
     533    /// \brief
     534    /// Finds a cached connection in the connection pool by name.
     535    ///
     536    /// \param connectionName
     537    /// Input The name of the connection.
     538    ///
     539    /// \return
     540    /// Returns an instance of an FdoIConnection if the named connection
     541    /// exists in the connection pool. Throws an instance of
     542    /// FdoClientServicesException if an error occurs.
     543    ///
     544    FDO_API virtual FdoIConnection* FindConnection(FdoString* connectionName) = 0;
     545
     546    /// \brief
     547    /// Frees cached FDO connections that are not currently in use. The cleanup
     548    /// can be localized to freeing connections corresponding to providers identified
     549    /// by a combination of their provider name and connection string
     550    ///
     551    /// \param providerName
     552    /// Input The unique name of the feature provider. This name should be of the form
     553    /// [Company].[Provider].[Version].
     554    ///
     555    /// \return
     556    /// Returns nothing.
     557    /// Throws an instance of FdoClientServicesException if an error occurs.
     558    ///
     559    FDO_API virtual void FreeCachedConnections(FdoString* providerName = NULL);
     560
     561    /// \brief
     562    /// Frees all cached FDO connections that have expired pass their timeout value
     563    ///
     564    /// \return
     565    /// Returns nothing.
     566    /// Throws an instance of FdoClientServicesException if an error occurs.
     567    ///
     568    FDO_API virtual void FreeExpiredConnections();
     569
     570    /// \brief
     571    /// Frees a connection library reference given the provider name
     572    ///
     573    /// \param providerName
     574    /// Input The unique name of the feature provider. This name should be of the form
     575    /// [Company].[Provider].[Version].
     576    ///
     577    /// \return
     578    /// Returns nothing.
     579    /// Throws an instance of FdoClientServicesException if an error occurs.
     580    ///
     581    FDO_API virtual void FreeLibrary(FdoString* providerName);
     582
     583private:
     584    /// Provider library reference map
     585    FdoModuleMap m_moduleMap;
     586
     587    /// Cache of Provider connection objects
     588    FdoConnectionCache m_connectionCache;
     589};
     590}}}
     591
     5922.1.1.6 Interface FdoIConnection (modified)
     593
     594A new property ‘name’ will be added to the FdoIConnection interface. This property will be accessible through GetName() and SetName methods.  These methods will allow clients to retrieve pooled connection interfaces through the IConnectionManager.
     595
     596
     597{{{
     598/// \brief
     599/// Gets the optional name associated to the connection. The connection name
     600/// can be used to enhance re-use of connection objects through connection pooling.
     601/// Connection pooling is implemented through the FDO IConnectionManager interface.
     602/// Named pooled connections can be retrieved through the use of
     603/// IConnectionManager::FindConnection(FdoString* connectionName)
     604///
     605/// \return
     606/// Returns the name of the connection
     607///
     608FDO_API virtual FdoString* GetName(void) = 0;
     609
     610/// \brief
     611/// Sets an optional name that will be associated to the connection. The connection
     612/// name can be used to enhance re-use of connection objects through connection pooling.
     613/// Connection pooling is implemented through the FDO IConnectionManager interface.
     614/// Named pooled connections can be retrieved through the use of
     615/// IConnectionManager::FindConnection(FdoString* connectionName)
     616///
     617/// \param connectionName
     618/// Input the name to be associated to the connection
     619///
     620/// \return
     621/// Returns nothing
     622///
     623FDO_API virtual void SetName(FdoString* connectionName) = 0;
     624}}}
     625
     6262.1.1.7 Interface FdoIReader (modified)
     627
     628A new GetConnection() method will be added to the FdoIReader that will allow clients to retrieve the connection interface that corresponds to a cached reader in their applications.
     629
     630
     631{{{
     632/// \brief
     633/// Gets the connection object associated to the reader. The returned connection
     634/// will be the owner connection that created the reader interface.
     635///
     636/// \return
     637/// Returns the instance of IConnection associated to the Reader
     638///
     639FDO_API virtual FdoIConnection* GetConnection() = 0;
     640}}}
     641
     6422.1.2   Managed API
     643
     6442.1.2.1 Interface OSGeo.FDO.Commands.Feature.IReader (modified)
     645
     646
     647{{{
     648A new GetConnection() method will be added to the FdoIReader that will allow clients to retrieve the connection interface that corresponds to a cached reader in their applications.
     649
     650/// \brief
     651/// Gets the connection associated to the reader. The returned connection
     652/// will be the owner connection that created the reader interface.
     653///
     654/// \return
     655/// Returns the instance of IConnection associated to the Reader
     656///
     657NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* GetConnection();
     658}}}
     659
     6602.1.2.2 Interface OSGeo.FDO.Connections.IConnection (modified)
     661
     662A new property ‘name’ will be added to the FdoIConnection interface. This property will be accessible through GetName() and SetName methods.  These methods will allow clients to retrieve pooled connection interfaces through the IConnectionManager.
     663
     664
     665{{{
     666/// \brief
     667/// Gets the optional name associated to the connection. The connection name
     668/// can be used to enhance re-use of connection objects through connection pooling.
     669/// Connection pooling is implemented through the FDO IConnectionManager interface.
     670/// Named pooled connections can be retrieved through the use of
     671/// IConnectionManager::FindConnection(FdoString* connectionName)
     672///
     673/// \return
     674/// Returns the name of the connection
     675///
     676__property System::String* get_Name();
     677
     678/// \brief
     679/// Sets an optional name that will be associated to the connection. The connection
     680/// name can be used to enhance re-use of connection objects through connection pooling.
     681/// Connection pooling is implemented through the FDO IConnectionManager interface.
     682/// Named pooled connections can be retrieved through the use of
     683/// IConnectionManager::FindConnection(FdoString* connectionName)
     684///
     685/// \param connectionName
     686/// Input the name to be associated to the connection
     687///
     688/// \return
     689/// Returns nothing
     690///
     691__property System::Void set_Name(System::String* connectionName);
     692}}}
     693
     694
     6952.1.2.3 Class OSGeo.FDO.Connections.IConnectionImp (modified)
     696
     697A new property ‘name’ will be added to the FdoIConnectionImp class. This property will be accessible through GetName() and SetName methods.  These methods will allow clients to retrieve pooled connection interfaces through the IConnectionManager.
     698
     699
     700{{{
     701/// \brief
     702/// Gets the optional name associated to the connection. The connection name
     703/// can be used to enhance re-use of connection objects through connection pooling.
     704/// Connection pooling is implemented through the FDO IConnectionManager interface.
     705/// Named pooled connections can be retrieved through the use of
     706/// IConnectionManager::FindConnection(FdoString* connectionName)
     707///
     708/// \return
     709/// Returns the name of the connection
     710///
     711__property System::String* get_Name();
     712
     713/// \brief
     714/// Sets an optional name that will be associated to the connection. The connection
     715/// name can be used to enhance re-use of connection objects through connection pooling.
     716/// Connection pooling is implemented through the FDO IConnectionManager interface.
     717/// Named pooled connections can be retrieved through the use of
     718/// IConnectionManager::FindConnection(FdoString* connectionName)
     719///
     720/// \param connectionName
     721/// Input the name to be associated to the connection
     722///
     723/// \return
     724/// Returns nothing
     725///
     726__property System::Void set_Name(System::String* connectionName);
     727}}}
     728
     729
     7302.1.2.4 Interface OSGeo.FDO.IConnectionManager (modified)
     731
     732The IConnectionManager Interface will be modified to support caching of FdoIConnection objects.
     733
     734
     735{{{
     736/// \brief
     737/// 
     738/// The IConnectionManager interface supports dynamic creation of connection objects
     739/// given a provider name, connection string, configuration and long transaction name. Newly
     740/// created connection objects will be initialized with the parameters supplied to the
     741/// CreateConnection methods.
     742///
     743/// If required, connections can be pooled and reused by the the calling application.
     744/// Applications requesting an FDO connection using the above connection
     745/// parameters will be returned a newly created connection if a previous connection has
     746/// not already been created with identical parameters. If an existing connection interface had
     747/// previously been created and is not currently in use by another process, it will be returned
     748/// to the calling application.
     749///
     750/// \remarks
     751///
     752/// In order for dynamic creation to work, each dynamic link library, shared library,
     753/// or assembly that implements a provider must supply a well-defined entry point function that
     754/// takes as input a provider name and returns an IConnection instance. The definition of the
     755/// entry point function is language- and platform-dependent. For this release of FDO, the
     756/// windows libraries supporting FDO providers will be expected to support the following well-known
     757/// entry point function, which will create and return an unitialized connection object:
     758///
     759///        IConnection * CreateConnection();
     760///
     761public __gc __interface IConnectionManager : public System::IDisposable
     762{
     763public:
     764    /// \brief
     765    /// Ebables the caching of FDO Connections. If caching has previously been enabled,
     766    /// and the poolSize is greater than the previous value used to initialze the pool,
     767    /// the cache will be re-initialized with the new poolSize. If caching has previously
     768    /// been enabled, the value of timeout shall replace the previous value used to initialize
     769    /// the cache.
     770    ///
     771    /// \param poolSize
     772    /// Input The size of the FDO connection cache pool
     773    ///
     774    /// \param timeout
     775    /// Input The length of time in seconds a connection may remain unused before it is removed from
     776    /// the connection cache
     777    ///
     778    /// \return
     779    /// Returns nothing.
     780    ///
     781    System::Void EnableCaching(System::Int32 poolSize, System::Int32 timeout);
     782
     783    /// \brief
     784    /// Disables the caching of FDO Connections. All FDO Connections will be removed from the cache.
     785    ///
     786    /// \return
     787    /// Returns nothing.
     788    ///
     789    System::Void DisableCaching();
     790
     791    /// \brief
     792    /// Creates an unitialized connection object given the provider name.
     793    ///
     794    /// \param providerName
     795    /// Input The unique name of the feature provider. This name should be of the form
     796    /// [Company].[Provider].[Version].
     797    ///
     798    /// \return
     799    /// Returns an instance of an IConnection interface.
     800    ///
     801    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(String* providerName);
     802
     803    /// \brief
     804    /// Creates an unitialized connection object given the provider name. The connection
     805    /// can optionally be initialized with a connectionString.
     806    ///
     807    /// \param providerName
     808    /// Input The unique name of the feature provider. This name should be of the form
     809    /// [Company].[Provider].[Version].
     810    ///
     811    /// \param connectionString
     812    /// Input The connectionString that will be used to configure the FDO connection
     813    ///
     814    /// \return
     815    /// Returns an instance of an IConnection interface.
     816    ///
     817    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(
     818                                String* providerName,
     819                                String* connectionString);
     820
     821    /// \brief
     822    /// Creates a connection object given the provider name and configuration document.
     823    ///
     824    /// \param providerName
     825    /// Input The unique name of the feature provider. This name should be of the form
     826    /// [Company].[Provider].[Version].
     827    ///
     828    /// \param configStream
     829    /// Input The XML configuration stream that will be used to configure the FDO connection
     830    ///
     831    /// \return
     832    /// Returns an instance of an IConnection interface.
     833    ///
     834    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(
     835                                String* providerName,
     836                                NAMESPACE_OSGEO_COMMON_IO::IoStream* configStream);
     837
     838    /// \brief
     839    /// Creates a connection object given the provider name and configuration document.
     840    /// The connection can optionally be initialized with a connectionString.
     841    ///
     842    /// \param providerName
     843    /// Input The unique name of the feature provider. This name should be of the form
     844    /// [Company].[Provider].[Version].
     845    ///
     846    /// \param configStream
     847    /// Input The XML configuration stream that will be used to configure the FDO connection
     848    ///
     849    /// \param connectionString
     850    /// Input The connectionString that will be used to configure the FDO connection
     851    ///
     852    /// \return
     853    /// Returns an instance of an IConnection interface.
     854    ///
     855    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(
     856                                String* providerName,
     857                                NAMESPACE_OSGEO_COMMON_IO::IoStream* configStream,
     858                                String* connectionString);
     859
     860    /// \brief
     861    /// Creates a connection object given the provider name and configuration document.
     862    /// The connection can optionally be initialized with a connectionString and long
     863    /// transaction name.
     864    ///
     865    /// \param providerName
     866    /// Input The unique name of the feature provider. This name should be of the form
     867    /// [Company].[Provider].[Version].
     868    ///
     869    /// \param configStream
     870    /// Input The XML configuration stream that will be used to configure the FDO connection
     871    ///
     872    /// \param connectionString
     873    /// Input The connectionString that will be used to configure the FDO connection
     874    ///
     875    /// \param longTransactionName
     876    /// Input The longTransactionName that will be used to configure the FDO connection
     877    ///
     878    /// \return
     879    /// Returns an instance of an IConnection interface.
     880    ///
     881    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(
     882                                String* providerName,
     883                                NAMESPACE_OSGEO_COMMON_IO::IoStream* configStream,
     884                                String* connectionString,
     885                                String* longTransactionName);
     886
     887    /// \brief
     888    /// Finds a cached connection in the connection pool by name.
     889    ///
     890    /// \param connectionName
     891    /// Input The name of the connection.
     892    ///
     893    /// \return
     894    /// Returns an instance of an IConnection if the named connection exists in the connection pool.
     895    ///
     896    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* FindConnection(System::String* connectionName);
     897   
     898    /// \brief
     899    /// Frees cached FDO connections that are not currently in use. The cleanup
     900    /// can be localized to freeing connections corresponding to providers identified
     901    /// by a combination of their provider name and connection string
     902    ///
     903    /// \return
     904    /// Returns nothing..
     905    ///
     906    System::Void FreeCachedConnections();
     907
     908    /// \brief
     909    /// Frees cached FDO connections that are not currently in use. The cleanup
     910    /// can be localized to freeing connections corresponding to providers identified
     911    /// by a combination of their provider name and connection string
     912    ///
     913    /// \param providerName
     914    /// Input The unique name of the feature provider . This name should be of the form
     915    /// [Company].[Provider].[Version].
     916    ///
     917    /// \return
     918    /// Returns nothing.
     919    ///
     920    System::Void FreeCachedConnections(System::String* providerName);
     921
     922    /// \brief
     923    /// Frees all cached FDO connections that have expired pass their timeout value
     924    ///
     925    /// \return
     926    /// Returns nothing.
     927    ///
     928    System::Void FreeExpiredConnections();
     929
     930    /// \brief
     931    /// Frees a connection library reference given the provider name.
     932    ///
     933    /// \param providerName
     934    /// Input The unique name of the feature provider. This name should be of the form
     935    /// [Company].[Provider].[Version].
     936    ///
     937    /// \return
     938    /// Returns nothing.
     939    ///
     940   System::Void FreeLibrary(System::String* providerName);
     941};
     942}}}
     943
     9442.1.2.5 Class OSGeo.FDO.ClientServices.ConnectionManager (modified)
     945
     946The ConnectionManager class, implmenets IConnectionManager will be modified to implement support for caching of Connection objects within the FDO API. This implementation will be available to all FDO clients.
     947
     948
     949{{{
     950/// \brief
     951/// 
     952/// The ConnectionManager class supports dynamic creation of connection objects
     953/// given a provider name, connection string, configuration and long transaction name. Newly
     954/// created connection objects will be initialized with the parameters supplied to the
     955/// CreateConnection methods.
     956///
     957/// If required, connections can be pooled and reused by the the calling application.
     958/// Applications requesting an FDO connection using the above connection
     959/// parameters will be returned a newly created connection if a previous connection has
     960/// not already been created with identical parameters. If an existing connection interface had
     961/// previously been created and is not currently in use by another process, it will be returned
     962/// to the calling application.
     963///
     964/// \remarks
     965///
     966/// In order for dynamic creation to work, each dynamic link library, shared library,
     967/// or assembly that implements a provider must supply a well-defined entry point function that
     968/// takes as input a provider name and returns an IConnection instance. The definition of the
     969/// entry point function is language- and platform-dependent. For this release of FDO, the
     970/// windows libraries supporting FDO providers will be expected to support the following well-known
     971/// entry point function, which will create and return an unitialized connection object:
     972///
     973///        IConnection * CreateConnection();
     974///
     975public __sealed __gc class ConnectionManager :
     976        public NAMESPACE_OSGEO_RUNTIME::Disposable,
     977        public NAMESPACE_OSGEO_FDO::IConnectionManager
     978{
     979public:
     980    /// \brief
     981    /// Ebables the caching of FDO Connections. If caching has previously been enabled,
     982    /// and the poolSize is greater than the previous value used to initialze the pool,
     983    /// the cache will be re-initialized with the new poolSize. If caching has previously
     984    /// been enabled, the value of timeout shall replace the previous value used to initialize
     985    /// the cache.
     986    ///
     987    /// \param poolSize
     988    /// Input The size of the FDO connection cache pool
     989    ///
     990    /// \param timeout
     991    /// Input The length of time in seconds a connection may remain unused before it is removed from
     992    /// the connection cache
     993    ///
     994    /// \return
     995    /// Returns nothing.
     996    ///
     997    System::Void EnableCaching(System::Int32 poolSize, System::Int32 timeout);
     998
     999    /// \brief
     1000    /// Disables the caching of FDO Connections. All FDO Connections will be removed from the cache.
     1001    ///
     1002    /// \return
     1003    /// Returns nothing.
     1004    ///
     1005    System::Void DisableCaching();
     1006
     1007    /// \brief
     1008    /// Creates an unitialized connection object given the provider name.
     1009    ///
     1010    /// \param providerName
     1011    /// Input The unique name of the feature provider. This name should be of the form
     1012    /// [Company].[Provider].[Version].
     1013    ///
     1014    /// \return
     1015    /// Returns an instance of an IConnection interface.
     1016    ///
     1017    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(System::String* providerName);
     1018
     1019    /// \brief
     1020    /// Creates an unitialized connection object given the provider name. The connection
     1021    /// can optionally be initialized with a connectionString.
     1022    ///
     1023    /// \param providerName
     1024    /// Input The unique name of the feature provider. This name should be of the form
     1025    /// [Company].[Provider].[Version].
     1026    ///
     1027    /// \param connectionString
     1028    /// Input The connectionString that will be used to configure the FDO connection
     1029    ///
     1030    /// \return
     1031    /// Returns an instance of an IConnection interface.
     1032    ///
     1033    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(System::String* providerName, System::String* connectionString);
     1034
     1035    /// \brief
     1036    /// Creates a connection object given the provider name and configuration document.
     1037    ///
     1038    /// \param providerName
     1039    /// Input The unique name of the feature provider. This name should be of the form
     1040    /// [Company].[Provider].[Version].
     1041    ///
     1042    /// \param configStream
     1043    /// Input The XML configuration stream that will be used to configure the FDO connection
     1044    ///
     1045    /// \return
     1046    /// Returns an instance of an IConnection interface.
     1047    ///
     1048    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(
     1049                                System::String* providerName,
     1050                                NAMESPACE_OSGEO_COMMON_IO::IoStream* configStream);
     1051
     1052
     1053    /// \brief
     1054    /// Creates a connection object given the provider name and configuration document.
     1055    /// The connection can optionally be initialized with a connectionString.
     1056    ///
     1057    /// \param providerName
     1058    /// Input The unique name of the feature provider. This name should be of the form
     1059    /// [Company].[Provider].[Version].
     1060    ///
     1061    /// \param configStream
     1062    /// Input The XML configuration stream that will be used to configure the FDO connection
     1063    ///
     1064    /// \param connectionString
     1065    /// Input The connectionString that will be used to configure the FDO connection
     1066    ///
     1067    /// \return
     1068    /// Returns an instance of an IConnection interface.
     1069    ///
     1070    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(
     1071                                System::String* providerName,
     1072                                NAMESPACE_OSGEO_COMMON_IO::IoStream* configStream,
     1073                                System::String* connectionString);
     1074
     1075
     1076    /// \brief
     1077    /// Creates a connection object given the provider name and configuration document.
     1078    /// The connection can optionally be initialized with a connectionString and long
     1079    /// transaction name.
     1080    ///
     1081    /// \param providerName
     1082    /// Input The unique name of the feature provider. This name should be of the form
     1083    /// [Company].[Provider].[Version].
     1084    ///
     1085    /// \param configStream
     1086    /// Input The XML configuration stream that will be used to configure the FDO connection
     1087    ///
     1088    /// \param connectionString
     1089    /// Input The connectionString that will be used to configure the FDO connection
     1090    ///
     1091    /// \param longTransactionName
     1092    /// Input The longTransactionName that will be used to configure the FDO connection
     1093    ///
     1094    /// \return
     1095    /// Returns an instance of an IConnection interface.
     1096    ///
     1097    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* CreateConnection(
     1098                                System::String* providerName,
     1099                                NAMESPACE_OSGEO_COMMON_IO::IoStream* configStream,
     1100                                System::String* connectionString,
     1101                                System::String* longTransactionName);
     1102
     1103    /// \brief
     1104    /// Finds a cached connection in the connection pool by name.
     1105    ///
     1106    /// \param connectionName
     1107    /// Input The name of the connection.
     1108    ///
     1109    /// \return
     1110    /// Returns an instance of an IConnection if the named connection exists in the connection pool.
     1111    ///
     1112    NAMESPACE_OSGEO_FDO_CONNECTIONS::IConnection* FindConnection(System::String* connectionName);
     1113 
     1114    /// \brief
     1115    /// Frees cached FDO connections that are not currently in use. The cleanup
     1116    /// can be localized to freeing connections corresponding to providers identified
     1117    /// by a combination of their provider name and connection string
     1118    ///
     1119    /// \return
     1120    /// Returns nothing.
     1121    ///
     1122    System::Void FreeCachedConnections();
     1123
     1124    /// \brief
     1125    /// Frees cached FDO connections that are not currently in use. The cleanup
     1126    /// can be localized to freeing connections corresponding to providers identified
     1127    /// by a combination of their provider name and connection string
     1128    ///
     1129    /// \param providerName
     1130    /// Input The unique name of the feature provider . This name should be of the form
     1131    /// [Company].[Provider].[Version].
     1132    ///
     1133    /// \return
     1134    /// Returns nothing.
     1135    ///
     1136    System::Void FreeCachedConnections(System::String* providerName);
     1137
     1138    /// \brief
     1139    /// Frees all cached FDO connections that have expired pass their timeout value
     1140    ///
     1141    /// \return
     1142    /// Returns nothing.
     1143    ///
     1144    System::Void FreeExpiredConnections();
     1145
     1146    /// \brief
     1147    /// Frees a connection library reference given the provider name.
     1148    ///
     1149    /// \param providerName
     1150    /// Input The unique name of the feature provider. This name should be of the form
     1151    /// [Company].[Provider].[Version].
     1152    ///
     1153    /// \return
     1154    /// Returns nothing.
     1155    ///
     1156    System::Void FreeLibrary(System::String* providerName);
     1157};
     1158}}}
     1159
     1160
     1161
     1162