Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +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 | */ |
Carsten Ziegeler | ba751bd | 2009-04-18 18:31:43 +0000 | [diff] [blame] | 19 | package org.apache.felix.scr.annotations; |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 20 | |
Carsten Ziegeler | b5618fe | 2009-03-31 17:18:17 +0000 | [diff] [blame] | 21 | import java.lang.annotation.*; |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 22 | |
| 23 | /** |
| 24 | * The <code>Component</code> annotation is the only required annotation. If |
| 25 | * this annotation is not declared in a Java class, the class is not declared as |
| 26 | * a component. |
| 27 | * <p> |
| 28 | * This annotation is used to declare the <component> element of the |
| 29 | * component declaration. See section 112.4.3, Component Element, in the OSGi |
| 30 | * Service Platform Service Compendium Specification for more information. The |
| 31 | * required <implementation> element is automatically generated with the |
| 32 | * fully qualified name of the class containing the <code>Component</code> |
| 33 | * annotation. |
| 34 | * </p> |
| 35 | */ |
| 36 | @Target(ElementType.TYPE) |
Carsten Ziegeler | 1993d10 | 2009-04-07 16:16:47 +0000 | [diff] [blame] | 37 | @Retention(RetentionPolicy.SOURCE) |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 38 | public @interface Component { |
| 39 | |
| 40 | /** |
| 41 | * Defines the Component name also used as the PID for the Configuration |
| 42 | * Admin Service. Default value: Fully qualified name of the Java class. |
| 43 | */ |
| 44 | String name() default ""; |
| 45 | |
| 46 | /** |
| 47 | * This is generally used as a title for the object described by the meta |
| 48 | * type. This name may be localized by prepending a % sign to the name. |
| 49 | * Default value: %<name>.name |
| 50 | */ |
| 51 | String label() default ""; |
| 52 | |
| 53 | /** |
| 54 | * This is generally used as a description for the object described by the |
| 55 | * meta type. This name may be localized by prepending a % sign to the name. |
Carsten Ziegeler | 27764de | 2009-04-16 09:39:33 +0000 | [diff] [blame] | 56 | * Default value: %<name>.description |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 57 | */ |
| 58 | String description() default ""; |
| 59 | |
| 60 | /** |
| 61 | * Whether the component is enabled when the bundle starts. |
| 62 | */ |
| 63 | boolean enabled() default true; |
| 64 | |
| 65 | /** |
| 66 | * Whether the component is a factory component. |
| 67 | */ |
| 68 | String factory() default ""; |
| 69 | |
| 70 | /** |
| 71 | * Whether the component is immediately activated. |
| 72 | */ |
| 73 | boolean immediate() default false; |
| 74 | |
| 75 | /** |
| 76 | * Whether any service, property and reference declarations from base |
| 77 | * classes should be inherited by this class. |
| 78 | */ |
| 79 | boolean inherit() default true; |
| 80 | |
| 81 | /** |
| 82 | * Whether Metatype Service data is generated or not. If this parameter is |
Carsten Ziegeler | be62240 | 2009-04-07 15:18:01 +0000 | [diff] [blame] | 83 | * set to true Metatype Service data is generated in the |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 84 | * <code>metatype.xml</code> file for this component. Otherwise no Metatype |
| 85 | * Service data is generated for this component. |
| 86 | */ |
Carsten Ziegeler | ea39fc5 | 2009-04-06 19:00:14 +0000 | [diff] [blame] | 87 | boolean metatype() default false; |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 88 | |
| 89 | /** |
| 90 | * This marks an abstract service description which is not added to the |
| 91 | * descriptor but intended for reuse through inheritance. This attribute |
| 92 | * defaults to true for abstract classes and false for concrete classes. |
| 93 | */ |
| 94 | boolean componentAbstract() default false; |
| 95 | |
| 96 | /** |
| 97 | * Whether Declarative Services descriptor is generated or not. If this |
| 98 | * parameter is not set or set to true the Declarative Services descriptor |
| 99 | * is generated in the service descriptor file for this component. Otherwise |
| 100 | * no Declarative Services descriptor is generated for this component. |
| 101 | */ |
| 102 | boolean ds() default true; |
| 103 | |
| 104 | /** |
| 105 | * Generated <code>service.pid</code> property by default, if none declared |
| 106 | * explicitly. |
| 107 | */ |
| 108 | boolean createPid() default true; |
| 109 | |
Carsten Ziegeler | 6e0c933 | 2009-06-12 16:05:22 +0000 | [diff] [blame] | 110 | /** |
| 111 | * The configuration policy |
| 112 | * @since 1.0 |
| 113 | */ |
| 114 | ConfigurationPolicy policy() default ConfigurationPolicy.OPTIONAL; |
Carsten Ziegeler | 5de92da | 2009-03-31 17:12:40 +0000 | [diff] [blame] | 115 | } |