diff --git a/livesupport/doc/model/Scheduler/index.html b/livesupport/doc/model/Scheduler/index.html index f8ea22bfd..b19fa7456 100644 --- a/livesupport/doc/model/Scheduler/index.html +++ b/livesupport/doc/model/Scheduler/index.html @@ -1,4211 +1,5785 @@ - - - - - LiveSupport Scheduler specifications - - - -

Preface

-This document is part of the LiveSupport -project, Copyright © 2004 Media -Development Loan Fund, under the GNU GPL.
- -

Scope

-This document contains the specification of the LiveSupport Scheduler -daemon.
-
-This document contains embedded SVG figures, thus an SVG -capable browser is needed to view it, or an SVG plugin like Adobe's SVG Viewer.
-

Requirements

-

Overview
-

-The purpose of the LiveSupport Scheduler daemon is to execute -playlists.
-

Goals
-

-The scheduler daemon is a remotely accessible service accepting -playlists on a local audio interface. Specific goals include:
- -

System functions

-The main system functions are described below. There are three -categories for these functions:
- - - - - - - - - - - - - - - - - - - -
function category
-
meaning
-
evident
-
Should perform, and the user should be cognizant -that it is performed
-
hidden
-
Should perform, but not visible to the users.
-
frill
-
Optional
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref#
-
function
-
category
-
F1.1
-
Accept uploaded playlists
-
evident
-
F1.2
-
Retrieve remote files referenced by playlists
-
hidden
-
F1.3
-
Access local files
-
hidden
-
F1.4
-
Provide status information
-
evident
-
F1.5
-
Log playlist execution for proof of broadcast -reasons
-
evident
-
F1.6
-
Purge local file storage of unused audio clips
-
hidden
-
F1.7
-
Execute playlists
-
evident
-
F1.8
-
Play live streams as part of the playlist
-
hidden
-
F1.9
-
Remove playists from the schedule
-
evident
-
F1.10
-
Re-schedule playlsits
-
evident
-
F1.11
-
Delete playlists
-
evident
-
F1.12
-
Create playlists
-
evident
-
F1.13
-
Edit playlists
-
evident
-
F1.14
-
Start the scheduler daemon
-
evident
-
F1.15
-
Stop the scheduler daemon
-
evident
-

-

-

-
-
-

System attributes

-Generic attributes
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref#
-
attribute
-
details and constraints
-
category
-
A1.1
-
operating system platform
-
Linux
-
must
-
A1.2
-
supported audio interfaces
-
ALSA (maybe also OSS?)
-
must
-
A1.3
-
supported playlist format
-
SMIL 2.0. only partial support is required, -which focuses only on audio aspects of SMIL.
-
must
-
A1.4
-
supported audio clip formats
-
Ogg Vorbis, mp3, wav
-
must
-

-

-

-

-
-
-Attributes related to system functions
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref#
-
function
-
ref#
-
attribute
-
details and constraints
-
category
-
F1.7
-
Execute playlists
-
A1.5
-
low latency
-
when executing playlists, very low latency -should be achieved
-
must
-

-

-
A1.6
-
handle time skew
-
the -daemon has to take into account that the system's clock is not -accurate. the clock is synchronized to an external regularly, but the -resulting time-jump must be handled.
-
must
-
F1.8
-
Play live streams as part of the playlist A1.7
-
supported audio stream formats
-
Ogg Vorbis via HTTP, mp3 via HTTP
-
must
-
F1.14
-F1.15
-
Start / stop the scheduler daemon
-
A1.8
-
provide System V init style services
-
Provide a System V init interface to starting -and stopping the scheduler daemon
-
must
-

-

-

-

-

-

-
-
-

Essential use cases

-This section lists generic (essential) uses cases, that do not contain -architecture-specific considerations.
-
- -

UC-1 Upload playlist

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref# UC-1
use case Upload playlist
type primary, essential
actors Playlist editor
purpose Upload a playlist
overview The Playlist editor uploads a new playlist.
references F1.1
-

Typical course of events

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. Playlist editor connects to the scheduler daemon -with the intent of uploading a new playlist.
-

-

-
2. The Playlist editor provides authentication -information 3. The system authenticates the Playlist editor and -grants access.
4. The Playlist editor presents the new playlist -and the intended schedule for the playlist.
-
5. The system validates the new playlist, and sees -that it does not conflict with existing schedule.

-

-
6. The system stores the new playlist, adds it to -the schedule, and sends confirmation to the Playlist editor.
7. The Playlist editor receives confirmation and -disconnects.
-

-

-

-

-

-
-
-

Alternate courses

- -

UC-2 Manage schedule
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref#
-
UC-2
use case Manage schedule
type
-
primary, essential
actors
-
Playlist editor
purpose
-
View the schedule and remove or re-schedule -playlists
-
overview
-
The Playlist editor reviews the schedule. If he -decides to, he might remove or re-schedule some of these playlists.
references
-
F1.4, F1.9, F1.10
-
-
-

Typical course of events
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. Playlist editor connects to the scheduler daemon -with the intent of viewing and editing the schedule.
-

-

-
2. The Playlist editor provides authentication -information 3. The system authenticates the Playlist editor and -grants access.

-

-
4.
-
The system shows the Schedule to the Playlist -editor
-
5.
-
The Playlist editor browses the Schedule, -selects a playlist for detailed viewing.
-
6.
-
The system shows the details of the selected -Playlist.
-
7.
-
The playlist editor removes a playlist from the -schedule.
-
8.
-
The system removes the playlist from the -schedule, than re-displays the updated schedle.
-
9.
-
The Playlist editor re-schedules a playlist
-
10.
-
The system removes the selected playlist from -the schedule, and re-enters it at a new timepoint
-
11.
-
The Playlist editor browses the Schedule
-
12.
-
The system shows the Schedule to the playlist -editor
-
13.
-
The Playlist editor disconnects.
-

-

-
-
-

Alternate courses

- -

UC-3 Manage playlists
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref#
-
UC-3
use case Manage playlists
type
-
primary, essential
actors
-
Playlist editor
purpose
-
View and delete playlists
overview
-
The Playlist editor reviews the uploaded -playlists. If he decides so, he might delete some of these playlists.
references
-
F1.4, F1.11
-
-
-

Typical course of events
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. Playlist editor connects to the scheduler daemon -with the intent of viewing and deleting playlists.
-

-

-
2. The Playlist editor provides authentication -information 3. The system authenticates the Playlist editor and -grants access.

-

-
4.
-
The system lists the available Playlists
-
5.
-
The Playlist editor browses the playlists, and -selects one for detailed viewing.
-
6.
-
The system shows the details of the selected -Playlist.
-
7.
-
The playlist editor deletes a playlist.
-
8.
-
The system deletes the playlist, than -re-displays the list of available Playlists.
-
9.
-
The Playlist editor disconnects.
-

-

-
-
-

Alternate courses

- -

UC-4 Retrieve remote files
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref# UC-4
use case Retrieve remote files
type
-
primary, essential
actors
-
(internal actor, initiator), Media archive, -Local storage
-
purpose
-
Retrieve remote files referenced by active -playlists and store them in the local storage
-
overview
-
The -daemon contacts the remote media archive and retrieves audio clips -referenced by active playlists. The clips are stored locally for -playing.
references
-
F1.2
-
-Note that this use case is somewhat reversed, as it is initiated by the -system (not an actor), and the main tasks are done by an external actor -(the Media archive).
-

Typical course of events

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. An Internal actor triggers the retrieval of some -remote files.
-
2. The system looks up the URN of the remote file, -and determines the Media archive to contact regarding the file.

-

-
3.
-
The system contacts the Local storage and sends -authorization information
-
4.
-
Local storage authenticates the system and -grants access
-
5.
-
The system iniquires the local storage about the -availability of the file to download in the Local storage by presenting -its unique ID
-
6.
-
Local storage tells if the required file is -already stored or not.
-
7.
-
If the file is available in the local storage, -the use case ends. Otherwise, it continues.
-

-

-
8.
-
The system contacts the Media archive and sends -authorization information
9. Media archive authenticates the system and -grants access 10. The system requests an audio clip by presenting -its unique ID
11. Media archive looks up the file, and presents it -to the system 12. The system retrieves the file and closes the -connection to the Media archive
-

-

-
13.
-
The system presents the file to Local storage
-
14.
-
Local storage stores the file under the -specified unique ID
-
15.
-
The system closes the connection to Local -storage.
-

-

-

-

-
-
-

Alternate courses

- -

UC-5 Review play log
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref# UC-5
use case Review play log
type secondary, essential
actors Broadcast auditor
purpose Review what has been played
overview The -Broadcast auditor reviews the audio clips that have been played in a -selected time interval. He may generate reports for proof of broadcast -reasons.
references F1.4
-

Typical course of events
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. Broadcast auditor connects to the scheduler -daemon with the intent of reviewing what has been played.
-

-

-
2. The Broadcast auditor provides authentication -information 3. The system authenticates the Broadcast auditor -and grants access.
3.
-
The Broadcast auditor browses through the play -log in a time-ordered manner.
-
4.
-
The system displays the play log entries.
-
5.
-
The Broadcast auditor requests a play report for -a given time period.
-
6.
-
The system displays the requested report.
-
7.
-
The Broadcast auditor disconnects.
-

-

-

-

-

-

-
-
-

Alternate courses

- -
-

UC-6 Create playlist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref# UC-6
use case Create playlist
-
type secondary, essential
actors Playlist editor
-
purpose Create a new playlist, and then edit it.
-
overview The Playlist editor connects to the Scheduler -with the aim of creating a new playlist. A basic user interface is -provided, which allows professionals to create and edit the playlsits -on the system.
-
references F1.12, F1.13
-
-

Typical course of events
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. Playlist editor connects to the scheduler with -the intent of creating a new playlist.
-

-

-
2. The Playlist editor provides authentication -information 3. The system authenticates the Playlist editor and -grants access.
4.
-
The Playlist editor signals that he whishes for -a new playlist
-
5.
-
The system creates a new, empty playlist, and -opens it for editing.
-
6.
-
The Playlist editor edits the new playlist. See -UC-7 actions 7-15 for details.
-

-

-
7.
-
The Playlist editor disconnects.
-

-

-

-

-

-

-
-
-

Alternate courses

- -
-

UC-7 Edit playlist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref# UC-7
use case Edit playlist
-
type secondary, essential
actors Playlist editor
-
purpose Edit a previoulsy uploaded playlist
-
overview The Playlist editor connects to the -Scheduler with the aim of either editing an existing playlist. A basic -user interface is provided, which allows -professionals to edit the playlsits on the system.
-
references F1.12
-

Typical course of events
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. Playlist editor connects to the scheduler with -the intent of editing a playlist.
-

-

-
2. The Playlist editor provides authentication -information 3. The system authenticates the Playlist editor and -grants access.

-

-
4.
-
The system lists the available playlists.
-
5.
-
The Playlist editor selects a playlist for -editing.
-
6.
-
The system opens the playlist in editing mode.
-
7.
-
The Playlist editor browses the available Audio -clips
-
8.
-
The system shows the list of available audio -clips
-
9.
-
The Playlist editor selects an Audio clip
-
10.
-
The system displays details on the audio clip.
-
11.
-
The Playlist editor ads a new audio clip to the -playlist, at a certain timepoint in the playlist.
-
12.
-
The new audio clip is added to the playlist.
-
13.
-
The Playlist editor removes an audio clip from -the playlist.
-
14.
-
The audio clip is removed from the playlist.
-
15.
-
The Playlist editor edits the fade-in or -fade-out of a clip in the playlist.
-
16.
-
The fade-in or fade-out is edited.
-
17.
-
The Playlist editor saves the playlist.
-
18.
-
The playlist is validated.
-

-

-
19.
-
The playlist is saved.
-
20.
-
The Playlist editor disconnects.
-

-

-
-
-

Alternate courses

- -
-

UC-8 Start/stop scheduler
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ref# UC-8
use case Start/stop scheduler
-
type primary, essential
actors Administrator
-
purpose Start and stop the scheduler daemon
-
overview The adminisitrator starts the scheduler deamon -by invoking a System V init-style startup script. He may also stop the -deamon with the same script.
-
references F1.14, F1.15, A1.8
-
-

Typical course of events
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
actor action
-
system response
-
1. The Administrator invokes the scheduler's System -V init script with the start parameter
-

-

-

-

-
2. The scheduler daemon starts up.
-
3.
-
The Administrator checks to see if the scheduler -daemon is running
-
4.
-
The scheduler daemon reports that it is running.
-
5.
-
The Administrator stops the scheduler deamon.
-
6.
-
The scheduler daemon stops.
-
-
-

Alternate courses

- -

Conceptual model

-The following figure displays the semantic concepts identified for the -Scheduler daemon, and the main associations between the concepts.
-
- -
-

