29
UNICORE Plugins – How to Design Application Specific Interfaces Krzysztof Benedyczak Michał Wroński

UNICORE Plugins – How to Design Application Specific Interfaces

  • Upload
    talbot

  • View
    28

  • Download
    1

Embed Size (px)

DESCRIPTION

UNICORE Plugins – How to Design Application Specific Interfaces. Krzysztof Benedyczak Micha ł Wro ń ski. Introduction. Plugin types Task Plugin (e.g. Gaussian, Amber) Extension Plugin (DBBrowser, LAJ) Classes public abstract class UnicorePlugable - PowerPoint PPT Presentation

Citation preview

Page 1: UNICORE Plugins – How to Design Application Specific Interfaces

UNICORE Plugins – How to Design Application Specific Interfaces

Krzysztof Benedyczak

Michał Wroński

Page 2: UNICORE Plugins – How to Design Application Specific Interfaces

Introduction

• Plugin types– Task Plugin (e.g. Gaussian, Amber)

– Extension Plugin (DBBrowser, LAJ)

• Classes– public abstract class UnicorePlugable

– public abstract class TaskPlugable extends UnicorePlugable

– public abstract class ExtensionPlugable extends UnicorePlugable

Page 3: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin

Job Preparation menu

Job Preparation tree

JPA Panel

Page 4: UNICORE Plugins – How to Design Application Specific Interfaces

ExtensionPlugin

Extensions menu

Plugin window

Page 5: UNICORE Plugins – How to Design Application Specific Interfaces

UnicorePlugable

• public abstract void startPlugin()

• public abstract void stopPlugin()

• public abstract String getPluginInfo()

• public JMenuItem getSettingsItem()

• public HelpSet getHelpSet()

• protected Client getClient()

Page 6: UNICORE Plugins – How to Design Application Specific Interfaces

ExtensionPlugable

public JMenuItem getSettingsItem()

Settings item

Extensions menu

public JMenuItem getCustomMenu()

JPA toolbar

public Component getJPAToolBarComponent()

Vsite toolbar

public Component getVsiteToolBarComponent()

Plugin info

public abstract String getPluginInfo()

Page 7: UNICORE Plugins – How to Design Application Specific Interfaces

ExtensionPlugable API

• public Component getVsiteToolBarComponent()

• public Component getJPAToolBarComponent()

• public JMenuItem getCustomMenu()

• public Object setupSpecialVsiteFeatures(Vsite vsite, AbstractJob job)

Page 8: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugable

Add task item

public abstract String getName()

Settings item

public JMenuItem getSettingsItem()

Plugin info

public abstract String getPluginInfo()

Icon

protected String getIconPath()

JPA panel

public abstract JPAPanel getPanelInstance(ActionContainer c)

Page 9: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – JPAPanel

• End user panel for preparing plugin's input

• Straightforward integration with client's standard panels - mainly for file imports and exports:

Page 10: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – Container

• Used to simplify low-level AJO creation • It is streamed to NJS • ErrorSet checkContents()

method can be used to validate Container data • Client offers wide range of Containers; most

commonly used in plugins are:– UserContainer: for executing SoftwareResources– GroupContainer: for maintaining complex job

structures

Page 11: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – OutcomePanel

• is used to post process plugin's task output

• generally it can perform any additional tasks (even submit another jobs)

Page 12: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugable API

• public abstract String getName()• public abstract ActionContainer

getContainerInstance(GroupContainer parent)• public abstract JPAPanel

getPanelInstance(ActionContainer container)

• protected String getIconPath()

• public final Class getContainerClass()

• public final boolean hasContainerClass(Class cls)

Page 13: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – JPAPanel API

• Extends JPAPanel (thus also extends JPanel)• Implements:

– void applyValues() - should setup underlying plugin container with GUI's values

– void resetValues() - just another way round – fills panel with container’s data

– void updateValues(boolean vsiteChanged) – invoked every time panel becomes visible

Page 14: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – UserContainer

• Simple scenario:– extend UserContainer

– use setPreinstalledSoftware()

– use addFileImport(), addFileExport()

• Optionally implement buildExecuteGroup which:– creates executeGroup instance

– adds to executeGroup custom AbstarctActions with dependences

Page 15: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – OutcomePanel API

• Container implements IPanelProvider interface to register additional panel(s) in Client's outcome area– JPanel getPanel(int i)

• usually OutcomePanel want to get notifications when new data is fetched and when the panel becomes visible: – OutcomePanel implements Applyable interface

