001/* 002 * (C) Copyright 2006-2018 Nuxeo (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 */ 019 020package org.nuxeo.runtime.model; 021 022/** 023 * A component instance is a proxy to the component implementation object. 024 * <p> 025 * Component instance objects are created each time a component is activated, and destroyed at component deactivation. 026 * 027 * @author <a href="mailto:[email protected]">Bogdan Stefanescu</a> 028 */ 029public interface ComponentInstance extends ComponentContext, Extensible, Adaptable { 030 031 /** 032 * Gets the actual component implementation instance. 033 * 034 * @return the component implementation instance 035 */ 036 Object getInstance(); 037 038 /** 039 * Gets the name of the component. 040 * 041 * @return the component name 042 */ 043 ComponentName getName(); 044 045 /** 046 * Gets the runtime context attached to this instance. 047 * 048 * @return the runtime context 049 */ 050 RuntimeContext getContext(); 051 052 /** 053 * Activates the implementation instance. 054 */ 055 void activate(); 056 057 /** 058 * Starts the implementation instance. 059 * 060 * @since 9.3 061 */ 062 void start(); 063 064 /** 065 * Stops the implementation instance. 066 * 067 * @since 9.3 068 */ 069 void stop() throws InterruptedException; 070 071 /** 072 * Deactivates the implementation instance. 073 */ 074 void deactivate(); 075 076 /** 077 * Destroys this instance. 078 */ 079 void destroy(); 080 081 /** 082 * Reload the component. All the extensions and registries are reloaded. 083 * 084 * @deprecated since 9.3, but in fact since 5.6, only usage in 085 * {@link org.nuxeo.runtime.model.impl.RegistrationInfoImpl} 086 */ 087 @Deprecated 088 void reload(); 089 090 /** 091 * Gets the list of provided services, or null if no service is provided. 092 * 093 * @return an array containing the service class names or null if no service is provided 094 */ 095 String[] getProvidedServiceNames(); 096 097 /** 098 * Gets the Registration Info 099 * 100 * @return the registration info 101 * @since 10.3 102 */ 103 RegistrationInfo getRegistrationInfo(); 104 105}