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 *     bstefanescu
011 *
012 * $Id$
013 */
014
015package org.nuxeo.runtime.api;
016
017/**
018 * A service provider.
019 * <p>
020 * A service provider is used by the framework to be able to change the way local services are found.
021 * <p>
022 * For example you may want to use a simple service provider for testing pourpose to avoid loading the nuxeo runtime
023 * framework to register services.
024 * <p>
025 * To set a service provider use: {@link DefaultServiceProvider#setProvider(ServiceProvider)}
026 *
027 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
028 */
029public interface ServiceProvider {
030
031    /**
032     * Gets the service instance given its API class.
033     */
034    <T> T getService(Class<T> serviceClass);
035
036}