Activities

Read about activities in Saros.

Overview

Activities are events that capture an action performed by a participant that changes the state of the session.
They are value objects and should thus be immutable.
Handling activities is performed on the Inversion of Control pattern.
All activities should inherit from IActivity, thus ensuring that they are "automatically" directed to the proper activity receivers that execute them.
An activity provider is responsible for creating and executing one or more activity types.
 
Activity providers execute their activities locally.
Providers report when they create an activity to the registered listeners by calling IActivityListener.activityCreated(IActivity).
The provider is intended to use ISarosSession#addActivityProvider(IActivityProvider), which in turn will register the ISarosSession to the provider. This way, the provider can fire activities for a Saros session by calling activityCreated().

How Saros handles activities

Warning: this documentation is partially out of date
 
The core functionality of Saros is to intercept several relevant actions in Eclipse (like inserting text, selecting text, opening files) and reproducing these actions at other clients of the DPP session.
Especially modifications are important to reproduce.
At the beginning of the session every member gets the current version of the project.
During the session every modification of a resource has to be performed on all other clients, to keep up the synchronal state of the project at all clients.
The following figure shows the main interfaces and classes of Saros handling activities.
 
 
Activities are created when listeners catch a relevant action in Eclipse.
Like a keypress in a project file editor is caught by a IDocumentListener that was registered at the Eclipse framework.
Activities will be wrapped in an object, get a timestamp, put in a queue and transmitted as XMPP message (XML format) to other clients of a DPP session.
On their end the activity object will be recreated by examining the XML body of the received message, creating an activity object, put it in a timestamp ordered list and sequentially executed on the clients Eclipse environment.
 
Creating and sending an activity
 
 
Receiving and repeating an activity