Concepts

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
concept
-
description
-
Media archive
-
An archive external to the system, which holds -Audio clips. The archive offers its clips for download by requesting -clips based on their unique ids.
-
Clip retriever
-
Retrieves Audio clips from the Media archive and -stores them in local storage.
-
Local storage
-
A local store of Audio clips. Provides access to -each clip based on the clips' unique id. Allows random access to the -clip files.
-
Audio clip
-
A uniquely identified audio file.
-
Playlist
-
A metafile, containing references to Audio -clips, and information on how the clips should be played.
-
PlaylistElement
-
An association class describing the specifics of -an instance of an Audio clip in a playlist.
-
FadeInfo
-
A class describing fade in or fade out -characteristics for an Audio clip in a Playlist
-
Playlist store
-
A container holding a range of playlists.
-
Schedule
-
Contains Schedule entries
-
Schedule entry
-
Contains the time and details of when a playlist -should be played.
-
Scheduler daemon
-
Executes playlists at timepoints specified by -the schedule.
-
Play log
-
A logging facility, holding Play log entries.
-
Play log entry
-
A record of when an Audio clip was played.
-
Play report
-
An audit report of what Audio clips have been -played in a certain time period
-
Authentication
-
Provides authentication services
-
Playlist editor
-
An external editor, managing playlists.
-
Broadcast auditor
-
An external auditor, browsing the Play log.
-
Administrator
-
The administrator responsible for starting and -stopping the scheduler daemon.
-

-

-
-
-

Associations

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
source
-
association
-
target
-
description
-
Clip retriever
-
Retrieves clips from
-
Media archive
-

-
Media archive
-
Contains
-
Audio clip
-

-
Clip retriever
-
Stores clips in
-
Local storage
-

-
Local storage
-
Contains
-
Audio clip
-

-
Playlist
-
References by PlaylistElement
-
Audio clip
-

-
PlaylistElement
-
Fades in with
-
FadeInfo
-

-
PlaylistElement
-
Fades out with
-
FadeInfo
-

-
Playlist store
-
Contains
-
Play list
-

-
Playlist editor
-
Uploads playlist to
-
Playlist store
-

-
Playlist editor
-
Manages schedule in
-
Schedule
-
The Playlist editor schedules playlists.
-
Schedule
-
Contains
-
Schedule entry
-

-
Schedule entry
-
References
-
Playlist
-

-
Scheduler daemon
-
Executes
-
Schedule
-
The Scheduler daemon plays the scheduled -playlists.
-
Scheduler daemon
-
Logs into
-
Play log
-
The Scheduler daemon logs all the played audio -clips into the Play log for proof of broadcast purposes.
-
Play log
-
Contains
-
Play log entry
-

-
Play log
-
Generated
-
Play report
-
The play log generates reports based on Play log -entries.
-
Play log entry
-
References
-
Audio clip
-

-
Broadcast auditor
-
Browses entries from
-
Play log
-

-
Broadcast auditor
-
Requests
-
Play report
-

-
Playlist editor
-
Is authenticated by
-
Authentication
-

-
Broadcast auditor
-
Is authenticated by
-
Authentication
-

-
Administrator
-
Manages
-
Scheduler daemon
-

-

-

-

-

-
-
-

System behavior

-The behavior of the system as a whole as experienced from the outside -is discussed in this section.
-

System sequence diagrams

-System diagrams are presented for each use case below.
-

UC-1 Upload playlists

- -
-

UC-2 Manage schedule

- -
-

UC-3 Manage playlists

- -
-

UC-4 Retrieve remote files
-

- -
-

UC-5 Review play log

- -

UC-6 Create playlist

- -

UC-7 Edit playlist
- -

-

UC-8 Start/stop scheduler

- -
-
-

System objects

-The following figures shows the system objects and their functions, as -derived from the system sequence diagrams.
- -

Contracts

-For all operations exposed in the system sequence diagrams, the -following contracts are defined.
-

Contract for Scheduler : authenticate

-See Authentication : authenticate
-
-

Contract for Scheduler : uploadPlaylist

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
uploadPlaylist
-(playlist : Playlist,
-playtime: Schedule)
-: UniqueId
-
Responsibilities
-
Upload a playlist and -put it into the schedule.
-
Type
-
system
-
Cross-reference
-
F1.1, UC-1
-
Notes
-

-
Exceptions
-
If the uploaded playlist -is not valid, indicate as an error
-If the proposed schedule conflicts with existing schedules, indicate as -an error
-
Output
-
the unique id of the -ScheduleEntry created with this upload
-
Pre-conditions
-
none
Post-conditions
-
condition
-
type
-

-
A new Playlist is created, storing the uploaded -playlist
-
instance creation

-
Playlist is entered into the Playlist store
-
association formed
-

-
A new Schedule is created, according to the -supplied schedule
-
instance creation
-

-
Schedule is associated with the Playlist
-
association formed
-

-

-

-
-
-

Contract for Scheduler : displaySchedule

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
displaySchedule
-(from : TimeStamp,
-to : TimeStamp)
-: Schedule
-
Responsibilities
-
Display Schedule entries -for a time period.
-
Type
-
system
-
Cross-reference
-
F1.4, UC-2
-
Notes
-

-
Exceptions
-
none
-
Output
-
The Schedule entries for -the specified time period.
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : displayPlaylist

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
displayPlaylist
-(playlistId : UniqueId)
-: Playlist
-
Responsibilities
-
Display a specific -playlist
-
Type
-
system
-
Cross-reference
-
F1.4, UC-3
-
Notes
-

-
Exceptions
-
If no playlist exists -for the specified playlistId, indicate as an error.
-
Output
-
The requested playlist.
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : deletePlaylist

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
deletePlaylist
-(playlist : Playlist)
-: void
-
Responsibilities
-
Delete a specific -playlist
-
Type
-
system
-
Cross-reference
-
F1.11, UC-3
-
Notes
-

-
Exceptions
-
If no playlist exists -for the specified playlistId, indicate as an error.
-If the playlist is referenced by any Schedule entry, indicate as an -error.
-
Output
-
none
-
Pre-conditions
-
none
Post-conditions
-
condition
-
type
-

-
The playlist is removed from the Playlist store.
-
association broken
-

-
References by the playlist to Audio clips removed
-
association broken
-

-
The playlist is deleted
-
instance deletion
-

-

-

-
-
-

Contract for Scheduler : removeFromSchedule
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
removeFromSchedule
-(scheduleEntryId : UniqueId)
-: bool
-
Responsibilities
-
Remove a specific -playlist from a schedule entry
-
Type
-
system
-
Cross-reference
-
F1.9, UC-2
-
Notes
-

-
Exceptions
-
If no ScheduleEntry by -the specified -scheduleEntryId exist, indicate as an error.
-
Output
-
true if the specified -entry was removed, false if it did not exist.
-
Pre-conditions
-
none
Post-conditions
-
condition
-
type
-

-
Reference to the playlist by the scheduleEntry -is removed.
-
association broken
-

-
The ScheduleEntry specified by the -scheduleEntryId is deleted
-
instance deletion
-

-

-

-
-
-

Contract for Scheduler : reschedule
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
reschedule
-(scheduleEntryId : UniqueId,
-playtime : TimeStamp)
-: bool
-
Responsibilities
-
Change when a certain -playlist is scheduled to play.
-
Type
-
system
-
Cross-reference
-
F1.10, UC-2
-
Notes
-

-
Exceptions
-
If no ScheduleEntry by -the specified -scheduleEntryId exist, indicate as an error.
-If the new playtime conflicts with other schedule entries, indicate as -an error.
-
Output
-
false on errors
-
Pre-conditions
-
none
Post-conditions
-
condition
-
type
-

-
The time attribute of scheduleEntry is updated -to the supplied playtime.
-
attribute modification
-

-

-

-
-
-

Contract for Scheduler : displayPlaylists

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
displayPlaylists
-()
-: Playlist
-
Responsibilities
-
Display Playlists -contained in the Playlist store
-
Type
-
system
-
Cross-reference
-
F1.4, UC-3
-
Notes
-

-
Exceptions
-
none
-
Output
-
The playlists contained -in the Playlist store.
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : displayPlayLog

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
displayPlayLog
-()
-: Play log
-
Responsibilities
-
Display Play log entries -contained in the Play log
-
Type
-
system
-
Cross-reference
-
F1.4, UC-5
-
Notes
-

-
Exceptions
-
none
-
Output
-
The play log entries -contained in the Play log.
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : generatePlayReport
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
generatePlayReport
-(from : TimeStamp,
-to : TimeStamp)
-: Play report
-
Responsibilities
-
Present a report on what -Audio clips have been played to the Broadcast auditor.
-
Type
-
system
-
Cross-reference
-
F1.4, UC-5
-
Notes
-

-
Exceptions
-
none
-
Output
-
A report on the played -Audio clips played in the specified time period.
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : createPlaylist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
createPlaylist
-()
-: Playlist
-
Responsibilities
-
Create a new playlist
-
Type
-
system
-
Cross-reference
-
F1.12, UC-6
-
Notes
-
A new playlist is -created, and is immediately locked for editing.
-
Exceptions
-
none
-
Output
-
none
-
Pre-conditions
-
none
Post-conditions
-
condition
-
type
-

-
A new Playlist is created
-
instance creation
-

-
The lockedForEditing attribute is set to true -for the playlist
-
attribute modification
-

-
The playlist is added to the Playlist store
-
association formed
-

-

-

-
-
-

Contract for Scheduler : openPlaylistForEditing
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
openPlaylistForEditing
-(playlist : Playlist)
-: void
-
Responsibilities
-
Open a playlist for -editing
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
A playlist is opened for -editing. The playlist may not be played when being edited. Also, active -(currently executing) playlists may not be opened for editing. This is -in effect a lock, which is released by saving the playlist.
-
Exceptions
-
if the playlist is -currently being executed, indicate as an error.
-
Output
-
none
-
Pre-conditions
-
none
Post-conditions
-
condition
-
type
-

-
The current version of the playlist is stored, -in case the user wants to revert to the last saved version (see -revertEditedPlaylist)
-
instance creation
-

-
The lockedForEditing attribute is set to true -for the playlist
-
attribute modification
-

-

-

-
-
-

Contract for Scheduler : addAudioClipToPlaylist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
addAutioClipToPlaylist
-(playlist : Playlist,
-audioClip : AudioClip,
-relativeOffset : Time)
-: void
-
Responsibilities
-
Add an Audio clip to a -Playlist
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
The Audio clip is added -to the playlist with the specified relativeOffset from the beginning of -the Playlist.
-
Exceptions
-
none
-
Output
-
none
-
Pre-conditions
-
the Playlist is -currently opened for editing
-
Post-conditions
-
condition
-
type
-

-
The new PlaylistElement is created associating -the playlist with the audio clip, with the specified relativeOffset
-
association formed, instnace creation
-

-

-

-
-
-

Contract for Scheduler : displayAudioClips
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
displayAudioClips
-()
-: AudioClip
-
Responsibilities
-
Display the audio clips -known to the Scheduler
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
none
-
Exceptions
-
none
-
Output
-
The Audio clips kown to -the Scheduler
-
Pre-conditions
-
none
-
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : displayAudioClip
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
displayAudioClip
-(audioClipId : UniqueId)
-: AudioClip
-
Responsibilities
-
Display the audio clip -specified by the audioClipId
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
none
-
Exceptions
-
if no audio clip by the -specified id exists, indicate as an error
-
Output
-
The Audio clip specified -by the audioClipId
-
Pre-conditions
-
none
-
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : removeAudioClipFromPlaylist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
removeAutioClipFromPlaylist
-(playlist : Playlist,
-audioClip : AudioClip)
-: void
-
Responsibilities
-
Remove an Audio clip -from a Playlist
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
The Audio clip is -removed from the Playlist.
-
Exceptions
-
If the Audio clip is not -in the playlist, indicate as an error.
-
Output
-
none
-
Pre-conditions
-
the Playlist is -currently opened for editing
-
Post-conditions
-
condition
-
type
-

-
The PlaylistElement associating the AudioClip -with the Playlist is removed, with the related FadeInfo instances
-
instance deletion, association broken
-

-

-

-
-
-

Contract for Scheduler : updateFadeInFadeOut
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
updateFadeInFadeOut
-(audioClip : AudioClip,
-playlist : Playlist)
-: void
-
Responsibilities
-
Update the fade-in and -fade-out parameters for an audio clip playing in a playlist.
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
none
-
Exceptions
-
If the Audio clip is not -in the playlist, indicate as an error.
-
Output
-
none
-
Pre-conditions
-
the Playlist is -currently opened for editing
-
Post-conditions
-
condition
-
type
-

-
The fade-in and fade-out parameters for the -audio clip in the playlist are updated
-
attribute modification
-

-

-

-
-
-

Contract for Scheduler : validatePlaylist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
validatePlaylist
-(playlist : Playlist)
-: boolean
-
Responsibilities
-
Validate a playlist for -being complete.
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
The playlist is checked -for being complete (not containing silence) and other sanity criteria.
-
Exceptions
-
none
-
Output
-
none
-
Pre-conditions
-
none
-
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : savePlaylist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
savePlaylist
-(playlist : Playlist)
-: void
-
Responsibilities
-
The playlist is saved.
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
none
-
Exceptions
-
If the playlist is not -valid, indicate as an error.
-
Output
-
none
-
Pre-conditions
-
the Playlist is -currently opened for editing
-
Post-conditions
-
condition
-
type
-

-
The lockedForEditing attriubute is set to false -for the playlist
-
attribute modification
-

-
The old version of the Playlist that could have -been used for reverting is deleted (see revertEditedPlaylist)
-
instance deletion
-

-

-

-
-
-

Contract for Scheduler : revertEditedPlaylist
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
revertEditedPlaylist
-(playlist : Playlist)
-: void
-
Responsibilities
-
Changes are discarded -for a Playlist that is being edited.
-
Type
-
system
-
Cross-reference
-
F1.13, UC-7
-
Notes
-
The contents of the -playlist are reverted to the state prior to when editing began on it.
-
Exceptions
-
none
-
Output
-
none
-
Pre-conditions
-
the Playlist is -currently opened for editing
-
Post-conditions
-
condition
-
type
-

