Connect. Communicate. Collaborate PerfsonarUI plug-in tutorial Nina Jeliazkova ISTF, Bulgaria.

Post on 14-Dec-2015

213 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Connect. Communicate. Collaborate

PerfsonarUI plug-in tutorial

Nina Jeliazkova

ISTF, Bulgaria

Connect. Communicate. CollaborateRoadmap

• Objective– teach developers how to create a visualisation for perfsonar web

services and make it as easy as possible for them to start developing perfsonarUI plug-ins

• Content– introduction to the plug-ins– what can be re-used

• Data structures • Request (generation , sending, aggregation, threads)• Response processing• Visualization

– most important code snippets • from my point of view • based on the questions asked by plugin developers

Connect. Communicate. CollaborateWhere to find PerfsonarUI

• Releases at perfSONAR wiki– http://wiki.perfsonar.net/jra1-wiki/index.php/PerfsonarUI

• Java Web start – http://perfsonar.acad.bg

• Source code at perfSONAR SVN repository – https://svn.perfsonar.net/svn/perfsonar/branches/perfsonarui– Javadoc http://perfsonar.acad.bg/doc/

• Whom to contact – perfsonar@acad.bg

Connect. Communicate. CollaboratePerfsonarUI plugins• PerfsonarUI plugins are jar files,

found in PerfsonarUI-vX.XX/bin/ext folder.

• Plugins are loaded on startup: – Each jar in that folder is scanned to

find a class, implementing IPerfsonarTab interface.

– All found IPerfsonarTab classes are instantiated, added to PerfsonarTabsList and sorted by their IPerfsonarTab.getOrder() property.

– Command line parameters are set to each tab via IPerfsonarTab.setParameters(java.lang.String[])

– For each IPerfsonarTab a PerfsonarTaskPane is created and added as a new tab.

org.perfsonar.perfsonarui.PerfsonarTab

Connect. Communicate. CollaborateThe anatomy of the tab (1)

• A set of clickable actions on the left. Actions are created by IPerfsonarTab.getActions().

• Set of panels (JComponent[ ]) displaying some details of the query or the result just below actions. Created by IPerfsonarTab.createDetailsComponent

• Status bar, which is configured as a listener to IPerfsonarTab#.getRequest

Main panel (PluginMainPanel

)

Created by IPerfsonarTab.

createMainComponent()

Connect. Communicate. CollaborateThe anatomy of the tab (3)• org.perfsonar.perfsonarui.I

PerfsonarTab • a placeholder for several common

data structures, that are deemed sufficient to create and send a request and process the response of perfSONAR service:

