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 * $Id$
012 */
013
014package org.nuxeo.runtime.model;
015
016/**
017 * A component instance is a proxy to the component implementation object.
018 * <p>
019 * Component instance objects are created each time a component is activated, and destroyed at component deactivation.
020 *
021 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
022 */
023public interface ComponentInstance extends ComponentContext, Extensible, Adaptable {
024
025    /**
026     * Gets the actual component implementation instance.
027     *
028     * @return the component implementation instance
029     */
030    Object getInstance();
031
032    /**
033     * Gets the name of the component.
034     *
035     * @return the component name
036     */
037    ComponentName getName();
038
039    /**
040     * Gets the runtime context attached to this instance.
041     *
042     * @return the runtime context
043     */
044    RuntimeContext getContext();
045
046    /**
047     * Activates the implementation instance.
048     */
049    void activate();
050
051    /**
052     * Deactivates the implementation instance.
053     */
054    void deactivate();
055
056    /**
057     * Destroys this instance.
058     */
059    void destroy();
060
061    /**
062     * Reload the component. All the extensions and registries are reloaded.
063     */
064    void reload();
065
066    /**
067     * Gets the list of provided services, or null if no service is provided.
068     *
069     * @return an array containing the service class names or null if no service is provided
070     */
071    String[] getProvidedServiceNames();
072
073}