001/* 002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Nuxeo - initial API and implementation 011 * 012 */ 013 014package org.nuxeo.ecm.core.api.blobholder; 015 016import org.nuxeo.ecm.core.api.DocumentModel; 017import org.nuxeo.ecm.core.api.adapter.DocumentAdapterFactory; 018import org.nuxeo.runtime.api.Framework; 019 020/** 021 * {@link DocumentModel} adapter factory. Delegates calls to the {@link BlobHolderAdapterService} that management the 022 * pluggability for factories. 023 * 024 * @author tiry 025 */ 026public class BlobHolderAdapterFactory implements DocumentAdapterFactory { 027 028 protected static BlobHolderAdapterService bhas; 029 030 protected BlobHolderAdapterService getService() { 031 if (bhas == null) { 032 bhas = Framework.getLocalService(BlobHolderAdapterService.class); 033 } 034 return bhas; 035 } 036 037 @Override 038 public Object getAdapter(DocumentModel doc, Class itf) { 039 return getService().getBlobHolderAdapter(doc); 040 } 041 042}