Page 16: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – JPAPanel codepublic class DBAccessJPAPanel extends JPAPanel {

public DBAccessJPAPanel(JFrame parentFrame, ScriptContainer container) {[...]initComponents();

}/** Apply values from GUI to container */

public void applyValues() {container.setModifiedTime(new Date(System.currentTimeMillis()));container.setName(taskTextField.getText());

}/** Fill values from container into gui */

public void resetValues() {taskTextField.setText(container.getName());scriptTextArea.setText(task.getScript());

}/** Method will be called whenever this panel is activated */

public void updateValues(boolean vsiteChanged) {if (vsiteChanged) loadQueries();enableControls();

}[...]

}

Page 17: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – Container code (1)public class ExampleContainer extends UserContainer

implements IPanelProvider {

private transient JPanel simpleOutcomePanel;

public ExampleContainer(GroupContainer parent) { super(parent);}

public ErrorSet checkContents() {

ErrorSet er = super.checkContents();

//Does Vsite support needed SoftwareResource? NamedResourceSet nrs =

ResourceManager.getResourceSet(getVsite()); if (nrs.findSoftwareResourceByName("our_executable") == null) er.add(new Uerror(getIdentifier(),"Wrong Vsite")); setErrors(er); return er; }....

Page 18: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – Container code (2).....

public int getNrOfPanels() { return 1;}

public String getPanelTitle(int i) { return “Simple outcome panel”;}

public void finalizePanel(){}

public JPanel getPanel(int i) { if (!simpleOutcomePanel) simpleOutcomePanel =

new ReexSimpleOutcomePanel(this); return simpleOutcomePanel;}

}

Page 19: UNICORE Plugins – How to Design Application Specific Interfaces

TaskPlugin – OutcomePanel code

public class SimpleOutcomePanel extends JPanel implements Applyable { [...]

public SimpleOutcomePanel(Container container) { initComponents();}

public void applyValues() {}

/** Becomes visible */public void updateValues() { if (plot == null) addPlotPanel();}

/** New outcome */public void resetValues() { if (panelReady) return; if (plot == null) addPlotPanel(); [...]}

[...]

}

Page 20: UNICORE Plugins – How to Design Application Specific Interfaces

Re-usable components

• Graphical interfaces– FileImportPanel, FileExportPanel, RemoteTextEditor

• Container classes– UserContainer, GroupContainer

• Classes to get the outcome of AJO– OutcomeManager

• Classes to manage resources– ResourceManager

• Requests

Page 21: UNICORE Plugins – How to Design Application Specific Interfaces

Requests

• Requests allow to prepare jobs at low level (AJO) without using containers

• but they still hides from programmer many issues: sending job to Vsite, waiting/checking for reply and all certificates related work

• Requests are often used in ExtensionPlugins• There are many out-of-the-box requests in the Client. The

most interesting:– GetJobStatus – GetFilesFromUspace– GetListing

Page 22: UNICORE Plugins – How to Design Application Specific Interfaces

How to implement a Request

• extends ObservableRequestThread • add some IObservers to Request object • implement run() method where:

– AJO is constructed

– AJO is sent with desired method (polling or nonPolling)

– if nonPolling() answer was RetrieveOutcomeReply then in run() we can get (deserialized) outcome – else it must be done in IObserver code

Page 23: UNICORE Plugins – How to Design Application Specific Interfaces

Summary

• TaskPlugin– used as a component in standard Client’s job

– integrates JPAPanel, Container and OutcomePanel

• ExtensionPlugin– adds any other new functionality to the Client

Page 24: UNICORE Plugins – How to Design Application Specific Interfaces

DeviceSteer Plugin (1)

• Plugin for steering remote devices through Unicore infrastructure- user friendly – GUI

• Interactivity in Unicore• Designed in the way which allows simple

adaptation to different devices

Page 25: UNICORE Plugins – How to Design Application Specific Interfaces

DeviceSteer Plugin (2)

Page 26: UNICORE Plugins – How to Design Application Specific Interfaces

DBAccess Plugin (1)

• Plugin allows for access to SQL databases• Features:

– User friendliness

– Support for the most popular free DBMSes: PostgreSQL and MySQL

– Support for SDSC Storage Resource Broker

– Extensibility

Page 27: UNICORE Plugins – How to Design Application Specific Interfaces

DBAccess Plugin (2)

Page 28: UNICORE Plugins – How to Design Application Specific Interfaces

References

• Plugin Programmer’s Guide

• Client API documentation

• Client and plugins source code

Page 29: UNICORE Plugins – How to Design Application Specific Interfaces

QUESTIONS ?