Document & Media Library

Now we are going to understand the document management system of liferay along with its various features & implementation.  Liferay document management systems commonly provide storage, versioning, metadata, security, as well as indexing and retrieval capabilities.

In liferay we can manage the documents using the document & media library and it is the most important functionality of the portal. We can store any types of files like images, document, audio, video into the shared drive or we can mount the external repositories. I should say that it’s the beauty of liferay to provide the document management capabilities through a single portlet called Document & Media portlet.

Document & media portlet is based on JCR 170 standards and provides all the standard features of document management system like checkin, checkout, permissions, versions, move etc. Liferay provides the flexibility of managing document with our custom metadata types and it can be implemented through the web interface.

The document & media library allows users to manage the documents and the functionality is implemented in such a way that it stores documents in file system (AFS/ CMIS / DB / S3 / JCR / FS ) and the document metadata is stored in the database for searching & indexing.

When you open the portal.properties file then you can find all the below properties to configure the document store in liferay to persist the documents: -

dl.store.impl=com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore

dl.store.impl=com.liferay.portlet.documentlibrary.store.CMISStore

dl.store.impl=com.liferay.portlet.documentlibrary.store.DBStore

dl.store.impl=com.liferay.portlet.documentlibrary.store.FileSystemStore

dl.store.impl=com.liferay.portlet.documentlibrary.store.JCRStore

dl.store.impl=com.liferay.portlet.documentlibrary.store.S3Store

 

Now let’s go through the entire document Store one by one: -

 

1)    File Store: - It defines the structure & logic to store & retrieved the data and by storing the files inside the folder based on the defined the folder location.  

 

 To implement the filesystemstore in liferay uncomment the below property & add the store location: -

    dl.store.impl=com.liferay.portlet.documentlibrary.store.FileSystemStore

    dl.store.file.system.root.dir=${liferay.home}/data/document_library

 

Liferay by default implements the FileSystemStore  for storing the documents.

 

2)    Advanced File System Store: - It is same like Filesystemstore and only the difference is that Advanced File System Stores the file in the multiple folder structure. It is suggested to implement SAN for Advanced File System store in order to get the better performance.

 

Advanced File System store can be configured by defining the following properties in portal-ext.properties:

    dl.store.impl = com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore

    dl.store.file.system.root = (SAN directory Location)

 

3)    Database Store: - The DB store should be avoided as the performance is not good as compared to other file systems as it stores all the files in the Database so it takes more time to retrieve the data.

 

Add the below properties in portal-ext.properties file: -

   dl.store.impl=com.liferay.portlet.documentlibrary.store.DBStore

 

4)    JCR Store: - Java Content Repository is hierarchical, flexible, supports events, locking, versioning & other features through Java standard API.

 

JCR follows the best standards for the repositories across content management systems and it internally uses Apache Jackrabbit. By default the Apache Jackrabbit stores the data in the filsystem. JCR can be configured to store the files in the both the store i.e. filesystem & db store.

 

Add the below property in liferay portal-ext.properties for JCR Store: -

    dl.store.impl=com.liferay.portlet.documentlibrary.store.JCRStore

    dl.store.jcr.fetch.delay=500

    dl.store.jcr.fetch.max.failures=5

 

    #

    # Set this to true to allow version labels to be moved when updated. This

    # provides a workaround to duplicate version labels that may result when

    # using JCRStore.

    #

    dl.store.jcr.move.version.labels=false

 

 

5)    S3 Store: - Liferay provides the configuration to integrate with the amazon S3 repositories and nowadays the enterprises wants to go with the cloud system. Amazon S3 provides the storage with the web services interfaces i.e. REST, SOAP, BitTorrent.  Amazon cloud provides the S3 storage to store the documents in the repositories and liferay can be configured by defining the properties in the portal-ext.properties file.

Liferay by default comes with the pre-defined libraries for S3 integration and you can find jets3t.ajr under ROOT/WEB-INF/lib which contain all the classes required for integration.

Now only we need to define the configuration in portal-ext.properties to store document in S3 repositories: -

    dl.store.s3.access.key= (S3 access key ID)

    dl.store.s3.secret.key= (S3 encrypted access key)

    dl.store.s3.bucket.name= (S3 root folder name)

 

    #

    # Set the number of days that files should be left in the temporary

    # directory before they are deleted.

    #

    dl.store.s3.temp.dir.clean.up.expunge=7

 

    #

    # Set to the number of calls to S3Store#getFile() before triggering the

    # clean up process.

    #

    dl.store.s3.temp.dir.clean.up.frequency=100 

 

6)    CMIS Store: - Content Management Interoperability Services (CMIS) is an open standard that defines services for controlling document management repositories. CMIS defines the abstraction layer to control all the repositories & documents by using web protocols.

 

It is widely implemented content management systems and uses web services and RESTful services that any application can access. Liferay provides the CMIS store which can connect to any CMIS- compatible content repositories. The metadata of the Media Library content will be stored in Liferay and the actual files will be stored in the external CMIS-compatible repository.

 

We can integrate Alfresco content repository with Liferay, we can mount the CMIS repository which will internally connect with Alfresco using CMIS services.

 

To configure Liferay with the CMIS repository, we need to add the following properties to portal-ext.properties:

 

    dl.store.impl = com.liferay.portlet.documentlibrary.store.CMISStore

    dl.store.cmis.credentials.username = (user name for authentication)

    dl.store.cmis.credentials.password = (password for authentication)

    dl.store.cmis.repository.url = (CMIS store repository URL)

    dl.store.cmis.system.root.dir = Liferay Home