felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1587054 [1/3] - in /felix/sandbox/pderop/dependencymanager-prototype/dm.annotations: ./ .settings/ generated/ src/ src/dm/ src/dm/annotation/ src/dm/annotation/api/ src/dm/annotation/plugin/ src/dm/annotation/plugin/bnd/
Date Sun, 13 Apr 2014 17:23:52 GMT
Author: pderop
Date: Sun Apr 13 17:23:51 2014
New Revision: 1587054

URL: http://svn.apache.org/r1587054
Log:
Added DM annotations api, as well as the annotation bnd plugin. For now, the maven plugin has not been added

Added:
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.classpath   (with props)
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.gitignore
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.project   (with props)
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.settings/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.settings/org.eclipse.jdt.core.prefs
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/bnd.bnd
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/build.xml   (with props)
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/.index   (with props)
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/buildfiles
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/dm.annotations.jar   (with props)
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/.gitignore
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AdapterService.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AspectService.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleAdapterService.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleDependency.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Component.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Composition.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ConfigurationDependency.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Destroy.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/FactoryConfigurationAdapterService.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Init.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Inject.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/LifecycleController.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Property.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/PropertyMetaData.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Registered.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ResourceAdapterService.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ResourceDependency.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ServiceDependency.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Start.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Stop.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Unregistered.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/packageinfo
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/AnnotationCollector.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/AnnotationPlugin.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/BndLogger.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/DescriptorGenerator.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/EntryParam.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/EntryType.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/EntryWriter.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/Logger.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/MetaType.java
    felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/plugin/bnd/Patterns.java

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.classpath
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.classpath?rev=1587054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.classpath
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.gitignore
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.gitignore?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.gitignore (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.gitignore Sun Apr 13 17:23:51 2014
@@ -0,0 +1,3 @@
+/generated/
+/bin/
+/bin_test/

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.project
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.project?rev=1587054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.project
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.settings/org.eclipse.jdt.core.prefs?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.settings/org.eclipse.jdt.core.prefs (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/.settings/org.eclipse.jdt.core.prefs Sun Apr 13 17:23:51 2014
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/bnd.bnd?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/bnd.bnd (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/bnd.bnd Sun Apr 13 17:23:51 2014
@@ -0,0 +1,10 @@
+Bundle-Version:0.0.0.${tstamp}
+-buildpath: \
+	osgi.core;version=4.2,\
+	biz.aQute.bndlib;version=2.2,\
+	de.twentyeleven.skysail.org.json-osgi;version=20080701.0
+Private-Package: \
+	dm.annotation.plugin.bnd, \
+	org.json.*
+Export-Package: \
+	dm.annotation.api

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/build.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/build.xml?rev=1587054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/build.xml
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/.index
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/.index?rev=1587054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/.index
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/buildfiles
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/buildfiles?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/buildfiles (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/buildfiles Sun Apr 13 17:23:51 2014
@@ -0,0 +1 @@
+/home/nxuser/work/osgi/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/dm.annotations.jar

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/dm.annotations.jar
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/dm.annotations.jar?rev=1587054&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/generated/dm.annotations.jar
------------------------------------------------------------------------------
    svn:mime-type = application/zip

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/.gitignore
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/.gitignore?rev=1587054&view=auto
==============================================================================
    (empty)

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AdapterService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AdapterService.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AdapterService.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AdapterService.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotates an Adapater service. Adapters, like {@link AspectService}, are used to "extend" 
+ * existing services, and can publish different services based on the existing one. 
+ * An example would be implementing a management interface for an existing service, etc .... 
+ * <p>When you annotate an adapter class with the <code>@AdapterService</code> annotation, it will be applied 
+ * to any service that matches the implemented interface and filter. The adapter will be registered 
+ * with the specified interface and existing properties from the original service plus any extra 
+ * properties you supply here. If you declare the original service as a member it will be injected.
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> Here, the AdapterService is registered into the OSGI registry each time an AdapteeService
+ * is found from the registry. The AdapterImpl class adapts the AdapteeService to the AdapterService.
+ * The AdapterService will also have a service property (param=value), and will also include eventual
+ * service properties found from the AdapteeService:<p>
+ * <blockquote>
+ * <pre>
+ * 
+ * &#64;AdapterService(adapteeService = AdapteeService.class, properties={&#64;Property(name="param", value="value")})
+ * class AdapterImpl implements AdapterService {
+ *     // The service we are adapting (injected by reflection)
+ *     protected AdapteeService adaptee;
+ *   
+ *     public void doWork() {
+ *        adaptee.mehod1();
+ *        adaptee.method2();
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface AdapterService
+{
+    /**
+     * Sets the adapter service interface(s). By default, the directly implemented interface(s) is (are) used.
+     */
+    Class<?>[] provides() default {};
+
+    /**
+     * Sets some additional properties to use with the adapter service registration. By default, 
+     * the adapter will inherit all adaptee service properties.
+     */
+    Property[] properties() default {};
+
+    /**
+     * Sets the adaptee service interface this adapter is applying to.
+     */
+    Class<?> adapteeService();
+    
+    /**
+     * Sets the filter condition to use with the adapted service interface.
+     */
+    String adapteeFilter() default "";
+    
+    /**
+     * Sets the static method used to create the adapter service implementation instance.
+     * By default, the default constructor of the annotated class is used.
+     */
+    String factoryMethod() default "";
+    
+    /**
+     * Sets the field name where to inject the original service. By default, the original service is injected
+     * in any attributes in the aspect implementation that are of the same type as the aspect interface.
+     */
+    String field() default "";
+    
+    /**
+     * The callback method to be invoked when the original service is available. This attribute can't be mixed with
+     * the field attribute.
+     */
+    String added() default "";
+
+    /**
+     * The callback method to be invoked when the original service properties have changed. When this attribute is used, 
+     * then the added attribute must also be used.
+     */
+    String changed() default "";
+
+    /**
+     * name of the callback method to invoke on swap.
+     */
+    String swap() default "";
+
+    /**
+     * The callback method to invoke when the service is lost. When this attribute is used, then the added attribute 
+     * must also be used.
+     */
+    String removed() default "";
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AspectService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AspectService.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AspectService.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/AspectService.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotates an Aspect service. Aspects allow you to define an interceptor, or chain of interceptors 
+ * for a service (to add features like caching or logging, etc ...). The dependency manager intercepts 
+ * the original service, and allows you to execute some code before invoking the original service ...
+ * The aspect will be applied to any service that matches the specified interface and filter and 
+ * will be registered with the same interface and properties as the original service, plus any 
+ * extra properties you supply here. It will also inherit all dependencies, 
+ * and if you declare the original service as a member it will be injected.<p>
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> Here, the AspectService is registered into the OSGI registry each time an InterceptedService
+ * is found from the registry. The AspectService class intercepts the InterceptedService, and decorates
+ * its "doWork()" method. This aspect uses a rank with value "10", meaning that it will intercept some
+ * other eventual aspects with lower ranks. The Aspect also uses a service property (param=value), and 
+ * include eventual service properties found from the InterceptedService:<p>
+ * <blockquote>
+ * <pre>
+ * 
+ * &#64;AspectService(ranking=10), properties={&#64;Property(name="param", value="value")})
+ * class AspectService implements InterceptedService {
+ *     // The service we are intercepting (injected by reflection)
+ *     protected InterceptedService intercepted;
+ *   
+ *     public void doWork() {
+ *        intercepted.doWork();
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface AspectService
+{
+    /**
+     * Sets the service interface to apply the aspect to. By default, the directly implemented interface is used.
+     */
+    Class<?> service() default Object.class;
+
+    /**
+     * Sets the filter condition to use with the service interface this aspect is applying to.
+     */
+    String filter() default "";
+    
+    /**
+     * Sets Additional properties to use with the aspect service registration
+     */
+    Property[] properties() default {};
+    
+    /**
+     * Sets the ranking of this aspect. Since aspects are chained, the ranking defines the order in which they are chained.
+     * Chain ranking is implemented as a service ranking so service lookups automatically retrieve the top of the
+     * chain.
+     */
+    int ranking();
+    
+    /**
+     * Sets the field name where to inject the original service. By default, the original service is injected
+     * in any attributes in the aspect implementation that are of the same type as the aspect interface.
+     */
+    String field() default "";
+    
+    /**
+     * The callback method to be invoked when the original service is available. This attribute can't be mixed with
+     * the field attribute.
+     */
+    String added() default "";
+
+    /**
+     * The callback method to be invoked when the original service properties have changed. When this attribute is used, 
+     * then the added attribute must also be used.
+     */
+    String changed() default "";
+
+    /**
+     * The callback method to invoke when the service is lost. When this attribute is used, then the added attribute 
+     * must also be used.
+     */
+    String removed() default "";
+    
+    /**
+     * name of the callback method to invoke on swap.
+     */
+    String swap() default "";
+
+    /**
+     * Sets the static method used to create the AspectService implementation instance. The
+     * default constructor of the annotated class is used. The factoryMethod can be used to provide a specific
+     * aspect implements, like a DynamicProxy.
+     */
+    String factoryMethod() default "";
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleAdapterService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleAdapterService.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleAdapterService.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleAdapterService.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * Annotates a bundle adapter service class. Bundle adapters are similar to {@link AdapterService},
+ * but instead of adapting a service, they adapt a bundle with a certain set of states (STARTED|INSTALLED|...),
+ * and provide a service on top of it. <p>
+ * The bundle adapter will be applied to any bundle that matches the specified bundle state mask and 
+ * filter conditions, which may match some of the bundle OSGi manifest headers. For each matching 
+ * bundle an adapter will be created based on the adapter implementation class. The adapter will be 
+ * registered with the specified interface and with service properties found from the original bundle
+ * OSGi manifest headers plus any extra properties you supply here.
+ * If you declare the original bundle as a member it will be injected.
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> In the following example, a "VideoPlayer" Service is registered into the OSGi registry each time
+ * an active bundle containing a "Video-Path" manifest header is detected:
+ * <p>
+ * <blockquote>
+ * <pre>
+ * &#64;BundleAdapterService(filter = "(Video-Path=*)", stateMask = Bundle.ACTIVE, propagate=true)
+ * public class VideoPlayerImpl implements VideoPlayer {
+ *     Bundle bundle; // Injected by reflection
+ *     
+ *     void play() {
+ *         URL mpegFile = bundle.getEntry(bundle.getHeaders().get("Video-Path"));
+ *         // play the video provided by the bundle ...
+ *     }
+ *     
+ *     void stop() {}
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public @Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+@interface BundleAdapterService
+{
+    /**
+     * The interface(s) to use when registering adapters. By default, the interface(s) directly implemented
+     * by the annotated class is (are) used.
+     */
+    Class<?>[] provides() default {};
+    
+    /**
+     * Additional properties to use with the service registration
+     */
+    Property[] properties() default {};
+    
+   /**
+     * The filter used to match a given bundle.
+     */
+    String filter();
+    
+    /**
+     * the bundle state mask to apply
+     */
+    int stateMask() default Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE;
+    
+    /**
+     * Specifies if manifest headers from the bundle should be propagated to the service properties.
+     */
+    boolean propagate() default true;
+    
+    /**
+     * Sets the static method used to create the BundleAdapterService implementation instance.
+     */
+    String factoryMethod() default "";
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleDependency.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleDependency.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleDependency.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/BundleDependency.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * Annotates a class or method for a bundle dependency. A bundle dependency allows you to 
+ * depend on a bundle in a certain set of states (INSTALLED|RESOLVED|STARTED|...), as 
+ * indicated by a state mask. You can also use a filter condition that is matched against 
+ * all manifest entries. When applied on a class field, optional unavailable dependencies 
+ * are injected with a NullObject.
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> In the following example, the "SCR" Component allows to track 
+ * all bundles containing a specific "Service-Component" OSGi header, in order to load
+ * and manage all Declarative Service components specified in the SCR xml documents referenced by the header:
+ * <p>
+ * <blockquote>
+ * <pre>
+ * &#64;Component
+ * public class SCR {
+ *     &#64;BundleDependency(required = false,
+ *                       removed = "unloadServiceComponents", 
+ *                       filter = "(Service-Component=*)"
+ *                       stateMask = Bundle.ACTIVE)
+ *     void loadServiceComponents(Bundle b) {
+ *         String descriptorPaths = (String) b.getHeaders().get("Service-Component");
+ *         // load all service component specified in the XML descriptorPaths files ...
+ *     }
+ *
+ *     void unloadServiceComponents(Bundle b) {
+ *         // unload all service component we loaded from our "loadServiceComponents" method.
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface BundleDependency
+{
+    /**
+     * Returns the callback method to be invoked when the service have changed.
+     */
+    String changed() default "";
+
+    /**
+     * Returns the callback method to invoke when the service is lost.
+     */
+    String removed() default "";
+    
+    /**
+     * Returns whether the dependency is required or not.
+     */
+    boolean required() default true;
+    
+    /**
+     * Returns the filter dependency
+     */
+    String filter() default "";
+     
+    /**
+     * Returns the bundle state mask
+     */
+    int stateMask() default Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE;
+
+    /**
+     * Specifies if the manifest headers from the bundle should be propagated to 
+     * the service properties.
+     */
+    boolean propagate() default false;
+    
+    /**
+     * The name used when dynamically configuring this dependency from the init method.
+     * Specifying this attribute allows to dynamically configure the dependency 
+     * <code>filter</code> and <code>required</code> flag from the Service's init method.
+     * All unnamed dependencies will be injected before the init() method; so from the init() method, you can
+     * then pick up whatever information needed from already injected (unnamed) dependencies, and configure dynamically
+     * your named dependencies, which will then be calculated once the init() method returns.
+     */
+    String name() default "";
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Component.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Component.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Component.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Component.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,202 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotates an OSGi Component class with its dependencies. Components are the main building 
+ * blocks for OSGi applications. They can publish themselves as a service, and/or they can have 
+ * dependencies. These dependencies will influence their life cycle as component will only be 
+ * activated when all required dependencies are available. 
+ * By default, all directly implemented interfaces are registered into the OSGi registry,
+ * and the component is instantiated automatically, when the component bundle is started and 
+ * when the component dependencies are available. If you need to take control of when and how 
+ * much component instances must be created, then you can use the <code>factorySet</code> 
+ * annotation attribute.<p> 
+ * If a <code>factorySet</code> attribute is set, the component is not started automatically 
+ * during bundle startup, and a <code>java.util.Set&lt;Dictionary&gt;</code> 
+ * object is registered into the OSGi registry on behalf of the component. This Set will act 
+ * as a Factory API, and another component may use this Set and add some configuration 
+ * dictionaries in it, in order to fire some component activations (there is one component 
+ * instantiated per dictionary, which is passed to component instances via a configurable 
+ * callback method).
+ *
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> Here is a sample showing a X component, which depends on a configuration dependency:<p>
+ * <blockquote>
+ * 
+ * <pre>
+ * &#47;**
+ *   * This component will be activated once the bundle is started and when all required dependencies
+ *   * are available.
+ *   *&#47;
+ * &#64;Component
+ * class X implements Z {
+ *     &#64;ConfigurationDependency(pid="MyPid")
+ *     void configure(Dictionary conf) {
+ *          // Configure or reconfigure our component.
+ *     }
+ *   
+ *     &#64;Start
+ *     void start() {
+ *         // Our component is starting and is about to be registered in the OSGi registry as a Z service.
+ *     }
+ *   
+ *     public void doService() {
+ *         // ...
+ *     }   
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * Here is a sample showing how a Y component may dynamically instantiate several X component instances, 
+ * using the {@link #factorySet()} attribute:<p>
+ * <blockquote>
+ * 
+ * <pre>
+ *  &#47;**
+ *    * All component instances will be created/updated/removed by the "Y" component
+ *    *&#47;
+ *  &#64;Component(factorySet="MyComponentFactory", factoryConfigure="configure")
+ *  class X implements Z {                 
+ *      void configure(Dictionary conf) {
+ *          // Configure or reconfigure our component. The conf is provided by the factory,
+ *          // and all public properties (which don't start with a dot) are propagated with the
+ *          // service properties specified in the properties annotation attribute.
+ *      }
+ * 
+ *      &#64;ServiceDependency
+ *      void bindOtherService(OtherService other) {
+ *          // store this require dependency
+ *      }
+ *      
+ *      &#64;Start
+ *      void start() {
+ *          // Our component is starting and is about to be registered in the OSGi registry as a Z service.
+ *      } 
+ *      
+ *      public void doService() {
+ *          // ...
+ *      }   
+ *  }
+ * 
+ *  &#47;**
+ *    * This class will instantiate some X component instances
+ *    *&#47;
+ *  &#64;Component 
+ *  class Y {
+ *      &#64;ServiceDependency(filter="(dm.factory.name=MyComponentFactory)")
+ *      Set&lt;Dictionary&gt; _XFactory; // This Set acts as a Factory API for creating X component instances.
+ *    
+ *      &#64;Start
+ *      void start() {
+ *          // Instantiate a X component instance
+ *          Dictionary x1 = new Hashtable() {{ put("foo", "bar1"); }};
+ *          _XFactory.add(x1);
+ *      
+ *          // Instantiate another X component instance
+ *          Dictionary x2 = new Hashtable() {{ put("foo", "bar2"); }};
+ *          _XFactory.add(x2);
+ *      
+ *          // Update the first X component instance
+ *          x1.put("foo", "bar1_modified");
+ *          _XFactory.add(x1);
+ *          
+ *          // Instantiate a third X instance, by explicitly providing the implementation object
+ *          Dictionary x3 = new Hashtable() {{ put(Component.FACTORY_INSTANCE, new X()); }};
+ *          _XFactory.add(x3);
+ *      
+ *          // Destroy x1/x2/x3 components (Notice that invoking XFactory.clear() will destroy all X component  instances).
+ *          _XFactory.remove(x1);
+ *          _XFactory.remove(x2); 
+ *          _XFactory.remove(x3); 
+ *      }
+ *  }
+ * </pre>
+ * 
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface Component
+{
+    /**
+     * Sets list of provided interfaces. By default, the directly implemented interfaces are provided.
+     */
+    Class<?>[] provides() default {};
+
+    /**
+     * Sets list of provided service properties.
+     */
+    Property[] properties() default {};
+
+    /**
+     * Returns the name of the <code>Factory Set</code> used to dynamically instantiate this component.
+     * When you set this attribute, a <code>java.util.Set&lt;java.lang.Dictionary&gt;</code> OSGi Service will 
+     * be provided with a <code>dm.factory.name</code> service property matching your specified <code>factorySet</code> attribute.
+     * This Set will be provided once the component bundle is started, even if required dependencies are not available, and the
+     * Set will be unregistered from the OSGi registry once the component bundle is stopped or being updated.<p>
+     * So, basically, another component may then be injected with this set in order to dynamically instantiate some component instances:
+     * <ul>
+     * <li> Each time a new Dictionary is added into the Set, then a new instance of the annotated component will be instantiated.</li>
+     * <li> Each time an existing Dictionary is re-added into the Set, then the corresponding component instance will be updated.</li>
+     * <li> Each time an existing Dictionary is removed from the Set, then the corresponding component instance will be destroyed.</li>
+     * </ul>
+     * 
+     * <p>The dictionary registered in the Set will be provided to the created component instance using a callback method that you can 
+     * optionally specify in the {@link Component#factoryConfigure()} attribute. Each public properties from that dictionary 
+     * (which don't start with a dot) will be propagated along with the annotated component service properties.
+     * 
+     * <p>Optionally, the dictionary registered into the factory set may provide an implementation instance for the component to be created,
+     * using the {@value #FACTORY_INSTANCE} key. 
+     */
+    String factorySet() default "";
+
+    /**
+     * Sets "configure" callback method name to be called with the factory configuration. This attribute only makes sense if the 
+     * {@link #factorySet()} attribute is used. If specified, then this attribute references a callback method, which is called 
+     * for providing the configuration supplied by the factory that instantiated this component. The current component service properties will be 
+     * also updated with all public properties (which don't start with a dot).
+     */
+    String factoryConfigure() default "";
+    
+    /**
+     * Sets the static method used to create the components implementation instance.
+     */
+    String factoryMethod() default "";
+        
+    /**
+     * Service property name used to match a given Factory Set.
+     * @see #factorySet() for more information about factory sets.
+     */
+    final static String FACTORY_NAME = "dm.factory.name";
+    
+    /**
+     * Key used when providing an implementation in a factory Set dictionary configuration.
+     * @see #factorySet()
+     */
+    final static String FACTORY_INSTANCE = "dm.factory.instance";
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Composition.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Composition.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Composition.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Composition.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotates a method returning the list of objects which are part of a Component implementation.
+ * When implementing complex Components, you often need to use more than one object instances. 
+ * Moreover, several of these instances might want to have dependencies injected, as well as lifecycle
+ * callbacks invoked, like the methods annotated with {@link Init}, {@link Start}, {@link Stop}, 
+ * {@link Destroy} annotations. In such cases you can tell the dependency manager which instances to 
+ * consider, by annotating a method in your Component, returning a list of objects which are part 
+ * of the implementation.
+ * <p>
+ * This annotation may be applied on a method which is part of class annotated with either a {@link Component},
+ * {@link AspectService}, {@link AdapterService}, {@link FactoryConfigurationAdapterService} or 
+ * {@link ResourceAdapterService} annotation.
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> Here, the "MyComponent" component is composed of the Helper class, which is also injected with 
+ * service dependencies. The lifecycle callbacks are also invoked in the Helper (if the Helper defines 
+ * them):<p>
+ * <blockquote>
+ * <pre>
+ *
+ * class Helper {
+ *     LogService logService; // Injected
+ *     void start() {} // lifecycle callback
+ *     void bind(OtherService otherService) {} // injected
+ * }
+ * 
+ * &#64;Component
+ * class MyComponent {
+ *     // Helper which will also be injected with our service dependencies
+ *     private Helper helper = new Helper();
+ *      
+ *     &#64;Composition
+ *     Object[] getComposition() {
+ *         return new Object[] { this, helper }; 
+ *     }
+ *
+ *     &#64;ServiceDependency
+ *     private LogService logService; // Helper.logService will be also be injected, if defined.
+ *     
+ *     &#64;Start
+ *     void start() {} // the Helper.start() method will also be called, if defined
+ *     
+ *     &#64;ServiceDependency
+ *     void bind(OtherService otherService) {} // the Helper.bind() method will also be called, if defined     
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface Composition
+{
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ConfigurationDependency.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ConfigurationDependency.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ConfigurationDependency.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/ConfigurationDependency.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * Annotates a method for injecting a Configuration Dependency. A configuration dependency 
+ * is always required, and allows you to depend on the availability of a valid configuration 
+ * for your component. This dependency requires the OSGi Configuration Admin Service.
+ * 
+ * <h3>Usage Examples</h3>
+ * 
+ * <p> In the following example, the "Printer" component depends on a configuration
+ * whose PID name is "org.apache.felix.sample.Printer". This service will initialize
+ * its ip/port number from the provided configuration:
+ * <p>
+ * <blockquote>
+ * <pre>
+ * package org.apache.felix.sample;
+ * 
+ * &#64;Component
+ * public class Printer {
+ *     &#64;ConfigurationDependency
+ *     void updated(Dictionary config) {
+ *         // load printer ip/port from the provided dictionary.
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * <p> This other example shows how to specify a configuration dependency, as well as meta data
+ * used to customize the WebConsole GUI. Using these meta data, you can specify for example the
+ * default value for your configurations data, some descriptions, the cardinality of configuration 
+ * values, etc ... 
+ * <p>
+ * <blockquote>
+ * <pre>
+ * package org.apache.felix.sample;
+ * 
+ * &#64;Component
+ * public class Printer {
+ *     &#64;ConfigurationDependency(
+ *         heading = "Printer Service",
+ *         description = "Declare here parameters used to configure the Printer service", 
+ *         metadata = { 
+ *             &#64;PropertyMetaData(heading = "Ip Address", 
+ *                               description = "Enter the ip address for the Printer service",
+ *                               defaults = { "127.0.0.1" }, 
+ *                               type = String.class,
+ *                               id = "IPADDR", 
+ *                               cardinality = 0),
+ *             &#64;PropertyMetaData(heading = "Port Number", 
+ *                               description = "Enter the port number for the Printer service",
+ *                               defaults = { "4444" }, 
+ *                               type = Integer.class,
+ *                               id = "PORTNUM", 
+ *                               cardinality = 0) 
+
+ *         }
+ *     )
+ *     void updated(Dictionary config) {
+ *         // load configuration from the provided dictionary.
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface ConfigurationDependency
+{
+    /**
+     * Returns the pid for a given service (by default, the pid is the service class name).
+     * @return the pid for a given service (default = Service class name)
+     */
+    String pid() default "";
+
+    /**
+     * Returns true if the configuration properties must be published along with the service. 
+     * Any additional service properties specified directly are merged with these.
+     * @return true if configuration must be published along with the service, false if not.
+     */
+    boolean propagate() default false;
+    
+    /**
+     * The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service".
+     * @return The label used to display the tab name where the properties are displayed.
+     */
+    String heading() default "";
+
+    /**
+     * A human readable description of the PID this annotation is associated with. Example: "Configuration for the PrinterService bundle".
+     * @return A human readable description of the PID this annotation is associated with.
+     */
+    String description() default "";
+
+    /**
+     * The list of properties types used to expose properties in web console. 
+     * @return The list of properties types used to expose properties in web console. 
+     */
+    PropertyMetaData[] metadata() default {};
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Destroy.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Destroy.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Destroy.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Destroy.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotates a method which is invoked when the component is destroyed.
+ * The method is called when the component's bundle is stopped, or when one of its
+ * required dependency is lost (unless the dependency has been defined as an "instance bound" 
+ * dependency using the Dependency Manager API).
+ * </ul>
+ * 
+ * <h3>Usage Examples</h3>
+ * <blockquote>
+ * <pre>
+ * &#64;Component
+ * class MyComponent {
+ *     &#64;ServiceDependency
+ *     private LogService logService; // Required dependency over the log service.
+ *     
+ *     &#64;Destroy
+ *     void destroyed() {} // called if bundle is stopped or if we have lost some required dependencies.     
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface Destroy
+{
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/FactoryConfigurationAdapterService.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/FactoryConfigurationAdapterService.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/FactoryConfigurationAdapterService.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/FactoryConfigurationAdapterService.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,199 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * Annotates a class that acts as a Factory Configuration Adapter Service. For each new <code>Config Admin</code> factory configuration matching
+ * the specified factoryPid, an instance of this service will be created.
+ * The adapter will be registered with the specified interface, and with the specified adapter service properties.
+ * Depending on the <code>propagate</code> parameter, every public factory configuration properties 
+ * (which don't start with ".") will be propagated along with the adapter service properties. <p>
+ * 
+ * Like in &#64;{@link ConfigurationDependency}, you can optionally specify the meta types of your
+ * configurations for Web Console GUI customization (configuration heading/descriptions/default values/etc ...).
+ *
+ * <h3>Usage Examples</h3>
+ * Here, a "Dictionary" service instance is instantiated for each existing factory configuration
+ * instances matching the factory pid "DictionaryServiceFactory".
+ * <blockquote>
+ * <pre>
+ * &#64;FactoryConfigurationAdapterService(factoryPid="DictionaryServiceFactory", updated="updated")
+ * public class DictionaryImpl implements DictionaryService
+ * {
+ *     &#47;**
+ *      * The key of our config admin dictionary language.
+ *      *&#47;
+ *     final static String LANG = "lang";
+ *     
+ *     &#47;**
+ *      * The key of our config admin dictionary values.
+ *      *&#47;
+ *     final static String WORDS = "words";
+ *     
+ *     &#47;**
+ *      * We store all configured words in a thread-safe data structure, because ConfigAdmin
+ *      * may invoke our updated method at any time.
+ *      *&#47;
+ *     private CopyOnWriteArrayList&#60;String&#62; m_words = new CopyOnWriteArrayList&#60;String&#62;();
+ *     
+ *     &#47;**
+ *      * Our Dictionary language.
+ *      *&#47;
+ *     private String m_lang;
+ * 
+ *     protected void updated(Dictionary&#60;String, ?&#62; config) {
+ *         m_lang = (String) config.get(LANG);
+ *         m_words.clear();
+ *         String[] words = (String[]) config.get(WORDS);
+ *         for (String word : words) {
+ *             m_words.add(word);
+ *         }
+ *     }   
+ *     ...
+ * }
+ * </pre>
+ * </blockquote>
+ * Here, this is the same example as above, but using meta types:
+ * 
+ * <blockquote>
+ * <pre>
+ * &#64;FactoryConfigurationAdapterService(
+ *     factoryPid="DictionaryServiceFactory", 
+ *     propagate=true, 
+ *     updated="updated",
+ *     heading="Dictionary Services",
+ *     description="Declare here some Dictionary instances, allowing to instantiates some DictionaryService services for a given dictionary language",
+ *     metadata={
+ *         &#64;PropertyMetaData(
+ *             heading="Dictionary Language",
+ *             description="Declare here the language supported by this dictionary. " +
+ *                 "This property will be propagated with the Dictionary Service properties.",
+ *             defaults={"en"},
+ *             id=DictionaryImpl.LANG,
+ *             cardinality=0),
+ *         &#64;PropertyMetaData(
+ *             heading="Dictionary words",
+ *             description="Declare here the list of words supported by this dictionary. This properties starts with a Dot and won't be propagated with Dictionary OSGi service properties.",
+ *             defaults={"hello", "world"},
+ *             id=DictionaryImpl.WORDS,
+ *             cardinality=Integer.MAX_VALUE)
+ *     }
+ * )  
+ * public class DictionaryImpl implements DictionaryService
+ * {
+ *     &#47;**
+ *      * The key of our config admin dictionary language.
+ *      *&#47;
+ *     final static String LANG = "lang";
+ *     
+ *     &#47;**
+ *      * The key of our config admin dictionary values.
+ *      *&#47;
+ *     final static String WORDS = "words";
+ *     
+ *     &#47;**
+ *      * We store all configured words in a thread-safe data structure, because ConfigAdmin
+ *      * may invoke our updated method at any time.
+ *      *&#47;
+ *     private CopyOnWriteArrayList&#60;String&#62; m_words = new CopyOnWriteArrayList&#60;String&#62;();
+ *     
+ *     &#47;**
+ *      * Our Dictionary language.
+ *      *&#47;
+ *     private String m_lang;
+ * 
+ *     protected void updated(Dictionary&#60;String, ?&#62; config) {
+ *         m_lang = (String) config.get(LANG);
+ *         m_words.clear();
+ *         String[] words = (String[]) config.get(WORDS);
+ *         for (String word : words) {
+ *             m_words.add(word);
+ *         }
+ *     }
+ *     
+ *     ...
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.TYPE)
+public @interface FactoryConfigurationAdapterService
+{
+    /**
+     * The interface(s) to use when registering adapters. By default, directly implemented 
+     * interfaces will be registered in the OSGi registry.
+     */
+    Class<?>[] provides() default {};
+
+    /**
+     * Adapter Service properties. Notice that public factory configuration is also registered in service properties,
+     * (only if propagate is true). Public factory configuration properties are those which don't starts with a dot (".").
+     */
+    Property[] properties() default {};
+
+    /**
+     * Returns the factory pid whose configurations will instantiate the annotated service class. (By default, the pid is the 
+     * service class name).
+     */
+    String factoryPid() default "";
+
+    /**
+     * The Update method to invoke (defaulting to "updated"), when a factory configuration is created or updated
+     */
+    String updated() default "updated";
+
+    /**
+     * Returns true if the configuration properties must be published along with the service. 
+     * Any additional service properties specified directly are merged with these.
+     * @return true if configuration must be published along with the service, false if not.
+     */
+    boolean propagate() default false;
+
+    /**
+     * The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service".
+     * @return The label used to display the tab name where the properties are displayed.
+     */
+    String heading() default "";
+
+    /**
+     * A human readable description of the PID this annotation is associated with. Example: "Configuration for the PrinterService bundle".
+     * @return A human readable description of the PID this annotation is associated with.
+     */
+    String description() default "";
+
+    /**
+     * The list of properties types used to expose properties in web console. 
+     * @return The list of properties types used to expose properties in web console. 
+     */
+    PropertyMetaData[] metadata() default {};
+    
+    /**
+     * Sets the static method used to create the adapter instance.
+     */
+    String factoryMethod() default "";
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Init.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Init.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Init.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Init.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotates a method which will be invoked when the Service is initializing.
+ * All required dependencies are already injected before the annotated method is called, and 
+ * optional dependencies on class fields are injected with NullObjects if the optional
+ * dependencies are not currently available.<p>
+ * 
+ * If some dependencies are declared using a <b>named</b> &#64;{@link ServiceDependency} annotation, 
+ * then the annotated method may optionally return a Map used to dynamically configure such 
+ * dependencies (Please refer to &#64;{@link ServiceDependency#name()} attribute for more 
+ * information about this feature).<p>
+ * 
+ * After the init method returns, the component is then invoked in the method annotated with
+ * &#64;{@link Start}, in order to notify that the component is about to be registered into the OSGi 
+ * registry (if this one provides a service). However, you can take control of when the service is registered,
+ * using the &#64;{@link LifecycleController} annotation).
+ * 
+ * <h3>Usage Examples</h3>
+ * Here, the "VideoPlayer" init method is called after the "log" dependency is injected.
+ * <blockquote>
+ * <pre>
+ * 
+ * &#64;Component
+ * public class VideoPlayer {
+ *     &#64;ServiceDependency
+ *     LogService log;
+ *     
+ *     &#64;Init
+ *     void init() {} // initialize our service (the "log" dependency is already injected).
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface Init
+{
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Inject.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Inject.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Inject.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Inject.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+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:
+ * <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>
+ * &#64;Component
+ * class X implements Z {
+ *     &#64;Inject
+ *     BundleContext bundleContext;
+ *   
+ *     &#64;Inject
+ *     Component component;
+ *     
+ *     &#64;Inject
+ *     DependencyManager manager;
+ *   
+ *     OtherService otherService;
+ *   
+ *     &#64;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));
+ *     }
+ *     
+ *     &#64;Start
+ *     void start() {
+ *         System.out.println("OtherService: " + otherService);
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface Inject
+{
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/LifecycleController.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/LifecycleController.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/LifecycleController.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/LifecycleController.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 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 is started or stopped. In this case, the injected <code>Runnable</code> 
+ * can be invoked in order to start/register (or stop/unregister) a Service at any time. When this annotation 
+ * is used, then the Service on which this annotation is applied is not activated by default, and you have to 
+ * call the injected Runnable yourself. 
+ * <p>
+ * <h3>Usage Examples</h3>
+ * <blockquote>
+ * 
+ * <pre>
+ * &#47;**
+ *   * This Service will be registered programatically into the OSGi registry, using the LifecycleController annotation.
+ *   *&#47;
+ * &#64;Service
+ * class X implements Z {
+ *     &#64;LifecycleController
+ *     Runnable starter
+ *     
+ *     &#64;LifecycleController(start=false)
+ *     Runnable stopper
+ *   
+ *     &#64;Init
+ *     void init() {
+ *         // At this point, all required dependencies are there, but we'll activate our service in 2 seconds ...
+ *         Thread t = new Thread() {
+ *            public void run() {
+ *              sleep(2000);
+ *              // start our "Z" service (our "start" method will be called, juste before service registration
+ *              starter.run();
+ *              
+ *              sleep(2000);
+ *              // now, stop/unregister the "Z" service (we'll then be called in our stop() method
+ *              stopper.run();
+ *            }
+ *          };
+ *          t.start();
+ *     }
+ *     
+ *     &#64;Start
+ *     public void start() {
+ *         // This method will be called after we invoke our starter Runnable, and our service will be
+ *         // published after our method returns, as in normal case.
+ *     }
+
+ *     &#64;Stop
+ *     public void stop() {
+ *         // This method will be called after we invoke our "stop" Runnable, and our service will be
+ *         // unregistered before our method is invoked, as in normal case. Notice that the service won't
+ *         // be destroyed here, and the "starter" runnable can be re-invoked later.
+ *     }
+ * }
+ * </pre>
+ * </blockquote> 
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */ 
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.FIELD)
+public @interface LifecycleController
+{
+    /**
+     * Specifies 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;
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Property.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Property.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Property.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Property.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to describe a property key-value(s) pair. It is used for example when
+ * declaring {@link Component#properties()} attribute.<p>
+ * 
+ * Property value(s) type is String by default, and the type is scalar if the value is single-valued, 
+ * or an array if the value is multi-valued.
+ * 
+ * Eight primitive types are supported:<p>
+ * <ul>
+ * <li> String (default type)
+ * <li> Long
+ * <li> Double
+ * <li> Float
+ * <li> Integer
+ * <li> Byte
+ * <li> Boolean
+ * <li> Short
+ * </ul>
+ * 
+ * You can specify the type of a property either using a combination of <code>value</code> and <code>type</code> attributes,
+ * or using one of the <code>longValue/doubleValue/floatValue/intValue/byteValue/charValue/booleanValue/shortValue</code> attributes.
+ * 
+ * Notice that you can also specify service properties dynamically by returning a Map from a method
+ * annotated with {@link Start}.
+ * 
+ * <p>
+ * <h3>Usage Examples</h3>
+ * <blockquote>
+ * 
+ * <pre>
+ * &#64;Component(properties={
+ *     &#64;Property(name="p1", value="v")})                    // String value type (scalar)
+ *     &#64;Property(name="p2", value={"s1", "s2")})            // Array of Strings
+ *     &#64;Property(name="service.ranking", intValue=10)       // Integer value type (scalar)
+ *     &#64;Property(name="p3", intValue={1,2})                 // Array of Integers
+ *     &#64;Property(name="p3", value={"1"), type=Long.class})  // Long value (scalar)
+ * class ServiceImpl implements Service {
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target( { ElementType.ANNOTATION_TYPE })
+public @interface Property
+{
+    /**
+     * Returns the property name.
+     * @return this property name
+     */
+    String name();
+
+    /**
+     * Returns the property value(s). The property value(s) is (are) 
+     * parsed using the <code>valueOf</code> method of the class specified in the #type attribute 
+     * (which is <code>String</code> by default). When the property value is single-value, then 
+     * the value type is scalar (not an array). If the property value is multi-valued, then the value type 
+     * is an array of the type specified in the {@link #type()} attribute (String by default).
+     * 
+     * @return this property value(s).
+     */
+    String[] value() default {};
+    
+    /**
+     * Specifies how the {@link #value()} or {@link #values()} attributes are parsed.
+     * @return the property value type (String by default) used to parse {@link #value()} or {@link #values()} 
+     * attribtues
+     */
+    Class<?> type() default String.class;    
+    
+    /**
+     * A Long value or an array of Long values. 
+     */
+    long[] longValue() default {};
+
+    /**
+     * A Double value or an array of Double values. 
+     */
+    double[] doubleValue() default {};
+
+    /**
+     * A Float value or an array of Float values. 
+     */
+    float[] floatValue() default {};
+
+    /**
+     * An Integer value or an array of Integer values. 
+     */
+    int[] intValue() default {};
+
+    /**
+     * A Byte value or an array of Byte values. 
+     */
+    byte[] byteValue() default {};
+
+    /**
+     * A Character value or an array of Character values. 
+     */
+    char[] charValue() default {};
+
+    /**
+     * A Boolean value or an array of Boolean values. 
+     */
+    boolean[] booleanValue() default {};
+
+    /**
+     * A Short value or an array of Short values. 
+     */
+    short[] shortValue() default {};
+    
+    /**
+     * Returns an array of property values.
+     * The property value are parsed using the <code>valueOf</code> method of the class specified in the #type attribute 
+     * (which is <code>String</code> by default).
+     * 
+     * @return an array of property values. 
+     * @deprecated use {@link #value()} attribute.
+     */
+    String[] values() default {};    
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/PropertyMetaData.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/PropertyMetaData.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/PropertyMetaData.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/PropertyMetaData.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,121 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+/**
+ * This annotation describes the data types of a configuration Property.
+ * It can be used by other annotations which require meta type support.
+ * For now, the following annotations are using <code>PropertyMetaData</code:
+ * <ul>
+ *   <li>{@link ConfigurationDependency}: This dependency allows to define a 
+ *   dependency over a <code>Configuration Admin</code> configuration dictionaries, whose 
+ *   metadata can be described using <code>PropertyMetaData</code> annotation.
+ *   <li>{@link FactoryConfigurationAdapterService}: This service adapter allows 
+ *   to dynamically create Services on behalf of <code>Factory Configuration Admin</code> 
+ *   configuration dictionaries, whose metadata can be described using this <code>PropertyMetaData</code> annotation.
+ * </ul>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface PropertyMetaData
+{
+    /**
+     * The label used to display the property. Example: "Log Level".
+     * @return The label used to display the property
+     */
+    String heading();
+
+    /**
+     * The key of a ConfigurationAdmin property. Example: "printer.logLevel"
+     * @return The Configuration Admin property name
+     */
+    String id();
+
+    /**
+     * Return the property primitive type. If must be either one of the following types:<p>
+     * <ul>
+     *    <li>String.class</li>
+     *    <li>Long.class</li>
+     *    <li>Integer.class</li>
+     *    <li>Character.class</li>
+     *    <li>Byte.class</li>
+     *    <li>Double.class</li>
+     *    <li>Float.class</li>
+     *    <li>Boolean.class</li>
+     * </ul>
+     */
+    Class<?> type() default String.class;
+
+    /**
+     * Return a default for this property. The object must be of the appropriate type as defined by the cardinality and getType(). 
+     * The return type is a list of String  objects that can be converted to the appropriate type. The cardinality of the return 
+     * array must follow the absolute cardinality of this type. E.g. if the cardinality = 0, the array must contain 1 element. 
+     * If the cardinality is 1, it must contain 0 or 1 elements. If it is -5, it must contain from 0 to max 5 elements. Note that 
+     * the special case of a 0 cardinality, meaning a single value, does not allow arrays or vectors of 0 elements. 
+     */
+    String[] defaults() default {};
+
+    /**
+     * Returns the property description. The description may be localized and must describe the semantics of this type and any 
+     * constraints. Example: "Select the log level for the Printer Service".
+     * @return The localized description of the definition.
+     */
+    String description();
+
+    /**
+     * Return the cardinality of this property. The OSGi environment handles multi valued properties in arrays ([]) or in Vector objects. 
+     * The return value is defined as follows:<p>
+     *
+     * <ul>
+     * <li> x = Integer.MIN_VALUE    no limit, but use Vector</li>
+     * <li> x < 0                    -x = max occurrences, store in Vector</li>
+     * <li> x > 0                     x = max occurrences, store in array []</li>
+     * <li> x = Integer.MAX_VALUE    no limit, but use array []</li>
+     * <li> x = 0                     1 occurrence required</li>
+     * </ul>
+     */
+    int cardinality() default 0;
+
+    /**
+     * Tells if this property is required or not.
+     */
+    boolean required() default true;
+
+    /**
+     * Return a list of valid option labels for this property. The purpose of this method is to allow menus with localized labels.
+     * It is associated with the {@link #optionValues()} attribute. The labels returned here are ordered in the same way as the 
+     * {@link #optionValues()} attribute values. 
+     * @return the list of valid option labels for this property.
+     */
+    String[] optionLabels() default {};
+    
+    /**
+     * Return a list of option values that this property can take. This list must be in the same sequence as the {@link #optionLabels()} 
+     * attribute.
+     */
+   String[] optionValues() default {};
+}

Added: felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Registered.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Registered.java?rev=1587054&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Registered.java (added)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.annotations/src/dm/annotation/api/Registered.java Sun Apr 13 17:23:51 2014
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package dm.annotation.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation can be used to be notified when a component is registered. At this point, the
+ * component has been registered into the OSGI registry (if it provides some services).
+ * 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>
+ * &#64;Component
+ * class X implements Z {
+ *     &#64;Start
+ *     void start() {
+ *         // Our Z Service is about to be registered into the OSGi registry. 
+ *     }
+ *     
+ *     &#64;Registered
+ *     void registered(ServiceRegistration sr) {
+ *        // At this point, our service has been registered into the registry.
+ *     }
+ * }
+ * </pre>
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+@Retention(RetentionPolicy.CLASS)
+@Target(ElementType.METHOD)
+public @interface Registered
+{
+}



Mime
View raw message