David Jencks | 9c8e4b1 | 2014-11-21 22:13:59 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) OSGi Alliance (2004, 2013). All Rights Reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.osgi.service.component; |
| 18 | |
| 19 | import org.osgi.annotation.versioning.ProviderType; |
| 20 | |
| 21 | /** |
| 22 | * A ComponentInstance encapsulates a component instance of an activated |
| 23 | * component configuration. ComponentInstances are created whenever a component |
| 24 | * configuration is activated. |
| 25 | * |
| 26 | * <p> |
| 27 | * ComponentInstances are never reused. A new ComponentInstance object will be |
| 28 | * created when the component configuration is activated again. |
| 29 | * |
| 30 | * @ThreadSafe |
| 31 | * @author $Id: 8078babdd771f18831a54bfaa407e4edd2781552 $ |
| 32 | */ |
| 33 | @ProviderType |
| 34 | public interface ComponentInstance { |
| 35 | /** |
| 36 | * Dispose of the component configuration for this component instance. The |
| 37 | * component configuration will be deactivated. If the component |
| 38 | * configuration has already been deactivated, this method does nothing. |
| 39 | */ |
| 40 | public void dispose(); |
| 41 | |
| 42 | /** |
| 43 | * Returns the component instance of the activated component configuration. |
| 44 | * |
| 45 | * @return The component instance or {@code null} if the component |
| 46 | * configuration has been deactivated. |
| 47 | */ |
| 48 | public Object getInstance(); |
| 49 | } |