Liferay Support does not recommend or endorse specific third-party products over others. Liferay is not responsible for any instructions herein or referenced regarding these products. Any implementation of these principles is the responsibility of the subscriber.
This article is a legacy article. It applies to previous versions of the Liferay product. While the article is no longer maintained, the information may still be applicable.
This is a guide for using and setting up the Document Library in Liferay Portal 5.2 and 6.0. The goal is to give you adequate information about the Document Library so that it can be properly evaluated and/or utilized.
Resolution
General Setup
By default, Liferay 5.2 and 6.0 is configured to use the FileSystemHook, which stores files on a local file system repository. You can change the hook or storage method by selecting a different DL Hook option using this property:
dl.hook.impl=
Document Library Hook Options
com.liferay.documentlibrary.util.AdvancedFileSystemHook- The AdvancedFileSystemHook distributes the files into multiple directories and thus circumvents filesystem limitations. Liferay does not implement any file level locking, so use this only if you're using a SAN that supports file locking (most modern ones do but check your SAN documentation to be sure). The path for storing your documents is set also set using the dl.hook.file.system.root.dir property in the portal.properties.
com.liferay.documentlibrary.util.FileSystemHook - This is the default hook in 5.2EE and 6.0EE. Use this hook for a single server Liferay installation where you want your files stored on a file system. The path for storing your documents is set using the dl.hook.file.system.root.dir property in the portal.properties.
com.liferay.documentlibrary.util.S3Hook- Use this hook for storing your documents using Amazon's Simple Storage Service. If using this hook, there are additional settings that must be configured in the portal.properties.
liferay.documentum.hook.DocumentumHook- Use this hook for storing your documents using Documentum. This hook is configured through the deployment of the documentum-hook plugin. The documentum-hook plugin is only supported on Liferay Enterprise Edition. If using this hook, there are additional settings that must be configured in the documentum-hook/docroot/WEB-INF/src/dfc.properties and documentum-hook/docroot/WEB-INF/src/portlet.properties files.
com.liferay.documentlibrary.util.JCRHook- This is a JCR-170 compliant hook. This hook can be used for small deployments when you don't have a SAN to store files. Jackrabbit does not take care of file locking issues when storing on a file system, so for clustered environments, use Jackrabbit in conjuction with a transactional database. There are several jcr properties in the portal.properties and additional configuration is done through the ${liferay.home}/data/jackrabbit/repository.xml If you do choose this option, be sure to use a transactional database.
Cluster Setup Test
How do you know whether you are sharing the Document Library file repository successfully? Using two nodes, Node1 and Node2, you can do a simple test. In Node1, upload a file to Document Library. Now go to Node2 to see if the file can be downloaded. If you can't download the file for any reason, you need to recheck your setup.
File Migration
The migration tool exists starting in 5.2EE SP3, so if you are on an earlier version of Liferay, you would need to upgrade. If you switch Document Library Hooks without a proper migration, your previously uploaded files will not be accessible.
Best Practices
Before you go into production, you should decide whether there is a possibility of clustering. If there is, you should select a Document Library Hook that is suitable for a clustered environment so that you don't have to worry about migration. For example, you would not want to use FileSystemHook since this hook stores files exclusively on the local file system and cannot be used for a clustered environment.
Avoid switching between Document Library Hooks when you have already started uploading files. The result would be losing the files you uploaded on the previously used Hook.
If the files are physically stored on the database or on a file system, you should be careful never to edit these files. The Document Library stores the path of the physical file on the database, so when you change the name or path of the phyical files or directories, then the Document Library won't be able to locate the file.
Backend
The Document Library generally stores file data in two places, the database and the filesystem. Metadata including the file's path to the actual file location on the filesystem is stored in the database (see dl* tables). The physical file is stored on the filesystem in a directory structure dependent on the type of Document Library Hook you utilize.