Developing Shared Applications - PowerPoint PPT Presentation

About This Presentation
Title:

Developing Shared Applications

Description:

RegisterEventCallback() Register callback for event. SetData() Set shared state ... Example: Shared PDF. SharedAppClient # Create shared application client ... – PowerPoint PPT presentation

Number of Views:18
Avg rating:3.0/5.0
Slides: 28
Provided by: lefv
Learn more at: https://www.mcs.anl.gov
Category:

less

Transcript and Presenter's Notes

Title: Developing Shared Applications


1
Developing Shared Applications
  • Susanne Lefvert
  • lefvert_at_mcs.anl.gov
  • University of Chicago

2
Outline
  • Overview
  • Sharing State
  • Event Communication
  • SharedAppClient
  • DatastoreClient
  • Packaging and Installation
  • Example Shared PDF
  • Exercises
  • Documentation

3
Shared Applications
Allows individuals to use programs together from
remote locations
  • Shared Browser
  • Browse the web together
  • Shared Presentation
  • View and control remote presentations
  • Shared VNC
  • Secured screen sharing
  • Question and Answer Tool
  • Remotely post questions and answers

4
Shared Applications
5
Sharing State

Venue
foo
Client 1
Application Session State
foo
foo
Client 2
foo
Client 3
Communicating via SOAP calls
6
Event Communication

Venue
foo
bar
Client 1
Application Session
foo
bar
Event Channel
Client 2
Event Channel
foo
bar
Client 3
Communicating via GSITCP Sockets
7
SharedAppClient

Your Application
Venue
SharedAppClient
SharedApplicationIW
Application Session
Event Channel
EventClient
8
SharedAppClient
  • Tool for developers
  • Hides details about
  • SOAP communication
  • Event communication
  • Logging
  • Data cache
  • Exception handling
  • API
  • AccessGrid.SharedAppClient
  • AccessGrid.SharedApplication.SharedApplicationIW

http//www.mcs.anl.gov/fl/research/accessgrid/docu
mentation/developer/api/
9
SharedAppClient
  • API
  • Join() Connect to an application session
  • InitLogging() Get object for logging
  • Shutdown() Shut down soap interface and event
    client
  • SendEvent() Distribute an event to all clients
  • RegisterEventCallback() Register callback for
    event
  • SetData() Set shared state
  • GetData() Get shared state
  • UpdateDataCache() Update cached data
  • GetPublicId() Get my unique id
  • GetVenueURL() Get venue url

10
DatastoreClient
  • API
  • LoadData() Get data from venue
  • QueryMatchingFiles() Get file names matching
    pattern
  • GetFileData() Get data description for a file
  • Download() Download file from venue
  • Upload() Upload file to venue
  • RemoveFile() Remove file from venue

11
Packaging and Installation
  • Create an application description file.
  • SharedMyApp.app
  • Create an Access Grid package.
  • SharedAppName.agpkg
  • Use agpm.py to install the application.
  • agpm.py --help
  • Open the package in the Venue Client
  • Start application sessions in the Venue Client.

application name SharedMyApp mimetype
application/x-ag-shared-myapp extension
sharedmyapp files SharedMyApp.py,
otherFile commands Open (python)s
SharedMyApp.py -a (appUrl)s
12
Example Shared PDF
13
Example Shared PDFSharedAppClient
Create shared application client
self.sharedAppClient SharedAppClient(name)
self.log self.sharedAppClient.InitLogging()
Get client profile clientProfile
ClientProfile(UserConfig.instance().GetProfile())
Join the application session
self.sharedAppClient.Join(appUrl, clientProfile)
self.id self.sharedAppClient.GetPublicId()
Register callbacks for external events
self.sharedAppClient.RegisterEventCallback("openFi
le", self.OpenCallback) self.sharedAppClient.Regi
sterEventCallback(changePage",

self.ChangePageCallback)

14
Example Shared PDFGet Current State
  • State URL to file and current page number

Get current state self.file
self.sharedAppClient.GetData(file") self.pageNr
self.sharedAppClient.GetData(page")
if self.file try
self.dataStoreClient.Download(self.file, "tmp")
self.pdf.LoadFile("tmp")
self.pdf.setCurrentPage(self.pageNr) except
self.log.exception("PdfViewer.__init__
Download failed s"(self.file))
15
Example Shared PDF

16
Example Shared PDFEvent Communication
Event type changePage, data unique ID and
page number
-- sender --- def OnNextPageButton(self,
event) '''Invoked when user clicks the
next button.''' self.pageNr self.pageNr
1 self.pdf.setCurrentPage(self.pageNr)
self.sharedAppClient.SendEvent(changePage"
, (self.id, self.pageNr))
self.sharedAppClient.SetData("page",
self.pageNr) --- receiver --- def
ChangePageCallback(self, event) '''
Invoked when a changePage event is received.'''
id, self.pageNr event.data
Ignore my own events if self.id ! id
wxCallAfter(self.pdf.setCurrentPage,
self.pageNr)
17
Example Shared PDF

18
Example Shared PDFDatastoreClient

def PopulateCombobox(self, default None)
Get pdf files from venue fileNames
wxBeginBusyCursor() try
self.dataStoreClient.LoadData()
fileNames self.dataStoreClient.QueryMatchingF
iles(".pdf") except
self.log.exception("FileSelectorDialog.PopulateCom
bobox Failed.") wxEndBusyCursor()
Update combobox
self.pdfList.Clear() for file in
fileNames self.pdfList.Append(file)
19
Example Shared PDFPackaging and Installation
  • 1. Create SharedPDF.app
  • 2. SharedPDF.py SharedPDF.app gt
    SharedPDF.agpkg (zip)
  • 3. agpm.py --p SharedPDF.agpkg

application name Shared PDF mimetype
application/x-ag-shared-pdf extension
sharedpdf files SharedPDF.py commands Open
(python)s SharedPDF.py -v (venueUrl)s -a
(appUrl)s
20
Starting Application Session

21
Exercises
http//www.mcs.anl.gov/fl/research/accessgrid/docu
mentation/tutorial/AGTk_2.4
  • Exercise 4 Shared Applications
  • Shared Stoplight
  • Shared Group Chat

22
Exercise 1 Shared Stoplight
23
Exercise 1 Shared Stoplight
  • Creating the application environment
  • Initializing the AG environment
  • Creating SharedAppClient
  • Joining the application session
  • Registering event callbacks
  • Retrieving initial state
  • Sending and receiving events
  • Setting application state

24
Exercise 1 Shared Stoplight
  • Three Exercises
  • Create an AG package, install, and start the
    application from the Venue Client.
  • Add a new button yellow
  • Add a text field to change the title

25
Exercise 1 Shared Stoplight
26
Exercise 2 Shared Group Chat
27
Documentation
  • Contributed Software Page
  • http//www.mcs.anl.gov/fl/research/accessgrid/wiki
    /moin.cgi/ContributedSoftware
  • Reference Materials
  • http//www.mcs.anl.gov/fl/research/accessgrid/wiki
    /moin.cgi/DevelopingSharedApplications
  • Toolkit API
  • http//www.mcs.anl.gov/fl/research/accessgrid/docu
    mentation/developer/api/
Write a Comment
User Comments (0)
About PowerShow.com