-
The contents of the Playlist are reverted to the -last saved version. This includes deleting all created PlaylistElement -and FadeInfo instances.
-
attribute modification, instance deletion
-

-
The lockedForEditing attriubute is set to false -for the playlist
-
attribute modification
-

-

-

-
-
-

Contract for Scheduler : start
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
start
-()
-: void
-
Responsibilities
-
Starts the scheduler -daemon
-
Type
-
system
-
Cross-reference
-
F1.14, UC-8
-
Notes
-
A System V init-style -daemon starting entry point
-
Exceptions
-
none
-
Output
-
none
-
Pre-conditions
-
The scheduler daemon is -currently not running
-
Post-conditions
-
condition
-
type
-

-
The scheduler daemon object is created
-
instance creation
-

-
All the necessary structures are created for the -deamon to run
-
instance creation
-

-

-

-
-
-

Contract for Scheduler : isRunning
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
isRunning
-()
-: boolean
-
Responsibilities
-
Tells if the scheduler -daemon is running
-
Type
-
system
-
Cross-reference
-
UC-8
-
Notes
-
A System V init-style -daemon status entry point
-
Exceptions
-
none
-
Output
-
true of the daemon is -running, false otherwise
-
Pre-conditions
-
none
-
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Scheduler : stop
-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
stop
-()
-: void
-
Responsibilities
-
Stops the scheduler -daemon
-
Type
-
system
-
Cross-reference
-
F1.15, UC-8
-
Notes
-
A System V init-style -daemon stopping entry point
-
Exceptions
-
none
-
Output
-
none
-
Pre-conditions
-
The scheduler daemon is -currently running
-
Post-conditions
-
condition
-
type
-

-
The scheduler daemon object is deleted
-
instance deletion
-

-

-

-
-
-

Contract for Media archive : authenticate

-TODO: move to Media archive spec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
authenticate
-(authenticationInfo : AuthenticationInfo)
-: boolean
-
Responsibilities
-
Check if the provided -authentication info is recognized.
-
Type
-
interface
-
Cross-reference
-
UC-4
-
Notes
-

-
Exceptions
-
none
Output
-
true if the provided -authentication is recognized, false otherwise
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Media archive : retrieveAudioClip

-TODO: move to Media archive spec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
retrieveAudioClip
-(clipId : UniqueId)
-: AudioClip
-
Responsibilities
-
Retrieve an AudioClip -specified by the supplied audio clip id.
-
Type
-
interface
-
Cross-reference
-
F1.2, UC-4
-
Notes
-

-
Exceptions
-
if no audio clip exists -with the supplied id, indicate as an error
-
Output
-
the requested audio clip
-
Pre-conditions
-
none
Post-conditions
-
condition
-
type
-

-
A new Audio clip is created and filled with the -contents of the retrieved audio clip
-
instance creation

-
Audio clip is entered into Local storage
-
association formed
-

-

-

-
-
-

Contract for Local storage : authenticate

-TODO: move to Local storage spec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
authenticate
-(authenticationInfo : AuthenticationInfo)
-: boolean
-
Responsibilities
-
Check if the provided -authentication info is recognized.
-
Type
-
interface
-
Cross-reference
-
UC-4
-
Notes
-

-
Exceptions
-
none
Output
-
true if the provided -authentication is recognized, false otherwise
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Local storage : existsAudioClip

-TODO: move to Local storage spec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
existsAudioClip
-(audioClipId : UniqueId)
-: boolean
-
Responsibilities
-
Tell if an audio clip by -the provided unique id is stored in the Local storage
-
Type
-
interface
-
Cross-reference
-
UC-4
-
Notes
-

-
Exceptions
-
none
Output
-
true if an audio clip -with the provided id exists, false otherwise
-
Pre-conditions
-
none
Post-conditions
-
none
-

-

-

-

-
-
-

Contract for Local storage : storeAudioClip

-TODO: move to Local storage spec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name
-
storeAudioClip
-(audioClip : AudioClip)
-: void
-
Responsibilities
-
Store an audio clip.
-
Type
-
interface
-
Cross-reference
-
UC-4
-
Notes
-

-
Exceptions
-
none
Output
-
none
-
Pre-conditions
-
none
Post-conditions
-
The supplied audio clip is stored in the storage.
-

-

-

-

-
-
-

Glossary

-playlist
-The playlist is a metafile, containing references to audio clips that -should be played, and details on how they should be played.
-
- - + + + + + LiveSupport Scheduler specifications + + + + + + +

Preface

+

This document is part of the LiveSupport +project, Copyright Š 2004 Media +Development Loan Fund, under the GNU GPL.

+ +

Scope

+

This document contains the specification of the LiveSupport +Scheduler daemon.

This document contains embedded SVG +figures, thus an SVG capable browser is needed to view it, or an SVG +plugin like Adobe's SVG Viewer.

+

Requirements

+

Overview

+

The purpose of the LiveSupport Scheduler daemon is to execute +playlists.

+

Goals

+

The scheduler daemon is a remotely accessible service accepting +playlists on a local audio interface. Specific goals include:

+ +

System functions

+

The main system functions are described +below. There are three categories for these functions:

+ + + + + + + + + + + + + + + + + +
+

function category

+
+

meaning

+
+

evident

+
+

Should perform, and the user should be cognizant that it is + performed

+
+

hidden

+
+

Should perform, but not visible to the users.

+
+

frill

+
+

Optional

+
+



+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref#

+
+

function

+
+

category

+
+

F1.1

+
+

Accept uploaded playlists

+
+

evident

+
+

F1.2

+
+

Retrieve remote files referenced by playlists

+
+

hidden

+
+

F1.3

+
+

Access local files

+
+

hidden

+
+

F1.4

+
+

Provide status information

+
+

evident

+
+

F1.5

+
+

Log playlist execution for proof of broadcast reasons

+
+

evident

+
+

F1.6

+
+

Purge local file storage of unused audio clips

+
+

hidden

+
+

F1.7

+
+

Execute playlists

+
+

evident

+
+

F1.8

+
+

Play live streams as part of the playlist

+
+

hidden

+
+

F1.9

+
+

Remove playists from the schedule

+
+

evident

+
+

F1.10

+
+

Re-schedule playlsits

+
+

evident

+
+

F1.11

+
+

Delete playlists

+
+

evident

+
+

F1.12

+
+

Create playlists

+
+

evident

+
+

F1.13

+
+

Edit playlists

+
+

evident

+
+

F1.14

+
+

Start the scheduler daemon

+
+

evident

+
+

F1.15

+
+

Stop the scheduler daemon

+
+

evident

+
+


+

+
+


+

+
+


+

+
+



+

+

System attributes

+

Generic attributes

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref#

+
+

attribute

+
+

details and constraints

+
+

category

+
+

A1.1

+
+

operating system platform

+
+

Linux

+
+

must

+
+

A1.2

+
+

supported audio interfaces

+
+

ALSA (maybe also OSS?)

+
+

must

+
+

A1.3

+
+

supported playlist format

+
+

SMIL 2.0. only partial support is required, which focuses only + on audio aspects of SMIL.

+
+

must

+
+

A1.4

+
+

supported audio clip formats

+
+

Ogg Vorbis, mp3, wav

+
+

must

+
+


+

+
+


+

+
+


+

+
+


+

+
+


Attributes related to system functions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref#

+
+

function

+
+

ref#

+
+

attribute

+
+

details and constraints

+
+

category

+
+

F1.7

+
+

Execute playlists

+
+

A1.5

+
+

low latency

+
+

when executing playlists, very low latency should be achieved

+
+

must

+
+


+

+
+


+

+
+

A1.6

+
+

handle time skew

+
+

the daemon has to take into account that the system's clock is + not accurate. the clock is synchronized to an external regularly, + but the resulting time-jump must be handled.

+
+

must

+
+

F1.8

+
+

Play live streams as part of the playlist +

+
+

A1.7

+
+

supported audio stream formats

+
+

Ogg Vorbis via HTTP, mp3 via HTTP

+
+

must

+
+

F1.14
F1.15

+
+

Start / stop the scheduler daemon

+
+

A1.8

+
+

provide System V init style services

+
+

Provide a System V init interface to starting and stopping the + scheduler daemon

+
+

must

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Essential use cases

+

This section lists generic (essential) uses cases, that do not +contain architecture-specific considerations.

+

UC-1 Upload playlist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref# +

+
+

UC-1 +

+
+

use case +

+
+

Upload playlist +

+
+

type +

+
+

primary, essential +

+
+

actors +

+
+

Playlist editor +

+
+

purpose +

+
+

Upload a playlist +

+
+

overview +

+
+

The Playlist editor uploads a new playlist. +

+
+

references +

+
+

F1.1 +

+
+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

Playlist editor connects to the scheduler daemon with the + intent of uploading a new playlist. +

+
+


+

+
+


+

+
+

2. +

+
+

The Playlist editor provides authentication information +

+
+

3. +

+
+

The system authenticates the Playlist editor and grants access. +

+
+

4. +

+
+

The Playlist editor presents the new playlist and the intended + schedule for the playlist.

+
+

5. +

+
+

The system validates the new playlist, and sees that it does + not conflict with existing schedule. +

+
+


+

+
+


+

+
+

6. +

+
+

The system stores the new playlist, adds it to the schedule, + and sends confirmation to the Playlist editor. +

+
+

7. +

+
+

The Playlist editor receives confirmation and disconnects. +

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Alternate courses

+ +

UC-2 Manage schedule

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref#

+
+

UC-2 +

+
+

use case +

+
+

Manage schedule +

+
+

type

+
+

primary, essential +

+
+

actors

+
+

Playlist editor +

+
+

purpose

+
+

View the schedule and remove or re-schedule playlists

+
+

overview

+
+

The Playlist editor reviews the schedule. If he decides to, he + might remove or re-schedule some of these playlists. +

+
+

references

+
+

F1.4, F1.9, F1.10

+
+



+

+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

Playlist editor connects to the scheduler daemon with the + intent of viewing and editing the schedule.

+
+


+

+
+


+

+
+

2. +

+
+

The Playlist editor provides authentication information +

+
+

3. +

+
+

The system authenticates the Playlist editor and grants access. +

+
+


+

+
+


+

+
+

4.

+
+

The system shows the Schedule to the Playlist editor

+
+

5.

+
+

The Playlist editor browses the Schedule, selects a playlist + for detailed viewing.

+
+

6.

+
+

The system shows the details of the selected Playlist.

+
+

7.

+
+

The playlist editor removes a playlist from the schedule.

+
+

8.

+
+

The system removes the playlist from the schedule, than + re-displays the updated schedle.

+
+

9.

+
+

The Playlist editor re-schedules a playlist

+
+

10.

+
+

The system removes the selected playlist from the schedule, and + re-enters it at a new timepoint

+
+

11.

+
+

The Playlist editor browses the Schedule

+
+

12.

+
+

The system shows the Schedule to the playlist editor

+
+

13.

+
+

The Playlist editor disconnects.

+
+


+

+
+


+

+
+



+

+

Alternate courses

+ +

UC-3 Manage playlists

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref#

+
+

UC-3 +

+
+

use case +

+
+

Manage playlists +

+
+

type

+
+

primary, essential +

+
+

actors

+
+

Playlist editor +

+
+

purpose

+
+

View and delete playlists +

+
+

overview

+
+

The Playlist editor reviews the uploaded playlists. If he + decides so, he might delete some of these playlists. +

+
+

references

+
+

F1.4, F1.11

+
+



+

+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

Playlist editor connects to the scheduler daemon with the + intent of viewing and deleting playlists.

+
+


+

+
+


+

+
+

2. +

+
+

The Playlist editor provides authentication information +

+
+

3. +

+
+

The system authenticates the Playlist editor and grants access. +

+
+


+

+
+


+

+
+

4.

+
+

The system lists the available Playlists

+
+

5.

+
+

The Playlist editor browses the playlists, and selects one for + detailed viewing.

+
+

6.

+
+

The system shows the details of the selected Playlist.

+
+

7.

+
+

The playlist editor deletes a playlist.

+
+

8.

+
+

The system deletes the playlist, than re-displays the list of + available Playlists.

+
+

9.

+
+

The Playlist editor disconnects.

+
+


+

+
+


+

+
+



+

+

Alternate courses

+ +

UC-4 Retrieve remote files

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref# +

+
+

UC-4 +

+
+

use case +

+
+

Retrieve remote files +

+
+

type

+
+

primary, essential +

+
+

actors

+
+

(internal actor, initiator), Media archive, Local storage

+
+

purpose

+
+

Retrieve remote files referenced by active playlists and store + them in the local storage

+
+

overview

+
+

The daemon contacts the remote media archive and retrieves + audio clips referenced by active playlists. The clips are stored + locally for playing. +

+
+

references

+
+

F1.2 +

+
+


Note that this use case is somewhat reversed, as it is +initiated by the system (not an actor), and the main tasks are done +by an external actor (the Media archive).

+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

An Internal actor triggers the retrieval of some remote files. +

+
+

2. +

+
+

The system looks up the URN of the remote file, and determines + the Media archive to contact regarding the file. +

+
+


+

+
+


+

+
+

3.

