001/* 002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Vladimir Pasquier <vpasquier@nuxeo.com> 016 */ 017package org.nuxeo.binary.metadata.api; 018 019import java.util.List; 020import java.util.Map; 021 022import org.nuxeo.ecm.core.api.Blob; 023 024/** 025 * Class to extends to contribute processor runner. See extension point 'metadataProcessors'. 026 * 027 * @since 7.1 028 */ 029public interface BinaryMetadataProcessor { 030 031 /** 032 * Write given metadata into given blob. Since 7.3 ignorePrefix is added. 033 * 034 * @param blob Blob to write. 035 * @param metadata Metadata to inject. 036 * @param ignorePrefix 037 * @return the updated blob, or {@code null} if there was an error (since 7.4) 038 */ 039 public Blob writeMetadata(Blob blob, Map<String, String> metadata, boolean ignorePrefix); 040 041 /** 042 * Read from a given blob given metadata map. Since 7.3 ignorePrefix is added. 043 * 044 * @param blob Blob to read. 045 * @param metadata Metadata to extract. 046 * @param ignorePrefix 047 * @return Metadata map. 048 */ 049 public Map<String, Object> readMetadata(Blob blob, List<String> metadata, boolean ignorePrefix); 050 051 /** 052 * Read all metadata from a given blob. Since 7.3 ignorePrefix is added. 053 * 054 * @param blob Blob to read. 055 * @param ignorePrefix 056 * @return Metadata map. 057 */ 058 public Map<String, Object> readMetadata(Blob blob, boolean ignorePrefix); 059 060}