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/12/01 22:59:22 UTC

svn commit: r885958 [1/2] - in /tuscany/sca-java-2.x/trunk/modules/node-impl-osgi: META-INF/ src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ src/main/java/org/apache/tusca...

Author: rfeng
Date: Tue Dec  1 21:59:20 2009
New Revision: 885958

URL: http://svn.apache.org/viewvc?rev=885958&view=rev
Log:
Update to the latest OSGi remoteserviceadmin apis

Added:
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/ExportReference.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/ExportRegistration.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/ImportReference.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/ImportRegistration.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteConstants.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminEvent.java   (with props)
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java   (with props)
Removed:
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointDescription.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointListener.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointPermission.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportRegistration.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportRegistration.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteConstants.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdmin.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdminEvent.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdminListener.java
Modified:
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceExporter.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/AbstractDiscoveryService.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/META-INF/MANIFEST.MF?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/META-INF/MANIFEST.MF Tue Dec  1 21:59:20 2009
@@ -32,7 +32,6 @@
  org.apache.tuscany.sca.node;version="2.0.0",
  org.apache.tuscany.sca.node.configuration;version="2.0.0",
  org.apache.tuscany.sca.node.impl;version="2.0.0",
- org.apache.tuscany.sca.osgi.remoteserviceadmin;version="2.0.0",
  org.apache.tuscany.sca.policy;version="2.0.0",
  org.apache.tuscany.sca.provider;version="2.0.0",
  org.apache.tuscany.sca.runtime;version="2.0.0",
@@ -45,9 +44,10 @@
  org.osgi.service.component;version="1.1.0";resolution:=optional,
  org.osgi.service.event;version="1.2.0",
  org.osgi.service.packageadmin;version="1.2.0";resolution:=optional,
+ org.osgi.service.remoteserviceadmin;version="1.0.0",
  org.osgi.util.tracker;version="1.3.0";resolution:=optional
 Bundle-SymbolicName: org.apache.tuscany.sca.node.osgi.impl
 Bundle-DocURL: http://www.apache.org/
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
 Bundle-ActivationPolicy: lazy
