Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +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 | */ |
Marcel Offermans | 8b93efa | 2010-07-02 18:27:21 +0000 | [diff] [blame] | 19 | package org.apache.felix.dm; |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 20 | |
Marcel Offermans | a8c213f | 2010-07-02 17:27:20 +0000 | [diff] [blame] | 21 | import java.net.URL; |
| 22 | |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 23 | |
Marcel Offermans | faaed47 | 2010-09-08 10:07:32 +0000 | [diff] [blame] | 24 | public interface ResourceDependency extends Dependency, ComponentDependencyDeclaration, ResourceHandler { |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 25 | /** |
| 26 | * Sets the callbacks for this service. These callbacks can be used as hooks whenever a |
| 27 | * dependency is added or removed. When you specify callbacks, the auto configuration |
| 28 | * feature is automatically turned off, because we're assuming you don't need it in this |
| 29 | * case. |
| 30 | * |
| 31 | * @param added the method to call when a service was added |
| 32 | * @param removed the method to call when a service was removed |
| 33 | * @return this service dependency |
| 34 | */ |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 35 | public ResourceDependency setCallbacks(String added, String removed) ; |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Sets the callbacks for this service. These callbacks can be used as hooks whenever a |
| 39 | * dependency is added, changed or removed. When you specify callbacks, the auto |
| 40 | * configuration feature is automatically turned off, because we're assuming you don't |
| 41 | * need it in this case. |
| 42 | * |
| 43 | * @param added the method to call when a service was added |
| 44 | * @param changed the method to call when a service was changed |
| 45 | * @param removed the method to call when a service was removed |
| 46 | * @return this service dependency |
| 47 | */ |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 48 | public ResourceDependency setCallbacks(String added, String changed, String removed); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Sets the callbacks for this service. These callbacks can be used as hooks whenever a |
| 52 | * dependency is added or removed. They are called on the instance you provide. When you |
| 53 | * specify callbacks, the auto configuration feature is automatically turned off, because |
| 54 | * we're assuming you don't need it in this case. |
| 55 | * |
| 56 | * @param instance the instance to call the callbacks on |
| 57 | * @param added the method to call when a service was added |
| 58 | * @param removed the method to call when a service was removed |
| 59 | * @return this service dependency |
| 60 | */ |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 61 | public ResourceDependency setCallbacks(Object instance, String added, String removed); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * Sets the callbacks for this service. These callbacks can be used as hooks whenever a |
| 65 | * dependency is added, changed or removed. They are called on the instance you provide. When you |
| 66 | * specify callbacks, the auto configuration feature is automatically turned off, because |
| 67 | * we're assuming you don't need it in this case. |
| 68 | * |
| 69 | * @param instance the instance to call the callbacks on |
| 70 | * @param added the method to call when a service was added |
| 71 | * @param changed the method to call when a service was changed |
| 72 | * @param removed the method to call when a service was removed |
| 73 | * @return this service dependency |
| 74 | */ |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 75 | public ResourceDependency setCallbacks(Object instance, String added, String changed, String removed); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 76 | |
| 77 | /** |
| 78 | * Sets auto configuration for this service. Auto configuration allows the |
| 79 | * dependency to fill in any attributes in the service implementation that |
| 80 | * are of the same type as this dependency. Default is on. |
| 81 | * |
| 82 | * @param autoConfig the value of auto config |
| 83 | * @return this service dependency |
| 84 | */ |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 85 | public ResourceDependency setAutoConfig(boolean autoConfig); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * Sets auto configuration for this service. Auto configuration allows the |
| 89 | * dependency to fill in the attribute in the service implementation that |
| 90 | * has the same type and instance name. |
| 91 | * |
| 92 | * @param instanceName the name of attribute to auto config |
| 93 | * @return this service dependency |
| 94 | */ |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 95 | public ResourceDependency setAutoConfig(String instanceName); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 96 | |
Marcel Offermans | a8c213f | 2010-07-02 17:27:20 +0000 | [diff] [blame] | 97 | public ResourceDependency setResource(URL resource); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 98 | |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 99 | public ResourceDependency setRequired(boolean required); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 100 | |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 101 | public ResourceDependency setFilter(String resourceFilter); |
Marcel Offermans | d403a1d | 2009-12-10 09:57:06 +0000 | [diff] [blame] | 102 | |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 103 | public ResourceDependency setPropagate(boolean propagate); |
| 104 | |
Marcel Offermans | 26081d3 | 2010-07-12 12:43:42 +0000 | [diff] [blame] | 105 | public ResourceDependency setPropagate(Object instance, String method); |
| 106 | |
Marcel Offermans | a564b3a | 2010-03-20 20:19:15 +0000 | [diff] [blame] | 107 | public ResourceDependency setInstanceBound(boolean isInstanceBound); |
Pierre De Rop | ddce586 | 2009-12-04 22:16:48 +0000 | [diff] [blame] | 108 | } |