MODB MultiMedia ODB

MODB stands for MultiMedia ODB

The goal of this feature is to use ODB to store Multimedia File Types.

The idea is not to store the files in the odb database file itself but to store pointers to the files and keep these file in a separated ODB repository. The pointers will be instances of objects of type ODBFileContent.

Therefore we will have a default behavior:

  1. ODB has the default behavior to store the files on its local repository
  2. At the moment of database creation the user can setup a new behavior
  3. When creating a new ODBFileContent object, user can overrides the default behaviour by passing the new behaviour(true: copy to local repository, false: only keep the pointer) in the constructor.

Here is a suggestion of defininition for the class ODBFileContent :

Attributes

  • name (without path)
  • type (Multimedia File Types)
  • subtype (jpg,png,mp3,ogg,pdf,doc,…)
  • size in bytes
  • list of keywords(tags) - for search purpose
  • physical path where it is stored relative to MultimediaFile path directory
  • local or external (boolean to indicate if file must be stored in the local ODB repository or not )

Methods

  • getFileLocation() that returns the actual localation of the file
  • saveTo(String newLocation) that saves the file to a new location

modb will be abble to manage local files and external files :

  • Local files: files that will be copied the modb own file repository: all multimedia files will be stored in a specific ODB directory
  • External files: ODB will have the address(url) of the file but will not have the file itself. It can be usefull to store external files available on the web for example.

When using MODB, ODB will create a special directory 'file-repository' where all the local files will be copied in the original format. ODB will not keep them as byte array inside the ODB file.

The MultiMediaFile instance will have the path of the object and will be abble to retrieve the original file.

Query on MultiMedia Files

MODB will implement special mechanism to find contents in searchable files like text/pdf/doc/ods files. It will use the Pluggable Query manager that will use the 'Search in file' plugin.

Implementation

The first step is to create the MultiMediaFile class. Then we have to find a way to integrate it to ODB. This class (or classes) will have the following responsabilities:

  • Keep data of the multimedia file
  • Copy the file to the ODB local repository when it is marked as local.
  • Retrieve the original file when needed

Restrictions

Data Integrity

Saving objects in ODB that reference external objects (files) can cause Data integrity problems. The MODB file repository must be safe : Files should be marked as read-only to avoid deletion (even if it is not 100%). MODB will need to have a way to mark MultiMedia files as broken when the original file (local or external) does not exist any more. We need to create a notification mechanism to let MODB aware.

Repository checking

ODB will have to check if local repository exists. Not the files, only the repository.

Retrieving objects

When getting a ODBFileContent from database, ODB will user a trigger to check if file exist. If file should be local repository and it does not exist, ODB will send an exception. If file is only a reference and it does not exist anymore : the link is broken, what must we do ?

Usage

We want to keep things simple. The user will only have to store its object, as a normal object, ODB will do file related task in background in a transparent way.

ODB odb= ODBFactory.open("mmf.odb");
ODBFileContent ofc = new ODBFileContent("c:/tmp/foto1.jpg");
odb.store(ofc);
odb.close();

Implementation

ODB Triggers could be used to execute the file related tasks.

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License