Difference between revisions of "Software Development Kit"

(Adding Source)
(Adding Source)
Line 38: Line 38:
 
=== Adding Source ===
 
=== Adding Source ===
  
Next, create and add a single .java source file to the org.organization.test package. To do this, first, create the file <tt>TestComponent.java</tt> and copy and paste the code below.  Then, create the directories <tt>src/org/organization/test</tt> in /src and place this file in this directory.
+
Next, create and add a single .java source file to the org.organization.test package. To do this, first, create the file <tt>TestComponent.java</tt> and copy and paste the code below in this file.  Then, create the directories <tt>src/org/organization/test</tt> in /src and place this file in this directory.
  
 
  package org.organization.test;
 
  package org.organization.test;

Revision as of 15:32, 19 March 2009

Developers Home | A Simple Plugin | geWorkbench Archive Files | Collaborative Development | Design Documentation | Javadocs | gForge Page | Report Defects


The Development Kit is a self-contained package that facilitates the process of developing plugins for geWorkbench.

Using the Development Kit

The Development Kit is available] as a .zip file (see Download page). Unzip this archive, then follow the instructions below to create a geWorkbench plugin.

The high-level steps for creating, testing and releasing a plugin are as follows:

  1. From the command line, cd into the directory created after unpacking the archive.
  2. Edit the provided Apache Ant build script to specify the name of your plugin.
  3. Add the .java source files for your plugin to the src directory.
  4. Add any .jar libraries that your plugin requires to the lib directory.
  5. Run ant to build your plugin.
  6. Edit the geWorkbench configuration file to add a directive for your new plugin.
  7. Run geWorkbench with ant run to test your plugin.
  8. Once satisfied with your plugin, use the provided utility to package your plugin in to a single file for distribution.

The next section will illustrate the above steps with an example.

An Example Plugin

We will create an example plugin that is simply called test. This will be a very simple visualization plugin that just displays a blank blue region.

Setting the Plugin Name

In the provided build.xml, this line can be found near the beginning of the file:

<property name="component" value="noname"/>

The line is changed to:

<property name="component" value="test"/>

This specifies the name of our component, which is used for all build products.

Adding Source

Next, create and add a single .java source file to the org.organization.test package. To do this, first, create the file TestComponent.java and copy and paste the code below in this file. Then, create the directories src/org/organization/test in /src and place this file in this directory.

package org.organization.test;

import org.geworkbench.engine.config.VisualPlugin;
 
import javax.swing.*;
import java.awt.*;
 
/**
 * A simple demonstration component.
 */
public class TestComponent implements VisualPlugin {
 
    private JPanel panel;
 
    public TestComponent() {
        panel = new JPanel();
        panel.setBackground(Color.blue);
    }
 
    public Component getComponent() {
        return panel;
    }
}

If the component required any .jar files, those would be added to the lib directory.

Configure Plugin

The configuration file for the Development Kit is called minimal.xml and it is in the conf directory.

Add the following to the bottom of minimal.xml (before </geaw-config>):

   <plugin id="testPanel" name="Test Panel" class="org.organization.test.TestComponent" source="test">
       <gui-area name="VisualArea"/>
   </plugin>

Running the Plugin in geWorkbench

The plugin will now appear when the application is run. It can be run with the command:

ant run

Releasing the Plugin

Satisfied with the plugin, it can now be released by running:

ant gear

This creates the file test.gear. A .gear file is the geWorkbench analogue of a .war file for a web application. Is a bundled plugin that can deployed to a geWorkbench install by placing the file in the components directory. A configuration directive (such as the one above) would also need to be added to the configuration file to activate the plugin.

Download

See instructions in the Download page.