DataSourceManager

Class

The DataSourceManager is used to manage data source, including create/get/destroy data source instance. Please always use DataSourceManager.getInstance() to use this class. For example, to get a data source, you can use DataSourceManager.getInstance().getDataSource(dsId) . For widget developer, DataSourceManager.getInstance() return the same instance for both widget and widget's settings.

To use data source, the recommended way is to use DataSourceComponent , which is more handy.

Methods

MethodReturnsNotes
Promise<DataSource[]>

Return the successfully created data sources only. For the failed created data sources, return null.

createDataSource(mainDataSourceId, dataViewId?, localId?)
Promise<DataSource>

This method is used to create data source instance. Main data source, data view or local data source are created as data source instance.

Promise<DataSource>

Create data source according to the used data source info, and will create a local data source if localId is passed in.

createAllDataSources

Class Method
createAllDataSources(): Promise<DataSource[]>

Return the successfully created data sources only. For the failed created data sources, return null.

Returns 
Promise<DataSource[]>

createDataSource

Class Method
createDataSource(mainDataSourceIdstring, dataViewId?string, localId?string): Promise<DataSource>

This method is used to create data source instance. Main data source, data view or local data source are created as data source instance.

The parameter can be a data source id, data source config JSON or DataSourceConstructorOptions .

If pass in dataViewId , this method will create a data view. If pass in dataViewId and localId , this method will create a local data view. If pass in localId , this method will create a local data source.

To create a main data source instance, this method do the followings:

  • Create the data source object.
  • Call the object's ready() method.
  • Call the object's fetchSchema() method.

When start to create the data source instance, this method will set the data source instanceStatus as NotCreated at first. The instanceStatus will be set as Created when the creation process is done. The instanceStatus will be set as CreateError if an error occurs.

Parameters
ParameterType
mainDataSourceId
string
dataViewId
string
localId
string
Returns 
Promise<DataSource>

createDataSourceByUseDataSource

Class Method
createDataSourceByUseDataSource(useDsIMUseDataSource, localId?string): Promise<DataSource>

Create data source according to the used data source info, and will create a local data source if localId is passed in.

Parameters
ParameterType
useDs
IMUseDataSource
localId
string
Returns 
Promise<DataSource>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.