Skip to content.


Upload Data Plugin

This document describes the upload plugin architecture and how to create and add a new upload plugin to the MBAT Upload Workspace.

Architecture

The MBAT Upload Workspace is one of the MBAT core workspaces and uses a plugin framework. The MBAT Upload Workspace communicates with the upload data plugins using the following input/output model:

  • Plugin Input:
    1. none
  • Plugin Output:
    1. the main panel (JPanel) of the upload plugin

Events

To better understand the interaction between the MBAT upload workspace and its plugin, the events that cause certain plugin methods to be invoked are summarized below:

Plugin methodCalled on event
getMainPanel()Plugin is selected in combobox


SVN repository

For SVN setup, see the Eclipse SVN Configuration. The key projects for spatial registration plugins are:

  • svn+ssh://svn.loni.ucla.edu/cvs/MouseBIRN/mbWorkspacePlugins/ (plugin API)
  • svn+ssh://svn.loni.ucla.edu/cvs/MouseBIRN/mbUploadPlugins (sample plugins)

Adding a new plugin

For detailed instructions on how to create and add a plugin to the MBAT source code tree using Eclipse, see CreatingPlugins.

Once you have created and compiled your plugin, you must archive it and place it in the plugins folder. If you follow the above instructions for Eclipse, the build.xml will automatically archive and zip the plugin to the correct folder:

  1. Create a zip file of the plugin.xml and classes/ folder. The zip file should have the following structure:
       {root}
           classes/
           plugin.xml
  2. Add the .zip file to the plugins folder (mbat/dist/plugins/mbUpload)

Creating a new plugin

Creating a upload data plugin involves the following steps:

  1. Create a java class that implements the mbUploadBase interface. The mbUploadBase interface defines the common interface for all upload plugins. We describe here the major methods of the interface (see mbUploadBase.java for more detailed inline documentation).
          public class UploadAIDB implements mbUploadBase {   
            ...
          }
  2. Implement your GUI by overriding the getMainPanel() method. For performance reasons, it is recommended that you avoid instantiating JComponents inside this function; only layout of the JComponents should be done here since getMainPanel() is called everytime the plugin is selected:
          public JPanel getMainPanel() {
             // layout some JComponents in the JPanel
          }
  3. Create plugin.xml. This file is required by the Java Plugin Framework (JPF) and defines the extension point of the plugin. The extension point-id must be specified as point-id="Upload" to load correctly. For most purposes, you can copy the plugin.xml from the mbUploadPlugins project and edit the extension section:

    For more detailed information, consult the JPF Tutorial.


UploadSimpleBrowser

If your upload data plugin has a webbrowser interface, you can use the derived class UploadSimpleBrowser to launch an embedded browser. The UploadSimpleBrowser launches the default browser installed on the user's system and loads the URL defined in plugin.xml.

  1. Create the plugin directory structure using Eclipse as described in CreatingPlugins.
  2. Since we are using the UploadSimpleBrowser, creation of java classes are unnecessary. The src folder should only contain the plugin manifest plugin.xml.
  3. In plugin.xml:
    1. add dependency to net.nbirn.mbat.plugins.workspace.Upload in requires section (this is where the UploadSimpleBrowser.class files are located)
    2. define the "class" to be UploadSimpleBrowser
    3. define "baseURL"