Like what you see? Have a play with our trial version.

Error rendering macro 'rw-search'

null

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

 

Data Source Function List

A connector DataSource is an implementation of the abstract java class AbstractDataSource. When defining a DataSource the following functions require implementation: 

 

The following functions can optionally be overwritten: 

 

The following functions are available as utility functions: 

  • protected final byte[] loadBlob(String key); 
  • protected final boolean saveBlob(String key, byte[] data); 
  • protected final boolean areBlobsAvailable(); 
  • public final Object getAttribute(String key); 
  • public final Integer getSourceId(); 

 

 

DataSource Function Definitions 

 

public abstract String getDataSourceName(); 

Return a DataSourceName as a String. 

 

public abstract Collection<AbstractDataSet> getDataSets(); 

Return the collection of DataSets that are available in this DataSource. See the DataSet section for defining a DataSet. 

 

public abstract JDBCMetaData getDataSourceMetaData(); 

Return the connection meta-data required for this DataSource. See the MetaData section for defining Meta Data for a Data Source. 

 

public abstract boolean authenticate() throws Exception; 

Return true or false depending on whether authentication against the data source was successful. This can return true if this is not required. 

 

public abstract void disconnect(); 

disconnect() is called when the connection to the connector is closed. Perform any clean up here. This function can do nothing if it is not required. 

 

public abstract Map<String, Object> testConnection() throws Exception 

Return a map of text entries to be displayed on a successful connection test. The key to the Map is the description shown on the connection test within the Yellowfin UI. 

An error message can be displayed if the connection test was not successful. The key to the Map in this case should be “ERROR”, with a description of the error stored in the Map value. 

 

public ScheduleDefinition getScheduleDefinition(); 

Return a ScheduleDefinition for when the background task should run for this connector. A ScheduleDefinition is instantiated with: 

public ScheduleDefinition(FrequencyTypeCode frequencyTypeCode, String frequencyCode, Integer frequencyUnit);
 

 

Each frequencyTypeCode is defined below. For any type that requires n, that value is defined in the frequencyUnit

 

frequencyUnit 

Description 

MINUTES 

Run every n minutes. 

DAILY 

Run every day. 

WEEKLY 

Run once a week, on the nth day of the week. 

FORTNIGHTLY 

Run once a fortnight, where frequencyCode is ONE or TWO, specifying the week in the fortnight, and the nth day of that week. 

MONTHLY 

Run once a month on the nth day of the month. 

ENDOFMONTH 

Run at the end of the month. 

QUARTERLY 

Run once a quarter, where frequencyCode is ONE, TWO, or THREE, specifying the month within the quarter, and the nth day of the month. 

BIANNUAL 

Run once every six months, where frequencyCode is ONE, TWO, THREE, FOUR, FIVE, or SIX, specifying the month within the half year, and the nth day of that month. 

ANNUAL 

Run once a quarter, where frequencyCode is JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER, specifying the month of the year, and the nth day of the month. 

 

For example, to create a schedule for running background tasks once a week on Sunday: 

public ScheduleDefinition getScheduleDefinition() { 

		return new ScheduleDefinition("WEEKLY", null, 1); 

} 

 

To create a schedule for running background tasks every hour: 

public ScheduleDefinition getScheduleDefinition() { 

		return new ScheduleDefinition("MINUTES", null, 60); 

} 

 

 

public boolean autoRun(); 

autoRun is the called to perform any background tasks. This function is called based on the getScheduleDefinition(). This could be used to download and cache data locally. 

 

protected final byte[] loadBlob(String key); 

loadBlob() will load a blob (byte[]) that was previously saved by the connector, usually in a background task. The parameter key is a unique identifier for the data to load. Blobs can only be loaded on data sources that have been saved. areBlobsAvailable() can be used to see if blob access is available. 

 

protected final boolean saveBlob(String key, byte[] data); 

saveBlob() allows for saving a blob (byte[]) for later use. This is a way of saving data from background tasks for later use. The parameter key is the unique identifier for the data to be saved. data is the byte[] to be associated with that key. Writing null to data will delete the saved data for the specified key. Blobs can only be loaded on data sources that have been saved. areBlobsAvailable() can be used to see if blob access is available. 

 

protected final boolean areBlobsAvailable(); 

Blobs can only be loaded on data sources that have been saved. areBlobsAvailable() can be used to see if blob access is available. Blob access will not be available if a connector is tested prior to being saved. 

 

public final Object getAttribute(String key); 

getAttribute() allows for fetching attributes from the connection meta-data. For example, a Username may be specified for the connection through the Yellowfin UI. Using the key of the parameter, the contents of the Username meta-data field can be fetched for use when retrieving data from external APIs. 

 

public final Integer getSourceId(); 

getSourceId() can be used to fetch the unique internal id of source that this connector is associated with. This may be helpful for segregating data by connection in some kind of external cache or database. 

 

 

 

  • No labels