• MAEndpointList contains the list of services (addresses and other info as in MAEndpoint, that will be used in this IPerfsonarTab. Note that each tab may support its own list of services. This is accessible via IPerfsonarTab.getEndpointList(), IPerfsonarTab.setEndpointList()

• IUserData holds query and response data for a single entity (e.g. an interface in MA service, pair in IPPM service). Accessible via IPerfsonarTab.getUserData(), IPerfsonarTab.setUserData()

• MetaDataList is a list of IUserData which should be normally filled in from the response of the MetadataQuery. Accessible via IPerfsonarTab.getDataList(), IPerfsonarTab.setDataList().

• SmartMARequest is the class that handles request creation and sending. It can also aggregate requests if configured to do so, send them in parallel or sequentially. Can handle requests that need different XML schema. The request is accessible via IPerfsonarTab.getRequest() and IPerfsonarTab.setRequest().

IUserData MetaDataList

SmartMARequest

MAEndpointList

Connect. Communicate. CollaborateMAEndpoint - Lesson1-1 Lessons and demo plugin code used in the presentation are available in SVN repository

•org.perfsonar.perfsonarui.demo.Lesson1

•MAEndpoint encapsulates information about perfsonar service (address, name,schema)

•Currently list of addresses are read from a configuration file MA.conf

•The intention is to populate the same data structure with information retrieved from LS

•Latest configuration file used by JWS PerfsonarUI is at http://perfsonar.acad.bg/MA.conf

Connect. Communicate. CollaborateMAEndpointList: Lesson1-2

• MAEndpointList class– org.perfsonar.perfsonarui.plugins

package– Encapsulates Vector<MAEndpoint>– Extends Observable– Methods to read configuration file and

filter services based on schema

• Example code in lessons:– task2() - retrieve all services listed in

http://perfsonar.acad.bg/MA.conf

– task3() - retrieve all BWCTL services listed in http://perfsonar.acad.bg/MA.conf

• Future development: – populate MAEndpointList from

Lookup Service

Connect. Communicate. CollaborateInterface IUserData • Purpose

– Placeholder for query and response data necessary to communicate with Perfsonar service

• Package– org.perfsonar.perfsonarui.plugins

• Most important methods:– setEndpoint(MAEndpoint endpoint) ;– String getQuery(String name)– setQuery(String name, String value);– setResponse(String name, String value);– String getResponse(String name);

• Default implementation:– AbstractUserData : two hash tables –

one for query values and one for response values

– Advantages : generic structure, not fixed to particular schema

– Disadvantages: Some concerns about type safety

•Lesson2-1

Connect. Communicate. CollaborateAbstractUserData

• package – org.perfsonar.perfsonarui

• Default IUserData implementation:– two hash tables – one for query values

and one for response values– extends Observable– user interface classes can register as

Observers and reflect its changes (e.g. UserDataPanel)

•Lesson2-2

Connect. Communicate. CollaborateMetadataList

• Package– org.perfsonar.perfsonarui.plugins

• Encapsulates ArrayList<IUserData>

• Extends Observable

• Used to:– Store information received by MetadataKeyRequest

– Specify multiple entries (e.g. interfaces, IPPM pairs) for sending MetadataKeyRequest and SetupDataRequests

•Lesson2-3. UI for displaying MetadataList and selected item (IUserData) query and response fields

Connect. Communicate. CollaborateSMARTMARequest• Package org.perfsonar.perfsonarui • An implementation of IPerfsonarRequest that understands different

schema versions, based on the endpoint MAEndpoint. The descendants should implement createMARequest(MAEndpoint) and create specific IPerfsonarRequest based on MAEndpoint.getSchema()

• Send request to different MA • Query aggregation• Sending requests in parallel threads

•Lesson3-1

Connect. Communicate. CollaborateSmartMARequest•Lesson 3-1 : makeRequest(IUserData uData, String messageType, IPerfsonarResponse response, boolean runInThread)

•MetadatakeyRequest with parameters specified by IUserData

1)Query GEANT2 RRD MA for specific IP, then query ISTF RRD MA for all available interfaces.

2)The result is available in MetadataList object

Connect. Communicate. CollaborateSmartMARequest•Lesson 4-1 : Send SetupDataRequest with parameters specified by IUserData

•Lesson 4-1 : Send SetupDataRequest with parameters specified by MetadataList. It may consist of IUserData with different endpoints. SMARTMARequest will send separate queries.

Connect. Communicate. CollaborateThe anatomy of the tab (4)• IPerfsonarResponse An interface

to be implemented by classes that will receive response from perfSONAR service. This is basically a PropertyChangeListener that listens for PerfsonarResponseEvent

• All Known Implementing Classes:

IUserData MetaDataList

SmartMARequest

MAEndpointList

•IPerfsonarResponse

Connect. Communicate. CollaborateThe anatomy of the tab (5)

IUserData MetaDataList

SmartMARequest

MAEndpointList

IPerfsonarResponse

Connect. Communicate. CollaborateThe anatomy of the tab (6)

• Search list MetaDataList is another list of IUserData. Accessible via IPerfsonarTab.getSearchList(), IPerfsonarTab.setSearchList(). – Provides means to send queries for subset of MetadataList– Used in traceroute query

• Actions IPerfsonarTab.getActions() are an PSActionMap of PSUIAction descendants. You may find useful following actions: – PerfsonarRequestAction descendants – to send requests. – SetOptionsAction displays

