Mediaserver core module
The Mediaserver (aka. 'attachment server') handles media files and their metadata.
The functionality is implemented using the RESTful-architecture style
- The Mediaserver can be used as a standalone server (no coupling to an external system).
- The Mediaserver can be used as an integrated part of the collections management system (coupled).
The Mediaservers has the basic CRUD responsibilities:
- Storing : Storing binaries to the filesystem and Storing the metadata to a database.
- Retrieving: Retrieving the binaries and retrieving the metadata for the binaries.
- Update: Updating the binaries and updating the metadata for the binaries.
- Delete: Deleting the binaries and updating the metadata for the binaries.
- The Mediaserver stores the binary-files to the local file system, to the file system where the Mediaserver is installed.
The Mediaserver should provide services for other systems.
- To store media files (Create)
- To edit media files (Update)
- To search on metadata, fetch mediafiles (Retrieve)
- To delete media files (Delete)
The mediafiles are stored in the filesystem, which has a depth of 3 levels. Only one mediafile is stored, no derivates for images are created at the same time.
All medifiles are stored using UUID as names.
UUID, " Universally unique identifier, 128-bit number." ( http://tools.ietf.org/html/rfc4122)
The directories range from '0' to 'F' (hexadecimal) with a depth of 3 layers, which results in 4096 directories ( 16^3 ). To illustrate, 10 000 000 (ten million) mediafiles would be, with an even spread, would be divided into 2441 mediafiles per directory.
All media files are processed in the same way - they are streamed to the filesystem and streamed back to their client.
The mediafile will hold their own 'media-type'/'mime-type' ( stored in the database )
- The principle is the following :
-
- if the generated UUID is 'ab30899c-58a0-4305-85a6-bbfa14f89b92'
- Then the file is stored in the following directory ( subdirectory is made up by the first 3 chars ):
-
- directory = /opt/data/mediaserver/newmedia/a/b/3
-
- directory and file = /opt/data/mediaserver/newmedia/a/b/3/ab30899c-58a0-4305-85a6-bbfa14f89b92
The terms “metadata" and “tags” are distinguished in the following way:
- 'metadata' are immuatable, data about the file.
- 'tags’ are mutable, data about the file content.
- original filename
- mime type
- owner
- visibility (i.e 'private' or ‘public')
- md5hash
- Saving the md5hash for every media file facilitates finding duplicates.
- Exif-metadata Exif-metadata for media files where type is an image are stored in a separate table.
- Exif-metadata is stored in a table of its own.
- there is a configurable Boolean parameter in the database, this parameter is a flag set to 'true' or 'false'.
The Mediaserver sets no constraint on the keys that are used.
This gives an external module using the Mediaserver freedom to define its own keys and constrain others keys.
Generics tags are supported and saved as a text-string in the database.
- ':' is used as the delimiter between key and its value.
- '&' is used as the delimiter between key/value-pairs
i.e setting key='country' with value='sweden' and key='view' with value='dorsal'.
is saved as -> 'country:sweden&value=dorsal'
#User Guide The Mediaserver is database- and application server agnostic.
The guiding principle is 'ease of installation and management'.
##How to install see the 'turn-key vagrant'-project at dw-media
If not using the vagrant-project, then the basic steps are as follows:
- git clone
- install and populate the chosen database-engine, use the liquibase-script
- install the Application server, Wildfly 8.x set up a datasource/datapool/JNDI-handle ( JNDI: java:/MediaDS)
- set up the filesystem-path for the media files
- cd '/mediaserver-module' ( root pom ) :
- prompt> mvn clean package wildfly:deploy
##How to connect to an external system A link-table in the database maps the ID from the external system to one or many media files.
See the RESTful-API documenation ... found here (@TODO)
- @post mediafile
- @get mediafile
- @get derivate of an image-file
- @update
- @delete
##How to add supported licenses Licenses are stored in a separate license-table
This gives the administrator full control of what licenses are permitted in the system.
##Maintenability , How to configure
The database table ADMIN_CONFIG A table ( key/value) in the schema is used for managing settables :
For instance the below ( key/value ) is set in the database.
- is_exif = [true||false]
- path_to_files = '/opt/data/mediaserver/newmedia'
#Demo