How to Build an OSGi-Based Cytoscape 3 Plugin on Eclipse
Status
Under construction. Need to add section how to use maven archetype for Cytoscape 3: KeiichiroOno DateTime()
Introduction
This section is a step-by-step instruction for building Cytoscape 3 plugin based on OSGi framework. By following this tutorial, you can create/port your plugin for Cytoscape 3.
Background
In an OSGi system, everything is a plugin. This means, Cytoscape 3 running on OSGi framework is a collection of plugins called bundle and developing a plugin for Cytoscape 3 is equivalent to developing OSGi bundles.
The main difference between Cytoscape 2.x plugin and 3.x plugin is that you do not have to implement CytoscapePlugin interface in Cytoscape 3. Instead, you need to build your plugin jar file with metadata for OSGi. However, this process will be handled by Eclipse and other tools and you do not have to create metadata manually.
Requirements
To understand each steps in this document, it is better to understand following before building your plugin:
- Basic Java
- How to build Java project on Eclipse
- OSGi Bundle
- Note: OSGi Bundle = regular jar file + metadata text file.
- OSGi-Dependent API
BundleActivator
Tools
The following tools should be installed on your machine before starting this tutorial:
[http://www.eclipse.org/ Eclipse 3.3/3.4]
[http://maven.apache.org/ Maven] 2.0.9 or later
[http://www.ops4j.org/projects/pax/construct/ Pax-Construct 1.3]
[http://java.sun.com/javase/downloads/index_jdk5.jsp Java SE 5/6]
Eclipse Plugins
[http://m2eclipse.codehaus.org/ m2Eclipse] - Maven integration for Eclipse
[http://subclipse.tigris.org/ Subclipse] - [http://subversion.tigris.org/ Subversion] client for Eclipse
[http://springide.org/blog/ Spring IDE] (Optional)
Goal of This Tutorial
There are lots of ways to organize your plugin project directory, but in this tutorial, for simplicity, we will use the following directory structure:
- Plugin Project Root - The root directory of your plugin project.
- Plugin Bundle Directory - This is the actual directory to store plugin code.
wrappers - Wrapping existing library files as OSGi bundles if they are not available as OSGi bundles
Other directories will be generated automatically. Your workspace will look like the following:
- attachment:pluginProjectTree.png
Procedure
Part 1: Create New Plugin Project
- Start Eclipse
Select Run > Run Configurations...
Right click Maven Build and create new configuration
Press Variables... and select workspace_loc as the destination directory for the new plugin project. However, the location is up to you. You can select any directory. attachment:pluginProject1.png
Press Select... and select pax:create-project as the goal
Press Add and set artifactId and groupId. Usually, groupId is based on your organization's URL. This is because once you publish your plugin in the Maven repository, the string groupId+artifactId must be unique to locate your project attachment:pluginProject2.png
Press Apply and Run.
=== Part 2: