blob: 6efb36975d438a7a9eff914cbc7c324e3b07a818 [file] [log] [blame]
Carsten Ziegeler5de92da2009-03-31 17:12:40 +00001/*
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 Ziegelerba751bd2009-04-18 18:31:43 +000019package org.apache.felix.scr.annotations;
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000020
Carsten Ziegelerb5618fe2009-03-31 17:18:17 +000021import java.lang.annotation.*;
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000022
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 &lt;component&gt; 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 &lt;implementation&gt; 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 Ziegeler1993d102009-04-07 16:16:47 +000037@Retention(RetentionPolicy.SOURCE)
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000038public @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: %&lt;name&gt;.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 Ziegeler27764de2009-04-16 09:39:33 +000056 * Default value: %&lt;name&gt;.description
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000057 */
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 Ziegelerbe622402009-04-07 15:18:01 +000083 * set to true Metatype Service data is generated in the
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000084 * <code>metatype.xml</code> file for this component. Otherwise no Metatype
85 * Service data is generated for this component.
86 */
Carsten Ziegelerea39fc52009-04-06 19:00:14 +000087 boolean metatype() default false;
Carsten Ziegeler5de92da2009-03-31 17:12:40 +000088
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 Ziegeler6e0c9332009-06-12 16:05:22 +0000110 /**
111 * The configuration policy
112 * @since 1.0
113 */
114 ConfigurationPolicy policy() default ConfigurationPolicy.OPTIONAL;
Carsten Ziegeler5de92da2009-03-31 17:12:40 +0000115}