Difference between revisions of "Software Development Kit"

(Using the Development Kit)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{DevelopersTopNav}}
 
{{DevelopersTopNav}}
 +
 +
* This page is out of date. There is not much value for the developers to have a separate SDK besides the downloadable geWorkbench package and the code base from subversion, which includes an example plug-in. I will remove the link of this page from the Developers section (to avoid confusion) instead of maintainining this page. Feb 23, 2012. - Zhou Ji
  
 
The Development Kit is a self-contained package that facilitates the process of developing plugins for geWorkbench.  
 
The Development Kit is a self-contained package that facilitates the process of developing plugins for geWorkbench.  
Line 5: Line 7:
 
== Using the Development Kit ==
 
== 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.  Prerequisites to using the SDK are installing [http://ant.apache.org/manual/index.html ANT] and a [[Download#Software_Requirements|supported version]] of Java.
+
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.  Prerequisites to using the SDK are installing [http://ant.apache.org/manual/index.html ANT] and a [[Download#Software_Requirements|supported version]] of Java.
  
 
The high-level steps for creating, testing and releasing a plugin are as follows:
 
The high-level steps for creating, testing and releasing a plugin are as follows:
Line 20: Line 22:
 
The next section will illustrate the above steps with an example.
 
The next section will illustrate the above steps with an example.
  
== An Example Plugin ==
+
== An Example Plugin (geworkbench 1.7 or later) ==
 +
 
 +
We will create an example plugin that is simply called <tt>test</tt>. This will be a very simple visualization plugin that just displays a blank blue region.
 +
 
 +
=== Setting the Plugin Name ===
 +
 
 +
In the provided <tt>build.xml</tt>, change this line:
 +
 
 +
<property name="component" value="noname"/>
 +
 
 +
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 <tt>TestComponent.java</tt> (in your favorite editor) and copy and paste the code below in this file.  Then, create the directories <tt>src/org/organization/test</tt> in /src and place <tt>TestComponent.java</tt> 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 requires any .jar files, add them to the <tt>lib</tt> directory.
 +
 
 +
=== Configure Plugin ===
 +
 
 +
Create a .cwb.xml file for your plugin and place it under the same directory as the source file.  In this case, create ''test.cwb.xml'' and place it under ''GEWORKBENCHSDK_HOME/src/org/organization/test''.
 +
 
 +
  <component-descriptor  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ConfigurationFile Schema.xsd">
 +
    <component  name="Test SDK Panel" 
 +
      class="org.organization.test.TestComponent"
 +
      version="1.0"
 +
      author="C2B2"
 +
      authorURL=""
 +
      toolURL=""
 +
      description="test SDK"
 +
      visualizer="true">
 +
      <license>
 +
      <![CDATA[
 +
        <html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"></head>
 +
          <body>----</body>
 +
        </html>
 +
      ]]></license>
 +
    </component>
 +
    <plugin id="TestSDKPanel" name="Test SDK" class="org.organization.test.TestComponent" source="test">
 +
      <gui-area name="VisualArea"/>
 +
    </plugin>
 +
  </component-descriptor>
 +
 
 +
=== Running the Plugin in geWorkbench ===
 +
 
 +
To run the plugin and see it appear in geWorkbench (a blue visual), do the following:
 +
 
 +
ant run
 +
 
 +
When geWorkbench appears, right click on the ''Workspace'' and select ''New Project''.  You should see the blue visual plugin.
 +
 
 +
=== Releasing the Plugin ===
 +
 
 +
To create a plugin release, type:
 +
 
 +
ant gear
 +
 
 +
This creates the file <tt>test.gear</tt>. This gear file is a bundled  plugin that can deployed to a geWorkbench installation by placing the file in the <tt>components</tt> directory, then unzipping it.
 +
 
 +
== An Example Plugin (Pre geworkbench 1.7) ==
  
 
We will create an example plugin that is simply called <tt>test</tt>. This will be a very simple visualization plugin that just displays a blank blue region.
 
We will create an example plugin that is simply called <tt>test</tt>. This will be a very simple visualization plugin that just displays a blank blue region.

Latest revision as of 11:38, 23 February 2012

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


  • This page is out of date. There is not much value for the developers to have a separate SDK besides the downloadable geWorkbench package and the code base from subversion, which includes an example plug-in. I will remove the link of this page from the Developers section (to avoid confusion) instead of maintainining this page. Feb 23, 2012. - Zhou Ji

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. Prerequisites to using the SDK are installing ANT and a supported version of Java.

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 (geworkbench 1.7 or later)

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, change this line:

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

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 (in your favorite editor) and copy and paste the code below in this file. Then, create the directories src/org/organization/test in /src and place TestComponent.java 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 requires any .jar files, add them to the lib directory.

Configure Plugin

Create a .cwb.xml file for your plugin and place it under the same directory as the source file. In this case, create test.cwb.xml and place it under GEWORKBENCHSDK_HOME/src/org/organization/test.

 <component-descriptor  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ConfigurationFile Schema.xsd">
   <component  name="Test SDK Panel"  
     class="org.organization.test.TestComponent" 
     version="1.0"
     author="C2B2"
     authorURL=""
     toolURL=""
     description="test SDK"
     visualizer="true">
     <license>
     <![CDATA[
       <html><head><meta http-equiv=Content-Type content="text/html; charset=windows-1252"></head>
         <body>----</body>
       </html>
     ]]></license>
   </component>
   <plugin id="TestSDKPanel" name="Test SDK" class="org.organization.test.TestComponent" source="test">
     <gui-area name="VisualArea"/>
   </plugin>
 </component-descriptor>

Running the Plugin in geWorkbench

To run the plugin and see it appear in geWorkbench (a blue visual), do the following:

ant run

When geWorkbench appears, right click on the Workspace and select New Project. You should see the blue visual plugin.

Releasing the Plugin

To create a plugin release, type:

ant gear

This creates the file test.gear. This gear file is a bundled plugin that can deployed to a geWorkbench installation by placing the file in the components directory, then unzipping it.

An Example Plugin (Pre geworkbench 1.7)

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, change this line:

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

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 (in your favorite editor) and copy and paste the code below in this file. Then, create the directories src/org/organization/test in /src and place TestComponent.java 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 requires any .jar files, add them 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

To run the plugn and see it appear in geWorkbench (a blue visual), do the following:

ant run

When geWorkbench appears, right click on the Workspace and select New Project. You should see the blue visual plugin.

Releasing the Plugin

To create a plugin release, type:

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.