Download presentation
Presentation is loading. Please wait.
Published byGwenda Cole Modified over 9 years ago
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
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()
7
ExtensionPlugable API public Component getVsiteToolBarComponent() public Component getJPAToolBarComponent() public JMenuItem getCustomMenu() public Object setupSpecialVsiteFeatures(Vsite vsite, AbstractJob job)
8
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)
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 – 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; }....
18
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; }
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 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 ?
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.