+
+

The system contacts the Local storage and sends authorization + information

+
+

4.

+
+

Local storage authenticates the system and grants access

+
+

5.

+
+

The system iniquires the local storage about the availability + of the file to download in the Local storage by presenting its + unique ID

+
+

6.

+
+

Local storage tells if the required file is already stored or + not.

+
+

7.

+
+

If the file is available in the local storage, the use case + ends. Otherwise, it continues.

+
+


+

+
+


+

+
+

8.

+
+

The system contacts the Media archive and sends authorization + information +

+
+

9. +

+
+

Media archive authenticates the system and grants access +

+
+

10. +

+
+

The system requests an audio clip by presenting its unique ID +

+
+

11. +

+
+

Media archive looks up the file, and presents it to the system +

+
+

12. +

+
+

The system retrieves the file and closes the connection to the + Media archive

+
+


+

+
+


+

+
+

13.

+
+

The system presents the file to Local storage

+
+

14.

+
+

Local storage stores the file under the specified unique ID

+
+

15.

+
+

The system closes the connection to Local storage.

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Alternate courses

+ +

UC-5 Review play log

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref# +

+
+

UC-5 +

+
+

use case +

+
+

Review play log +

+
+

type +

+
+

secondary, essential +

+
+

actors +

+
+

Broadcast auditor +

+
+

purpose +

+
+

Review what has been played +

+
+

overview +

+
+

The Broadcast auditor reviews the audio clips that have been + played in a selected time interval. He may generate reports for + proof of broadcast reasons. +

+
+

references +

+
+

F1.4 +

+
+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

Broadcast auditor connects to the scheduler daemon with the + intent of reviewing what has been played.

+
+


+

+
+


+

+
+

2. +

+
+

The Broadcast auditor provides authentication information +

+
+

3. +

+
+

The system authenticates the Broadcast auditor and grants + access. +

+
+

3.

+
+

The Broadcast auditor browses through the play log in a + time-ordered manner.

+
+

4.

+
+

The system displays the play log entries.

+
+

5.

+
+

The Broadcast auditor requests a play report for a given time + period.

+
+

6.

+
+

The system displays the requested report.

+
+

7.

+
+

The Broadcast auditor disconnects.

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Alternate courses

+ +



+

+

UC-6 Create playlist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref# +

+
+

UC-6 +

+
+

use case +

+
+

Create playlist

+
+

type +

+
+

secondary, essential +

+
+

actors +

+
+

Playlist editor

+
+

purpose +

+
+

Create a new playlist, and then edit it.

+
+

overview +

+
+

The Playlist editor connects to the Scheduler with the aim of + creating a new playlist. A basic user interface is provided, which + allows professionals to create and edit the playlsits on the + system.

+
+

references +

+
+

F1.12, F1.13

+
+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

Playlist editor connects to the scheduler with the intent of + creating a new playlist.

+
+


+

+
+


+

+
+

2. +

+
+

The Playlist editor provides authentication information +

+
+

3. +

+
+

The system authenticates the Playlist editor and grants access. +

+
+

4.

+
+

The Playlist editor signals that he whishes for a new playlist

+
+

5.

+
+

The system creates a new, empty playlist, and opens it for + editing.

+
+

6.

+
+

The Playlist editor edits the new playlist. See UC-7 actions + 7-15 for details.

+
+


+

+
+


+

+
+

7.

+
+

The Playlist editor disconnects.

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Alternate courses

+ +



+

+

UC-7 Edit playlist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref# +

+
+

UC-7 +

+
+

use case +

+
+

Edit playlist

+
+

type +

+
+

secondary, essential +

+
+

actors +

+
+

Playlist editor

+
+

purpose +

+
+

Edit a previoulsy uploaded playlist

+
+

overview +

+
+

The Playlist editor connects to the Scheduler with the aim of + either editing an existing playlist. A basic user interface is + provided, which allows professionals to edit the playlsits on the + system.

+
+

references +

+
+

F1.12 +

+
+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

Playlist editor connects to the scheduler with the intent of + editing a playlist.

+
+


+

+
+


+

+
+

2. +

+
+

The Playlist editor provides authentication information +

+
+

3. +

+
+

The system authenticates the Playlist editor and grants access. +

+
+


+

+
+


+

+
+

4.

+
+

The system lists the available playlists.

+
+

5.

+
+

The Playlist editor selects a playlist for editing.

+
+

6.

+
+

The system opens the playlist in editing mode.

+
+

7.

+
+

The Playlist editor browses the available Audio clips

+
+

8.

+
+

The system shows the list of available audio clips

+
+

9.

+
+

The Playlist editor selects an Audio clip

+
+

10.

+
+

The system displays details on the audio clip.

+
+

11.

+
+

The Playlist editor ads a new audio clip to the playlist, at a + certain timepoint in the playlist.

+
+

12.

+
+

The new audio clip is added to the playlist.

+
+

13.

+
+

The Playlist editor removes an audio clip from the playlist.

+
+

14.

+
+

The audio clip is removed from the playlist.

+
+

15.

+
+

The Playlist editor edits the fade-in or fade-out of a clip in + the playlist.

+
+

16.

+
+

The fade-in or fade-out is edited.

+
+

17.

+
+

The Playlist editor saves the playlist.

+
+

18.

+
+

The playlist is validated.

+
+


+

+
+


+

+
+

19.

+
+

The playlist is saved.

+
+

20.

+
+

The Playlist editor disconnects.

+
+


+

+
+


+

+
+



+

+

Alternate courses

+ +



+

+

UC-8 Start/stop scheduler

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

ref# +

+
+

UC-8 +

+
+

use case +

+
+

Start/stop scheduler

+
+

type +

+
+

primary, essential +

+
+

actors +

+
+

Administrator

+
+

purpose +

+
+

Start and stop the scheduler daemon

+
+

overview +

+
+

The adminisitrator starts the scheduler deamon by invoking a + System V init-style startup script. He may also stop the deamon + with the same script.

+
+

references +

+
+

F1.14, F1.15, A1.8

+
+

Typical course of events

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

actor action +

+
+

system response +

+
+

1. +

+
+

The Administrator invokes the scheduler's System V init script + with the start parameter

+
+


+

+
+


+

+
+


+

+
+


+

+
+

2. +

+
+

The scheduler daemon starts up.

+
+

3.

+
+

The Administrator checks to see if the scheduler daemon is + running

+
+

4.

+
+

The scheduler daemon reports that it is running.

+
+

5.

+
+

The Administrator stops the scheduler deamon.

+
+

6.

+
+

The scheduler daemon stops.

+
+



+

+

Alternate courses

+ +

Conceptual model

+

The following figure displays the semantic concepts identified for +the Scheduler daemon, and the main associations between the +concepts.


+

+

Concepts

+


+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

concept

+
+

description

+
+

Media archive

+
+

An archive external to the system, which holds Audio clips. The + archive offers its clips for download by requesting clips based on + their unique ids.

+
+

Clip retriever

+
+

Retrieves Audio clips from the Media archive and stores them in + local storage.

+
+

Local storage

+
+

A local store of Audio clips. Provides access to each clip + based on the clips' unique id. Allows random access to the clip + files.

+
+

Audio clip

+
+

A uniquely identified audio file.

+
+

Playlist

+
+

A metafile, containing references to Audio clips, and + information on how the clips should be played.

+
+

PlaylistElement

+
+

An association class describing the specifics of an instance of + an Audio clip in a playlist.

+
+

FadeInfo

+
+

A class describing fade in or fade out characteristics for an + Audio clip in a Playlist

+
+

Playlist store

+
+

A container holding a range of playlists.

+
+

Schedule

+
+

Contains Schedule entries

+
+

Schedule entry

+
+

Contains the time and details of when a playlist should be + played.

+
+

Scheduler daemon

+
+

Executes playlists at timepoints specified by the schedule.

+
+

Play log

+
+

A logging facility, holding Play log entries.

+
+

Play log entry

+
+

A record of when an Audio clip was played.

+
+

Play report

+
+

An audit report of what Audio clips have been played in a + certain time period

+
+

Authentication

+
+

Provides authentication services

+
+

Playlist editor

+
+

An external editor, managing playlists.

+
+

Broadcast auditor

+
+

An external auditor, browsing the Play log.

+
+

Administrator

+
+

The administrator responsible for starting and stopping the + scheduler daemon.

+
+


+

+
+


+

+
+



+

+

Associations

+


+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

source

+
+

association

+
+

target

+
+

description

+
+

Clip retriever

+
+

Retrieves clips from

+
+

Media archive

+
+


+

+
+

Media archive

+
+

Contains

+
+

Audio clip

+
+


+

+
+

Clip retriever

+
+

Stores clips in

+
+

Local storage

+
+


+

+
+

Local storage

+
+

Contains

+
+

Audio clip

+
+


+

+
+

Playlist

+
+

References by PlaylistElement

+
+

Audio clip

+
+


+

+
+

PlaylistElement

+
+

Fades in with

+
+

FadeInfo

+
+


+

+
+

PlaylistElement

+
+

Fades out with

+
+

FadeInfo

+
+


+

+
+

Playlist store

+
+

Contains

+
+

Play list

+
+


+

+
+

Playlist editor

+
+

Uploads playlist to

+
+

Playlist store

+
+


+

+
+

Playlist editor

+
+

Manages schedule in

+
+

Schedule

+
+

The Playlist editor schedules playlists.

+
+

Schedule

+
+

Contains

+
+

Schedule entry

+
+


+

+
+

Schedule entry

+
+

References

+
+

Playlist

+
+


+

+
+

Scheduler daemon

+
+

Executes

+
+

Schedule

+
+

The Scheduler daemon plays the scheduled playlists.

+
+

Scheduler daemon

+
+

Logs into

+
+

Play log

+
+

The Scheduler daemon logs all the played audio clips into the + Play log for proof of broadcast purposes.

+
+

Play log

+
+

Contains

+
+

Play log entry

+
+


+

+
+

Play log

+
+

Generated

+
+

Play report

+
+

The play log generates reports based on Play log entries.

+
+

Play log entry

+
+

References

+
+

Audio clip

+
+


+

+
+

Broadcast auditor

+
+

Browses entries from

+
+

Play log

+
+


+

+
+

Broadcast auditor

+
+

Requests

+
+

Play report

+
+


+

+
+

Playlist editor

+
+

Is authenticated by

+
+

Authentication

+
+


+

+
+

Broadcast auditor

+
+

Is authenticated by

+
+

Authentication

+
+


+

+
+

Administrator

+
+

Manages

+
+

Scheduler daemon

+
+


+

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

System behavior

+

The behavior of the system as a whole as experienced from the +outside is discussed in this section.

+

System sequence diagrams

+

System diagrams are presented for each use case below.

+

UC-1 Upload playlists

+



+

+

UC-2 Manage schedule

+



+

+

UC-3 Manage playlists

+



+

+

UC-4 Retrieve remote files

+



+

+

UC-5 Review play log

+

UC-6 Create playlist

+

UC-7 Edit playlist

+

UC-8 Start/stop scheduler

+



+

+

System objects

+

The following figures shows the system objects and their +functions, as derived from the system sequence diagrams.

+

Contracts

+

For all operations exposed in the system sequence diagrams, the +following contracts are defined.

+

Contract for Scheduler : authenticate

+

See Authentication : authenticate

+

Contract for Scheduler : uploadPlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

uploadPlaylist
(playlist : Playlist,
playtime: + Schedule)
: UniqueId

+
+

Responsibilities

+
+

Upload a playlist and put it into the schedule.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.1, UC-1

+
+

Notes

+
+


+

+
+

Exceptions

+
+

If the uploaded playlist is not valid, indicate as an error
If + the proposed schedule conflicts with existing schedules, indicate + as an error

+
+

Output

+
+

the unique id of the ScheduleEntry created with this upload

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

A new Playlist is created, storing the uploaded playlist

+
+

instance creation +

+
+


+

+
+

Playlist is entered into the Playlist store

+
+

association formed

+
+


+

+
+

A new Schedule is created, according to the supplied schedule

+
+

instance creation

+
+


+

+
+

Schedule is associated with the Playlist

+
+

association formed

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : displaySchedule

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

displaySchedule
(from : TimeStamp,
to : TimeStamp)
: + Schedule

+
+

Responsibilities

+
+

Display Schedule entries for a time period.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.4, UC-2

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

The Schedule entries for the specified time period.

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : displayPlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

displayPlaylist
(playlistId : UniqueId)
: Playlist

+
+

Responsibilities

+
+

Display a specific playlist

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.4, UC-3

+
+

Notes

+
+


+

+
+

Exceptions

+
+

If no playlist exists for the specified playlistId, indicate as + an error.

+
+

Output

+
+

The requested playlist.

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : deletePlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

deletePlaylist
(playlist : Playlist)
: void

+
+

Responsibilities

+
+

Delete a specific playlist

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.11, UC-3

+
+

Notes

+
+


+

+
+

Exceptions

+
+

If no playlist exists for the specified playlistId, indicate as + an error.
If the playlist is referenced by any Schedule entry, + indicate as an error.

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The playlist is removed from the Playlist store.

+
+

association broken

+
+


+

+
+

References by the playlist to Audio clips removed

+
+

association broken

+
+


+

+
+

The playlist is deleted

+
+

instance deletion

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : removeFromSchedule

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

removeFromSchedule
(scheduleEntryId : UniqueId)
: bool

+
+

