Carsten Ziegeler | fc1e692 | 2015-02-05 09:41:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.apache.felix.scr; |
| 20 | |
| 21 | |
| 22 | import org.osgi.framework.ServiceReference; |
| 23 | |
| 24 | |
| 25 | /** |
| 26 | * The <code>Reference</code> interface represents a single reference (or |
| 27 | * dependency) to a service used by a Component. |
| 28 | * |
| 29 | * @deprecated Use the ServiceComponentRuntime service. |
| 30 | */ |
| 31 | @Deprecated |
| 32 | public interface Reference |
| 33 | { |
| 34 | |
| 35 | /** |
| 36 | * Returns the name of this Reference. This method provides access to the |
| 37 | * <code>name</code> attribute of the <code>referenec</code> element. |
| 38 | */ |
| 39 | String getName(); |
| 40 | |
| 41 | |
| 42 | /** |
| 43 | * Returns the name of the service used by this Reference. This method |
| 44 | * provides access to the <code>interface</code> attribute of the |
| 45 | * <code>reference</code> element. |
| 46 | */ |
| 47 | String getServiceName(); |
| 48 | |
| 49 | |
| 50 | /** |
| 51 | * Returns an array of references to the services bound to this Reference |
| 52 | * or <code>null</code> if no services are currently bound. |
| 53 | */ |
| 54 | ServiceReference[] getServiceReferences(); |
| 55 | |
| 56 | /** |
| 57 | * added by mistake. Use getServiceReferences(); |
| 58 | * @return |
| 59 | */ |
| 60 | @Deprecated |
| 61 | ServiceReference[] getBoundServiceReferences(); |
| 62 | |
| 63 | /** |
| 64 | * Returns whether this reference is satisified. A {@link #isOptional() optional} |
| 65 | * component is always satsified. Otherwise <code>true</code> is only |
| 66 | * returned if at least one service is bound. |
| 67 | */ |
| 68 | boolean isSatisfied(); |
| 69 | |
| 70 | |
| 71 | /** |
| 72 | * Returns whether this reference is optional. This method provides access |
| 73 | * to the lower bound of the <code>cardinality</code> attribute of the |
| 74 | * <code>reference</code> element. In other words, this method returns |
| 75 | * <code>true</code> if the cardinality is <em>0..1</em> or <em>0..n</em>. |
| 76 | */ |
| 77 | boolean isOptional(); |
| 78 | |
| 79 | |
| 80 | /** |
| 81 | * Returns whether this reference is multiple. This method provides access |
| 82 | * to the upper bound of the <code>cardinality</code> attribute of the |
| 83 | * <code>reference</code> element. In other words, this method returns |
| 84 | * <code>true</code> if the cardinality is <em>0..n</em> or <em>1..n</em>. |
| 85 | */ |
| 86 | boolean isMultiple(); |
| 87 | |
| 88 | |
| 89 | /** |
| 90 | * Returns <code>true</code> if the reference is defined with static policy. |
| 91 | * This method provides access to the <code>policy</code> element of the |
| 92 | * <code>reference</code> element. <code>true</code> is returned if the |
| 93 | * policy is defined as <em>static</em>. |
| 94 | */ |
| 95 | boolean isStatic(); |
| 96 | |
| 97 | /** |
| 98 | * Returns <code>true</code> if the reference is defined with reluctant |
| 99 | * policy option. This method provides access to the <code>policy-option</code> |
| 100 | * element of the <code>reference</code> element. <code>true</code> is |
| 101 | * returned if the policy option is defined as <em>reluctant</em> |
| 102 | * |
| 103 | * @since 1.7 |
| 104 | */ |
| 105 | boolean isReluctant(); |
| 106 | |
| 107 | /** |
| 108 | * Returns the value of the target property of this reference. Initially |
| 109 | * (without overwriting configuration) this method provides access to the |
| 110 | * <code>target</code> attribute of the <code>reference</code> element. If |
| 111 | * configuration overwrites the target property, this method returns the |
| 112 | * value of the Component property whose name is derived from the |
| 113 | * {@link #getName() reference name} plus the suffix <em>.target</em>. If |
| 114 | * no target property exists this method returns <code>null</code>. |
| 115 | */ |
| 116 | String getTarget(); |
| 117 | |
| 118 | |
| 119 | /** |
| 120 | * Returns the name of the method called if a service is being bound to |
| 121 | * the Component or <code>null</code> if no such method is configued. This |
| 122 | * method provides access to the <code>bind</code> attribute of the |
| 123 | * <code>reference</code> element. |
| 124 | */ |
| 125 | String getBindMethodName(); |
| 126 | |
| 127 | |
| 128 | /** |
| 129 | * Returns the name of the method called if a service is being unbound from |
| 130 | * the Component or <code>null</code> if no such method is configued. This |
| 131 | * method provides access to the <code>unbind</code> attribute of the |
| 132 | * <code>reference</code> element. |
| 133 | */ |
| 134 | String getUnbindMethodName(); |
| 135 | |
| 136 | |
| 137 | /** |
| 138 | * Returns the name of the method called if a bound service updates its |
| 139 | * service registration properties or <code>null</code> if no such method |
| 140 | * is configued. This method provides access to the <code>updated</code> |
| 141 | * attribute of the <code>reference</code> element. |
| 142 | * <p> |
| 143 | * For a component declared in a Declarative Services 1.0 and 1.1 |
| 144 | * descriptor, this method always returns <code>null</code>. |
| 145 | * |
| 146 | * @since 1.4 |
| 147 | */ |
| 148 | String getUpdatedMethodName(); |
| 149 | |
| 150 | } |