1 / 29

UNICORE Plugins – How to Design Application Specific Interfaces

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

talbot
Download Presentation

UNICORE Plugins – How to Design Application Specific Interfaces

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 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

  3. TaskPlugin Job Preparation menu Job Preparation tree JPA Panel

  4. ExtensionPlugin Extensions menu Plugin window

  5. UnicorePlugable • public abstract void startPlugin() • public abstract void stopPlugin() • public abstract String getPluginInfo() • public JMenuItem getSettingsItem() • public HelpSet getHelpSet() • protected Client getClient()

  6. JPA toolbar Settings item Extensions menu Vsite toolbar Plugin info public JMenuItem getSettingsItem() publicJMenuItemgetCustomMenu() publicComponentgetVsiteToolBarComponent() public abstract String getPluginInfo() publicComponentgetJPAToolBarComponent() ExtensionPlugable

  7. ExtensionPlugable API • publicComponentgetVsiteToolBarComponent() • publicComponentgetJPAToolBarComponent() • publicJMenuItemgetCustomMenu() • publicObjectsetupSpecialVsiteFeatures(Vsitevsite,AbstractJobjob)

  8. Add task item Icon Settings item JPA panel Plugin info public abstract String getName() public JMenuItem getSettingsItem() public abstract String getPluginInfo() protected String getIconPath() public abstract JPAPanel getPanelInstance(ActionContainer c) TaskPlugable

  9. TaskPlugin – JPAPanel • End user panel for preparing plugin's input • Straightforward integration with client's standard panels - mainly for file imports and exports:

  10. 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

  11. TaskPlugin – OutcomePanel • is used to post process plugin's task output • generally it can perform any additional tasks (even submit another jobs)

  12. 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)

  13. 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

  14. 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

  15. 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

  16. TaskPlugin – JPAPanel code public 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(); } [...] }

  17. TaskPlugin – Containercode (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; } ....

  18. TaskPlugin – Containercode (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; } }

  19. 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(); [...] } [...] }

  20. 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

  21. 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

  22. 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

  23. 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

  24. 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

  25. DeviceSteer Plugin (2)

  26. 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

  27. DBAccess Plugin (2)

  28. References • Plugin Programmer’s Guide • Client API documentation • Client and plugins source code

  29. QUESTIONS ?

More Related