Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Mylyn/Incubator/Generic Industrial Connector"

(Create SQL statements for Repository conaining legal values)
(Temporary SVN)
 
(32 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This work is funded by [http://www.remainsoftware.com Remain Software] and [http://www.industrial-tsi.com Industrial-TSI].
 
This work is funded by [http://www.remainsoftware.com Remain Software] and [http://www.industrial-tsi.com Industrial-TSI].
  
This is a temp doc space for the generic SQL connector for mylyn.
+
= Rationale =
 +
The main goal of this project is to enable the connection of [http://en.wikipedia.org/wiki/Legacy_system legacy] tasks databases to Mylyn quickly and cleanly. We want to provide Mylyn access to Tasks that are stored in a non-web repository, primarily a database, but this project can be used to hookup anything to Mylyn implementing just one class.  
  
==Update Site==
 
We have created an [http://bugs.industrial-tsi.com/mylyndb/ update site] to try this connector for 3.0.x and 2.3.x.
 
  
Create the update site reference as follows, using the above URL:
 
  
[[Image:industrial_url.png]]
+
__TOC__
  
Then select that site:
+
= Example Projects =
 +
This project provides three demo projects to such a repository.
  
[[Image:industrial_update_site.png]]
+
*'''Memory'''
 +
**Just implements the [[Mylyn/Incubator/Generic Industrial Connector/IPersisor|IPersistor]] interface and manages an in-memory task database, complete with attachements and multi comments.
 +
*'''Derby and Ibatis'''
 +
**By defining only '''12 SQL queries''', you have access to all the Tasks in the database.
 +
**By adding another '''6 SQL queries''' you have added support for Comments and Attachments
 +
*'''Derby and JPA'''
 +
**Describes how JPA can be used to connect a database to Mylyn
  
And make select the latest version plus the Ibatis SqlMap feature:
+
== Use Case 0: personal cross workspace local task repository ==
  
[[Image:industrial_selection.png]]
+
When you have multiple workspace and use local tasks, you can only get at the tasks in the current workspace.
 +
There is also no facility for adding attachments or comments. Running a local Derby instance provides all of this in transparent manner.
 +
 
 +
[https://bugs.eclipse.org/bugs/votes.cgi?action=show_user&bug_id=184532#vote_184532 Vote when this use case applies to you]
 +
 
 +
== Use Case 1: small development or web shops with home-grown tracker in database ==
 +
 
 +
Many small web or software development shops have created their own issue trackers or workflow systems that predate the ever wider acceptance of Eclipse as a platform.
 +
These usually have the data stored in a local database, accessible via lan via a custom application (Filemaker, MS Access) or a home built web frontend (LAMP).
 +
 +
It is not worthwile to them to build or purchase a full-fledged connector (yet), but they want access to the tasks in the convenient Mylyn way with lowest possible configuration effort.
 +
 
 +
[https://bugs.eclipse.org/bugs/votes.cgi?action=show_user&bug_id=184532#vote_184532 Vote when this use case applies to you]
 +
 
 +
== Use Case 2: provide task like access to logged system/server exceptions stored in a database ==
 +
 
 +
Webservers and application servers can store their logs in a database instead of in a plain text file.
 +
Example: [http://www.onlamp.com/pub/a/apache/2005/02/10/database_logs.html Writing Apache's Logs to MySQL]
  
==Temporary SVN==
+
But who likes going over these logs or doing periodc queries on them.
The port of the generic SQL connector to Mylyn 3.0 will be at:
+
This connector can look in such log files and and a system operator can thus create easy queries looking at error types, source IP's server id's or string matches in the request URL.
  
- svn://bugs.industrial-tsi.com/mylyn_gsc/trunk
+
The Mylyn notification pop up window and the task list will indicate where new issues occurred.
  
The generic SQL connector for Mylyn 2.3.x will be at:
+
[https://bugs.eclipse.org/bugs/votes.cgi?action=show_user&bug_id=184532#vote_184532 Vote when this use case applies to you]
  
- svn://bugs.industrial-tsi.com/mylyn_gsc/branches/mylyn23x
+
= Team and Plan =
  
 
==Members==
 
==Members==
Line 33: Line 55:
  
 
==Plan==
 
==Plan==
Initial Request: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=184532 bug 184532]<br>
+
Initial Request: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=184532 bug 184532] Discussion: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=223048 bug 223048]
Discussion: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=223048 bug 223048]
+
  
Current work is done using [http://ibatis.apache.org Apache Ibatis] so that '''all''' configuration can be stored in the ibatis xml configuration files.
+
Current work has proven to connect to a back-end database using Ibatis and JPA. A third connector project was recently added that provides a memory persistor which only implements one class and a config file.
  
Legal parameter sets for various fields can then be stored as pseudo queries.
+
We are currently programming a USENET connector based on this core and a configurable SQL connector is next. The latter requires ZERO programming and enables a end user to establish a connection using wizards.
  
==News from the dev team==
 
  
* 06/21 Restructured the SVN to start porting to Mylyn 3.0
+
=== version 0.8.x (current) ===
* 06/13 Now ready to create tasks as well, using a property in the db.properties to allow this. Only how to set the properties in the new task editor?
+
*separated Persistor interface
* 06/10 Well I have refactored the code and project structure, so now basically settings for every database are in a Fragment.  
+
*ibatis based connector:
This increases modularity and offers the possibility of adding code fragments for specific databases, adds a speciic home for JDBC drivers, etc.
+
**Current work is done using [http://ibatis.apache.org Apache Ibatis] so that '''all''' configuration can be stored in the ibatis xml configuration files.
* 09/08 Port to 3.0 is underway, new preliminary package names: org.eclipse.mylyn.sql.*
+
**Legal parameter sets for various fields can then be stored as pseudo queries.
* 09/26 New version 0.7.0.v20080926 with extended queryEditor and general UI improvements, download site available
+
*JPA persistence based connector
 +
**use annotations in Java to define mapping
 +
* Memory based connector to demonstrate ease of implementation
 +
** One Java class to simulate task database
 +
*Documentation
 +
** Wiki updates
 +
** Creation of getting started documentation
 +
** Creation of Example Movie
 +
* Downloads
 +
** Creation of update site
 +
** Current version is 0.8.2
 +
 
 +
=== version 0.9.x ===
 +
*move connector.xml into an extension point schema
 +
*completer test coverage
 +
*auto setup/initialization of local Derby connector
 +
*do another Persistor implementation to test versatility: MS Excel, NNTP, ...
 +
 
 +
= Architecture =
 +
[[Image:IndustrialArchitecture.png]]
 +
 
  
 
==Generic Task Structure to map to any SQL DB==
 
==Generic Task Structure to map to any SQL DB==
Line 68: Line 108:
 
  - a list of TaskAttachments.
 
  - a list of TaskAttachments.
  
But how?
 
  
 
===Task Context===
 
===Task Context===
Line 91: Line 130:
 
  - in the list of TaskAttachments.
 
  - in the list of TaskAttachments.
  
==Configuring the SQL Connector using Ibatis==
+
== Persistor interface description ==
  
 +
TBD.
  
=== Create db.properties ===
+
= Getting the source or runtime =
  
then create a file called db.properties with the folowing conent:
+
==Update Site==
<source lang="text">
+
We have created an [http://svn.codespot.com/a/eclipselabs.org/industrial-mylyn/trunk/com.industrialtsi.mylyn.site/ update site] to try this connector for 3.0.x and 2.3.x.
# properties for working with iBatis SqlMaps to access the `derby local demo` database
+
# compulsory
+
#
+
driver=org.apache.derby.jdbc.ClientDriver # class anme of your driver code
+
#
+
# optional, also in repository settings
+
#url=jdbc:derby:C:\DerbyDatabases\MyDB;create=true # optional url of your DB
+
#
+
user=APP # user name
+
password=secret # password also in dialog
+
</source>
+
  
=== Create an SqlMapConfig.xml ===
+
Create the update site reference as follows, using the above URL:
 +
 
 +
[[Image:industrial_url.png]]
 +
 
 +
Then select that site:
 +
 
 +
[[Image:industrial_update_site.png]]
 +
 
 +
And make select the latest version plus the Ibatis SqlMap feature:
 +
 
 +
[[Image:industrial_selection.png]]
  
<source lang="xml">
+
==SVN==
<?xml version="1.0" encoding="utf-8"?>
+
The source of the generic SQL connector is hosted at Eclipse Labs:
<!DOCTYPE sqlMapConfig
+
    PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
+
    "http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
+
<sqlMapConfig>
+
    <!-- the proeprties for driver and DB -->
+
    <properties resource="derby_local_demo/db.properties"/>
+
  
    <!-- These settings control SqlMap configuration details, primarily to do with transaction
+
- http://svn.codespot.com/a/eclipselabs.org/industrial-mylyn/trunk/
            management. They are all optional (see the Developer Guide for more). -->
+
    <settings cacheModelsEnabled="true" enhancementEnabled="false"
+
        lazyLoadingEnabled="false" maxRequests="32" maxSessions="10"
+
        maxTransactions="5" useStatementNamespaces="true"/>
+
    <!-- Type aliases allow you to use a shorter name for long fully qualified class names. -->
+
  
    <typeAlias alias="ibatisTask" type="org.eclipse.mylyn.industrial.core.dto.IndustrialTask"/>
+
The Project page is here:
    <typeAlias alias="ibatisCriteria" type="org.eclipse.mylyn.industrial.core.dto.IndustrialQueryParams"/>
+
    <typeAlias alias="ibatisComment" type="org.eclipse.mylyn.industrial.core.dto.IndustrialComment"/>
+
    <typeAlias alias="ibatisAttachment" type="org.eclipse.mylyn.industrial.core.dto.IndustrialAttachment"/>
+
    <!-- Configure a datasource to use with this SQL Map using SimpleDataSource.
+
            Notice the use of the properties from the above resource -->
+
  
    <transactionManager type="JDBC">
+
- http://code.google.com/a/eclipselabs.org/p/industrial-mylyn/
        <dataSource type="SIMPLE">
+
            <property name="JDBC.Driver" value="${driver}"/>
+
            <property name="JDBC.ConnectionURL" value="${url}"/>
+
            <property name="JDBC.Username" value="${user}"/>
+
            <property name="JDBC.Password" value="${password}"/>
+
            <property value="15" name="Pool.MaximumActiveConnections"/>
+
            <property value="15" name="Pool.MaximumIdleConnections"/>
+
            <property value="1000" name="Pool.MaximumWait"/>
+
        </dataSource>
+
    </transactionManager>
+
    <!-- use the url syntax of the task maps to locate the sql Map absolutely. -->
+
    <!-- use the resource syntax to locate in the class tree using class loader -->
+
  
    <sqlMap resource="derby_local_demo/TaskMapDerby.xml"/>
+
= Using the source to create your own =
    <sqlMap resource="derby_local_demo/RepositoryMapDerby.xml"/>
+
    <sqlMap resource="derby_local_demo/CommentsMapDerby.xml"/>
+
</sqlMapConfig>
+
</source>
+
  
=== Create SQL statements for Repository conaining legal values ===
+
==Configuring the Connector in its absolute bare essence==
  
Create SQL statements to return legal Owners, legal Products, legal Issue States, legal Priority values for the query lists and combos.
+
If you have access to your task repository in your own homegrown persistence framework then you might want to know what exactly you have to implement to create a Mylyn connector. This is the 5 minutes DIY connector creation. Implements just one java class: [[Mylyn/Incubator/Generic Industrial Connector/Configuring Industrial Connector using Nothing]]
  
Also add code to validate and initialize the database when relevant. Default is not to allow initialization.
+
==Configuring the Connector using Ibatis==
  
<source lang="xml">
+
For detailed instructions on configuring a Industrial Generic SQL Connector see [[Mylyn/Incubator/Generic Industrial  Connector/Configuring Industrial Connector using Ibatis]]
<?xml version="1.0" encoding="UTF-8"?>
+
<!DOCTYPE sqlMap
+
    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
+
    "http://ibatis.apache.org/dtd/sql-map-2.dtd" >
+
<sqlMap namespace="Repository">
+
    <sql id="repository">issues</sql>
+
    <!--
+
Legal issue owners and other legal values for fields are taken here
+
from DISTINCT values in the database. An alternative would be a
+
SELECT from any table containing legal users.
+
    -->
+
    <!-- return a list of legal issue owners. -->
+
    <select id="legalOwners" resultClass="string">SELECT DISTINCT bug_owner FROM <include refid="repository"/> ORDER BY bug_owner</select>
+
    <!-- return a list of legal products. -->
+
    <select id="legalProducts" resultClass="string">SELECT DISTINCT product FROM products ORDER BY product</select>
+
    <!-- return a list of legal issue status values. -->
+
    <select id="legalIssueStatus" resultClass="string">SELECT DISTINCT status FROM status ORDER BY sort</select>
+
    <!-- return a legal list of priority values.
+
        Note that in Mylyn these all need to be mapped to one of "P1", "P2", "P3", "P4" or "P5".
+
    -->
+
    <select id="legalPriority" resultClass="string">SELECT DISTINCT priority FROM priority ORDER BY priority</select>
+
    <!-- this query will be executed when pressing the Validate Connection in
+
        the Repository Settings dialog -->
+
    <statement id="validate" resultClass="integer">
+
        SELECT COUNT(*) - 3 FROM SYS.SYSTABLES WHERE (TABLENAME = 'ISSUES' OR TABLENAME = 'COMMENTS' OR TABLENAME= 'ATTACHMENTS')
+
    </statement>
+
    <!-- This query will be executed when validation fails and the repository
+
        can be initialized or updated based on version (like local Derby) -->
+
    <statement id="initialize" resultClass="string">
+
        SELECT count(*) FROM <include refid="repository"/>;
+
    </statement>
+
</sqlMap>
+
  
<source>
+
==Configuring the Connector using JPA Persistence==
  
=== Create SQL statements for handling basic Tasks ===
+
For detailed instructions on configuring a Industrial Generic SQL Connector see [[Mylyn/Incubator/Generic Industrial  Connector/Configuring Industrial Connector using JPA]]
=== Create SQL statements for handling Comments and Attachments ===
+
  
 
==Screenshots==
 
==Screenshots==
 
<gallery widths="300px">
 
<gallery widths="300px">
Image:queryEditor2.png|New Query Edotor with dates
 
 
Image:Mylyn_sql_1.png|Full Workbench showing all relevant structures
 
Image:Mylyn_sql_1.png|Full Workbench showing all relevant structures
 
Image:Dbconfig.png|New Repository Wizard
 
Image:Dbconfig.png|New Repository Wizard
 
Image:Taskeditor.png|Rich SQL Task Editor
 
Image:Taskeditor.png|Rich SQL Task Editor
 
</gallery>
 
</gallery>

Latest revision as of 05:54, 29 December 2010

This work is funded by Remain Software and Industrial-TSI.

Rationale

The main goal of this project is to enable the connection of legacy tasks databases to Mylyn quickly and cleanly. We want to provide Mylyn access to Tasks that are stored in a non-web repository, primarily a database, but this project can be used to hookup anything to Mylyn implementing just one class.


Example Projects

This project provides three demo projects to such a repository.

  • Memory
    • Just implements the IPersistor interface and manages an in-memory task database, complete with attachements and multi comments.
  • Derby and Ibatis
    • By defining only 12 SQL queries, you have access to all the Tasks in the database.
    • By adding another 6 SQL queries you have added support for Comments and Attachments
  • Derby and JPA
    • Describes how JPA can be used to connect a database to Mylyn

Use Case 0: personal cross workspace local task repository

When you have multiple workspace and use local tasks, you can only get at the tasks in the current workspace. There is also no facility for adding attachments or comments. Running a local Derby instance provides all of this in transparent manner.

Vote when this use case applies to you

Use Case 1: small development or web shops with home-grown tracker in database

Many small web or software development shops have created their own issue trackers or workflow systems that predate the ever wider acceptance of Eclipse as a platform. These usually have the data stored in a local database, accessible via lan via a custom application (Filemaker, MS Access) or a home built web frontend (LAMP).

It is not worthwile to them to build or purchase a full-fledged connector (yet), but they want access to the tasks in the convenient Mylyn way with lowest possible configuration effort.

Vote when this use case applies to you

Use Case 2: provide task like access to logged system/server exceptions stored in a database

Webservers and application servers can store their logs in a database instead of in a plain text file. Example: Writing Apache's Logs to MySQL

But who likes going over these logs or doing periodc queries on them. This connector can look in such log files and and a system operator can thus create easy queries looking at error types, source IP's server id's or string matches in the request URL.

The Mylyn notification pop up window and the task list will indicate where new issues occurred.

Vote when this use case applies to you

Team and Plan

Members

Maarten Meijer
Wim Jongman
Ahmed Aadel

Plan

Initial Request: bug 184532 Discussion: bug 223048

Current work has proven to connect to a back-end database using Ibatis and JPA. A third connector project was recently added that provides a memory persistor which only implements one class and a config file.

We are currently programming a USENET connector based on this core and a configurable SQL connector is next. The latter requires ZERO programming and enables a end user to establish a connection using wizards.


version 0.8.x (current)

  • separated Persistor interface
  • ibatis based connector:
    • Current work is done using Apache Ibatis so that all configuration can be stored in the ibatis xml configuration files.
    • Legal parameter sets for various fields can then be stored as pseudo queries.
  • JPA persistence based connector
    • use annotations in Java to define mapping
  • Memory based connector to demonstrate ease of implementation
    • One Java class to simulate task database
  • Documentation
    • Wiki updates
    • Creation of getting started documentation
    • Creation of Example Movie
  • Downloads
    • Creation of update site
    • Current version is 0.8.2

version 0.9.x

  • move connector.xml into an extension point schema
  • completer test coverage
  • auto setup/initialization of local Derby connector
  • do another Persistor implementation to test versatility: MS Excel, NNTP, ...

Architecture

IndustrialArchitecture.png


Generic Task Structure to map to any SQL DB

These are mainly the fields from AbstractTask

- repositoryUrl
- taskId
- owner
- summary
- priority (as P1, P2, P3, P4 or P5)
- completed
- completionDate (null is not completed)
- creationDate
- dueDate
- notes

Further more a generic Task can hold:

- a list of TaskComments and
- a list of TaskAttachments.


Task Context

Since the users of this connector are owners of the database (otherwise they would not be able to access it) it makes sense to create a new table that is keyed by task id and that holds a blob for the task context. In this way the task context can conveniently be dropped in this table. This could also be a setting in the connector.

Generic Query Structure to map to any SQL DB

There will be a Query window allowing (full text) selection on:

- taskId : match a specific ID
- owner : match a known owner from a list
- summary : match a string in a description
- priority (as P1, P2, P3, P4 or P5) : match one or more priorities
- completed : match true or false
- completionDate (null is not completed)  : match before, after and null
- creationDate  : match before, after and null
- dueDate  : match before, after and null
- notes : match a string in a description

and possibly:

- in the list of TaskComments and
- in the list of TaskAttachments.

Persistor interface description

TBD.

Getting the source or runtime

Update Site

We have created an update site to try this connector for 3.0.x and 2.3.x.

Create the update site reference as follows, using the above URL:

Industrial url.png

Then select that site:

Industrial update site.png

And make select the latest version plus the Ibatis SqlMap feature:

Industrial selection.png

SVN

The source of the generic SQL connector is hosted at Eclipse Labs:

- http://svn.codespot.com/a/eclipselabs.org/industrial-mylyn/trunk/

The Project page is here:

- http://code.google.com/a/eclipselabs.org/p/industrial-mylyn/

Using the source to create your own

Configuring the Connector in its absolute bare essence

If you have access to your task repository in your own homegrown persistence framework then you might want to know what exactly you have to implement to create a Mylyn connector. This is the 5 minutes DIY connector creation. Implements just one java class: Mylyn/Incubator/Generic Industrial Connector/Configuring Industrial Connector using Nothing

Configuring the Connector using Ibatis

For detailed instructions on configuring a Industrial Generic SQL Connector see Mylyn/Incubator/Generic Industrial Connector/Configuring Industrial Connector using Ibatis

Configuring the Connector using JPA Persistence

For detailed instructions on configuring a Industrial Generic SQL Connector see Mylyn/Incubator/Generic Industrial Connector/Configuring Industrial Connector using JPA

Screenshots

Back to the top