• Aucun résultat trouvé

This section presents the interfaces of the application pool control, as depicted in Figure 6.8 on page 115 in the previous chapter. It starts with a description of the public interface of the appli-cation pool, which is the interfacePc::Pool, followed by a discussion of the interfaces of the session object that represents a running application.

7.7.1 Interface Pc::Pool

Pc::Pool is the public interface of the application pool. Terminals access it to start applica-tions, or to join application sessions. A terminal control that wants to start an application calls the following operation:

ParentSessionControl get_application(in Atyp::UserRecord user, in Atyp::ApplicationNameF application,

in Atyp::TitleNameF title) raises (Atyp::NoSuchApplication,

Atyp::NoSuchTitle,

Atyp::ApplicationStartupDenied, Ex::ResourceProblem);

This operation does not yet start the application. It returns a reference to the session control interface of a session object. This session object represents the application that the terminal control addresses with the combination of title and application name in the parameter list of the operation. The session control interface allows the terminal control to find out if it is compati-ble before it actually starts the application. It is a parent session control because all applica-tions started by a terminal are automatically parent applicaapplica-tions. The operation get_

application() fails if the application pool does not contain the combination of application and title requested by the terminal control, if the user denoted by the parameter user is not authorized to start the application, or if the application pool does not have enough resources left to start this application.

A terminal control that holds an identifier for a session on an application pool may retrieve a reference to the session access interface of the respective participation control:

Pac::SessionAccess get_access(in Atyp::SessionId sid) raises (....);

The operation fails if the given session identifier is invalid, if the session cannot be joined, or if there is a resource problem. This operation is also used by terminals that want to join a slave application of a broadcast application. The slave application is transparently launched by the first terminal that wants to join it, and terminates when the last terminal quits the application session.

The interfacePc::Pool also contains an operation with which a user may reserve a session identifier for a future application session on this application pool:

Atyp::SessionId reserve_identifier(in Atyp::UserRecord user in Typ::Date expires);

A user accesses this operation for instance via his control panel. The parameterexpires cates the expiration date of the session. If the session has not taken place until the date indi-cated by expires, the reservation is automatically cancelled. The reservation of session identifiers is the most simple form of reservation that can be imagined. A future version of the Pc::Pool interface may provide access to more refined reservation interfaces.

7.7.2 Interface Pc::SessionControl

Applications started by terminals are parent applications and are represented by a parent ses-sion object in the application pool control. Parent applications may start child applications which are represented by a child session object. Similarly, child applications may start their own child applications, which results in a hierarchy of application sessions that are all part of the same composite session. A composite session is controlled by the application that was orig-inally launched by a terminal. Figure 7.1 depicts the interfaces of the child and parent session object, and the interaction between these objects with the terminal control and the child and parent applications. Child session objects differ from parent session objects in the control interface that is exposed to the owner of the application:

module Pc { ....

interface SessionControl;

interface ParentSessionControl : SessionControl {...};

interface ChildSessionControl : SessionControl {...};

};

The common base interface Pc::SessionControl allows applications and terminals to retrieve a list of terminal interfaces required by the application:

Typ::InfIdents required_interfaces();

Terminals may compare this list with the list of interfaces that they implement in order to determine if they are compatible with the application. Applications may check this list against the list of interfaces implemented by every terminal in the application session. The terminal or parent application that started an application may also kill it:

void kill();

It is assumed that there is normally no need to call this operation.

The interface Pc::ParentSessionControl contains two operations that allow to start an application:

Atyp::SessionId start(in Typ::StringRef tc) raises (....);

void start_with_id(in Typ::StringRef tc, in Atyp::SessionId id)

raises (....);

The operationstart() returns a session identifier if the application could be started success-fully. The operation start_with_id() allows to start the application with a previously reserved session identifier. Both operations block until the application runs. The parametertc is a stringified reference to a Tc::TerminalControl interface in the terminal that wants to start the application. The application control initializes the application with this reference.

The interfacePc::ChildSessionControl contains an operation that allows an applica-tion to start a child applicaapplica-tion:

App::Application start() raises (....);

Figure 7.1. Interfaces of the child and parent session.

Application Pool Management

Terminal Control Parent

Pc::ParentSessionControl Pc::PoolControl Pa::Session

Parent Application Child

Pc::ChildSession Pc::PoolControl Pa::Session

Control

Session Session

Child Application

Composite Session

Application Pool Boundary

The operation returns a reference to the control interface of the child application.

7.7.3 Interface Pc::PoolControl

Pc::PoolControl is the interface of the application pool control towards a running applica-tion. It allows to start application pool utilities and other applications. Similar to the interface Pc::Pool it provides information about installed utilities, applications and titles:

readonly attribute Typ::InfIdents installed_uts;

readonly attribute Atyp::ApplicationNames installed_apps;

readonly attribute Atyp::TitleNames installed_titles;

Applications may first consult these lists before they choose to start a child application or a utility. They may also access the service broker of the application pool to get more information about installed applications and titles. Two further attributes inform the application about the utilities and child applications it has currently running:

readonly attribute Put::UtilityDescriptions running_uts;

readonly attribute ChildSessionControls child_sessions;

The attributechild_sessions is a list of references toPc::ChildSessionControl inter-faces. The attribute running_uts is a list of utility descriptions, with a utility description containing some basic information about the utility and a reference to aPut::Utility inter-face. Utilities are started with a call to the following operation:

Put::Utility get_utility(in Typ::InfIdent utility) raises (....);

The call returns a reference to a Put::Utility interface once the utility is up and running.

The application may then narrow this reference to the type of interface it actually instantiated, and start to issue operation requests to this interface.

The procedure for starting a child application is similar to the one for starting a parent appli-cation. The application that wants to start a child application must first get hold of a reference to a session control interface:

ChildSessionControl get_application(in Atyp::ApplicationNameF application,

in Atyp::TitleNameF title) raises (....);

The application specifies a combination of application and title name, and receives a reference to a Pc::ChildSessionControl interface if the application pool can satisfy the request.

This interface allows the application to test if the terminals that are currently participating in the application session are compatible with the child application. Once compatibility is tested the application may start the child application:

App::Application start() raises (....);

The exceptions raised by this operation correspond to those of the get_application() call in the interfacePc::Pool.

An application that terminates indicates this to the application pool control with a call to the following operation:

void terminated();

Before calling this operation, the application must have disconnected from all terminals and removed all application pool utilities and child applications that it owns. It will exit right after the call toterminated() returns.