How to create your own OpenData import plugin


This article is a manual on creating your own OpenData import plugins for Geo2Tag platform. Detailed information about the basic classes and common interfaces of these plugins could be found in article Interfaces of the plugins for OpenData import.

Preliminary preparation

Before you create your plugin for OpenData import you should to have the answers to the next questions: 

  1. What kind of  access to the open data you have:
    • access protocol (HTTP(S), FTP, WebDav ..)
    • the presence of encryption
    • the presence of authorization
  2. How does user receive the open data:  in form of array or element-by-element?
  3. In which format does the user receive data (XML/JSON/CSV/ other)?
  4. Is it possible to get access to element of data by the external link?
  5. Do the elements of data contain images and if so, how can you get an external link?
  6. What kind of information about location do elements of data contain:
    • latitude, longitude and altitude
    • postal address
    • zip code

Creation the basic classes

The minimal realization OpenData import plugins contains inheritance/extension of the next classes: 

  1. Job – the abstract class for the import.
  2. OpenDataObjectsLoader – the basic class for downloading elements of open data from external sources.
  3. OpenDataToPointTranslator – the abstract class for conversion elements of open data to the format of points Geo2Tag.  
  4. OpenDataObjectsParser – the abstract class for split the array of open data into single elements.
  5. OpenDataToPointsLoader –  the abstract class for points record to Geo2Tag DB.
  6. ODImportParser – parser of arguments for REST queries to the plugin.

To create ordinary REST queries you have to use:

  1. Resource class for manage a separate job of import JobResource.
  2. Factory method JobListResourceFactory for creating resource class in order to add and view all jobs of import.

For the overall sequence import actions you can use the existing function performImportActions: the passed parameters are the derived classes from the classes specified above. Also it’s possible to create your own implementation of the import function. In that case the main requirement will be a correspondence between the implementation your own class derived from Job and the prototype of the import function.

Adding a plugin

It’s necessary to formalize and connect created set of sources files according to the article Format and connection of plugins.

ShareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VKEmail this to someone