## 1.4. Resources and repository

Summary

The repository is found in OLAT under Learning resources and lists repository entries. These entries are meta information about a contained resource, typically a file. Each resource has an associated handler responsible for implementing the behaviour of the possible actions.

This is working in the same fashion as the filetypes - application association in a browser or a modern operating system. See Figure 1.1 for an example repository listing. The type - handler mechanism is more detailed described in Section 1.4.1, “Types and repositoryhandlers” , and a description of the actions can be found in Section 1.4.2, “Workflows”

Figure 1.1. How the repository looks.

### 1.4.1. Types and repositoryhandlers

First of all the `RepositoryHandlerFactory` is the central point where the implementations of the `RepositoryHandler`s are subscribed for the types they claim. By design the type should be the string returned from the `OLATResourcable.getResourceableTypeName()` .

All resources in the repository refer to a file so far, but the type - handler mechanism is restricted by no means to files. The following class hierarchy maps filresources and their suffixes to the `OLATResourcable` .

- `OLATResourceable`

  - `FileResource` :

    A generic file resource for files not categorized by the following list.

    - `AnimationFileResource` :

      SWF

    - `DocFileResource` :

      DOC

    - `ImageFileResource` :

      JPG, JPEG, GIF, TIFF, IMG, BMP, PBM, ICO, PICT, PNG

    - `ImsCPFileResource` :

      the extracted archive must contain the imsmanifest.xml which must validate.

    - `MovieFileResource` :

      MPG, MPEG, QT, RM, RAM, AVI

    - `PdfFileResource` :

      PDF

    - `PowerpointFileResource` :

      PPT, PPS

    - `ScormCPFileResource` :

      the extracted archive must contain the imsmanifest.xml which must validate.

    - `SharedFolderFileResource` :

    - `SoundFileResource` :

      MP3, WAV, RA, MIDI

    - `SurveyFileResource` :

      the extracted archive must contain the qti.xml which must validate.

    - `TestFileResource` :

      the extracted archive must contain the qti.xml which must validate.

    - `XlsFileResource` :

      XLS

Each of the above mentioned fileresource has a handler associated. The handler is responsible to inform the `RepositoryHandlerFactory` about possible actions (see Section 1.4.2, “Workflows”) and which types it handles.

The next list enumerates the association of the `XyzFileResouce` with the appropriate handler in OLAT.

- `CourseHandler` associated with

  `CourseModule.ORES_TYPE_COURSE` this represents the type OLAT course.

- `ImsCPHandler` associated with

  `ImsCPFileResource`

- `QTISurveyHandler` associated with

  `SurveyFileResource`

- `QTITestHandler` associated with

  `TestFileResource`

- `SCORMCPHandler` associated with

  `ScormCPFileResource`

- `SharedFolderHandler` associated with

  `SharedFolderFileResource`

- `WebDocumentHandler` associated with

  `FileResource` , `DocFileResource` , `XlsFileResource` , `PowerpointFileResource` , `PdfFileResource` , `SoundFileResource` , `MovieFileResource` , `AnimationFileResource` , `ImageFileResource`

### 1.4.2. Workflows

Manageing the repository involves adding, creating new resources, removing existing ones and update the meta information of a repository entry. Adding involves either uploading a file resource or selecting one from the various folder places. Creating is typically only possible if OLAT offers the appropriate editor.

Figure 1.2. The actions on the repository.

The concrete implementation of the `RepositoryHandler`, i.e. `WebDocumentHandler`, must provide a controller for adding the given resource. This controller is returned when the `getAddController(..)` method is called.

Before a deletion is issued the handler of the respective resource is asked if the resource is `readyToDelete(..)`. The deletion is initiated by `cleanUpOnDelete(..)` which is expected to do any work necessary, before removing the resource definitively.

Similiar to the adding of a resource, the handler also may provide the facility to create or edit the resources meta information. This is the so called details view and a component for this can be provided in the method `getDetailsComponent(..)`.

Figure 1.3. How the repository looks.