Venue Client Refactoring

Version: 1.1
Code Basis:AG 2.1.2
Author: Thomas D. Uram
Status: Draft

Abstract

This document describes a plan to refactor the venue client code to separate the application code from the user interface code. This will make the code easier to maintain, and allow components to replaced modularly. The appearance of the venue client is expected to remain unchanged.

Motivation

This separation and refactoring work is motivated by two desires:

Design Summary

The design uses the Model-View-Controller pattern, defining the following components:

AccessGrid/VenueClient.py

VenueClient

The VenueClient class includes the following components:

  • VenueClientIW

    Used for calls to the venue

  • SOAP Server

    Used for lead/follow and personal data

  • Text Client

    Used to connect to the TextService for sending and receiving messages

  • Data Store

    Used to store personal data

  • Data Store Client

    Used for file transfers with the venue data store

  • EventClient

    • Maintains the connection to the venue by sending heartbeats
    • Receives events to maintain venue state coherence

VenueClientI (SOAPInterface)

Defines the SOAP interface to the VenueClient class. The SOAP interface specifications are in AGEP-0116 [3].

AccessGrid/VenueClientUI.py

This module defines the venue client UI and its constituent parts.

VenueClientUI

  • Defines callbacks to capture wx nature of callbacks and events

    For example, the typical wx callback takes an "event" argument. Callbacks will extract the necessary data from the event, and call the controller method to do the real work.

  • Implements the VenueClientObserver interface

    Enables the VenueClientUI as an observer of the VeneuClient. Given that these calls may be made from a thread other than the main (wx) thread, wxCallAfter is used within these methods to pass the call off to the main thread. This hides the interthread intricacy within the VenueClientUI.

  • Implements additional methods for the controller to manipulate the UI and access its data

AccessGrid/VenueClientController.py

VenueClientController

An implementation of the controller interface that manipulates the model and updates the view accordingly.

AccessGrid/VenueClientObserver.py

VenueClientObserver

Defines the interface implemented by observers of the venue client.

TestVenueClientObserver

An implementation of the Observer interface intended for testing.

bin/VenueClient.py

This module reduces to code necessary to bring the parts together as an executable:

  • Argument processing
  • Logging initialization
  • Toolkit initialization
  • Create and associate the venue client components (VenueClient, controller, ui)
  • Handle personal node startup/shutdown

Class Relationships

The classes are associated according to the MVC pattern. The Observer pattern [1] is used to define the relationship between the VenueClient and (its observer) the VenueClientUI. Multiple observers can be registered with the VenueClient. Observers must implement the VenueClientObserver interface [2].

Calls made across each of the associations are categorized here (and pictorially here). These associations are explicit references:

  • VenueClientUI -> VenueClient

    Calls to query venue client state

  • VenueClientUI -> VenueClientController

    Calls originating from user interface callbacks

  • VenueClientController -> VenueClientUI

    Update the view

  • VenueClientController -> VenueClient

    Manipulate the model

This association is through the Observer pattern:

  • VenueClient -> VenueClientUI

    Propagate changes in the VenueClient (possibly from incoming events) to the VenueClientUI

Relocation of existing functionality

The following functionality currently resides in user interface code, but will be moved to the VenueClient module:

  • data transfer code
  • text client startup
  • administrator detection
  • SOAP calls

Security Issues

None; this set of modifications should in no way affect the security of the system.

Interoperability Issues

The refactoring in this proposal should not affect the interoperability of the client with servers and services. This is an internal refactoring.

Notes

References

  1. Design Patterns: Elements of Reusable Object-Oriented Software, Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides. Addison-Wesley Professions Computing Series, Addison Wesley Longman, Inc, Reading, MA, 1995.
  2. VenueClient Design (2.1.3)
  3. AGEP-0116, VenueClient SOAP Interface
  4. Reference Implementation, http://www.mcs.anl.gov/~turam/AGEP0115