IPerfsonarTab.createOptionsComponent(java.awt.Component) in a JTabbedPane.

– EndpointsAction Perfsorm some action on a list of services (e.g. select, check status).

– ClearAction Calls IPerfsonarTab.clear().

Connect. Communicate. CollaborateDemo plug-in (1)

•Set to true in order to query > 1 service at time

•Use only perfsonar 2.0 services

•Create IUserData instance to be used in all requests

•Sets the default order of IUserData entries

Connect. Communicate. CollaborateDemo plug-in (2)

Connect. Communicate. CollaborateDemo plug-in (3)

Connect. Communicate. CollaborateDemo plug-in (4)

•This plug-in will be the last one

•The main panel

•The class listening for time/value pairs

Connect. Communicate. CollaborateDemo plug-in (5)

•Chart view - PerfsonarTimeSeriesDataset

•Tabular view - ResponseData

Connect. Communicate. CollaborateDemo plug-in (6)

Connect. Communicate. CollaborateDemo plug-in (6)

Connect. Communicate. CollaborateThe anatomy of the tab (again)

IUserData MetaDataList

SmartMARequest

MAEndpointList

IPerfsonarResponse

Connect. Communicate. Collaborate

How to implement classes to handle new request types

• Implement interface IPerfsonarRequest or subclass AbstractMARequest

• Most important IPerfsonarRequest methods:

Connect. Communicate. CollaborateAbstractMARequest

• Default implementation of IPerfsonarRequest

• Sends requests synchronously or asynchronously

• Abstract methods, have to be implemented by descendant classes:

Connect. Communicate. CollaborateSummary

• Create class that implements IPerfsonarTab. The easies way is to extend PerfsonarModel. 1. Override PerfsonarModel.createUserData() and instantiate your

IUserData class within method (or use the default) 2. Override PerfsonarModel.createDataList and instantiate your

MetadataList (sub)class within the method (or use the default)3. Implement #createSmartRequest 4. Implement #getOrder 5. Create PluginMainPanel descendant that will visualize your data

and make #createMainComponent return it. 6. If existing IPerfsonarRequest classes are not suitable, derive your

own class from AbstractMARequest and make SmartRequest to create it when necessary.

7. Override actions implementations, if necessary.

Connect. Communicate. CollaborateSummary (cont)

• Decide whether to use current implementations of IUserData and MetadataList or derive your own.

• If new type of request necessary, subclass AbstractMARequest. – Define new request type new PerfsonarSchema(“MyNewType”)– The “MyNewType” string will be used in MA.conf file– Implement its createRequest() methods, generating request from

information available in IUserData (single query) or MetadataList (multiple queries).

– Implement processRequest() method

Connect. Communicate. CollaborateSummary (cont)

• Use existing implementations or implement IPerfsonarResponse

• Use existing classes for user interface or implement your own and implement PluginMainPanel

Connect. Communicate. CollaborateSummary (cont)

• Use existing implementations or implement IPerfsonarResponse

• Use existing classes for user interface or implement your own and implement PluginMainPanel

• Use classes from org.perfsonar.perfsonarui.ui.panels package for user interface or implement your own. Most data classes extends Observable and a good approach for UI is to register as Observer and reflect its changes.

Connect. Communicate. CollaborateFuture developments

• PerfsonarUI distribution– Stable releases– Latest code

• Code refactoring if necessary– Generalize API for MP and MA (are there other type of services?)– Proposal: separate directory for plugins, separate plugin build files from the

main one– In principle plug-ins can be developed even completely outside of the

PerfsonarUI source tree, using only perfsonarui jar files. Plug-ins are supposed to work by just placing jar files into PerfsonarUI/ext directory

• Implement missing functionality (e.g. LS, AA) and make them available for plugins

• Better documentation for developers• Create plug-in repository

– Source code – perfsonarui SVN source tree – JAR files – again at SVN with links from WIKI (other proposals?)

Connect. Communicate. Collaborate

Thank you!

Questions?

top related