27 #include "../../../../dataaccess/datasource/AbstractConnectionPool.h" 28 #include "../../common/Utils.h" 32 #include <boost/cstdint.hpp> 39 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the initialize method!"));
43 return ::v8::Undefined();
51 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the finalize method!"));
55 return ::v8::Undefined();
63 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the idle method!"));
67 return ::v8::Undefined();
77 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the isValid method!"));
81 ::v8::Handle<::v8::Boolean> jisValid = ::v8::Boolean::New(isValid);
83 return hs.Close(jisValid);
93 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the isInitialized method!"));
97 ::v8::Handle<::v8::Boolean> jisInitialized = ::v8::Boolean::New(isInitialized);
99 return hs.Close(jisInitialized);
104 ::v8::HandleScope hs;
109 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the getPoolsize method!"));
113 ::v8::Handle<::v8::Integer> jpoolSize = ::v8::Integer::New(static_cast<boost::int32_t>(poolSize));
115 return hs.Close(jpoolSize);
120 ::v8::HandleScope hs;
125 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the getInitialPoolsize method!"));
129 ::v8::Handle<::v8::Integer> jinitialPoolSize = ::v8::Integer::New(static_cast<boost::int32_t>(initialPoolSize));
131 return hs.Close(jinitialPoolSize);
136 if(args.Holder().IsEmpty())
137 return ::v8::ThrowException(::v8::String::New(
"In order to use the setInitialPoolSize method you must use the object notation: \"obj.setInitialPoolSize(size);\""));
139 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsInt32())
140 return ::v8::ThrowException(::v8::String::New(
"In order to use the setInitialPoolSize method you must use the object notation: \"obj.setInitialPoolSize(size);\""));
145 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the setInitialPoolSize method!"));
147 int initialPoolSize = args[0]->ToInt32()->Value();
151 return ::v8::Undefined();
156 ::v8::HandleScope hs;
161 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the getMinPoolsize method!"));
165 ::v8::Handle<::v8::Integer> jminPoolSize = ::v8::Integer::New(static_cast<boost::int32_t>(minPoolSize));
167 return hs.Close(jminPoolSize);
172 if(args.Holder().IsEmpty())
173 return ::v8::ThrowException(::v8::String::New(
"In order to use the setMinPoolSize method you must use the object notation: \"obj.setMinPoolSize(size);\""));
175 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsInt32())
176 return ::v8::ThrowException(::v8::String::New(
"In order to use the setMinPoolSize method you must use the object notation: \"obj.setMinPoolSize(size);\""));
181 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the setMinPoolSize method!"));
183 int minPoolSize = args[0]->ToInt32()->Value();
187 return ::v8::Undefined();
192 ::v8::HandleScope hs;
197 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the getMaxPoolsize method!"));
201 ::v8::Handle<::v8::Integer> jmaxPoolSize = ::v8::Integer::New(static_cast<boost::int32_t>(maxPoolSize));
203 return hs.Close(jmaxPoolSize);
208 if(args.Holder().IsEmpty())
209 return ::v8::ThrowException(::v8::String::New(
"In order to use the setMaxPoolSize method you must use the object notation: \"obj.setMaxPoolSize(size);\""));
211 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsInt32())
212 return ::v8::ThrowException(::v8::String::New(
"In order to use the setMaxPoolSize method you must use the object notation: \"obj.setMaxPoolSize(size);\""));
217 return ::v8::ThrowException(::v8::String::New(
"Invalid connection pool in the setMaxPoolSize method!"));
219 int maxPoolSize = args[0]->ToInt32()->Value();
223 return ::v8::Undefined();
232 ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
233 ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
::v8::Handle<::v8::Value > AbstractConnectionPool_IsInitialized(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > AbstractConnectionPool_GetInitialPoolSize(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > AbstractConnectionPool_GetMinPoolSize(const ::v8::Arguments &args)
virtual std::size_t getInitialPoolSize() const =0
It returns the initial number of connections opened by the pool at its startup.
JavaScript exporting routine for the TerraLib Data Access module.
virtual void setInitialPoolSize(std::size_t size)=0
It sets the initial number of connections opened by the pool at its startup.
virtual std::size_t getPoolSize() const =0
It returns the number of connections in the pool.
::v8::Handle<::v8::Value > AbstractConnectionPool_IsValid(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > AbstractConnectionPool_SetInitialPoolSize(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > AbstractConnectionPool_Idle(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > AbstractConnectionPool_SetMaxPoolSize(const ::v8::Arguments &args)
virtual std::size_t getMinPoolSize() const =0
It returns the minimum number of connections managed by the pool.
::v8::Handle<::v8::Value > AbstractConnectionPool_Initialize(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > AbstractConnectionPool_SetMinPoolSize(const ::v8::Arguments &args)
virtual std::size_t getMaxPoolSize() const =0
It returns the maximum number of connections managed by the pool.
static::v8::Persistent<::v8::FunctionTemplate > sg_abstractconnectionpool_template
virtual void initialize()=0
It initializes the connections to be managed by the pool.
::v8::Persistent<::v8::FunctionTemplate > & GetAbstractConnectionPoolTemplate()
It returns a reference to the persistent template of a AbstractConnectionPool object.
virtual void idle()=0
It releases the connections that are not in use for a long time.
::v8::Handle<::v8::Value > AbstractConnectionPool_GetPoolSize(const ::v8::Arguments &args)
virtual bool isValid() const =0
It checks if all the connections in the pool are valid (the communication channel is ok)...
This class defines the basic interface for a connection pool.
virtual void finalize()=0
It closes all connections and clears all resources managed by the pool.
virtual bool isInitialized() const =0
It returns true if the connection pool is initialized, otherwise it returns false.
virtual void setMaxPoolSize(std::size_t size)=0
It sets the maximum number of connections managed by the pool.
::v8::Handle<::v8::Value > AbstractConnectionPool_GetMaxPoolSize(const ::v8::Arguments &args)
virtual void setMinPoolSize(std::size_t size)=0
It sets the minimum number of connections managed by the pool.
::v8::Handle<::v8::Value > AbstractConnectionPool_Finalize(const ::v8::Arguments &args)