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 * Starts the implementation instance. 060 * 061 * @since 9.3 062 */ 063 void start(); 064 065 /** 066 * Stops the implementation instance. 067 * 068 * @since 9.3 069 */ 070 void stop() throws InterruptedException; 071 072 /** 073 * Deactivates the implementation instance. 074 */ 075 void deactivate(); 076 077 /** 078 * Destroys this instance. 079 */ 080 void destroy(); 081 082 /** 083 * Reload the component. All the extensions and registries are reloaded. 084 * 085 * @deprecated since 9.3, but in fact since 5.6, only usage in 086 * {@link org.nuxeo.runtime.model.impl.RegistrationInfoImpl} 087 */ 088 @Deprecated 089 void reload(); 090 091 /** 092 * Gets the list of provided services, or null if no service is provided. 093 * 094 * @return an array containing the service class names or null if no service is provided 095 */ 096 String[] getProvidedServiceNames(); 097 098}