27 #include "../../../../dataaccess/datasource/DataSourceCatalog.h" 28 #include "../../common/Utils.h" 35 #include <boost/cstdint.hpp> 41 if(args.Holder().IsEmpty())
42 return ::v8::ThrowException(::v8::String::New(
"In order to use the getId method, you must use the object notation: \"id = obj.getId();\""));
47 return ::v8::ThrowException(::v8::String::New(
"Invalid catalog in the getId method!"));
49 unsigned int id = catalog->
getId();
51 ::v8::Local<::v8::Integer> jid = ::v8::Uint32::New(static_cast<boost::uint32_t>(
id));
60 if(args.Holder().IsEmpty())
61 return ::v8::ThrowException(::v8::String::New(
"In order to use setId method, you must use the object notation: \"obj.setId();\""));
66 return ::v8::ThrowException(::v8::String::New(
"Invalid catalog in the getId method!"));
68 if((args.Length() == 1) && !args[0].IsEmpty() && args[0]->IsUint32())
70 unsigned int id = args[0]->ToUint32()->Value();
76 return hs.Close(::v8::Undefined());
83 if(args.Holder().IsEmpty())
84 return ::v8::ThrowException(::v8::String::New(
"In order to use the getDataSource method you must use the object notation: \"ds = obj.getDataSource();\""));
89 return ::v8::ThrowException(::v8::String::New(
"Invalid data source catalog in the getDataSource method!"));
100 ::v8::HandleScope hs;
102 if(args.Holder().IsEmpty())
103 return ::v8::ThrowException(::v8::String::New(
"In order to use the setDataSource method, you must use the object notation: \"obj.setDataSource(ds);\""));
105 if((args.Length() != 1) || args[0].IsEmpty() || !args[0]->IsObject())
106 return ::v8::ThrowException(::v8::String::New(
"Missing parameter or wrong parameter type in the setDataSource method!"));
111 return ::v8::ThrowException(::v8::String::New(
"Invalid data source catalog in the setDataSource method!"));
117 return ::v8::Undefined();
122 if(args.Holder().IsEmpty())
123 return ::v8::ThrowException(::v8::String::New(
"In order to use the clear method, you must use the object notation: \"obj.clear();\""));
128 return ::v8::ThrowException(::v8::String::New(
"Invalid data source catalog in the clear method!"));
132 return ::v8::Undefined();
137 ::v8::HandleScope hs;
139 if(args.Holder().IsEmpty())
140 return ::v8::ThrowException(::v8::String::New(
"In order to use the clone method, you must use the object notation: \"obj.clone();\""));
145 return ::v8::ThrowException(::v8::String::New(
"Invalid data source catalog in the clone method!"));
151 return hs.Close(jcloneCatalog);
156 ::v8::HandleScope hs;
158 if(args.Holder().IsEmpty())
159 return ::v8::ThrowException(::v8::String::New(
"In order to use the getNumberOfDatasets method you must use the object notation: \"ndataSets = obj.getNumberOfDatasets();\""));
164 return ::v8::ThrowException(::v8::String::New(
"Invalid data source catalog in the clone method!"));
168 ::v8::Local<::v8::Integer> jndataSets = ::v8::Integer::New(static_cast<boost::int32_t>(ndataSets));
170 return hs.Close(jndataSets);
175 return ::v8::Undefined();
180 return ::v8::Undefined();
185 return ::v8::Undefined();
190 return ::v8::Undefined();
195 return ::v8::Undefined();
200 return ::v8::Undefined();
205 return ::v8::Undefined();
210 ::v8::HandleScope hs;
212 if(args.Holder().IsEmpty())
213 return ::v8::ThrowException(::v8::String::New(
"In order to use the getNumberOfSequences method you must use the object notation: \"nSequences = obj.getNumberOfSequences();\""));
218 return ::v8::ThrowException(::v8::String::New(
"Invalid data source catalog in the clone method!"));
222 ::v8::Local<::v8::Integer> jnSequences = ::v8::Integer::New(static_cast<boost::int32_t>(nSequences));
224 return hs.Close(jnSequences);
229 return ::v8::Undefined();
234 return ::v8::Undefined();
239 return ::v8::Undefined();
244 return ::v8::Undefined();
249 return ::v8::Undefined();
254 return ::v8::Undefined();
259 return ::v8::Undefined();
264 ::v8::HandleScope hs;
266 if(!args.IsConstructCall())
267 return ::v8::ThrowException(::v8::String::New(
"In order to create a data source catalog, you need call its constructor like: var c = new TeDataSourceCatalog();"));
269 if(args.Holder().IsEmpty())
270 return ::v8::ThrowException(::v8::String::New(
"The DataSourceCatalog constructor must use object notation!"));
272 if(args.Length() != 0)
273 return ::v8::ThrowException(::v8::String::New(
"The DataSourceCatalog constructor has no parameters!"));
281 return hs.Close(jcatalog);
286 ::v8::HandleScope hs;
290 global->Set(::v8::String::New(
"TeDataSourceCatalog"), jscatalog->GetFunction());
299 ::v8::Local<::v8::FunctionTemplate> result = ::v8::FunctionTemplate::New();
301 ::v8::Handle<::v8::ObjectTemplate> prototype = result->PrototypeTemplate();
void setDataSource(DataSource *ds)
It sets the DataSource associated to the catalog.
::v8::Handle<::v8::Value > DataSourceCatalog_SetId(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetDataSource(const ::v8::Arguments &args)
::v8::Local<::v8::Object > Make(T *obj, TF tfunc, const bool isOwner)
It creates a new JavaScript object from a C++ object (obj).
::v8::Handle<::v8::Value > DataSourceCatalog_GetId(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetSequenceById(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_Clone(const ::v8::Arguments &args)
It represents the system catalog of a DataSource.
::v8::Handle<::v8::Value > DataSourceCatalog_Clear(const ::v8::Arguments &args)
JavaScript exporting routine for the TerraLib Data Access module.
::v8::Persistent<::v8::FunctionTemplate > & GetDataSourceCatalogTemplate()
It returns a reference to the persistent template of a DataSourceCatalog object.
::v8::Handle<::v8::Value > DataSourceCatalog_GetNumberOfSequences(const ::v8::Arguments &args)
std::size_t getNumberOfDataSets() const
It returns the number of datasets in the catalog.
static te::dt::Date ds(2010, 01, 01)
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
void RegisterDataSourceCatalog(::v8::Local<::v8::Object > &global)
It registers the DataSourceCatalog class.
::v8::Handle<::v8::Value > DataSourceCatalog_GetSequence(const ::v8::Arguments &args)
DataSource * getDataSource() const
It returns the DataSource associated to the catalog.
unsigned int getId() const
It returns the catalog identifier.
::v8::Handle<::v8::Value > DataSourceCatalog_Rename(const ::v8::Arguments &args)
::v8::Persistent<::v8::FunctionTemplate > & GetDataSourceTemplate()
It returns a reference to the persistent template of a DataSource object.
void clear()
It clears the catalog, releasing all the resources used by it.
::v8::Handle<::v8::Value > DataSourceCatalog_Add(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_Constructor(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetRefFK(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_Remove(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_SetDataSource(const ::v8::Arguments &args)
std::size_t getNumberOfSequences() const
It returns the number of sequences in the catalog.
::v8::Handle<::v8::Value > DataSourceCatalog_AddRef(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_RemoveRef(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetDataSetTypeById(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetDataSetType(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetDataSetTypePos(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_Detach(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetSequencePos(const ::v8::Arguments &args)
void setId(unsigned int id)
It sets the catalog identifier.
::v8::Handle<::v8::Value > DataSourceCatalog_DropDependentSequences(const ::v8::Arguments &args)
::v8::Handle<::v8::Value > DataSourceCatalog_GetNumberOfDatasets(const ::v8::Arguments &args)
static::v8::Persistent<::v8::FunctionTemplate > sds_datasourcecatalog_template