Stuart McCulloch | 26e7a5a | 2011-10-17 10:31:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) OSGi Alliance (2011). 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.annotations; |
| 18 | |
| 19 | /** |
| 20 | * Policy for the {@link Reference} annotation. |
| 21 | * |
| 22 | * @version $Id$ |
| 23 | */ |
| 24 | public enum ReferencePolicy { |
| 25 | /** |
| 26 | * The static policy is the most simple policy and is the default policy. A |
| 27 | * component instance never sees any of the dynamics. Component |
| 28 | * configurations are deactivated before any bound service for a reference |
| 29 | * having a static policy becomes unavailable. If a target service is |
| 30 | * available to replace the bound service which became unavailable, the |
| 31 | * component configuration must be reactivated and bound to the replacement |
| 32 | * service. |
| 33 | */ |
| 34 | STATIC, |
| 35 | /** |
| 36 | * The dynamic policy is slightly more complex since the component |
| 37 | * implementation must properly handle changes in the set of bound services. |
| 38 | * With the dynamic policy, SCR can change the set of bound services without |
| 39 | * deactivating a component configuration. If the component uses the event |
| 40 | * strategy to access services, then the component instance will be notified |
| 41 | * of changes in the set of bound services by calls to the bind and unbind |
| 42 | * methods. |
| 43 | */ |
| 44 | DYNAMIC; |
| 45 | } |