Richard S. Hall | 7fa1415 | 2006-06-14 15:22:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2006 The Apache Software Foundation |
| 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.apache.felix.ipojo; |
| 18 | |
| 19 | import org.apache.felix.ipojo.metadata.Element; |
| 20 | |
| 21 | /** |
| 22 | * Handler Interface. |
| 23 | * An handler need implements tese method to be notifed of lifecycle change, getfield operation and putfield operation |
| 24 | * @author Clement Escoffier |
| 25 | */ |
| 26 | public interface Handler { |
| 27 | |
| 28 | /** |
| 29 | * Configure the handler. |
| 30 | * @param cm : the component manager |
| 31 | * @param metadata : the metadata of the component |
| 32 | */ |
| 33 | void configure(ComponentManager cm, Element metadata); |
| 34 | |
| 35 | /** |
| 36 | * Stop the handler : stop the management. |
| 37 | */ |
| 38 | void stop(); |
| 39 | |
| 40 | /** |
| 41 | * Start the handler : start the management. |
| 42 | */ |
| 43 | void start(); |
| 44 | |
| 45 | /** |
| 46 | * This method is called when a PUTFIELD operation is detected. |
| 47 | * @param fieldName : the field name |
| 48 | * @param value : the value passed to the field |
| 49 | */ |
| 50 | void setterCallback(String fieldName, Object value); |
| 51 | |
| 52 | /** |
| 53 | * This method is called when a GETFIELD operation is detected. |
| 54 | * @param fieldName : the field name |
| 55 | * @param value : the value passed to the field (by the previous handler) |
| 56 | * @return : the managed value of the field |
| 57 | */ |
| 58 | Object getterCallback(String fieldName, Object value); |
| 59 | |
| 60 | /** |
| 61 | * Is the actual state valid for this handler ? |
| 62 | * @return true is the state seems valid for the handler |
| 63 | */ |
| 64 | boolean isValid(); |
| 65 | |
| 66 | /** |
| 67 | * This method is called when the component state changed. |
| 68 | * @param state : the new state |
| 69 | */ |
| 70 | void stateChanged(int state); |
| 71 | |
| 72 | } |