001/* 002 * (C) Copyright 2010 Nuxeo SAS (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.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 * Olivier Grisel 016 * 017 * $Id$ 018 */ 019 020package org.nuxeo.ecm.directory; 021 022import org.nuxeo.ecm.core.api.DocumentModel; 023 024/** 025 * Interface to be used by Directory implementations to perform arbitrary "fetch-time" adaptations on the entry fields 026 * and the readonly flag. 027 */ 028public interface EntryAdaptor { 029 030 /** 031 * Allow the directory initialization process to configure the adaptor by providing String valued parameters. 032 */ 033 void setParameter(String name, String value); 034 035 /** 036 * Apply an arbitrary transformation of the fetched entry. 037 * 038 * @param directory the directory instance the entry is fetched from 039 * @param entry the entry to transform 040 * @return the adapted entry 041 * @throws DirectoryException if the adapting process fails unexpectedly 042 */ 043 DocumentModel adapt(Directory directory, DocumentModel entry) throws DirectoryException; 044 045}