Sie sind auf Seite 1von 6

DEMAPI -FAQ

What is DEMAPI? DEM API is a set of Service methods that can be used with Data Extraction Projects to extract data from different data sources and can export the extracted data as SQLite database file.

Is it a reusable component? Yes it is a reusable component. You can use it in other applications by adding the DEMAPI jar in your class path.

Does it work with any kind of UIs? Yes it will work with any kind of UI even in WEB and in Desktop.

How can I use DEMAPI? DEMAPI is an independent module and you can use it by adding the DEMAPI jar to the library.

What are the other library files to be included in the class path when using DEMAPI? When using the DEMAPI, the following library files should be in the class path. log4j-1.2.16.jar mysql-connector-java-5.1.15-bin.jar slf4j-log4j12-1.6.1.jar slf4j-api-1.6.1.jar sqlitejdbc-v056.jar sqljdbc.jar terajdbc4.jar

What are the basic building blocks in the DEMAPI?

The three main building blocks in DEMAPI are Source Query and Report

What are sources? How can I create a Source? Source is a data store, from which the data is to be extracted. The current version of API supports three different types of data sources, SqlServerSource TeradataSource and MySqlSource

Is there any Source hierarchy? Yes, the following is the Source hierarchy.
Source

DBSource

SqlServ erSource

My SqlSource

TeradataSource

The bottom three classes in the diagram are concrete classes.

How can I create a Source object? The bottom three classes in the above diagram are concrete classes and the sources can be created by calling their corresponding constructors (the constructor without Id).

What are Queries? Queries are used to extract data from Sources. These are SQL queries. Eech query associated with a given source.

Is there any hierarchy in Queries? Yes,


Query

CustomSqlQuery

Query BuilderQuery

Two types of Queries, CustomSql Query and Query Builder Query.

CustomSQLQuery It is used when the user knows the query .User can create CustomSqlQuery by using its constructor QueryBuilderQuery If the user is not expert in writing the query, the QueryBuilderQuery helps him to create the query by parts. User can create QueryBuilderQuery object by using the constructor. The user can use the following methods of QueryBuilderQuery to build up the query. addTable() addFields() addJoinClause() addWhereClause()

The getQueryString() method of query, returns the generated query.

What are reports? A report is the execution result of a query. User can give additional where clauses to the report, to filter the query results. A query can have any number of reports, with different where clauses.

Can I execute a Query without a report of it? No. There is no way to execute a Query. Need to wrapper it with a report. And only report can be executed.

Is there any hierarchy in reports? No.

How can I create a Report object? By using the Report constructor.

How can I perform Source/Query/Report related functionalities-like Add/Update/Delete and Get to/from DEM? All the Source, Query and Report functionalities are categorized under three main interfaces. E.g.: The SourceService instance can be can be obtained by DEMFactory.getDEMService().getSourceService() , this returns an instance of SourceService. To get the list of Sources, use SourceService sourceService= DEMFactory.getDEMService().getSourceService(); sourceService.getAllSources(); SourceService QueryService and ReportService.

You can get the instance of these services by invoking the DEMFactory methods.

How can I execute a Report? Use the execute () method of ReportService to execute a report.

Is there any caching of results? Yes the results reports will be cached for future use and is stored in SQLite database file. The name of report will be the name of File.

How to get the cached results? To get the cached results, use the getResults() method of ReportService. If the result is not cached yet, the report will be executed and cached before returning the results.

Is there any way to know, whether a report is ever executed or not? Yes. You can use the hasResults() method of ReportService to get that details.

Is there a way to remove the cached results? You need to call the execute () method again to remove the old cached results and the new results will be cached.

Is it possible to get the list of Tables and its Fields in a Source? Yes it is possible. For the SqlServer and MySql sources, you can use the getTables() method in the Source object to get the list of Tables. But for teradata, you have to use the getTablesByContainer(containerName) method in the teradata source to get the tables details. To get the fields in a table, you can use the getFields(tableName) , for all type of sources.

How to get the list of supported source types? Use SourceType.getAllSourceTypes()

How to get the list of supported join types in query-useful in query generation? Use JoinType.getAllJoinTypes()

How to get the list of comparison operators- useful in query generation? Use CompareType.getAllCompareTypes()

What is the Use of PagingCriteria class? It is used to limit the number of records in the result. When calling the getResult(report,pagingCriteria) method of ReportService, the number of records returned is determined by the pagingCriteria object. When passing PagingCriteria.UNPAGED as the pagingCriteria, it returns all the records; and when passing new PagingCriteria(100), it retrns the first 100 records from the cached result.

Where these Sources, Queries and Reports get stored?

The DEMAPI uses the light weight database SQLite to store those details. All these data are stored in a single database DemDB.db and the database file can be found in the application root directory with the same file name.

Any configuration/Installation required for the SQLite? No. It is automatically configurable and the only requirement is the SQLite jar should be in the class path.

How can I backup DEM data, or move them from one computer to another?

A copy of the database file DemDB.db can be used for making backups or transferring data to another computer.

Das könnte Ihnen auch gefallen