forgot to add this file in the previous commit
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@987874 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java
new file mode 100644
index 0000000..a8b59b0
--- /dev/null
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/LifecycleController.java
@@ -0,0 +1,76 @@
+package org.apache.felix.dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Injects a <code>Runnable</code> object in a Service for starting/stopping it programatically.
+ * By default, a Service is implicitly started when the service's bundle is started and when
+ * all required dependencies are satisfied. However, it is sometimes required to programatically
+ * take control of when the service started or stopped. In this case, the injected <code>Runnable</code>
+ * can be invoked in order to start (and eventually register) a Service at any time. When this annotation
+ * is used, then the Service on which this annotation is applied is not provided once the Service is ready,
+ * as it is the case by default and you have to call the injected Runnable yourself.
+ * <p>
+ * <h3>Usage Examples</h3>
+ * <blockquote>
+ *
+ * <pre>
+ * /**
+ * * This Service will be registered programatically into the OSGi registry, using the publisher attribute.
+ * */
+ * @Service
+ * class X implements Z {
+ * @LifecycleController
+ * Runnable m_starter
+ *
+ * @Init
+ * void init() {
+ * // Our component won't be started by default once the bundle is started and when all
+ * // required dependencies are injected. Our Component will be registered only when we
+ * // decide to invoke the Runnable injected by the LifecycleController annotation.
+ * }
+ *
+ * public void registerServiceWheneverIWant() {
+ * m_starter.run(); // start our component.
+ * }
+ *
+ * public void start() {
+ * // This method will be called after we invoke our m_starter Runnable.
+ * }
+ * }
+ * </pre>
+ * </blockquote>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface LifecycleController
+{
+ /**
+ * Specify the action to be performed when the Injected runnable is invoked. By default, the
+ * Runnable will fire a Service Component activation, when invoked. If you specify this attribute
+ * to false, then the Service Component will be stopped, when the runnable is invoked.
+ */
+ public boolean start() default true;
+}