Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Connect. Communicate. Collaborate PerfsonarUI plug-in tutorial Nina Jeliazkova ISTF, Bulgaria."— Presentation transcript:

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

2 Connect. Communicate. Collaborate Roadmap 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

3 Connect. Communicate. Collaborate Where to find PerfsonarUI Releases at perfSONAR wiki –http://wiki.perfsonar.net/jra1-wiki/index.php/PerfsonarUIhttp://wiki.perfsonar.net/jra1-wiki/index.php/PerfsonarUI Java Web start –http://perfsonar.acad.bghttp://perfsonar.acad.bg Source code at perfSONAR SVN repository –https://svn.perfsonar.net/svn/perfsonar/branches/perfsonaruihttps://svn.perfsonar.net/svn/perfsonar/branches/perfsonarui –Javadoc http://perfsonar.acad.bg/doc/http://perfsonar.acad.bg/doc/ Whom to contact –perfsonar@acad.bg

4 Connect. Communicate. Collaborate PerfsonarUI 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. IPerfsonarTab –All found IPerfsonarTab classes are instantiated, added to PerfsonarTabsList and sorted by their IPerfsonarTab.getOrder() property.IPerfsonarTab PerfsonarTabsListIPerfsonarTab.getOrder() –Command line parameters are set to each tab via IPerfsonarTab.setParameters(java.l ang.String[]) IPerfsonarTab.setParameters(java.l ang.String[]) –For each IPerfsonarTab a PerfsonarTaskPane is created and added as a new tab.IPerfsonarTab PerfsonarTaskPane org.perfsonar.perfsonarui.PerfsonarTab

5 Connect. Communicate. Collaborate The anatomy of the tab (1) A set of clickable actions on the left. Actions are created by IPerfsonarTab.getActions(). IPerfsonarTab.getActions() Set of panels ( JComponent[ ] ) displaying some details of the query or the result just below actions. Created by IPerfsonarTab.createDetailsComponent IPerfsonarTab.createDetailsComponent Status bar, which is configured as a listener to IPerfsonarTab#.getRequest IPerfsonarTab#.getRequest Main panel ( PluginMainPanel ) PluginMainPanel Created by IPerfsonarTab. IPerfsonarTab. createMainComponent()

6 Connect. Communicate. Collaborate The anatomy of the tab (3) org.perfsonar.perfsonarui.IPerfso narTaborg.perfsonar.perfsonarui.IPerfso narTab 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()MAEndpointListMAEndpointIPerfsonarTab 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()IUserData 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().MetaDataListIUserData 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().SmartMARequest IPerfsonarTab.getRequest() IPerfsonarTab.setRequest( IUserData MetaDataList SmartMARequest MAEndpointList

7 Connect. Communicate. Collaborate MAEndpoint - 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

8 Connect. Communicate. Collaborate MAEndpointList: Lesson1-2 MAEndpointList class –org.perfsonar.perfsonarui.plugins package –Encapsulates Vector –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 http://perfsonar.acad.bg/MA.conf –task3() - retrieve all BWCTL services listed in http://perfsonar.acad.bg/MA.conf http://perfsonar.acad.bg/MA.conf Future development: –populate MAEndpointList from Lookup Service

9 Connect. Communicate. Collaborate Interface 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

10 Connect. Communicate. Collaborate AbstractUserData 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

11 Connect. Communicate. Collaborate MetadataList Package –org.perfsonar.perfsonarui.plugins Encapsulates ArrayList 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

12 Connect. Communicate. Collaborate SMARTMARequest 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()IPerfsonarRequestMAEndpointcreateMARequest(MAEndpoint)IPerfsonarRequestMAEndpoint.getSchema() Send request to different MA Query aggregation Sending requests in parallel threads Lesson3-1

13 Connect. Communicate. Collaborate SmartMARequest 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

14 Connect. Communicate. Collaborate SmartMARequest 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.

15 Connect. Communicate. Collaborate The 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 PerfsonarResponseEventIPerfsonarResponse PerfsonarResponseEvent All Known Implementing Classes: IUserData MetaDataList SmartMARequest MAEndpointList IPerfsonarResponse

16 Connect. Communicate. Collaborate The anatomy of the tab (5) IUserData MetaDataList SmartMARequest MAEndpointList IPerfsonarResponse

17 Connect. Communicate. Collaborate The anatomy of the tab (6) Search list MetaDataList is another list of IUserData. Accessible via IPerfsonarTab.getSearchList(), IPerfsonarTab.setSearchList().MetaDataListIUserData 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:IPerfsonarTab.getActions()PSActionMapPSUIAction –PerfsonarRequestAction descendants – to send requests.PerfsonarRequestAction –SetOptionsAction displays IPerfsonarTab.createOptionsComponent(java.awt.Component) in a JTabbedPane.SetOptionsAction IPerfsonarTab.createOptionsComponent(java.awt.Component) –EndpointsAction Perfsorm some action on a list of services (e.g. select, check status).EndpointsAction –ClearAction Calls IPerfsonarTab.clear().ClearActionIPerfsonarTab.clear()

18 Connect. Communicate. Collaborate Demo 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

19 Connect. Communicate. Collaborate Demo plug-in (2)

20 Connect. Communicate. Collaborate Demo plug-in (3)

21 Connect. Communicate. Collaborate Demo plug-in (4) This plug-in will be the last one The main panel The class listening for time/value pairs

22 Connect. Communicate. Collaborate Demo plug-in (5) Chart view - PerfsonarTimeSeriesDataset Tabular view - ResponseData

23 Connect. Communicate. Collaborate Demo plug-in (6)

24 Connect. Communicate. Collaborate Demo plug-in (6)

25 Connect. Communicate. Collaborate The anatomy of the tab (again) IUserData MetaDataList SmartMARequest MAEndpointList IPerfsonarResponse

26 Connect. Communicate. Collaborate How to implement classes to handle new request types Implement interface IPerfsonarRequest or subclass AbstractMARequest Most important IPerfsonarRequest methods:

27 Connect. Communicate. Collaborate AbstractMARequest Default implementation of IPerfsonarRequest Sends requests synchronously or asynchronously Abstract methods, have to be implemented by descendant classes:

28 Connect. Communicate. Collaborate Summary Create class that implements IPerfsonarTab. The easies way is to extend PerfsonarModel.IPerfsonarTabPerfsonarModel 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.PluginMainPanel 6.If existing IPerfsonarRequest classes are not suitable, derive your own class from AbstractMARequest and make SmartRequest to create it when necessary.IPerfsonarRequestAbstractMARequest 7.Override actions implementations, if necessary.

29 Connect. Communicate. Collaborate Summary (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

30 Connect. Communicate. Collaborate Summary (cont) Use existing implementations or implement IPerfsonarResponse Use existing classes for user interface or implement your own and implement PluginMainPanelPluginMainPanel

31 Connect. Communicate. Collaborate Summary (cont) Use existing implementations or implement IPerfsonarResponse Use existing classes for user interface or implement your own and implement PluginMainPanelPluginMainPanel 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. org.perfsonar.perfsonarui.ui.panels

32 Connect. Communicate. Collaborate Future 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?)

33 Connect. Communicate. Collaborate Thank you! Questions?


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

Similar presentations


Ads by Google