Author: pderop
Date: Tue Jun 7 11:40:01 2011
New Revision: 1132960
URL: http://svn.apache.org/viewvc?rev=1132960&view=rev
Log:
fixed some javadocs
Modified:
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Inject.java
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Property.java
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Registered.java
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Start.java
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Unregistered.java
Modified:
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Inject.java
URL:
http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Inject.java?rev=1132960&r1=1132959&r2=1132960&view=diff
==============================================================================
---
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Inject.java
(original)
+++
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Inject.java
Tue Jun 7 11:40:01 2011
@@ -27,11 +27,51 @@ import java.lang.annotation.Target;
* Inject classes in a component instance field.
* The following injections are currently performed, depending on the type of
the
* field this annotation is applied on:
- * <dl>
- * <dt>BundleContext</dt><dd>the bundle context of the bundle</dd>
- * <dt>DependencyManager</dt><dd>the dependency manager instance</dd>
- * <dt>Component</dt><dd>the component instance of the dependency manager</dd>
- * </dl>
+ * <ul>
+ * <li>BundleContext: the bundle context of the bundle
+ * <li>DependencyManager: the dependency manager instance
+ * <li>Component: the component instance of the dependency manager
+ * </ul>
+ *
+ * <p>
+ * <h3>Usage Examples</h3>
+ * <blockquote>
+ *
+ * <pre>
+ * @Component
+ * class X implements Z {
+ * @Inject
+ * BundleContext bundleContext;
+ *
+ * @Inject
+ * Component component;
+ *
+ * @Inject
+ * DependencyManager manager;
+ *
+ * OtherService otherService;
+ *
+ * @Init
+ * void init() {
+ * System.out.println("Bundle Context: " + bundleContext);
+ * System.out.println("Manager: " + manager);
+ *
+ * // Use DM API for defining an extra service dependency
+ * componnent.add(manager.createServiceDependency()
+ * .setService(OtherService.class)
+ * .setRequired(true)
+ * .setInstanceBound(true));
+ * }
+ *
+ * @Start
+ * void start() {
+ * System.out.println("OtherService: " + otherService);
+ * }
+ * }
+ * </pre>
+ * </blockquote>
+ *
+ * @author <a href="mailto:[email protected]">Felix Project Team</a>
*/
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.FIELD)
Modified:
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Property.java
URL:
http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Property.java?rev=1132960&r1=1132959&r2=1132960&view=diff
==============================================================================
---
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Property.java
(original)
+++
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Property.java
Tue Jun 7 11:40:01 2011
@@ -26,6 +26,11 @@ import java.lang.annotation.Target;
/**
* Annotation used to describe a property key-value pair. It is used when
* declaring {@link Component#properties()} attribute.
+ * This annotation only support properties which type is either a
+ * String, or a String array.
+ * If you need to specify some properties with types other than Strings,
+ * then use the {@link Start} annotation, which allows to annotate a
<code>start</code>
+ * method which may optionally return a Map of any service property types.
*
* @author <a href="mailto:[email protected]">Felix Project Team</a>
*/
@@ -46,7 +51,7 @@ public @interface Property
String value() default "";
/**
- * Returns the property values as a String array).
+ * Returns the property value as a String array.
* @return this property value as a String array
*/
String[] values() default {};
Modified:
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Registered.java
URL:
http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Registered.java?rev=1132960&r1=1132959&r2=1132960&view=diff
==============================================================================
---
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Registered.java
(original)
+++
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Registered.java
Tue Jun 7 11:40:01 2011
@@ -29,6 +29,26 @@ import java.lang.annotation.Target;
* When a service is registered, the ServiceRegistration used to register the
service is
* also passed to the method (if it takes a ServiceRegistration as parameter).
*
+ * <p>
+ * <h3>Usage Examples</h3>
+ * <blockquote>
+ *
+ * <pre>
+ * @Component
+ * class X implements Z {
+ * @Start
+ * void start() {
+ * // Our Z Service is about to be registered into the OSGi registry.
+ * }
+ *
+ * @Registered
+ * void registered(ServiceRegistration sr) {
+ * // At this point, our service has been registered into the registry.
+ * }
+ * }
+ * </pre>
+ * </blockquote>
+ *
* @author <a href="mailto:[email protected]">Felix Project Team</a>
*/
@Retention(RetentionPolicy.CLASS)
Modified:
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Start.java
URL:
http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Start.java?rev=1132960&r1=1132959&r2=1132960&view=diff
==============================================================================
---
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Start.java
(original)
+++
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Start.java
Tue Jun 7 11:40:01 2011
@@ -45,7 +45,10 @@ import java.lang.annotation.Target;
* // Our Z Service is ready (all required dependencies have been
satisfied), and is about to be
* // registered into the OSGi registry. We return here an optional
Map containing some extra-properties
* // which will be appended to the properties supplied in the
Component annotation.
- * return new HashMap() {{ put("foo2", "bar2"); }};
+ * return new HashMap() {{
+ * put("foo2", "bar2");
+ * put(Constants.SERVICE_RANKING, Integer.valueOf(10));
+ * }};
* }
* }
* </pre>
Modified:
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Unregistered.java
URL:
http://svn.apache.org/viewvc/felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Unregistered.java?rev=1132960&r1=1132959&r2=1132960&view=diff
==============================================================================
---
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Unregistered.java
(original)
+++
felix/trunk/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/Unregistered.java
Tue Jun 7 11:40:01 2011
@@ -28,6 +28,26 @@ import java.lang.annotation.Target;
* At this point, the component has been unregistered from the OSGI registry
(if it provides some services).
* The method must not take any parameters.
*
+ * <p>
+ * <h3>Usage Examples</h3>
+ * <blockquote>
+ *
+ * <pre>
+ * @Component
+ * class X implements Z {
+ * @Stop
+ * void stop(ServiceRegistration sr) {
+ * // Our service must stop because it is about to be unregistered from
the registry.
+ * }
+ *
+ * @Unregistered
+ * void unregistered() {
+ * // At this point, our service has been unregistered from the OSGi
registry
+ * }
+ * }
+ * </pre>
+ * </blockquote>
+ *
* @author <a href="mailto:[email protected]">Felix Project Team</a>
*/
@Retention(RetentionPolicy.CLASS)