fixed inconsistency in the api, where Services were not using the same 'provides' attribute when specifying the provided service interfaces

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@985575 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java
index 7bfdb8f..5f1f816 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/AdapterService.java
@@ -38,13 +38,13 @@
     /**
      * Sets the adapter service interface(s). By default, the directly implemented interface(s) is (are) used.
      */
-    Class<?>[] adapterService() default {};
+    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[] adapterProperties() default {};
+    Property[] properties() default {};
 
     /**
      * Sets the adaptee service interface this adapter is applying to.
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java
index 648ee8a..d0c25f8 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/BundleAdapterService.java
@@ -39,6 +39,17 @@
 @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();
@@ -49,17 +60,6 @@
     int stateMask() default Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE;
     
     /**
-     * The interface(s) to use when registering adapters. By default, the interface(s) directly implemented
-     * by the annotated class is (are) used.
-     */
-    Class<?>[] service() default {};
-    
-    /**
-     * Additional properties to use with the service registration
-     */
-    Property[] properties() default {};
-    
-    /**
      * Specifies if properties from the bundle should be propagated to the service.
      */
     boolean propagate() default true;
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java
index d1482d9..fd0bee5 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/FactoryConfigurationAdapterService.java
@@ -36,6 +36,18 @@
 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).
      */
@@ -54,18 +66,6 @@
     boolean propagate() default false;
 
     /**
-     * The interface(s) to use when registering adapters. By default, directly implemented 
-     * interfaces will be registered in the OSGi registry.
-     */
-    Class<?>[] service() 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 {};
-
-    /**
      * 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.
      */
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/ResourceAdapterService.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/ResourceAdapterService.java
index 3875038..287eb48 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/ResourceAdapterService.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/api/ResourceAdapterService.java
@@ -38,20 +38,20 @@
 public @interface ResourceAdapterService
 {
     /**
-     * The filter condition to use with the resource.
-     */
-    String filter();
-
-    /**
      * The interface(s) to use when registering adapters
      */
-    Class<?>[] service() default {};
+    Class<?>[] provides() default {};
 
     /**
      * Additional properties to use with the adapter service registration
      */
     Property[] properties() default {};
 
+   /**
+     * The filter condition to use with the resource.
+     */
+    String filter();
+
     /**
      * <code>true</code> if properties from the resource should be propagated to the service.
      */
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
index c1814e8..08bda25 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/AnnotationCollector.java
@@ -489,10 +489,10 @@
         writer.putClass(annotation, EntryParam.adapteeService, null);
 
         // Parse Adapter properties.
-        parseProperties(annotation, EntryParam.adapterProperties, writer);
+        parseProperties(annotation, EntryParam.properties, writer);
 
-        // Parse the optional adapter service (use directly implemented interface by default).
-        writer.putClassArray(annotation, EntryParam.adapterService, m_interfaces);
+        // Parse the provided adapter service (use directly implemented interface by default).
+        writer.putClassArray(annotation, EntryParam.provides, m_interfaces);
         
         // Parse factoryMethod attribute
         writer.putString(annotation, EntryParam.factoryMethod, null);
@@ -529,7 +529,7 @@
         parseProperties(annotation, EntryParam.properties, writer);
 
         // Parse the optional adapter service (use directly implemented interface by default).
-        writer.putClassArray(annotation, EntryParam.service, m_interfaces);
+        writer.putClassArray(annotation, EntryParam.provides, m_interfaces);
 
         // Parse propagate attribute
         writer.putString(annotation, EntryParam.propagate, Boolean.FALSE.toString());
@@ -564,8 +564,8 @@
         // Parse Adapter properties.
         parseProperties(annotation, EntryParam.properties, writer);
 
-        // Parse the optional adapter service (use directly implemented interface by default).
-        writer.putClassArray(annotation, EntryParam.service, m_interfaces);
+        // Parse the provided adapter service (use directly implemented interface by default).
+        writer.putClassArray(annotation, EntryParam.provides, m_interfaces);
 
         // Parse propagate attribute
         writer.putString(annotation, EntryParam.propagate, Boolean.FALSE.toString());
@@ -598,8 +598,8 @@
         // propagate attribute
         writer.putString(annotation, EntryParam.propagate, Boolean.FALSE.toString());
 
-        // Parse the optional adapter service (use directly implemented interface by default).
-        writer.putClassArray(annotation, EntryParam.service, m_interfaces);
+        // Parse the provided adapter service (use directly implemented interface by default).
+        writer.putClassArray(annotation, EntryParam.provides, m_interfaces);
 
         // Parse Adapter properties.
         parseProperties(annotation, EntryParam.properties, writer);
diff --git a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
index 5c3679b..5f295ec 100644
--- a/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
+++ b/dependencymanager/annotation/src/main/java/org/apache/felix/dm/annotation/plugin/bnd/EntryParam.java
@@ -26,8 +26,6 @@
     propagate, 
     updated, 
     timeout,
-    adapterService,
-    adapterProperties,
     adapteeService,
     adapteeFilter,
     stateMask,
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
index b7cd711..e20144f 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/AdapterServiceBuilder.java
@@ -44,12 +44,12 @@
         throws Exception
     {
         Class<?> adapterImplClass = b.loadClass(srvMeta.getString(Params.impl));
-        String[] adapterService = srvMeta.getStrings(Params.adapterService, null);
-        Dictionary<String, Object> adapterProperties = srvMeta.getDictionary(Params.adapterProperties, null);
+        String[] provides = srvMeta.getStrings(Params.provides, null);
+        Dictionary<String, Object> adapterProperties = srvMeta.getDictionary(Params.properties, null);
         Class<?> adapteeService = b.loadClass(srvMeta.getString(Params.adapteeService));
         String adapteeFilter = srvMeta.getString(Params.adapteeFilter, null);     
         Service service = dm.createAdapterService(adapteeService, adapteeFilter)
-                            .setInterface(adapterService, adapterProperties);
+                            .setInterface(provides, adapterProperties);
         String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
         if (factoryMethod == null)
         {
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java
index 181d197..d00c9b6 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/BundleAdapterServiceBuilder.java
@@ -42,11 +42,11 @@
         int stateMask = srvMeta.getInt(Params.stateMask, Bundle.INSTALLED | Bundle.RESOLVED | Bundle.ACTIVE);
         String filter = srvMeta.getString(Params.filter, null);
         Class<?> adapterImplClass = b.loadClass(srvMeta.getString(Params.impl));
-        String[] service = srvMeta.getStrings(Params.service, null);
+        String[] provides = srvMeta.getStrings(Params.provides, null);
         Dictionary<String, Object> properties = srvMeta.getDictionary(Params.properties, null);
         boolean propagate = "true".equals(srvMeta.getString(Params.propagate, "false"));
         Service srv = dm.createBundleAdapterService(stateMask, filter, propagate)
-                            .setInterface(service, properties);
+                            .setInterface(provides, properties);
         String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
         if (factoryMethod == null)
         {
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java
index 36ee018..5937577 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/FactoryConfigurationAdapterServiceBuilder.java
@@ -42,11 +42,11 @@
         Class<?> implClass = b.loadClass(srvMeta.getString(Params.impl));
         String factoryPid = srvMeta.getString(Params.factoryPid);
         String updated = srvMeta.getString(Params.updated);
-        String[] services = srvMeta.getStrings(Params.service, null);
+        String[] provides = srvMeta.getStrings(Params.provides, null);
         Dictionary<String, Object> properties = srvMeta.getDictionary(Params.properties, null);
         boolean propagate = "true".equals(srvMeta.getString(Params.propagate, "false"));
         Service srv = dm.createFactoryConfigurationAdapterService(factoryPid, updated, propagate)
-                        .setInterface(services, properties);
+                        .setInterface(provides, properties);
         String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
         if (factoryMethod == null)
         {
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Params.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Params.java
index 1f6e8f3..d2efcc8 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Params.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/Params.java
@@ -44,8 +44,6 @@
     propagate,
     updated,
     timeout,
-    adapterService,
-    adapterProperties,
     adapteeService,
     adapteeFilter,
     stateMask,
diff --git a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java
index 601925e..6c74481 100644
--- a/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java
+++ b/dependencymanager/runtime/src/main/java/org/apache/felix/dm/runtime/ResourceAdapterServiceBuilder.java
@@ -41,12 +41,12 @@
     {
         String filter = srvMeta.getString(Params.filter, null);
         Class<?> implClass = b.loadClass(srvMeta.getString(Params.impl));
-        String[] service = srvMeta.getStrings(Params.service, null);
+        String[] provides = srvMeta.getStrings(Params.provides, null);
         Dictionary<String, Object> properties = srvMeta.getDictionary(Params.properties, null);
         boolean propagate = "true".equals(srvMeta.getString(Params.propagate, "false"));
         String changed = srvMeta.getString(Params.changed, null /* no change callback if not specified explicitly */);
         Service srv = dm.createResourceAdapterService(filter, propagate, null, changed)
-                        .setInterface(service, properties);       
+                        .setInterface(provides, properties);       
         String factoryMethod = srvMeta.getString(Params.factoryMethod, null);
         if (factoryMethod == null)
         {
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/adapter/ServiceProviderAdapter.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/adapter/ServiceProviderAdapter.java
index 48bb7e6..d570810 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/adapter/ServiceProviderAdapter.java
+++ b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/adapter/ServiceProviderAdapter.java
@@ -23,7 +23,7 @@
 import org.apache.felix.dm.annotation.api.ServiceDependency;
 import org.apache.felix.dm.test.bundle.annotation.sequencer.Sequencer;
 
-@AdapterService(adapteeService = ServiceInterface.class, adapterProperties={@Property(name="param2", value="value2")})
+@AdapterService(adapteeService = ServiceInterface.class, properties={@Property(name="param2", value="value2")})
 public class ServiceProviderAdapter implements ServiceInterface3
 {
     // This is the adapted service
diff --git a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/extraproperties/ExtraAdapterServiceProperties.java b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/extraproperties/ExtraAdapterServiceProperties.java
index 0fa83ff..12588bb 100644
--- a/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/extraproperties/ExtraAdapterServiceProperties.java
+++ b/dependencymanager/test/src/main/java/org/apache/felix/dm/test/bundle/annotation/extraproperties/ExtraAdapterServiceProperties.java
@@ -48,7 +48,7 @@
     {
     }
     
-    @AdapterService(adapteeService=Provider.class, adapterProperties={@Property(name="foo2", value="bar2")})
+    @AdapterService(provides=Provider2.class, properties={@Property(name="foo2", value="bar2")}, adapteeService=Provider.class)
     public static class Provider2Impl implements Provider2
     {
         protected Provider m_adaptee;