Responsibilities

+
+

Remove a specific playlist from a schedule entry

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.9, UC-2

+
+

Notes

+
+


+

+
+

Exceptions

+
+

If no ScheduleEntry by the specified scheduleEntryId exist, + indicate as an error.

+
+

Output

+
+

true if the specified entry was removed, false if it did not + exist.

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

Reference to the playlist by the scheduleEntry is removed.

+
+

association broken

+
+


+

+
+

The ScheduleEntry specified by the scheduleEntryId is deleted

+
+

instance deletion

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : reschedule

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

reschedule
(scheduleEntryId : UniqueId,
playtime : + TimeStamp)
: bool

+
+

Responsibilities

+
+

Change when a certain playlist is scheduled to play.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.10, UC-2

+
+

Notes

+
+


+

+
+

Exceptions

+
+

If no ScheduleEntry by the specified scheduleEntryId exist, + indicate as an error.
If the new playtime conflicts with other + schedule entries, indicate as an error.

+
+

Output

+
+

false on errors

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The time attribute of scheduleEntry is updated to the supplied + playtime.

+
+

attribute modification

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : displayPlaylists

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

displayPlaylists
()
: Playlist

+
+

Responsibilities

+
+

Display Playlists contained in the Playlist store

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.4, UC-3

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

The playlists contained in the Playlist store.

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : displayPlayLog

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

displayPlayLog
()
: Play log

+
+

Responsibilities

+
+

Display Play log entries contained in the Play log

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.4, UC-5

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

The play log entries contained in the Play log.

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : generatePlayReport

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

generatePlayReport
(from : TimeStamp,
to : TimeStamp)
: + Play report

+
+

Responsibilities

+
+

Present a report on what Audio clips have been played to the + Broadcast auditor.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.4, UC-5

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

A report on the played Audio clips played in the specified time + period.

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : createPlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

createPlaylist
()
: Playlist

+
+

Responsibilities

+
+

Create a new playlist

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.12, UC-6

+
+

Notes

+
+

A new playlist is created, and is immediately locked for + editing.

+
+

Exceptions

+
+

none

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

A new Playlist is created

+
+

instance creation

+
+


+

+
+

The lockedForEditing attribute is set to true for the playlist

+
+

attribute modification

+
+


+

+
+

The playlist is added to the Playlist store

+
+

association formed

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : openPlaylistForEditing

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

openPlaylistForEditing
(playlist : Playlist)
: void

+
+

Responsibilities

+
+

Open a playlist for editing

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

A playlist is opened for editing. The playlist may not be + played when being edited. Also, active (currently executing) + playlists may not be opened for editing. This is in effect a lock, + which is released by saving the playlist.

+
+

Exceptions

+
+

if the playlist is currently being executed, indicate as an + error.

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The current version of the playlist is stored, in case the user + wants to revert to the last saved version (see + revertEditedPlaylist)

+
+

instance creation

+
+


+

+
+

The lockedForEditing attribute is set to true for the playlist

+
+

attribute modification

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : addAudioClipToPlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

addAutioClipToPlaylist
(playlist : Playlist,
audioClip : + AudioClip,
relativeOffset : Time)
: void

+
+

Responsibilities

+
+

Add an Audio clip to a Playlist

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

The Audio clip is added to the playlist with the specified + relativeOffset from the beginning of the Playlist.

+
+

Exceptions

+
+

none

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

the Playlist is currently opened for editing

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The new PlaylistElement is created associating the playlist + with the audio clip, with the specified relativeOffset

+
+

association formed, instnace creation

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : displayAudioClips

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

displayAudioClips
()
: AudioClip

+
+

Responsibilities

+
+

Display the audio clips known to the Scheduler

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

none

+
+

Exceptions

+
+

none

+
+

Output

+
+

The Audio clips kown to the Scheduler

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : displayAudioClip

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

displayAudioClip
(audioClipId : UniqueId)
: AudioClip

+
+

Responsibilities

+
+

Display the audio clip specified by the audioClipId

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

none

+
+

Exceptions

+
+

if no audio clip by the specified id exists, indicate as an + error

+
+

Output

+
+

The Audio clip specified by the audioClipId

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : removeAudioClipFromPlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

removeAutioClipFromPlaylist
(playlist : + Playlist,
relativeOffset: Time)
: void

+
+

Responsibilities

+
+

Remove an Audio clip at the given relative offset from a + Playlist

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

The Audio clip is removed from the Playlist.

+
+

Exceptions

+
+

If there is no Audio clip at the specified relative offset in + the playlist, indicate as an error.

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

the Playlist is currently opened for editing

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The PlaylistElement associating the AudioClip with the Playlist + is removed, with the related FadeInfo instances

+
+

instance deletion, association broken

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : updateFadeInFadeOut

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

updateFadeInFadeOut
(audioClip : AudioClip,
playlist : + Playlist)
: void

+
+

Responsibilities

+
+

Update the fade-in and fade-out parameters for an audio clip + playing in a playlist.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

none

+
+

Exceptions

+
+

If the Audio clip is not in the playlist, indicate as an error.

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

the Playlist is currently opened for editing

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The fade-in and fade-out parameters for the audio clip in the + playlist are updated

+
+

attribute modification

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : validatePlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

validatePlaylist
(playlist : Playlist)
: boolean

+
+

Responsibilities

+
+

Validate a playlist for being complete.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

The playlist is checked for being complete (not containing + silence) and other sanity criteria.

+
+

Exceptions

+
+

none

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : savePlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

savePlaylist
(playlist : Playlist)
: void

+
+

Responsibilities

+
+

The playlist is saved.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

none

+
+

Exceptions

+
+

If the playlist is not valid, indicate as an error.

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

the Playlist is currently opened for editing

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The lockedForEditing attriubute is set to false for the + playlist

+
+

attribute modification

+
+


+

+
+

The old version of the Playlist that could have been used for + reverting is deleted (see revertEditedPlaylist)

+
+

instance deletion

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : revertEditedPlaylist

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

revertEditedPlaylist
(playlist : Playlist)
: void

+
+

Responsibilities

+
+

Changes are discarded for a Playlist that is being edited.

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.13, UC-7

+
+

Notes

+
+

The contents of the playlist are reverted to the state prior to + when editing began on it.

+
+

Exceptions

+
+

none

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

the Playlist is currently opened for editing

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The contents of the Playlist are reverted to the last saved + version. This includes deleting all created PlaylistElement and + FadeInfo instances.

+
+

attribute modification, instance deletion

+
+


+

+
+

The lockedForEditing attriubute is set to false for the + playlist

+
+

attribute modification

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : start

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

start
()
: void

+
+

Responsibilities

+
+

Starts the scheduler daemon

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.14, UC-8

+
+

Notes

+
+

A System V init-style daemon starting entry point

+
+

Exceptions

+
+

none

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

The scheduler daemon is currently not running

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The scheduler daemon object is created

+
+

instance creation

+
+


+

+
+

All the necessary structures are created for the deamon to run

+
+

instance creation

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : isRunning

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

isRunning
()
: boolean

+
+

Responsibilities

+
+

Tells if the scheduler daemon is running

+
+

Type

+
+

system

+
+

Cross-reference

+
+

UC-8

+
+

Notes

+
+

A System V init-style daemon status entry point

+
+

Exceptions

+
+

none

+
+

Output

+
+

true of the daemon is running, false otherwise

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Scheduler : stop

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

stop
()
: void

+
+

Responsibilities

+
+

Stops the scheduler daemon

+
+

Type

+
+

system

+
+

Cross-reference

+
+

F1.15, UC-8

+
+

Notes

+
+

A System V init-style daemon stopping entry point

+
+

Exceptions

+
+

none

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

The scheduler daemon is currently running

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

The scheduler daemon object is deleted

+
+

instance deletion

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Media archive : authenticate

+

TODO: move to Media archive spec

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

authenticate
(authenticationInfo : AuthenticationInfo)
: + boolean

+
+

Responsibilities

+
+

Check if the provided authentication info is recognized.

+
+

Type

+
+

interface

+
+

Cross-reference

+
+

UC-4

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

true if the provided authentication is recognized, false + otherwise

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Media archive : retrieveAudioClip

+

TODO: move to Media archive spec

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

retrieveAudioClip
(clipId : UniqueId)
: AudioClip

+
+

Responsibilities

+
+

Retrieve an AudioClip specified by the supplied audio clip id.

+
+

Type

+
+

interface

+
+

Cross-reference

+
+

F1.2, UC-4

+
+

Notes

+
+


+

+
+

Exceptions

+
+

if no audio clip exists with the supplied id, indicate as an + error

+
+

Output

+
+

the requested audio clip

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

condition

+
+

type

+
+


+

+
+

A new Audio clip is created and filled with the contents of the + retrieved audio clip

+
+

instance creation +

+
+


+

+
+

Audio clip is entered into Local storage

+
+

association formed

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Local storage : authenticate

+

TODO: move to Local storage spec

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

authenticate
(authenticationInfo : AuthenticationInfo)
: + boolean

+
+

Responsibilities

+
+

Check if the provided authentication info is recognized.

+
+

Type

+
+

interface

+
+

Cross-reference

+
+

UC-4

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

true if the provided authentication is recognized, false + otherwise

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Local storage : existsAudioClip

+

TODO: move to Local storage spec

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

existsAudioClip
(audioClipId : UniqueId)
: boolean

+
+

Responsibilities

+
+

Tell if an audio clip by the provided unique id is stored in + the Local storage

+
+

Type

+
+

interface

+
+

Cross-reference

+
+

UC-4

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

true if an audio clip with the provided id exists, false + otherwise

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

none

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Contract for Local storage : storeAudioClip

+

TODO: move to Local storage spec

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Name

+
+

storeAudioClip
(audioClip : AudioClip)
: void

+
+

Responsibilities

+
+

Store an audio clip.

+
+

Type

+
+

interface

+
+

Cross-reference

+
+

UC-4

+
+

Notes

+
+


+

+
+

Exceptions

+
+

none

+
+

Output

+
+

none

+
+

Pre-conditions

+
+

none

+
+

Post-conditions

+
+

The supplied audio clip is stored in the storage.

+
+


+

+
+


+

+
+


+

+
+


+

+
+



+

+

Glossary

+

playlist
The playlist is a metafile, containing +references to audio clips that should be played, and details on how +they should be played.

