001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 * $Id$
019 */
020
021package org.nuxeo.runtime.model;
022
023/**
024 * A component instance is a proxy to the component implementation object.
025 * <p>
026 * Component instance objects are created each time a component is activated, and destroyed at component deactivation.
027 *
028 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
029 */
030public interface ComponentInstance extends ComponentContext, Extensible, Adaptable {
031
032    /**
033     * Gets the actual component implementation instance.
034     *
035     * @return the component implementation instance
036     */
037    Object getInstance();
038
039    /**
040     * Gets the name of the component.
041     *
042     * @return the component name
043     */
044    ComponentName getName();
045
046    /**
047     * Gets the runtime context attached to this instance.
048     *
049     * @return the runtime context
050     */
051    RuntimeContext getContext();
052
053    /**
054     * Activates the implementation instance.
055     */
056    void activate();
057
058    /**
059     * Deactivates the implementation instance.
060     */
061    void deactivate();
062
063    /**
064     * Destroys this instance.
065     */
066    void destroy();
067
068    /**
069     * Reload the component. All the extensions and registries are reloaded.
070     */
071    void reload();
072
073    /**
074     * Gets the list of provided services, or null if no service is provided.
075     *
076     * @return an array containing the service class names or null if no service is provided
077     */
078    String[] getProvidedServiceNames();
079
080}