Charles Jolley, email@example.com
The LinkBack Framework is an open framework that brings editable objects to Mac OS X. Using LinkBack-enabled applications, users can paste content create in other applications into a document and later edit or update the content from the original application. When activated by the user, the content can be updated automatically by the provider application or the provider application can display the content for the user to edit. Any changes will automatically replace the original embedded content.
By offering this framework as an open-source project, Nisus hopes in enable a wide variety of Cocoa-based applications, including Nisus Writer Express, to integrate more tightly with one another.
GOAL AND NON-GOALS
The goals of the LinkBack framework are:
- To enable applications to share data with one another, maintaining a link to the originating application so that the user can edit the data or have it refreshed.
- To provide this functionality though a simple API that is simple to use and requires minimal changes in an existing Cocoa-based application.
The goal of LinkBack is not to provide for in-application editing of data from another app. For example, LinkBack does not provide for a graphics application to provide an in-application editor for a word processor.
Following are some user scenarios that depict how we envision LinkBack being used.
SCENARIO 1: Drawing application
Linda is working with a graphics tool to create a new image for her research paper and then pastes the image into a Nisus Writer Express document. Later, Linda decides to change the drawing she inserted into Nisus Writer so she double-clicks on the drawing in Nisus Writer Express. The original drawing application opens and displays the drawing. She makes her changes and selected “Save” in the drawing application, updating the graphic in Nisus Writer Express.
SCENARIO 2: Live Data
Larry uses a stock quote application to lookup some online stock quotes. He then selects the quotes and copies them to the pasteboard. He opens a new Nisus Writer Express document and selects “Paste.” A dialog appears asking him if he wants the data he is about to paste to be updated automatically. He chooses the live update option and the stock quotes appear in his document. Every fifteen minutes the quotes automatically update in his document to reflect the current stock value.
This section describes the technical approach of the prototype implementation of LinkBack. In general, the pasteboard is used to transfer data between applications supplemented by a small amount of additional interprocess communication using distributed objects to coordinate server and client applications. This coordination is implemented by the LinkBack framework so that the host applications need only interact with the limited LinkBack API and the framework will do the rest.
LinkBack interactions occur between two applications, a server and a client application:
- A server application provides LinkBack data as an additional type on the pasteboard during normal pasteboard operations such as cut, copy or drag operations. It also responds to requests from client applications to edit or refresh the LinkBack data at a later time.
- A client application retrieves and stores LinkBack data along with other standard data types from the pasteboard during normal pasteboard operations such as paste and drop operations. At the request of the user or at predefined intervals, the client application may request the server application that generated some LinkBack data refresh or open the data for editing. It then receives the updated data from the server application and replaces its old data with the new.
The server and the client applications share data via the standard Cocoa pasteboard. Their interaction is coordinated by LinkBack object instances. For each edit or refresh session that takes place, peer LinkBack objects are created in both the server and the client applications for the edit. The two peers communicate with one another using distributed objects.
A server application provides LinkBack data by including an additional LinkBack data type on the pasteboard whenever it places other data on the pasteboard for cut, copy, or drag operations. The LinkBack data object is a dictionary that contains information needed for LinkBack updates including the application signature of the server application, information about the types of updates allowed, and custom data provided by the server application.
The custom data is used later by the server application to reconstruct and editable document. It may contain any object that can be serialized in a property list. It may contain the data for the document itself (such as a set of application-specific graphic objects) or it may contain a reference to the originating document (such as a URL).
If a LinkBack-enabled client application finds LinkBack data on the pasteboard during a paste or drop operation, it will take that data along with taking whatever other standard data types it would normally use. Both LinkBack-enabled client applications and non-LinkBack aware applications use the standard data types provided by the server application to display whatever is on the pasteboard. A LinkBack-enabled client application will also retain the LinkBack data it finds for a future update.
Updating LinkBack Data
Once a client application has some LinkBack data it can maintain, it can issue refresh requests to the server application at any time. To issue this update request the client application uses the LinkBack API to perform the following:
- Create a custom pasteboard and put the original LinkBack data on it.
- If the server application is not running, find it and start it. Once it is running, establish a LinkBack with the server application.
- Send a request to edit or refresh the data on the pasteboard, passing the name of the pasteboard containing the data.
The server application is activated when it receives this message and retrieves the data from the pasteboard. This operation is asynchronous; the client application can continue operation after it sends an edit request to the server.
Once the server has completed its refresh or edit, it uses the LinkBack API to place the updated LinkBack data on a private pasteboard along with other standard pasteboard data formats and informs the client application that refreshed data is available. Often times this can be implemented by factoring out the code normally used for a copy operation.
Once the client receives this notification of the change, it can extract the data from the pasteboard for display and save the updated LinkBack data for a future update.
At various times during the editing process, either the server or the client applications may wish to cancel an edit or refresh operation. For example, the client or server application may quit, or the user may close the original document or the document window opened by the server application for the user to edit the data. The application that wants to cancel the update can simply close its LinkBack. This will automatically inform the other application and clean up any open resources.
LinkBack will also detect when one of the applications has closed the connected unexpectedly and cancel the update automatically.
Last Revised: 28 Jun 2004