-Export-Package: org.apache.tuscany.sca.osgi.remoteserviceadmin;version="2.0.0"
+Export-Package: org.osgi.service.remoteserviceadmin;version="1.0.0"

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointHelper.java Tue Dec  1 21:59:20 2009
@@ -28,10 +28,10 @@
 import org.apache.tuscany.sca.implementation.osgi.OSGiProperty;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteConstants;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
 /**
  * Implementation of {@link EndpointDescription}
@@ -55,7 +55,7 @@
         
         if (!endpoint.isRemote()) {
             String uuid = OSGiHelper.getFrameworkUUID(bundleContext);
-            props.put(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID, uuid);
+            props.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, uuid);
         }
         
         for (Object ext : endpoint.getService().getExtensions()) {
@@ -65,8 +65,8 @@
             }
         }
         
-        props.put(RemoteConstants.SERVICE_REMOTE_ID, props.get(Constants.SERVICE_ID));
-        props.put(RemoteConstants.SERVICE_REMOTE_URI, endpoint.getURI());
+        props.put(RemoteConstants.ENDPOINT_ID, props.get(Constants.SERVICE_ID));
+        props.put(RemoteConstants.ENDPOINT_URI, endpoint.getURI());
         // FIXME: [rfeng] How to pass in the remote service id from the endpoint XML
         props.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, new String[] {"org.osgi.sca"});
         props.put(Endpoint.class.getName(), endpoint);

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/EndpointIntrospector.java Tue Dec  1 21:59:20 2009
@@ -70,7 +70,6 @@
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
 import org.apache.tuscany.sca.osgi.service.discovery.impl.LocalDiscoveryService;
 import org.apache.tuscany.sca.osgi.service.discovery.impl.LocalDiscoveryService.ExtenderConfiguration;
 import org.apache.tuscany.sca.policy.Intent;
@@ -80,6 +79,7 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.util.tracker.ServiceTracker;
 
 /**

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java Tue Dec  1 21:59:20 2009
@@ -19,9 +19,9 @@
 
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ExportReference;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.ExportReference;
 
 /**
  * 
@@ -44,7 +44,7 @@
         return exportedService;
     }
 
-    public EndpointDescription getEndpointDescription() {
+    public EndpointDescription getExportedEndpoint() {
         return endpointDescription;
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java Tue Dec  1 21:59:20 2009
@@ -20,10 +20,10 @@
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
 import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ExportReference;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ExportRegistration;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.ExportReference;
+import org.osgi.service.remoteserviceadmin.ExportRegistration;
 
 /**
  * Implementation of {@link ExportRegistration}
@@ -60,7 +60,7 @@
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.ExportRegistration#close()
+     * @see org.osgi.remoteserviceadmin.ExportRegistration#close()
      */
     public void close() {
         if (node != null) {

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java Tue Dec  1 21:59:20 2009
@@ -19,9 +19,9 @@
 
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ImportReference;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.ImportReference;
 
 /**
  * 
@@ -45,7 +45,7 @@
         return importedService;
     }
 
-    public EndpointDescription getImportedEndpointDescription() {
+    public EndpointDescription getImportedEndpoint() {
         return endpointDescription;
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java Tue Dec  1 21:59:20 2009
@@ -20,10 +20,10 @@
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
 import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ImportReference;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ImportRegistration;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.ImportReference;
+import org.osgi.service.remoteserviceadmin.ImportRegistration;
 
 /**
  * 
@@ -59,7 +59,7 @@
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.ImportRegistration#close()
+     * @see org.osgi.remoteserviceadmin.ImportRegistration#close()
      */
     public void close() {
         if (node != null) {
@@ -78,7 +78,7 @@
         return node;
     }
 
-    public ImportReference getImportedReference() {
+    public ImportReference getImportReference() {
         return importReference;
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceExporter.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceExporter.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceExporter.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceExporter.java Tue Dec  1 21:59:20 2009
@@ -19,13 +19,13 @@
 
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
-import static org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID;
-import static org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteConstants.SERVICE_REMOTE_ID;
 import static org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.EndpointHelper.createEndpointDescription;
 import static org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiHelper.createOSGiProperty;
 import static org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiHelper.getFrameworkUUID;
 import static org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiHelper.getOSGiProperties;
 import static org.osgi.framework.Constants.SERVICE_ID;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -38,10 +38,10 @@
 import org.apache.tuscany.sca.contribution.Contribution;
 import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
 import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ExportRegistration;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.ExportRegistration;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
 /**
@@ -85,10 +85,10 @@
                 ComponentService service = component.getServices().get(0);
                 service.getExtensions().addAll(getOSGiProperties(registry, reference));
                 service.getExtensions().add(createOSGiProperty(registry,
-                                                               SERVICE_REMOTE_FRAMEWORK_UUID,
+                                                               ENDPOINT_FRAMEWORK_UUID,
                                                                getFrameworkUUID(reference.getBundle()
                                                                    .getBundleContext())));
-                service.getExtensions().add(createOSGiProperty(registry, SERVICE_REMOTE_ID, reference
+                service.getExtensions().add(createOSGiProperty(registry, ENDPOINT_ID, reference
                     .getProperty(SERVICE_ID)));
 
                 // FIXME: Configure the domain and node URI

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java Tue Dec  1 21:59:20 2009
@@ -27,11 +27,11 @@
 import org.apache.tuscany.sca.node.Node;
 import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
 import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ImportRegistration;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.ImportRegistration;
 
 /**
  * Watching and exporting OSGi services 
@@ -88,7 +88,7 @@
     }
 
     public void unimportService(ImportRegistration importRegistration) {
-        Node node = (Node)importRegistration.getImportedReference().getImportedService().getProperty("sca.node");
+        Node node = (Node)importRegistration.getImportReference().getImportedService().getProperty("sca.node");
         node.stop();
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java Tue Dec  1 21:59:20 2009
@@ -27,12 +27,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ExportRegistration;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ImportRegistration;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdmin;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdminEvent;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdminListener;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -42,6 +36,14 @@
 import org.osgi.service.cm.ManagedService;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.ExportReference;
+import org.osgi.service.remoteserviceadmin.ExportRegistration;
+import org.osgi.service.remoteserviceadmin.ImportReference;
+import org.osgi.service.remoteserviceadmin.ImportRegistration;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener;
 import org.osgi.util.tracker.ServiceTracker;
 
 /**
@@ -56,8 +58,8 @@
     private OSGiServiceExporter exporter;
     private OSGiServiceImporter importer;
 
-    private Collection<ImportRegistration> importedEndpoints = new ArrayList<ImportRegistration>();
-    private Collection<ExportRegistration> exportedServices = new ArrayList<ExportRegistration>();
+    private Collection<ImportRegistration> importRegistrations = new ArrayList<ImportRegistration>();
+    private Collection<ExportRegistration> exportedRegistrations = new ArrayList<ExportRegistration>();
 
     public RemoteServiceAdminImpl(BundleContext context) {
         this.context = context;
@@ -97,14 +99,14 @@
             listeners.close();
             listeners = null;
         }
-        for (ExportRegistration exportRegistration : exportedServices) {
+        for (ExportRegistration exportRegistration : exportedRegistrations) {
             exportRegistration.close();
         }
-        exportedServices.clear();
-        for (ImportRegistration importRegistration : importedEndpoints) {
+        exportedRegistrations.clear();
+        for (ImportRegistration importRegistration : importRegistrations) {
             importRegistration.close();
         }
-        importedEndpoints.clear();
+        importRegistrations.clear();
         if (importer != null) {
             importer.stop();
             importer = null;
@@ -116,13 +118,13 @@
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdmin#exportService(org.osgi.framework.ServiceReference,
+     * @see org.osgi.remoteserviceadmin.RemoteServiceAdmin#exportService(org.osgi.framework.ServiceReference,
      *      java.util.Map)
      */
     public List<ExportRegistration> exportService(ServiceReference ref, Map properties) {
         List<ExportRegistration> exportRegistrations = exporter.exportService(ref, properties);
         if (exportRegistrations != null) {
-            exportedServices.addAll(exportRegistrations);
+            exportRegistrations.addAll(exportedRegistrations);
             fireExportEvents(ref.getBundle(), exportRegistrations);
         }
         return exportRegistrations;
@@ -131,8 +133,8 @@
     private void fireExportEvents(Bundle source, List<ExportRegistration> exportRegistrations) {
         for (ExportRegistration registration : exportRegistrations) {
             RemoteServiceAdminEvent rsaEvent =
-                new RemoteServiceAdminEvent(RemoteServiceAdminEvent.EXPORT_REGISTRATION, source, registration.getExportReference(),
-                                            registration.getException());
+                new RemoteServiceAdminEvent(RemoteServiceAdminEvent.EXPORT_REGISTRATION, source, registration
+                    .getExportReference(), registration.getException());
             EventAdmin eventAdmin = getEventAdmin();
             if (eventAdmin != null) {
                 eventAdmin.postEvent(wrap(rsaEvent));
@@ -215,9 +217,9 @@
         props.put("export.reference", rsaEvent.getExportReference());
         EndpointDescription ep = null;
         if (rsaEvent.getImportReference() != null) {
-            ep = rsaEvent.getImportReference().getImportedEndpointDescription();
+            ep = rsaEvent.getImportReference().getImportedEndpoint();
         } else {
-            ep = rsaEvent.getExportReference().getEndpointDescription();
+            ep = rsaEvent.getExportReference().getExportedEndpoint();
         }
         props.put("service.remote.id", ep.getRemoteServiceID());
         props.put("service.remote.uuid", ep.getRemoteFrameworkUUID());
@@ -231,8 +233,8 @@
 
     private void fireImportEvents(Bundle source, ImportRegistration registration) {
         RemoteServiceAdminEvent rsaEvent =
-            new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_REGISTRATION, source, registration.getImportedReference(), registration
-                .getException());
+            new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_REGISTRATION, source, registration
+                .getImportReference(), registration.getException());
         EventAdmin eventAdmin = getEventAdmin();
         if (eventAdmin != null) {
             eventAdmin.postEvent(wrap(rsaEvent));
@@ -244,28 +246,36 @@
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdmin#getExportedServices()
+     * @see org.osgi.remoteserviceadmin.RemoteServiceAdmin#getExportedServices()
      */
-    public Collection<ExportRegistration> getExportedServices() {
+    public Collection<ExportReference> getExportedServices() {
+        Collection<ExportReference> exportedServices = new ArrayList<ExportReference>();
+        for (ExportRegistration registration : exportedRegistrations) {
+            exportedServices.add(registration.getExportReference());
+        }
         return exportedServices;
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdmin#getImportedEndpoints()
+     * @see org.osgi.remoteserviceadmin.RemoteServiceAdmin#getImportedEndpoints()
      */
-    public Collection<ImportRegistration> getImportedEndpoints() {
+    public Collection<ImportReference> getImportedEndpoints() {
+        Collection<ImportReference> importedEndpoints = new ArrayList<ImportReference>();
+        for (ImportRegistration registration : importRegistrations) {
+            importedEndpoints.add(registration.getImportReference());
+        }
         return importedEndpoints;
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdmin#importService(org.apache.tuscany.sca.dosgi.discovery.EndpointDescription)
+     * @see org.osgi.remoteserviceadmin.RemoteServiceAdmin#importService(org.apache.tuscany.sca.dosgi.discovery.EndpointDescription)
      */
     public ImportRegistration importService(EndpointDescription endpoint) {
         Bundle bundle = (Bundle)endpoint.getProperties().get(Bundle.class.getName());
         ImportRegistration importReg = importer.importService(bundle, endpoint);
         if (importReg != null) {
             fireImportEvents(bundle, importReg);
-            importedEndpoints.add(importReg);
+            importRegistrations.add(importReg);
         }
         return importReg;
     }

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/TopologyManagerImpl.java Tue Dec  1 21:59:20 2009
@@ -20,8 +20,8 @@
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
 import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_INTERFACES;
-import static org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_CONFIGS;
-import static org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_EXPORTED_CONFIGS;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED;
 
 import java.util.Collection;
 import java.util.Dictionary;
@@ -37,13 +37,6 @@
 
 import org.apache.tuscany.sca.common.java.collection.CollectionMap;
 import org.apache.tuscany.sca.core.LifeCycleListener;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointListener;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ExportRegistration;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.ImportRegistration;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdmin;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdminEvent;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteServiceAdminListener;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -52,6 +45,13 @@
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.framework.hooks.service.ListenerHook;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.EndpointListener;
+import org.osgi.service.remoteserviceadmin.ExportRegistration;
+import org.osgi.service.remoteserviceadmin.ImportRegistration;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdminEvent;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener;
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
@@ -178,7 +178,7 @@
         } else {
             for (Object ra : admins) {
                 RemoteServiceAdmin remoteAdmin = (RemoteServiceAdmin)ra;
-                List<ExportRegistration> exportRegistrations = remoteAdmin.exportService(reference, null);
+                Collection<ExportRegistration> exportRegistrations = remoteAdmin.exportService(reference, null);
                 if (exportRegistrations != null && !exportRegistrations.isEmpty()) {
                     exportedServices.putValues(reference, exportRegistrations);
                 }
@@ -329,7 +329,7 @@
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointListener#addEndpoint(org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription,
+     * @see org.osgi.remoteserviceadmin.EndpointListener#addEndpoint(org.osgi.service.remoteserviceadmin.EndpointDescription,
      *      java.lang.String)
      */
     public void endpointAdded(EndpointDescription endpoint, String matchedFilter) {
@@ -337,7 +337,7 @@
     }
 
     /**
-     * @see org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointListener#removeEndpoint(org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription)
+     * @see org.osgi.remoteserviceadmin.EndpointListener#removeEndpoint(org.osgi.service.remoteserviceadmin.EndpointDescription)
      */
     public void endpointRemoved(EndpointDescription endpoint, String matchedFilter) {
         unimportService(endpoint);

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/AbstractDiscoveryService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/AbstractDiscoveryService.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/AbstractDiscoveryService.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/AbstractDiscoveryService.java Tue Dec  1 21:59:20 2009
@@ -19,7 +19,7 @@
 
 package org.apache.tuscany.sca.osgi.service.discovery.impl;
 
-import static org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointListener.ENDPOINT_LISTENER_SCOPE;
+import static org.osgi.service.remoteserviceadmin.EndpointListener.ENDPOINT_LISTENER_SCOPE;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -37,15 +37,15 @@
 import org.apache.tuscany.sca.core.LifeCycleListener;
 import org.apache.tuscany.sca.node.NodeFactory;
 import org.apache.tuscany.sca.node.impl.NodeFactoryImpl;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointListener;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteConstants;
 import org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiHelper;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.EndpointListener;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
 import org.osgi.util.tracker.ServiceTracker;
 
 /**

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java Tue Dec  1 21:59:20 2009
@@ -27,11 +27,11 @@
 import org.apache.tuscany.sca.assembly.Implementation;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
 import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
 import org.apache.tuscany.sca.runtime.EndpointListener;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
 
 /**
  * Discovery service based on the distributed SCA domain

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java?rev=885958&r1=885957&r2=885958&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java Tue Dec  1 21:59:20 2009
@@ -36,8 +36,6 @@
 import org.apache.tuscany.sca.implementation.osgi.SCAConfig;
 import org.apache.tuscany.sca.implementation.osgi.ServiceDescription;
 import org.apache.tuscany.sca.implementation.osgi.ServiceDescriptions;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.remoteserviceadmin.RemoteConstants;
 import org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiHelper;
 import org.oasisopen.sca.ServiceRuntimeException;
 import org.osgi.framework.Bundle;
@@ -46,6 +44,8 @@
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
 import org.osgi.util.tracker.BundleTracker;
 import org.osgi.util.tracker.BundleTrackerCustomizer;
 import org.osgi.util.tracker.ServiceTracker;
@@ -88,14 +88,14 @@
     private EndpointDescription createEndpointDescription(ServiceDescription sd) {
         Map<String, Object> props = new HashMap<String, Object>(sd.getProperties());
         props.put(Constants.OBJECTCLASS, sd.getInterfaces().toArray(new String[sd.getInterfaces().size()]));
-        if (!props.containsKey(RemoteConstants.SERVICE_REMOTE_ID)) {
-            props.put(RemoteConstants.SERVICE_REMOTE_ID, String.valueOf(System.currentTimeMillis()));
+        if (!props.containsKey(RemoteConstants.ENDPOINT_ID)) {
+            props.put(RemoteConstants.ENDPOINT_ID, String.valueOf(System.currentTimeMillis()));
         }
-        if (!props.containsKey(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID)) {
-            props.put(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID, OSGiHelper.getFrameworkUUID(context));
+        if (!props.containsKey(RemoteConstants.ENDPOINT_FRAMEWORK_UUID)) {
+            props.put(RemoteConstants.ENDPOINT_FRAMEWORK_UUID, OSGiHelper.getFrameworkUUID(context));
         }
-        if (!props.containsKey(RemoteConstants.SERVICE_REMOTE_URI)) {
-            props.put(RemoteConstants.SERVICE_REMOTE_URI, UUID.randomUUID().toString());
+        if (!props.containsKey(RemoteConstants.ENDPOINT_URI)) {
+            props.put(RemoteConstants.ENDPOINT_URI, UUID.randomUUID().toString());
         }
 
         EndpointDescription sed = new EndpointDescription(props);

Added: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java?rev=885958&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java Tue Dec  1 21:59:20 2009
@@ -0,0 +1,540 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ *
+ * Licensed 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 org.osgi.service.remoteserviceadmin;
+
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_INTERACE_VERSION_;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_URI;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS;
+import static org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_INTENTS;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+
+/**
+ * A description of an endpoint that provides sufficient information for a
+ * compatible distribution provider to create a connection to this endpoint
+ * 
+ * An Endpoint Description is easy to transfer between different systems. This
+ * allows it to be used as a communications device to convey available endpoint
+ * information to nodes in a network.
+ * 
+ * An Endpoint Description reflects the perspective of an importer. That is, the
+ * property keys have been chosen to match filters that are created by client
+ * bundles that need a service. Therefore the map must not contain any
+ * service.exported.* property and must contain the service.imported.* ones.
+ * 
+ * The service.intents property contains the intents provided by the service
+ * itself combined with the intents added by the exporting distribution
+ * provider. Qualified intents appear expanded on this property.
+ * 
+ * @Immutable
+ * @version $Revision$
+ */
+
+public class EndpointDescription {
+    private final Map<String, Object>   properties;
+    private final List<String>          interfaces;
+    private final long                  remoteServiceId;
+    private final String                remoteFrameworkUUID;
+    private final String                remoteUri;
+
+    /**
+     * Create an Endpoint Description based on a Map.
+     * 
+     * @param properties The map to create the Endpoint Description from.
+     * @throws IllegalArgumentException When the properties are not proper for
+     *         an Endpoint Description
+     */
+
+    public EndpointDescription(Map<String, Object> properties) {
+        this(properties, null);
+        if (properties == null) {
+            throw new NullPointerException("properties must not be null");
+        }
+    }
+
+    /**
+     * Create an Endpoint Description based on a reference and optionally a map
+     * of additional properties. The properties on the original service take
+     * precedence over the ones in the map.
+     * 
+     * @param reference A service reference that can be exported
+     * @param properties Additional properties to add. Can be <code>null</code>.
+     * @throws IllegalArgumentException When the properties are not proper for
+     *         an Endpoint Description
+     */
+    public EndpointDescription(ServiceReference reference,
+            Map<String, Object> properties) {
+        this(properties, reference);
+        if (reference == null) {
+            throw new NullPointerException("reference must not be null");
+        }
+    }
+
+    private EndpointDescription(Map<String, Object> map,
+            ServiceReference reference) {
+        Map<String, Object> props = new TreeMap<String, Object>(
+                String.CASE_INSENSITIVE_ORDER);
+
+        if (map != null) {
+            try {
+                props.putAll(map);
+            }
+            catch (ClassCastException e) {
+                IllegalArgumentException iae = new IllegalArgumentException(
+                        "non-String key in properties");
+                iae.initCause(e);
+                throw iae;
+            }
+            if (props.size() < map.size()) {
+                throw new IllegalArgumentException(
+                        "duplicate keys with different cases in properties");
+            }
+        }
+
+        if (reference != null) {
+            for (String key : reference.getPropertyKeys()) {
+                if (!props.containsKey(key)) {
+                    props.put(key, reference.getProperty(key));
+                }
+            }
+        }
+
+        properties = Collections.unmodifiableMap(props);
+        /* properties must be initialized before calling the following methods */
+        interfaces = verifyObjectClassProperty();
+        remoteServiceId = verifyLongProperty(ENDPOINT_ID);
+        remoteFrameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
+        remoteUri = verifyStringProperty(ENDPOINT_URI);
+    }
+
+    /**
+     * Verify and obtain the interface list from the properties.
+     * 
+     * @return A list with the interface names.
+     * @throws IllegalArgumentException When the properties do not contain the
+     *         right values for and interface list.
+     * 
+     */
+    private List<String> verifyObjectClassProperty() {
+        Object o = properties.get(Constants.OBJECTCLASS);
+        if (o == null) {
+            return Collections.EMPTY_LIST;
+        }
+        if (!(o instanceof String[])) {
+            throw new IllegalArgumentException(
+                    "objectClass must be of type String[]");
+        }
+        String[] objectClass = (String[]) o;
+        for (String interf : objectClass) {
+            try {
+                getInterfaceVersion(interf);
+            }
+            catch (IllegalArgumentException e) {
+                IllegalArgumentException iae = new IllegalArgumentException(
+                        "Improper version for interface " + interf);
+                iae.initCause(e);
+                throw iae;
+            }
+        }
+        return Collections.unmodifiableList(Arrays.asList(objectClass));
+    }
+
+    /**
+     * Verify and obtain a required String property.
+     * 
+     * @param propName The name of the property
+     * @return The value of the property.
+     * @throws IllegalArgumentException when the property is not set or doesn't
+     *         have the correct data type.
+     */
+    private String verifyStringProperty(String propName) {
+        Object r = properties.get(propName);
+        if (r == null) {
+            throw new IllegalArgumentException("Required property not set: "
+                    + propName);
+        }
+        if (!(r instanceof String)) {
+            throw new IllegalArgumentException(
+                    "Required property is not a String: " + propName);
+        }
+        return (String) r;
+    }
+
+    /**
+     * Verify and obtain a required long property.
+     * 
+     * @param propName The name of the property
+     * @return The value of the property.
+     * @throws IllegalArgumentException when the property is not set or doesn't
+     *         have the correct data type.
+     */
+    private long verifyLongProperty(String propName) {
+        Object r = properties.get(propName);
+        if (r == null) {
+            throw new IllegalArgumentException("Required property not set: "
+                    + propName);
+        }
+        if (!(r instanceof String)) {
+            throw new IllegalArgumentException(
+                    "Required property is not a string: " + propName);
+        }
+        try {
+            return Long.parseLong((String) r);
+        }
+        catch (NumberFormatException e) {
+            IllegalArgumentException iae = new IllegalArgumentException(
+                    "Required property cannot be parsed as a long: " + propName);
+            iae.initCause(e);
+            throw iae;
+        }
+    }
+
+    /**
+     * Returns the endpoint's URI.
+     * 
+     * The URI is an opaque id for an endpoint in URI form. No two different
+     * endpoints must have the same URI, two Endpoint Descriptions with the same
+     * URI must represent the same endpoint.
+     * 
+     * The value of the URI is stored in the
+     * {@link RemoteConstants#ENDPOINT_URI} property.
+     * 
+     * @return The URI of the endpoint, never <code>null</code>.
+     */
+    public String getRemoteURI() {
+        return remoteUri;
+    }
+
+    /**
+     * Provide the list of interfaces implemented by the exported service.
+     * 
+     * If this Endpoint Description does not map to a service, then this List
+     * must be empty.
+     * 
+     * The value of the interfaces is derived from the <code>objectClass</code>
+     * property.
+     * 
+     * @return The read only list of Java interface names accessible by this
+     *         endpoint.
+     */
+    public List<String> getInterfaces() {
+        return interfaces;
+    }
+
+    /**
+     * Provide the version of the given interface.
+     * 
+     * The version is encoded by prefixing the given interface name with
+     * <code>endpoint.interface.version.</code>, and then using this as an
+     * endpoint property key. For example:
+     * 
+     * <pre>
+     * endpoint.interface.version.com.acme.Foo
+     * </pre>
+     * 
+     * The value of this property is in String format and will be converted to a
+     * <code>Version</code> object by this method.
+     * 
+     * @param name The name of the interface for which a version is requested.
+     * @return The version of the given interface or <code>null</code> if the
+     *         interface has no version in this Endpoint Description.
+     * @throws IllegalArgumentException If the version property value is not
+     *         String.
+     */
+    public Version getInterfaceVersion(String name) {
+        String key = ENDPOINT_INTERACE_VERSION_ + name;
+        Object version = properties.get(key);
+        // [rfeng] Check for existence of the property
+        if (version == null) {
+            return null;
+        }
+        // [rfeng]
+        if (!(version instanceof String)) {
+            throw new IllegalArgumentException(key
+                    + " property is not a String");
+        }
+        return Version.parseVersion((String) version);
+    }
+
+    /**
+     * Returns the service id for the service exported through this endpoint.
+     * 
+     * This is the service id under which the framework has registered the
+     * service. This field together with the Framework UUID is a globally unique
+     * id for a service.
+     * 
+     * The value of the remote service id is stored in the
+     * {@link RemoteConstants#ENDPOINT_ID} endpoint property.
+     * 
+     * @return Service id of a service or 0 if this Endpoint Description does
+     *         not relate to an OSGi service
+     * 
+     */
+    public long getRemoteServiceID() {
+        return remoteServiceId;
+    }
+
+    /**
+     * Returns the configuration types.
+     * 
+     * A distribution provider exports a service with an endpoint. This endpoint
+     * uses some kind of communications protocol with a set of configuration
+     * parameters. There are many different types but each endpoint is
+     * configured by only one configuration type. However, a distribution
+     * provider can be aware of different configuration types and provide
+     * synonyms to increase the change a receiving distribution provider can
+     * create a connection to this endpoint.
+     * 
+     * This value of the configuration types is stored in the
+     * {@link RemoteConstants#SERVICE_IMPORTED_CONFIGS} service property.
+     * 
+     * @return An unmodifiable list of the configuration types used for the
+     *         associated endpoint and optionally synonyms.
+     */
+    public List<String> getConfigurationTypes() {
+        return getStringPlusProperty(SERVICE_IMPORTED_CONFIGS);
+    }
+
+    /**
+     * Return the list of intents implemented by this endpoint.
+     * 
+     * The intents are based on the service.intents on an imported service,
+     * except for any intents that are additionally provided by the importing
+     * distribution provider. All qualified intents must have been expanded.
+     * 
+     * This value of the intents is stored in the
+     * {@link RemoteConstants#SERVICE_INTENTS} service property.
+     * 
+     * @return An unmodifiable list of expanded intents that are provided by
+     *         this endpoint.
+     */
+    public List<String> getIntents() {
+        return getStringPlusProperty(SERVICE_INTENTS);
+    }
+
+    /**
+     * Reads a 'String+' property from the properties map, which may be of type
+     * String, String[] or Collection<String> and returns it as an unmodifiable
+     * List.
+     * 
+     * @param key The property
+     * @return An unmodifiable list
+     */
+    private List<String> getStringPlusProperty(String key) {
+        Object value = properties.get(key);
+        if (value == null) {
+            return Collections.EMPTY_LIST;
+        }
+
+        if (value instanceof String) {
+            return Collections.singletonList((String) value);
+        }
+
+        if (value instanceof String[]) {
+            String[] values = (String[]) value;
+            List<String> result = new ArrayList<String>(values.length);
+            for (String v : values) {
+                if (v != null) {
+                    result.add(v);
+                }
+            }
+            return Collections.unmodifiableList(result);
+        }
+
+        if (value instanceof Collection< ? >) {
+            Collection< ? > values = (Collection< ? >) value;
+            List<String> result = new ArrayList<String>(values.size());
+            for (Iterator< ? > iter = values.iterator(); iter.hasNext();) {
+                Object v = iter.next();
+                if ((v != null) && (v instanceof String)) {
+                    result.add((String) v);
+                }
+            }
+            return Collections.unmodifiableList(result);
+        }
+
+        return Collections.EMPTY_LIST;
+    }
+
+    /**
+     * Return the framework UUID for the remote service, if present.
+     * 
+     * The value of the remote framework uuid is stored in the
+     * {@link RemoteConstants#ENDPOINT_FRAMEWORK_UUID} endpoint property.
+     * 
+     * @return Remote Framework UUID, or null if this endpoint is not associated
+     *         with an OSGi service
+     */
+    public String getRemoteFrameworkUUID() {
+        return remoteFrameworkUUID;
+    }
+
+    /**
+     * Returns all endpoint properties.
+     * 
+     * @return An unmodifiable map referring to the properties of this Endpoint
+     *         Description.
+     */
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
+
+    /**
+     * Answers if this Endpoint Description refers to the same service instance
+     * as the given Endpoint Description.
+     * 
+     * Two Endpoint Descriptions point to the same service if they have the same
+     * URI or their framework UUIDs and remote service ids are equal.
+     * 
+     * @param other The Endpoint Description to look at
+     * @return True if this endpoint description points to the same service as
+     *         the other
+     */
+    public boolean isSameService(EndpointDescription other) {
+        if (this.equals(other)) {
+            return true;
+        }
+
+        if (getRemoteFrameworkUUID() == null) {
+            return false;
+        }
+
+        return (this.getRemoteServiceID() == other.getRemoteServiceID())
+                && this.getRemoteFrameworkUUID().equals(
+                        other.getRemoteFrameworkUUID());
+    }
+
+    /**
+     * Returns a hash code value for the object.
+     * 
+     * @return An integer which is a hash code value for this object.
+     */
+    public int hashCode() {
+        return getRemoteURI().hashCode();
+    }
+
+    /**
+     * Compares this <code>EndpointDescription</code> object to another object.
+     * 
+     * <p>
+     * An Endpoint Description is considered to be <b>equal to</b> another
+     * Endpoint Description if their URIs are equal.
+     * 
+     * @param other The <code>EndpointDescription</code> object to be compared.
+     * @return <code>true</code> if <code>object</code> is a
+     *         <code>EndpointDescription</code> and is equal to this object;
+     *         <code>false</code> otherwise.
+     */
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (!(other instanceof EndpointDescription)) {
+            return false;
+        }
+        return getRemoteURI().equals(
+                ((EndpointDescription) other).getRemoteURI());
+    }
+
+    /**
+     * Tests the properties of this <code>EndpointDescription</code> against the
+     * given filter using a case insensitive match.
+     * 
+     * @param filter The filter to test.
+     * @return <code>true</code> If the properties of this
+     *         <code>EndpointDescription</code> match the filter,
+     *         <code>false</code> otherwise.
+     * @throws IllegalArgumentException If <code>filter</code> contains an
+     *         invalid filter string that cannot be parsed.
+     */
+    public boolean matches(String filter) {
+        Filter f;
+        try {
+            f = FrameworkUtil.createFilter(filter);
+        }
+        catch (InvalidSyntaxException e) {
+            IllegalArgumentException iae = new IllegalArgumentException(e
+                    .getMessage());
+            iae.initCause(e);
+            throw iae;
+        }
+        Dictionary<String, Object> d = new UnmodifiableDictionary<String, Object>(
+                properties);
+        /*
+         * we can use matchCase here since properties already supports case
+         * insensitive key lookup.
+         */
+        return f.matchCase(d);
+    }
+
+    /**
+     * Unmodifiable wrapper for Dictionary.
+     */
+    private static class UnmodifiableDictionary<K, V> extends Dictionary<K, V> {
+        private final Map<K, V> wrapped;
+
+        UnmodifiableDictionary(Map<K, V> wrapped) {
+            this.wrapped = wrapped;
+        }
+
+        public Enumeration<V> elements() {
+            return Collections.enumeration(wrapped.values());
+        }
+
+        public V get(Object key) {
+            return wrapped.get(key);
+        }
+
+        public boolean isEmpty() {
+            return wrapped.isEmpty();
+        }
+
+        public Enumeration<K> keys() {
+            return Collections.enumeration(wrapped.keySet());
+        }
+
+        public V put(K key, V value) {
+            throw new UnsupportedOperationException();
+        }
+
+        public V remove(Object key) {
+            throw new UnsupportedOperationException();
+        }
+
+        public int size() {
+            return wrapped.size();
+        }
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java?rev=885958&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java Tue Dec  1 21:59:20 2009
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ *
+ * Licensed 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 org.osgi.service.remoteserviceadmin;
+
+/**
+ * A white board service that represents a listener for endpoints.
+ * 
+ * An Endpoint Listener represents a participant in the distributed model that
+ * is interested in Endpoint Descriptions.
+ * 
+ * This white board service can be used in many different scenarios. However,
+ * the primary use case is to allow a remote manager to be informed of End Point
+ * Descriptions available in the network and inform the network about available
+ * End Point Descriptions.
+ * 
+ * Both the network bundle and the manager bundle register an Endpoint Listener
+ * service. The manager informs the network bundle about End Points that it
+ * creates. The network bundles then uses a protocol like SLP to announce these
+ * local end-points to the network.
+ * 
+ * If the network bundle discovers a new Endpoint through its discovery
+ * protocol, then it sends an End Point Description to all the End Point
+ * Listener services that are registered (except its own) that have specified an
+ * interest in that endpoint.
+ * 
+ * Endpoint Listener services can express their <i>scope</i> with the service
+ * property {@link #ENDPOINT_LISTENER_SCOPE}. This service property is a list of
+ * filters. An Endpoint Description should only be given to a Endpoint Listener
+ * when there is at least one filter that matches the Endpoint Description
+ * properties. given to it.
+ * 
+ * This filter model is quite flexible. For example, a discovery bundle is only
+ * interested in locally originating Endpoint Descriptions. The following filter
+ * ensure that it only sees local endpoints.
+ * 
+ * <pre>
+ *   (org.osgi.framework.uuid=72dc5fd9-5f8f-4f8f-9821-9ebb433a5b72)
+ * </pre>
+ * 
+ * In the same vein, a manager that is only interested in remote Endpoint
+ * Descriptions can use a filter like:
+ * 
+ * <pre>
+ *   (!(org.osgi.framework.uuid=72dc5fd9-5f8f-4f8f-9821-9ebb433a5b72))
+ * </pre>
+ * 
+ * Where in both cases, the given UUID is the UUID of the local framework that
+ * can be found in the Framework properties.
+ * 
+ * The Endpoint Listener's scope maps very well to the service hooks. A manager
+ * can just register all filters found from the Listener Hook as its scope. This
+ * will automatically provide it with all known endpoints that match the given
+ * scope, without having to inspect the filter string.
+ * 
+ * In general, when an Endpoint Description is discovered, it should be
+ * dispatched to all registered Endpoint Listener services. If a new Endpoint
+ * Listener is registered, it should be informed about all currently known
+ * Endpoints that match its scope. If a getter of the Endpoint Listener service
+ * is unregistered, then all its registered Endpoint Description objects must be
+ * removed.
+ * 
+ * The Endpoint Listener models a <i>best effort</i> approach. Participating
+ * bundles should do their utmost to keep the listeners up to date, but
+ * implementers should realize that many endpoints come through unreliable
+ * discovery processes.
+ * 
+ * 
+ * @ThreadSafe
+ * @version $Revision$
+ */
+public interface EndpointListener {
+	/**
+	 * Specifies the interest of this listener with filters. This listener is
+	 * only interested in Endpoint Descriptions where its properties match the
+	 * given filter. The type of this property must be <code>String+</code>.
+	 */
+	String	ENDPOINT_LISTENER_SCOPE	= "endpoint.listener.scope";
+
+	/**
+	 * Register an endpoint with this listener.
+	 * 
+	 * If the endpoint matches one of the filters registered with the
+	 * {@link #ENDPOINT_LISTENER_SCOPE} service property then this filter should
+	 * be given as the <code>matchedFilter</code> parameter.
+	 * 
+	 * When this service is first registered or it is modified, it should
+	 * receive all known endpoints matching the filter.
+	 * 
+	 * @param endpoint The Endpoint Description to be published
+	 * @param matchedFilter The filter from the {@link #ENDPOINT_LISTENER_SCOPE}
+	 *        that matched the endpoint, must not be <code>null</code>.
+	 */
+	void endpointAdded(EndpointDescription endpoint, String matchedFilter);
+
+	/**
+	 * Remove the registration of an endpoint.
+	 * 
+	 * If an endpoint that was registered with the
+	 * {@link #endpointAdded(EndpointDescription, String)} method is no longer
+	 * available then this method should be called. This will remove the
+	 * endpoint from the listener.
+	 * 
+	 * It is not necessary to remove endpoints when the service is unregistered
+	 * or modified in such a way that not all endpoints match the interest
+	 * filter anymore.
+	 * 
+	 * @param endpoint The Endpoint Description that is no longer valid.
+	 * @param matchedFilter The filter from the {@link #ENDPOINT_LISTENER_SCOPE}
+	 *        that matched the endpoint, must not be <code>null</code>.
+	 */
+	void endpointRemoved(EndpointDescription endpoint, String matchedFilter);
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date