You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2009/07/17 20:51:34 UTC

svn commit: r795192 - in /tuscany/java/sca/modules/implementation-osgi-runtime: META-INF/ src/main/java/org/apache/tuscany/sca/dosgi/ src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/ src/main/java/org/osgi/service/distribution/

Author: rfeng
Date: Fri Jul 17 18:51:33 2009
New Revision: 795192

URL: http://svn.apache.org/viewvc?rev=795192&view=rev
Log:
Remove the need of the DistributionProvider interface

Removed:
    tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/dosgi/
    tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/osgi/service/distribution/
Modified:
    tuscany/java/sca/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiDistributionProvider.java
    tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF?rev=795192&r1=795191&r2=795192&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/META-INF/MANIFEST.MF Fri Jul 17 18:51:33 2009
@@ -28,4 +28,3 @@
  org.osgi.util.tracker;version="1.3.3"
 Bundle-DocURL: http://www.apache.org/
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
-Export-Package: org.osgi.service.distribution;version="1.0"

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiDistributionProvider.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiDistributionProvider.java?rev=795192&r1=795191&r2=795192&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiDistributionProvider.java (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiDistributionProvider.java Fri Jul 17 18:51:33 2009
@@ -19,47 +19,68 @@
 
 package org.apache.tuscany.sca.implementation.osgi.runtime;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.Dictionary;
 import java.util.Hashtable;
-import java.util.Map;
 
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.distribution.DistributionProvider;
+import org.osgi.framework.Constants;
 
 /**
- * OSGi distribution provider
+ * OSGi distribution provider for remote services
  */
-public class OSGiDistributionProvider implements DistributionProvider {
+public class OSGiDistributionProvider {
+    /**
+     * Registered by the distribution provider on one of its services to indicate the 
+     * supported configuration types.
+     */
+    public static final String REMOTE_CONFIGS_SUPPORTED = "remote.configs.supported"; // String+
+
+    /**
+     * Registered by the distribution provider on one of its services to indicate the vocabulary 
+     * of implemented intents.
+     */
+    public static final String REMOTE_INTENTS_SUPPORTED = "remote.intents.supported"; // String+ 
+
+    /**
+     * Service Registration property for the name of the Distribution Provider
+     * product.
+     * <p>
+     * The value of this property is of type String.
+     */
+    static final String PRODUCT_NAME = "osgi.remote.distribution.product";
+
+    /**
+     * Service Registration property for the version of the Distribution
+     * Provider product.
+     * <p>
+     * The value of this property is of type String.
+     */
+    static final String PRODUCT_VERSION = "osgi.remote.distribution.product.version";
+
+    /**
+     * Service Registration property for the Distribution Provider product
+     * vendor name.
+     * <p>
+     * The value of this property is of type String.
+     */
+    static final String VENDOR_NAME = "osgi.remote.distribution.vendor";
+
     private BundleContext bundleContext;
-    private Collection<ServiceReference> exposedServices = new ArrayList<ServiceReference>();
-    private Collection<ServiceReference> remoteServices = new ArrayList<ServiceReference>();
 
     public OSGiDistributionProvider(BundleContext bundleContext) {
         super();
         this.bundleContext = bundleContext;
     }
 
-    public Map<String, String> getExposedProperties(ServiceReference sr) {
-        return Collections.emptyMap();
-    }
-
-    public Collection<ServiceReference> getExposedServices() {
-        return exposedServices;
-    }
-
-    public Collection<ServiceReference> getRemoteServices() {
-        return remoteServices;
-    }
-
     public Dictionary<String, Object> getProperties() {
+        Dictionary headers = bundleContext.getBundle().getHeaders();
         Hashtable<String, Object> props = new Hashtable<String, Object>();
         props.put(PRODUCT_NAME, "Apache Tuscany SCA");
-        props.put(PRODUCT_VERSION, "2.0.0");
-        props.put(VENDOR_NAME, "Apache Software Foundation");
+        props.put(PRODUCT_VERSION, headers.get(Constants.BUNDLE_VERSION));
+        props.put(VENDOR_NAME, headers.get(Constants.BUNDLE_VENDOR));
+        props.put(REMOTE_CONFIGS_SUPPORTED, new String[] {"sca"});
+        // FIXME: We need to populate the list of intents from the SCA definitions
+        props.put(REMOTE_INTENTS_SUPPORTED, new String[] {});
         return props;
     }
 }

Modified: tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java?rev=795192&r1=795191&r2=795192&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java (original)
+++ tuscany/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationRuntimeActivator.java Fri Jul 17 18:51:33 2009
@@ -22,29 +22,22 @@
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.distribution.DistributionProvider;
 
 /**
  * Bundle activator to receive the BundleContext
  */
 public class OSGiImplementationRuntimeActivator implements BundleActivator {
     private static BundleContext bundleContext;
-//    private DiscoveryActivator discoveryActivator;
     private ServiceRegistration distributionProvider;
 
     public void start(BundleContext context) throws Exception {
         bundleContext = context;
-//        discoveryActivator = new DiscoveryActivator();
-//        discoveryActivator.start(context);
         OSGiDistributionProvider provider = new OSGiDistributionProvider(bundleContext);
-        distributionProvider = bundleContext.registerService(DistributionProvider.class.getName(), provider, provider.getProperties());
+        distributionProvider =
+            bundleContext.registerService(OSGiDistributionProvider.class.getName(), provider, provider.getProperties());
     }
 
     public void stop(BundleContext context) throws Exception {
-//        if (discoveryActivator != null) {
-//            discoveryActivator.stop(context);
-//        }
-//        discoveryActivator = null;
         if (distributionProvider != null) {
             distributionProvider.unregister();
         }