27 #include "../../../../common/Exception.h" 28 #include "../../../../core/translator/Translator.h" 29 #include "../../../../dataaccess/datasource/DataSourceFactory.h" 30 #include "../../common/Utils.h" 40 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsString())
41 return ::v8::ThrowException(::v8::String::New(
"Missing parameter for the TeDataSourceFactory. The correct syntax is: var my_ds = TeDataSourceFactory.make(dstype);"));
43 v8::String::Utf8Value jdsType(args[0]->
ToString());
44 std::string dsType = *jdsType;
51 return hs.Close(jsds);
53 catch(
const std::exception& e)
55 return ::v8::ThrowException(::v8::String::New(e.what()));
59 return ::v8::ThrowException(::v8::String::New(
TR_V8JSI(
"Unexpected exception in make method!")));
67 ::v8::Handle<::v8::ObjectTemplate> dsfactory = ::v8::ObjectTemplate::New();
71 global->Set(::v8::String::New(
"TeDataSourceFactory"), dsfactory->NewInstance());
::v8::Local<::v8::Object > Make(T *obj, TF tfunc, const bool isOwner)
It creates a new JavaScript object from a C++ object (obj).
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void RegisterDataSourceFactory(::v8::Local<::v8::Object > &global)
It registers the DataSourceFactory class.
JavaScript exporting routine for the TerraLib Data Access module.
static te::dt::Date ds(2010, 01, 01)
::v8::Persistent<::v8::FunctionTemplate > & GetDataSourceTemplate()
It returns a reference to the persistent template of a DataSource object.
#define TR_V8JSI(message)
It marks a string in order to get translated. This is a special mark used in the Vector Geometry modu...
::v8::Handle<::v8::Value > DataSourceFactory_Make(const ::v8::Arguments &args)
std::string ToString(const XMLCh *const value)
It converts the XML string to a standard C++ string.