001 /** 002 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved. 003 * 004 * The contents of this file are subject to the terms of the Liferay Enterprise 005 * Subscription License ("License"). You may not use this file except in 006 * compliance with the License. You can obtain a copy of the License by 007 * contacting Liferay, Inc. See the License for the specific language governing 008 * permissions and limitations under the License, including but not limited to 009 * distribution rights of the Software. 010 * 011 * 012 * 013 */ 014 015 package com.liferay.portlet.documentlibrary.util; 016 017 import com.liferay.portal.kernel.exception.PortalException; 018 import com.liferay.portal.kernel.exception.SystemException; 019 import com.liferay.portal.kernel.repository.model.FileEntry; 020 import com.liferay.portal.kernel.repository.model.FileVersion; 021 022 /** 023 * Document library processor responsible for the generation of raw metadata 024 * associated with all of the the files stored in the document library. 025 * 026 * <p> 027 * This processor automatically and assynchronously extracts the metadata from 028 * all of the files stored in the document library. The metadata extraction is 029 * done with the help of {@link 030 * com.liferay.portal.metadata.TikaRawMetadataProcessor} 031 * </p> 032 * 033 * @author Alexander Chow 034 * @author Mika Koivisto 035 * @author Miguel Pastor 036 */ 037 public interface RawMetadataProcessor { 038 039 public void cleanUp(FileEntry fileEntry); 040 041 public void cleanUp(FileVersion fileVersion); 042 043 /** 044 * Generates the raw metadata associated with the file entry. 045 * 046 * @param fileVersion the file version from which the raw metatada is to be 047 * generated 048 * @throws PortalException if an error occurred in the metadata extraction 049 * @throws SystemException if a system exception occurred 050 */ 051 public void generateMetadata(FileVersion fileVersion) 052 throws PortalException, SystemException; 053 054 public boolean isSupported(FileVersion fileVersion); 055 056 public boolean isSupported(String mimeType); 057 058 /** 059 * Saves the raw metadata present in the file version. 060 * 061 * <p> 062 * The raw metadata present in the file version is extracted and persisted 063 * using {@link com.liferay.portal.metadata.TikaRawMetadataProcessor}. 064 * </p> 065 * 066 * @param fileVersion the file version from which the raw metatada is to be 067 * extracted and persisted 068 * @throws PortalException if an error occurred in the metadata extraction 069 * @throws SystemException if a system exception occurred 070 */ 071 public void saveMetadata(FileVersion fileVersion) 072 throws PortalException, SystemException; 073 074 /** 075 * Launches extraction of raw metadata from the file version. 076 * 077 * <p> 078 * The raw metadata extraction is done asynchronously. 079 * </p> 080 * 081 * @param fileVersion the latest file version from which the raw metadata is 082 * to be generated 083 */ 084 public void trigger(FileVersion fileVersion); 085 086 }