+ + \ No newline at end of file diff --git a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h index 4359fb7b1..99544b3e6 100644 --- a/livesupport/modules/core/include/LiveSupport/Core/Playlist.h +++ b/livesupport/modules/core/include/LiveSupport/Core/Playlist.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/Playlist.h,v $ ------------------------------------------------------------------------------*/ @@ -71,7 +71,7 @@ using namespace boost::posix_time; * the playlist. * * @author $Author: fgerlits $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class Playlist : public Configurable { @@ -166,7 +166,7 @@ class Playlist : public Configurable * @return the name of the expected XML configuration element. */ static const std::string - getConfigElementName(void) throw () + getConfigElementName(void) throw () { return configElementNameStr; } @@ -182,7 +182,7 @@ class Playlist : public Configurable */ virtual void configure(const xmlpp::Element & element) - throw (std::invalid_argument); + throw (std::invalid_argument); /** * Return the id of the playlist. @@ -190,7 +190,7 @@ class Playlist : public Configurable * @return the unique id of the playlist. */ Ptr::Ref - getId(void) const throw () + getId(void) const throw () { return id; } @@ -201,7 +201,7 @@ class Playlist : public Configurable * @return the playling length of this playlist, in milliseconds. */ Ptr::Ref - getPlaylength(void) const throw () + getPlaylength(void) const throw () { return playlength; } @@ -209,12 +209,14 @@ class Playlist : public Configurable /** * Test whether the playlist is locked for editing. * - * @return true if playlist is locked, false if not + * @return true if playlist is currently being edited; + * false if not, or if the editing has been suspended + * because the playlist is being played */ bool - getIsLockedForEditing() throw () + getIsLockedForEditing() const throw () { - return isLockedForEditing; + return isLockedForEditing && !isLockedForPlaying; } /** @@ -223,7 +225,7 @@ class Playlist : public Configurable * @return true if playlist is locked, false if not */ bool - getIsLockedForPlaying() throw () + getIsLockedForPlaying() const throw () { return isLockedForPlaying; } @@ -235,7 +237,7 @@ class Playlist : public Configurable * false otherwise. */ bool - setLockedForEditing(bool lockStatus) + setLockedForEditing(const bool lockStatus) throw (); /** @@ -245,7 +247,7 @@ class Playlist : public Configurable * false otherwise. */ bool - setLockedForPlaying(bool lockStatus) + setLockedForPlaying(const bool lockStatus) throw (); /** @@ -256,7 +258,6 @@ class Playlist : public Configurable /** * Get an iterator pointing to the first playlist element. - * */ const_iterator begin() const throw () @@ -266,7 +267,6 @@ class Playlist : public Configurable /** * Get an iterator pointing to one after the last playlist element. - * */ const_iterator end() const throw () @@ -287,6 +287,27 @@ class Playlist : public Configurable addAudioClip(Ptr::Ref audioClip, Ptr::Ref relativeOffset) throw (std::invalid_argument); + + /** + * Remove an audio clip from the playlist. + * + * @param relativeOffset the start of the audio clip, relative + * to the start of the playlist + * @exception std::invalid_argument if the playlist does not contain + * an audio clip with the specified relative offset + */ + void + removeAudioClip(Ptr::Ref relativeOffset) + throw (std::invalid_argument); + + /** + * Validate the playlist: check that there are no overlaps or gaps. + * If the playlength is the only thing amiss, playlist is considered + * valid, and the playlength is fixed. (Hence no 'const'.) + */ + bool + valid(void) throw (); + }; diff --git a/livesupport/modules/core/src/Playlist.cxx b/livesupport/modules/core/src/Playlist.cxx index 9371ac4d2..96d3935f9 100644 --- a/livesupport/modules/core/src/Playlist.cxx +++ b/livesupport/modules/core/src/Playlist.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/Playlist.cxx,v $ ------------------------------------------------------------------------------*/ @@ -153,7 +153,7 @@ Playlist::addAudioClip(Ptr::Ref audioClip, throw (std::invalid_argument) { if (elementList->find(*relativeOffset) != elementList->end()) { - std::string eMsg = "two playlist elements at the same relative offset"; + std::string eMsg = "two audio clips at the same relative offset"; throw std::invalid_argument(eMsg); } @@ -164,11 +164,26 @@ Playlist::addAudioClip(Ptr::Ref audioClip, } +/*------------------------------------------------------------------------------ + * Remove an audio clip from the playlist. + *----------------------------------------------------------------------------*/ +void +Playlist::removeAudioClip(Ptr::Ref relativeOffset) + throw (std::invalid_argument) +{ + // this returns the number of elements found and erased + if (!elementList->erase(*relativeOffset)) { + std::string eMsg = "no audio clip at the specified relative offset"; + throw std::invalid_argument(eMsg); + } +} + + /*------------------------------------------------------------------------------ * Lock or unlock the playlist for editing. *----------------------------------------------------------------------------*/ bool -Playlist::setLockedForEditing(bool lockStatus) +Playlist::setLockedForEditing(const bool lockStatus) throw () { if (lockStatus == true) { @@ -196,7 +211,7 @@ Playlist::setLockedForEditing(bool lockStatus) * Lock or unlock the playlist for playing. *----------------------------------------------------------------------------*/ bool -Playlist::setLockedForPlaying(bool lockStatus) +Playlist::setLockedForPlaying(const bool lockStatus) throw () { if (lockStatus == true) { @@ -214,3 +229,27 @@ Playlist::setLockedForPlaying(bool lockStatus) } // was already unlocked! } + +/*------------------------------------------------------------------------------ + * Validate the playlist. + *----------------------------------------------------------------------------*/ +bool +Playlist::valid(void) throw () +{ + Ptr::Ref runningTime(new time_duration(0,0,0,0)); + Ptr::Ref playlistElement; + Ptr::Ref audioClip; + + PlaylistElementListType::const_iterator it = elementList->begin(); + while (it != elementList->end()) { + playlistElement = it->second; + if (*runningTime != *(playlistElement->getRelativeOffset())) { + return false; + } + audioClip = playlistElement->getAudioClip(); + *runningTime += *(audioClip->getPlaylength()); + ++it; + } + playlength = runningTime; // fix playlength, if everything else is OK + return true; +} diff --git a/livesupport/modules/core/src/PlaylistTest.cxx b/livesupport/modules/core/src/PlaylistTest.cxx index ef62115f8..0a5bd70db 100644 --- a/livesupport/modules/core/src/PlaylistTest.cxx +++ b/livesupport/modules/core/src/PlaylistTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -90,6 +90,9 @@ PlaylistTest :: setUp(void) throw () CPPUNIT_ASSERT(duration->hours() == 1); CPPUNIT_ASSERT(duration->minutes() == 30); CPPUNIT_ASSERT(duration->seconds() == 0); + + CPPUNIT_ASSERT(playlist->valid()); + } catch (std::invalid_argument &e) { CPPUNIT_FAIL("semantic error in configuration file"); } catch (xmlpp::exception &e) { @@ -162,10 +165,10 @@ PlaylistTest :: lockTest(void) /*------------------------------------------------------------------------------ - * Test to see if we can add a new audio clip + * Test to see if we can add or remove an audio clip *----------------------------------------------------------------------------*/ void -PlaylistTest :: addAudioClipTest(void) +PlaylistTest :: audioClipTest(void) throw (CPPUNIT_NS::Exception) { Ptr::Ref clipId(new UniqueId(20001)); @@ -183,6 +186,8 @@ PlaylistTest :: addAudioClipTest(void) CPPUNIT_FAIL(eMsg); } + CPPUNIT_ASSERT(!playlist->valid()); // overlapping audio clips + Playlist::const_iterator it = playlist->begin(); CPPUNIT_ASSERT(it != playlist->end()); @@ -200,4 +205,31 @@ PlaylistTest :: addAudioClipTest(void) ++it; CPPUNIT_ASSERT(it == playlist->end()); + + try { + playlist->removeAudioClip(relativeOffset); + } + catch (std::invalid_argument &e) { + string eMsg = "removeAudioClip returned with error: "; + eMsg += e.what(); + CPPUNIT_FAIL(eMsg); + } + + it = playlist->begin(); + CPPUNIT_ASSERT(it != playlist->end()); + ++it; + CPPUNIT_ASSERT(it != playlist->end()); + ++it; + CPPUNIT_ASSERT(it == playlist->end()); + + Ptr::Ref phonyRelativeOffset( + new time_duration(0,0,1,0)); + try { + playlist->removeAudioClip(phonyRelativeOffset); + } + catch (std::invalid_argument &e) { + return; + } + CPPUNIT_FAIL("removeAudioClip allowed to remove " + "non-existent audio clip"); } diff --git a/livesupport/modules/core/src/PlaylistTest.h b/livesupport/modules/core/src/PlaylistTest.h index 84d591ee1..e3c09d4aa 100644 --- a/livesupport/modules/core/src/PlaylistTest.h +++ b/livesupport/modules/core/src/PlaylistTest.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/PlaylistTest.h,v $ ------------------------------------------------------------------------------*/ @@ -58,7 +58,7 @@ namespace Core { * Unit test for the UploadPlaylistMetohd class. * * @author $Author: fgerlits $ - * @version $Revision: 1.3 $ + * @version $Revision: 1.4 $ * @see Playlist */ class PlaylistTest : public CPPUNIT_NS::TestFixture @@ -66,7 +66,7 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST_SUITE(PlaylistTest); CPPUNIT_TEST(firstTest); CPPUNIT_TEST(lockTest); - CPPUNIT_TEST(addAudioClipTest); + CPPUNIT_TEST(audioClipTest); CPPUNIT_TEST_SUITE_END(); private: @@ -100,7 +100,7 @@ class PlaylistTest : public CPPUNIT_NS::TestFixture * @exception CPPUNIT_NS::Exception on test failures. */ void - addAudioClipTest(void) throw (CPPUNIT_NS::Exception); + audioClipTest(void) throw (CPPUNIT_NS::Exception); public: diff --git a/livesupport/products/scheduler/doc/model/SchedulerModel.zuml b/livesupport/products/scheduler/doc/model/SchedulerModel.zuml index ab5f95812..a14396569 100644 Binary files a/livesupport/products/scheduler/doc/model/SchedulerModel.zuml and b/livesupport/products/scheduler/doc/model/SchedulerModel.zuml differ diff --git a/livesupport/products/scheduler/etc/Makefile.in b/livesupport/products/scheduler/etc/Makefile.in index 4f706e9f8..549730c6c 100644 --- a/livesupport/products/scheduler/etc/Makefile.in +++ b/livesupport/products/scheduler/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: fgerlits $ -# Version : $Revision: 1.13 $ +# Version : $Revision: 1.14 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/etc/Makefile.in,v $ # # @configure_input@ @@ -123,7 +123,9 @@ SCHEDULER_OBJS = ${TMP_DIR}/SignalDispatcher.o \ ${TMP_DIR}/DisplayPlaylistsMethod.o \ ${TMP_DIR}/OpenPlaylistForEditingMethod.o \ ${TMP_DIR}/CreatePlaylistMethod.o \ - ${TMP_DIR}/AddAudioClipToPlaylistMethod.o + ${TMP_DIR}/AddAudioClipToPlaylistMethod.o \ + ${TMP_DIR}/RemoveAudioClipFromPlaylistMethod.o \ + ${TMP_DIR}/ValidatePlaylistMethod.o SCHEDULER_EXE_OBJS = ${SCHEDULER_OBJS} \ ${TMP_DIR}/main.o @@ -150,6 +152,8 @@ TEST_RUNNER_OBJS = ${SCHEDULER_OBJS} \ ${TMP_DIR}/OpenPlaylistForEditingMethodTest.o \ ${TMP_DIR}/CreatePlaylistMethodTest.o \ ${TMP_DIR}/AddAudioClipToPlaylistMethodTest.o \ + ${TMP_DIR}/RemoveAudioClipFromPlaylistMethodTest.o \ + ${TMP_DIR}/ValidatePlaylistMethodTest.o \ ${TMP_DIR}/TestRunner.o TEST_RUNNER_LIBS = ${SCHEDULER_EXE_LIBS} -lcppunit -ldl diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx index b7e4f50f4..183a485a5 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.cxx,v $ ------------------------------------------------------------------------------*/ @@ -107,18 +107,32 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters, } Ptr::Ref playlistId; - Ptr::Ref audioClipId; - Ptr::Ref relativeOffset; try{ playlistId = XmlRpcTools::extractPlaylistId(parameters); - audioClipId = XmlRpcTools::extractAudioClipId(parameters); - relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); } catch (std::invalid_argument &e) { XmlRpcTools::markError(errorId+2, e.what(), returnValue); return; } + Ptr::Ref audioClipId; + try{ + audioClipId = XmlRpcTools::extractAudioClipId(parameters); + } + catch (std::invalid_argument &e) { + XmlRpcTools::markError(errorId+3, e.what(), returnValue); + return; + } + + Ptr::Ref relativeOffset; + try{ + relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); + } + catch (std::invalid_argument &e) { + XmlRpcTools::markError(errorId+4, e.what(), returnValue); + return; + } + Ptr::Ref scf; Ptr::Ref storage; scf = StorageClientFactory::getInstance(); @@ -129,13 +143,13 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters, playlist = storage->getPlaylist(playlistId); } catch (std::invalid_argument &e) { - XmlRpcTools::markError(errorId+3, "playlist does not exist", + XmlRpcTools::markError(errorId+5, "playlist does not exist", returnValue); return; } if (!playlist->getIsLockedForEditing()) { - XmlRpcTools::markError(errorId+4, + XmlRpcTools::markError(errorId+6, "playlist has not been opened for editing", returnValue); return; @@ -146,7 +160,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters, audioClip = storage->getAudioClip(audioClipId); } catch (std::invalid_argument &e) { - XmlRpcTools::markError(errorId+5, "audio clip does not exist", + XmlRpcTools::markError(errorId+7, "audio clip does not exist", returnValue); return; } @@ -155,7 +169,7 @@ AddAudioClipToPlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters, playlist->addAudioClip(audioClip, relativeOffset); } catch(std::invalid_argument &e) { - XmlRpcTools::markError(errorId+6, + XmlRpcTools::markError(errorId+8, "two audio clips at the same relative offset", returnValue); return; diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h index 88b14ca10..d2680d48f 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethod.h,v $ ------------------------------------------------------------------------------*/ @@ -88,14 +88,16 @@ using namespace LiveSupport::Core; * The possible error codes are: *
    *
  • 301 - invalid argument format
  • - *
  • 302 - missing ... argument
  • - *
  • 303 - playlist does not exist
  • - *
  • 304 - playlist has not been opened for editing
  • - *
  • 305 - audio clip does not exist
  • - *
  • 306 - two audio clips at the same relative offset
  • + *
  • 302 - missing playlist ID argument
  • + *
  • 303 - missing audio clip ID argument
  • + *
  • 304 - missing relative offset argument
  • + *
  • 305 - playlist does not exist
  • + *
  • 306 - playlist has not been opened for editing
  • + *
  • 307 - audio clip does not exist
  • + *
  • 308 - two audio clips at the same relative offset
  • *
* @author $Author: fgerlits $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class AddAudioClipToPlaylistMethod : public XmlRpc::XmlRpcServerMethod { diff --git a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx index 75d81fd29..3302963b2 100644 --- a/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx +++ b/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/AddAudioClipToPlaylistMethodTest.cxx,v $ ------------------------------------------------------------------------------*/ @@ -157,7 +157,7 @@ AddAudioClipToPlaylistMethodTest :: firstTest(void) openPlaylistMethod->execute(parameter, result); addAudioClipMethod->execute(parameter, result); CPPUNIT_ASSERT(result.hasMember("errorCode")); - CPPUNIT_ASSERT((int)(result["errorCode"]) == 306); + CPPUNIT_ASSERT((int)(result["errorCode"]) == 308); parameter.clear(); result.clear(); diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx new file mode 100644 index 000000000..cd487cf0e --- /dev/null +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx @@ -0,0 +1,163 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#ifdef HAVE_TIME_H +#include +#else +#error need time.h +#endif + + +#include + +#include "LiveSupport/Core/StorageClientInterface.h" +#include "LiveSupport/Storage/StorageClientFactory.h" +#include "ScheduleInterface.h" +#include "ScheduleFactory.h" +#include "XmlRpcTools.h" + +#include "RemoveAudioClipFromPlaylistMethod.h" + + +using namespace boost; +using namespace boost::posix_time; + +using namespace LiveSupport; +using namespace LiveSupport::Core; +using namespace LiveSupport::Storage; + +using namespace LiveSupport::Scheduler; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + +/*------------------------------------------------------------------------------ + * The name of this XML-RPC method. + *----------------------------------------------------------------------------*/ +const std::string RemoveAudioClipFromPlaylistMethod::methodName + = "removeAudioClipFromPlaylist"; + +/*------------------------------------------------------------------------------ + * The ID of this method for error reporting purposes. + *----------------------------------------------------------------------------*/ +const int RemoveAudioClipFromPlaylistMethod::errorId = 400; + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Construct the method and register it right away. + *----------------------------------------------------------------------------*/ +RemoveAudioClipFromPlaylistMethod :: RemoveAudioClipFromPlaylistMethod ( + Ptr::Ref xmlRpcServer) throw() + : XmlRpc::XmlRpcServerMethod(methodName, xmlRpcServer.get()) +{ +} + + +/*------------------------------------------------------------------------------ + * Execute the stop XML-RPC function call. + *----------------------------------------------------------------------------*/ +void +RemoveAudioClipFromPlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters, + XmlRpc::XmlRpcValue & returnValue) + throw () +{ + if (!parameters.valid()) { + XmlRpcTools::markError(errorId+1, "invalid argument format", + returnValue); + return; + } + + Ptr::Ref playlistId; + try{ + playlistId = XmlRpcTools::extractPlaylistId(parameters); + } + catch (std::invalid_argument &e) { + XmlRpcTools::markError(errorId+2, + "missing playlist ID argument", + returnValue); + return; + } + + Ptr::Ref relativeOffset; + try{ + relativeOffset = XmlRpcTools::extractRelativeOffset(parameters); + } + catch (std::invalid_argument &e) { + XmlRpcTools::markError(errorId+3, + "missing relative offset argument", + returnValue); + return; + } + + Ptr::Ref scf; + Ptr::Ref storage; + scf = StorageClientFactory::getInstance(); + storage = scf->getStorageClient(); + + Ptr::Ref playlist; + try { + playlist = storage->getPlaylist(playlistId); + } + catch (std::invalid_argument &e) { + XmlRpcTools::markError(errorId+4, "playlist does not exist", + returnValue); + return; + } + + if (!playlist->getIsLockedForEditing()) { + XmlRpcTools::markError(errorId+5, + "playlist has not been opened for editing", + returnValue); + return; + } + + try { // and finally, the beef + playlist->removeAudioClip(relativeOffset); + } + catch(std::invalid_argument &e) { + XmlRpcTools::markError(errorId+6, + "no audio clip at the specified " + "relative offset", + returnValue); + return; + } +} diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h new file mode 100644 index 000000000..a1654aaab --- /dev/null +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h @@ -0,0 +1,154 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethod.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef RemoveAudioClipFromPlaylistMethod_h +#define RemoveAudioClipFromPlaylistMethod_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include +#include +#include +#include + +#include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Core/Playlist.h" + + +namespace LiveSupport { +namespace Scheduler { + +using namespace LiveSupport; +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * An XML-RPC method object to remove an audio clip (specified by its relative + * offset) from a playlist (specified by its ID). + * + * The name of the method when called through XML-RPC is + * "removeAudioClipFromPlaylist". + * The expected parameter is an XML-RPC structure, with the following + * members: + *
    + *
  • playlistId - int - the unique id of the playlist.
  • + *
  • relativeOffset - int - the number of seconds between the + * start of the playlist and the start of the audio clip + * to be removed.
  • + *
+ * + * In case of an error, an XML-RPC structure is returned, with the following + * fields: + *
    + *
  • errorCode - int - the id of the error condition
  • + *
  • errorMessage - string - a description of the error
  • + *
+ * The possible error codes are: + *
    + *
  • 401 - invalid argument format
  • + *
  • 402 - missing playlist ID argument
  • + *
  • 403 - missing relative offset argument
  • + *
  • 404 - playlist does not exist
  • + *
  • 405 - playlist has not been opened for editing
  • + *
  • 406 - no audio clip at the specified relative offset
  • + *
+ * @author $Author: fgerlits $ + * @version $Revision: 1.1 $ + */ +class RemoveAudioClipFromPlaylistMethod : public XmlRpc::XmlRpcServerMethod +{ + private: + /** + * The name of this method, as it will be registered into the + * XML-RPC server. + */ + static const std::string methodName; + + /** + * The ID of this method for error reporting purposes. + */ + static const int errorId; + + + public: + /** + * A default constructor, for testing purposes. + */ + RemoveAudioClipFromPlaylistMethod(void) throw () + : XmlRpc::XmlRpcServerMethod(methodName) + { + } + + /** + * Constuctor that registers the method with the server right away. + * + * @param xmlRpcServer the XML-RPC server to register with. + */ + RemoveAudioClipFromPlaylistMethod( + Ptr::Ref xmlRpcServer) + throw (); + + /** + * Execute the display schedule command on the Scheduler daemon. + * + * @param parameters XML-RPC function call parameters + * @param returnValue the return value of the call (out parameter) + */ + void + execute( XmlRpc::XmlRpcValue & parameters, + XmlRpc::XmlRpcValue & returnValue) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Scheduler +} // namespace LiveSupport + +#endif // RemoveAudioClipFromPlaylistMethod_h + diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx new file mode 100644 index 000000000..ca96cf39f --- /dev/null +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx @@ -0,0 +1,175 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#if HAVE_UNISTD_H +#include +#else +#error "Need unistd.h" +#endif + + +#include +#include +#include + +#include "LiveSupport/Db/ConnectionManagerFactory.h" +#include "LiveSupport/Storage/StorageClientFactory.h" +#include "XmlRpcTools.h" + +#include "OpenPlaylistForEditingMethod.h" +#include "AddAudioClipToPlaylistMethod.h" +#include "RemoveAudioClipFromPlaylistMethod.h" + +#include "RemoveAudioClipFromPlaylistMethodTest.h" + + +using namespace std; +using namespace LiveSupport::Db; +using namespace LiveSupport::Storage; +using namespace LiveSupport::Scheduler; + + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + +CPPUNIT_TEST_SUITE_REGISTRATION(RemoveAudioClipFromPlaylistMethodTest); + +/** + * The name of the configuration file for the storage client factory. + */ +const std::string RemoveAudioClipFromPlaylistMethodTest::storageClientConfig = + "etc/storageClient.xml"; + +/** + * The name of the configuration file for the connection manager factory. + */ +const std::string RemoveAudioClipFromPlaylistMethodTest::connectionManagerConfig = + "etc/connectionManagerFactory.xml"; + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Configure a Configurable with an XML file. + *----------------------------------------------------------------------------*/ +void +RemoveAudioClipFromPlaylistMethodTest :: configure( + Ptr::Ref configurable, + const std::string fileName) + throw (std::invalid_argument, + xmlpp::exception) +{ + Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); + const xmlpp::Document * document = parser->get_document(); + const xmlpp::Element * root = document->get_root_node(); + + configurable->configure(*root); +} + + +/*------------------------------------------------------------------------------ + * Set up the test environment + *----------------------------------------------------------------------------*/ +void +RemoveAudioClipFromPlaylistMethodTest :: setUp(void) throw () +{ + try { + Ptr::Ref scf + = StorageClientFactory::getInstance(); + configure(scf, storageClientConfig); + + Ptr::Ref cmf + = ConnectionManagerFactory::getInstance(); + configure(cmf, connectionManagerConfig); + + } catch (std::invalid_argument &e) { + CPPUNIT_FAIL("semantic error in configuration file"); + } catch (xmlpp::exception &e) { + CPPUNIT_FAIL("error parsing configuration file"); + } catch (std::exception &e) { + CPPUNIT_FAIL(e.what()); + } +} + + +/*------------------------------------------------------------------------------ + * Clean up the test environment + *----------------------------------------------------------------------------*/ +void +RemoveAudioClipFromPlaylistMethodTest :: tearDown(void) throw () +{ +} + + +/*------------------------------------------------------------------------------ + * Just a very simple smoke test + *----------------------------------------------------------------------------*/ +void +RemoveAudioClipFromPlaylistMethodTest :: firstTest(void) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref + openPlaylistMethod(new OpenPlaylistForEditingMethod()); + Ptr::Ref + addAudioClipMethod(new AddAudioClipToPlaylistMethod()); + Ptr::Ref + removeAudioClipMethod(new RemoveAudioClipFromPlaylistMethod()); + XmlRpc::XmlRpcValue parameter; + XmlRpc::XmlRpcValue result; + + parameter["playlistId"] = 1; + parameter["audioClipId"] = 20002; + parameter["relativeOffset"] = 90*60; + + removeAudioClipMethod->execute(parameter, result); + CPPUNIT_ASSERT(result.hasMember("errorCode")); + CPPUNIT_ASSERT((int)(result["errorCode"]) == 405); // not open for editing + + result.clear(); + openPlaylistMethod->execute(parameter, result); + removeAudioClipMethod->execute(parameter, result); + CPPUNIT_ASSERT(result.hasMember("errorCode")); + CPPUNIT_ASSERT((int)(result["errorCode"]) == 406); // no such audio clip + + result.clear(); + addAudioClipMethod->execute(parameter, result); + removeAudioClipMethod->execute(parameter, result); + CPPUNIT_ASSERT(!result.hasMember("errorCode")); +} diff --git a/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h new file mode 100644 index 000000000..d73c6d49b --- /dev/null +++ b/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h @@ -0,0 +1,135 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/RemoveAudioClipFromPlaylistMethodTest.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef RemoveAudioClipFromPlaylistMethodTest_h +#define RemoveAudioClipFromPlaylistMethodTest_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + + +namespace LiveSupport { +namespace Scheduler { + +using namespace LiveSupport; +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * Unit test for the RemoveAudioClipFromPlaylistMethod class. + * + * @author $Author: fgerlits $ + * @version $Revision: 1.1 $ + * @see RemoveAudioClipFromPlaylistMethod + */ +class RemoveAudioClipFromPlaylistMethodTest : public CPPUNIT_NS::TestFixture +{ + CPPUNIT_TEST_SUITE(RemoveAudioClipFromPlaylistMethodTest); + CPPUNIT_TEST(firstTest); + CPPUNIT_TEST_SUITE_END(); + + /** + * The name of the configuration file for the storage client factory. + */ + static const std::string storageClientConfig; + + /** + * The name of the configuration file for the connection manager + * factory. + */ + static const std::string connectionManagerConfig; + + /** + * Configure a configurable with an XML file. + * + * @param configurable configure this + * @param fileName the name of the XML file to configure with. + * @exception std::invalid_argument on configuration errors. + * @exception xmlpp::exception on XML parsing errors. + */ + void + configure(Ptr::Ref configurable, + std::string fileName) + throw (std::invalid_argument, + xmlpp::exception); + + protected: + + /** + * A simple test. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + firstTest(void) throw (CPPUNIT_NS::Exception); + + + public: + + /** + * Set up the environment for the test case. + */ + void + setUp(void) throw (); + + /** + * Clean up the environment after the test case. + */ + void + tearDown(void) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Scheduler +} // namespace LiveSupport + +#endif // RemoveAudioClipFromPlaylistMethodTest_h + diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx b/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx new file mode 100644 index 000000000..aa9f365b1 --- /dev/null +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx @@ -0,0 +1,146 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#ifdef HAVE_TIME_H +#include +#else +#error need time.h +#endif + + +#include + +#include "LiveSupport/Core/StorageClientInterface.h" +#include "LiveSupport/Storage/StorageClientFactory.h" +#include "ScheduleInterface.h" +#include "ScheduleFactory.h" +#include "XmlRpcTools.h" + +#include "ValidatePlaylistMethod.h" + + +using namespace boost; +using namespace boost::posix_time; + +using namespace LiveSupport; +using namespace LiveSupport::Core; +using namespace LiveSupport::Storage; + +using namespace LiveSupport::Scheduler; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + +/*------------------------------------------------------------------------------ + * The name of this XML-RPC method. + *----------------------------------------------------------------------------*/ +const std::string ValidatePlaylistMethod::methodName + = "validatePlaylist"; + +/*------------------------------------------------------------------------------ + * The ID of this method for error reporting purposes. + *----------------------------------------------------------------------------*/ +const int ValidatePlaylistMethod::errorId = 500; + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Construct the method and register it right away. + *----------------------------------------------------------------------------*/ +ValidatePlaylistMethod :: ValidatePlaylistMethod ( + Ptr::Ref xmlRpcServer) throw() + : XmlRpc::XmlRpcServerMethod(methodName, xmlRpcServer.get()) +{ +} + + +/*------------------------------------------------------------------------------ + * Execute the stop XML-RPC function call. + *----------------------------------------------------------------------------*/ +void +ValidatePlaylistMethod :: execute(XmlRpc::XmlRpcValue & parameters, + XmlRpc::XmlRpcValue & returnValue) + throw () +{ + if (!parameters.valid()) { + XmlRpcTools::markError(errorId+1, "invalid argument format", + returnValue); + return; + } + + Ptr::Ref playlistId; + try{ + playlistId = XmlRpcTools::extractPlaylistId(parameters); + } + catch (std::invalid_argument &e) { + XmlRpcTools::markError(errorId+2, + "missing playlist ID argument", + returnValue); + return; + } + + Ptr::Ref scf; + Ptr::Ref storage; + scf = StorageClientFactory::getInstance(); + storage = scf->getStorageClient(); + + Ptr::Ref playlist; + try { + playlist = storage->getPlaylist(playlistId); + } + catch (std::invalid_argument &e) { + XmlRpcTools::markError(errorId+3, "playlist does not exist", + returnValue); + return; + } + + if (!playlist->getIsLockedForEditing()) { + XmlRpcTools::markError(errorId+4, + "playlist has not been opened for editing", + returnValue); + return; + } + + bool valid = playlist->valid(); // and finally, the beef + + XmlRpcTools::validStatusToXmlRpcValue(valid, returnValue); +} + diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethod.h b/livesupport/products/scheduler/src/ValidatePlaylistMethod.h new file mode 100644 index 000000000..f65923411 --- /dev/null +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethod.h @@ -0,0 +1,154 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethod.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef ValidatePlaylistMethod_h +#define ValidatePlaylistMethod_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include +#include +#include +#include + +#include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Core/Playlist.h" + + +namespace LiveSupport { +namespace Scheduler { + +using namespace LiveSupport; +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * An XML-RPC method object to validate a playlist (specified by its ID). + * + * The name of the method when called through XML-RPC is + * "validatePlaylist". + * The expected parameter is an XML-RPC structure, with the following + * member: + *
    + *
  • playlistId - int - the unique id of the playlist.
  • + *
+ * + * The XML-RPC function returns an XML-RPC structure, containing the following + * fields: + *
    + *
  • valid - bool - true if the playlist is valid, false otherwise
  • + *
+ * + * In case of an error, an XML-RPC structure is returned, with the following + * fields: + *
    + *
  • errorCode - int - the id of the error condition
  • + *
  • errorMessage - string - a description of the error
  • + *
+ * The possible error codes are: + *
    + *
  • 501 - invalid argument format
  • + *
  • 502 - missing playlist ID argument
  • + *
  • 503 - playlist does not exist
  • + *
  • 504 - playlist has not been opened for editing
  • + *
+ * @author $Author: fgerlits $ + * @version $Revision: 1.1 $ + */ +class ValidatePlaylistMethod : public XmlRpc::XmlRpcServerMethod +{ + private: + /** + * The name of this method, as it will be registered into the + * XML-RPC server. + */ + static const std::string methodName; + + /** + * The ID of this method for error reporting purposes. + */ + static const int errorId; + + + public: + /** + * A default constructor, for testing purposes. + */ + ValidatePlaylistMethod(void) throw () + : XmlRpc::XmlRpcServerMethod(methodName) + { + } + + /** + * Constuctor that registers the method with the server right away. + * + * @param xmlRpcServer the XML-RPC server to register with. + */ + ValidatePlaylistMethod( + Ptr::Ref xmlRpcServer) + throw (); + + /** + * Execute the display schedule command on the Scheduler daemon. + * + * @param parameters XML-RPC function call parameters + * @param returnValue the return value of the call (out parameter) + */ + void + execute( XmlRpc::XmlRpcValue & parameters, + XmlRpc::XmlRpcValue & returnValue) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Scheduler +} // namespace LiveSupport + +#endif // ValidatePlaylistMethod_h + diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx new file mode 100644 index 000000000..9a61fced4 --- /dev/null +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx @@ -0,0 +1,180 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#if HAVE_UNISTD_H +#include +#else +#error "Need unistd.h" +#endif + + +#include +#include +#include + +#include "LiveSupport/Db/ConnectionManagerFactory.h" +#include "LiveSupport/Storage/StorageClientFactory.h" +#include "XmlRpcTools.h" + +#include "OpenPlaylistForEditingMethod.h" +#include "RemoveAudioClipFromPlaylistMethod.h" +#include "ValidatePlaylistMethod.h" + +#include "ValidatePlaylistMethodTest.h" + + +using namespace std; +using namespace LiveSupport::Db; +using namespace LiveSupport::Storage; +using namespace LiveSupport::Scheduler; + + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + +CPPUNIT_TEST_SUITE_REGISTRATION(ValidatePlaylistMethodTest); + +/** + * The name of the configuration file for the storage client factory. + */ +const std::string ValidatePlaylistMethodTest::storageClientConfig = + "etc/storageClient.xml"; + +/** + * The name of the configuration file for the connection manager factory. + */ +const std::string ValidatePlaylistMethodTest::connectionManagerConfig = + "etc/connectionManagerFactory.xml"; + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Configure a Configurable with an XML file. + *----------------------------------------------------------------------------*/ +void +ValidatePlaylistMethodTest :: configure( + Ptr::Ref configurable, + const std::string fileName) + throw (std::invalid_argument, + xmlpp::exception) +{ + Ptr::Ref parser(new xmlpp::DomParser(fileName, true)); + const xmlpp::Document * document = parser->get_document(); + const xmlpp::Element * root = document->get_root_node(); + + configurable->configure(*root); +} + + +/*------------------------------------------------------------------------------ + * Set up the test environment + *----------------------------------------------------------------------------*/ +void +ValidatePlaylistMethodTest :: setUp(void) throw () +{ + try { + Ptr::Ref scf + = StorageClientFactory::getInstance(); + configure(scf, storageClientConfig); + + Ptr::Ref cmf + = ConnectionManagerFactory::getInstance(); + configure(cmf, connectionManagerConfig); + + } catch (std::invalid_argument &e) { + CPPUNIT_FAIL("semantic error in configuration file"); + } catch (xmlpp::exception &e) { + CPPUNIT_FAIL("error parsing configuration file"); + } catch (std::exception &e) { + CPPUNIT_FAIL(e.what()); + } +} + + +/*------------------------------------------------------------------------------ + * Clean up the test environment + *----------------------------------------------------------------------------*/ +void +ValidatePlaylistMethodTest :: tearDown(void) throw () +{ +} + + +/*------------------------------------------------------------------------------ + * Just a very simple smoke test + *----------------------------------------------------------------------------*/ +void +ValidatePlaylistMethodTest :: firstTest(void) + throw (CPPUNIT_NS::Exception) +{ + Ptr::Ref + openPlaylistMethod(new OpenPlaylistForEditingMethod()); + Ptr::Ref + removeAudioClipMethod(new RemoveAudioClipFromPlaylistMethod()); + Ptr::Ref + validatePlaylistMethod(new ValidatePlaylistMethod()); + XmlRpc::XmlRpcValue parameter; + XmlRpc::XmlRpcValue result; + + parameter["playlistId"] = 275; + validatePlaylistMethod->execute(parameter, result); + CPPUNIT_ASSERT(result.hasMember("errorCode")); + CPPUNIT_ASSERT(int(result["errorCode"]) == 503); // no such playlist + + result.clear(); + parameter.clear(); + parameter["playlistId"] = 1; + openPlaylistMethod->execute(parameter, result); + CPPUNIT_ASSERT(!result.hasMember("errorCode")); + result.clear(); + validatePlaylistMethod->execute(parameter, result); + CPPUNIT_ASSERT(result.hasMember("valid")); + CPPUNIT_ASSERT(bool(result["valid"])); + + result.clear(); + parameter["relativeOffset"] = 0; + removeAudioClipMethod->execute(parameter, result); + CPPUNIT_ASSERT(!result.hasMember("errorCode")); + result.clear(); + validatePlaylistMethod->execute(parameter, result); + CPPUNIT_ASSERT(result.hasMember("valid")); + CPPUNIT_ASSERT(!bool(result["valid"])); // has a gap at the beginning +} diff --git a/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h new file mode 100644 index 000000000..19abbb96f --- /dev/null +++ b/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h @@ -0,0 +1,135 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: fgerlits $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/ValidatePlaylistMethodTest.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef ValidatePlaylistMethodTest_h +#define ValidatePlaylistMethodTest_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + + +namespace LiveSupport { +namespace Scheduler { + +using namespace LiveSupport; +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * Unit test for the ValidatePlaylistMethod class. + * + * @author $Author: fgerlits $ + * @version $Revision: 1.1 $ + * @see ValidatePlaylistMethod + */ +class ValidatePlaylistMethodTest : public CPPUNIT_NS::TestFixture +{ + CPPUNIT_TEST_SUITE(ValidatePlaylistMethodTest); + CPPUNIT_TEST(firstTest); + CPPUNIT_TEST_SUITE_END(); + + /** + * The name of the configuration file for the storage client factory. + */ + static const std::string storageClientConfig; + + /** + * The name of the configuration file for the connection manager + * factory. + */ + static const std::string connectionManagerConfig; + + /** + * Configure a configurable with an XML file. + * + * @param configurable configure this + * @param fileName the name of the XML file to configure with. + * @exception std::invalid_argument on configuration errors. + * @exception xmlpp::exception on XML parsing errors. + */ + void + configure(Ptr::Ref configurable, + std::string fileName) + throw (std::invalid_argument, + xmlpp::exception); + + protected: + + /** + * A simple test. + * + * @exception CPPUNIT_NS::Exception on test failures. + */ + void + firstTest(void) throw (CPPUNIT_NS::Exception); + + + public: + + /** + * Set up the environment for the test case. + */ + void + setUp(void) throw (); + + /** + * Clean up the environment after the test case. + */ + void + tearDown(void) throw (); +}; + + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Scheduler +} // namespace LiveSupport + +#endif // ValidatePlaylistMethodTest_h + diff --git a/livesupport/products/scheduler/src/XmlRpcTools.cxx b/livesupport/products/scheduler/src/XmlRpcTools.cxx index 9a349d91d..45873ea78 100644 --- a/livesupport/products/scheduler/src/XmlRpcTools.cxx +++ b/livesupport/products/scheduler/src/XmlRpcTools.cxx @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.cxx,v $ ------------------------------------------------------------------------------*/ @@ -87,7 +87,7 @@ XmlRpcTools :: extractPlaylistId(XmlRpc::XmlRpcValue & xmlRpcValue) throw (std::invalid_argument) { if (!xmlRpcValue.hasMember(playlistIdName)) { - throw std::invalid_argument("missing playlist ID"); + throw std::invalid_argument("missing playlist ID argument"); } Ptr::Ref id(new UniqueId((int) xmlRpcValue[playlistIdName])); @@ -103,7 +103,7 @@ XmlRpcTools :: extractAudioClipId(XmlRpc::XmlRpcValue & xmlRpcValue) throw (std::invalid_argument) { if (!xmlRpcValue.hasMember(audioClipIdName)) { - throw std::invalid_argument("missing audio clip ID"); + throw std::invalid_argument("missing audio clip ID argument"); } Ptr::Ref id(new UniqueId((int) xmlRpcValue[audioClipIdName])); @@ -119,7 +119,7 @@ XmlRpcTools :: extractRelativeOffset(XmlRpc::XmlRpcValue & xmlRpcValue) throw (std::invalid_argument) { if (!xmlRpcValue.hasMember(relativeOffsetName)) { - throw std::invalid_argument("missing relative offset"); + throw std::invalid_argument("missing relative offset argument"); } Ptr::Ref relativeOffset(new time_duration(0,0, @@ -153,3 +153,17 @@ XmlRpcTools :: markError(int errorCode, const std::string errorMessage, xmlRpcValue["errorCode"] = errorCode; xmlRpcValue["errorMessage"] = errorMessage; } + + +/*------------------------------------------------------------------------------ + * Convert the valid status of a playlist to an XmlRpcValue + *----------------------------------------------------------------------------*/ +void +XmlRpcTools :: validStatusToXmlRpcValue( + bool validStatus, + XmlRpc::XmlRpcValue & xmlRpcValue) + throw () +{ + xmlRpcValue["valid"] = XmlRpc::XmlRpcValue(validStatus); +} + diff --git a/livesupport/products/scheduler/src/XmlRpcTools.h b/livesupport/products/scheduler/src/XmlRpcTools.h index ad6adbe52..282965cef 100644 --- a/livesupport/products/scheduler/src/XmlRpcTools.h +++ b/livesupport/products/scheduler/src/XmlRpcTools.h @@ -22,7 +22,7 @@ Author : $Author: fgerlits $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/scheduler/src/Attic/XmlRpcTools.h,v $ ------------------------------------------------------------------------------*/ @@ -68,7 +68,7 @@ using namespace LiveSupport::Core; * in the Scheduler. * * @author $Author: fgerlits $ - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ */ class XmlRpcTools { @@ -131,7 +131,7 @@ class XmlRpcTools * Convert a Playlist to an XmlRpcValue * * @param playlist the Playlist to convert. - * @param xmlRpcValue the output parameter holding the value of + * @param xmlRpcValue the output parameter holding the result of * the conversion. */ static void @@ -143,7 +143,7 @@ class XmlRpcTools * Convert an error code, message pair to an XmlRpcValue * * @param playlist the Playlist to convert. - * @param xmlRpcValue the output parameter holding the value of + * @param xmlRpcValue the output parameter holding the result of * the conversion. */ static void @@ -151,6 +151,17 @@ class XmlRpcTools XmlRpc::XmlRpcValue & xmlRpcValue) throw (); + /** + * Convert the valid status of a playlist to an XmlRpcValue + * + * @param validStatus true if the playlist is valid, false otherwise. + * @param xmlRpcValue the output parameter holding the result of + * the conversion. + */ + static void + validStatusToXmlRpcValue(bool validStatus, + XmlRpc::XmlRpcValue & xmlRpcValue) + throw (); }; /* ================================================= external data structures */