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/11/11 02:33:54 UTC

svn commit: r834738 - in /tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin: ./ impl/

Author: rfeng
Date: Wed Nov 11 01:33:53 2009
New Revision: 834738

URL: http://svn.apache.org/viewvc?rev=834738&view=rev
Log:
Add Import/Export Reference

Added:
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java   (with props)
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java   (with props)
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java   (with props)
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java   (with props)
Modified:
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointDescription.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointPermission.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportRegistration.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportRegistration.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteConstants.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdmin.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdminEvent.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointDescription.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointDescription.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointDescription.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointDescription.java Wed Nov 11 01:33:53 2009
@@ -15,14 +15,21 @@
  */
 package org.apache.tuscany.sca.osgi.remoteserviceadmin;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
+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;
 
@@ -36,28 +43,20 @@
  * 
  * 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.
- * 
- * TODO Automatically calculate versions of interface packages?
- * 
- * TODO Constructor that takes a class?
- * 
- * TODO Skipping of service.exported.* properties?
- * 
- * TODO qualified intents?
- * 
+ * 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 = new HashMap/*
-                                                                    * <String ,
-                                                                    * Object >
-                                                                    */();
-    private final List /* String */interfaces;
+    private final Map<String, Object> properties;
+    private final List<String> interfaces;
     private final long remoteServiceId;
     private final String remoteFrameworkUUID;
     private final String remoteUri;
@@ -65,38 +64,58 @@
     /**
      * Create an Endpoint Description based on a Map.
      * 
-     * @param properties
+     * @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) throws IllegalArgumentException {
-        this.properties.putAll(properties);
-
-        interfaces = verifyInterfacesProperty();
-        remoteServiceId = verifyLongProperty(RemoteConstants.SERVICE_REMOTE_ID);
-        remoteFrameworkUUID = verifyStringProperty(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID);
-        remoteUri = verifyStringProperty(RemoteConstants.SERVICE_REMOTE_URI);
+    public EndpointDescription(Map<String, Object> properties) {
+        this(properties, null);
     }
 
     /**
      * Create an Endpoint Description based on a reference and optionally a map
-     * of additional properties.
+     * of additional properties. The properties on the original service take
+     * precedence over the ones in the map.
      * 
-     * @param ref A service reference that can be exported
+     * @param reference A service reference that can be exported
      * @param properties Additional properties to add. Can be <code>null</code>.
-     * @throws IllegalArgumentException
+     * @throws IllegalArgumentException When the properties are not proper for
+     *         an Endpoint Description
      */
-    public EndpointDescription(ServiceReference ref, Map /* <String,Object> */properties)
-        throws IllegalArgumentException {
-        if (properties != null) {
-            this.properties.putAll(properties);
+    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");
+            }
         }
 
-        String[] keys = ref.getPropertyKeys();
-        for (int i = 0; i > keys.length; i++)
-            properties.put(keys[i], ref.getProperty(keys[i]));
+        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 = verifyInterfacesProperty();
         remoteServiceId = verifyLongProperty(RemoteConstants.SERVICE_REMOTE_ID);
         remoteFrameworkUUID = verifyStringProperty(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID);
@@ -104,64 +123,32 @@
     }
 
     /**
-     * Create an Endpoint Description based on the URI, the remote service ID
-     * and the interface names, and optionally service properties.
-     * 
-     * @param uri The URI of the remote service.
-     * @param interfaceNames The names of the interfaces of the service to
-     *        consider.
-     * @param remoteServiceId the remote service ID.
-     * @param properties Optionally service properties.
-     */
-    public EndpointDescription(String uri, String[] interfaceNames, int remoteServiceId, Map properties) {
-        if (uri == null) {
-            throw new IllegalArgumentException("URI must not be null");
-        }
-        if (interfaceNames == null) {
-            throw new IllegalArgumentException("Interfaces must not be null");
-        }
-        this.remoteUri = uri;
-        this.interfaces = Arrays.asList(interfaceNames);
-        this.remoteServiceId = remoteServiceId;
-        this.remoteFrameworkUUID = (String)properties.get(RemoteConstants.SERVICE_REMOTE_FRAMEWORK_UUID);
-        if (properties != null) {
-            this.properties.putAll(properties);
-        }
-        if (interfaceNames != null) {
-            this.properties.put(Constants.OBJECTCLASS, interfaceNames);
-        }
-        this.properties.put(RemoteConstants.SERVICE_REMOTE_URI, uri);
-        if (remoteServiceId <= 0) {
-            this.properties.put(RemoteConstants.SERVICE_REMOTE_ID, new Integer(remoteServiceId));
-        }
-    }
-
-    /**
      * Verify and obtain the interface list from the properties.
      * 
      * @return A list with the interface names.
-     * @throws IllegalArgumentException when
+     * @throws IllegalArgumentException When the properties do not contain the
+     *         right values for and interface list.
+     * 
      */
-    private List /* <String> */verifyInterfacesProperty() {
-        List l = null;
-
-        Object objectClass = properties.get(Constants.OBJECTCLASS);
-        if (objectClass == null)
-            l = Collections.EMPTY_LIST;
-        else if (!(objectClass instanceof String[]))
+    private List<String> verifyInterfacesProperty() {
+        Object o = properties.get(Constants.OBJECTCLASS);
+        if (o == null) {
+            return Collections.EMPTY_LIST;
+        }
+        if (!(o instanceof String[])) {
             throw new IllegalArgumentException("objectClass must be a String[]");
-        else {
-            l = Collections.unmodifiableList(Arrays.asList((String[])objectClass));
-            for (Iterator i = l.iterator(); i.hasNext();) {
-                String interf = (String)i.next();
-                try {
-                    getInterfaceVersion(interf);
-                } catch (Exception e) {
-                    throw new IllegalArgumentException("Improper version for interface " + interf + " caused by " + e);
-                }
+        }
+        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 l;
+        return Collections.unmodifiableList(Arrays.asList(objectClass));
     }
 
     /**
@@ -178,7 +165,7 @@
             throw new IllegalArgumentException("Required property not set: " + propName);
         }
         if (!(r instanceof String)) {
-            throw new IllegalArgumentException("Required property is not a string: " + propName);
+            throw new IllegalArgumentException("Required property is not a String: " + propName);
         }
         return (String)r;
     }
@@ -193,7 +180,6 @@
      */
     private long verifyLongProperty(String propName) {
         Object r = properties.get(propName);
-        long result;
         if (r == null) {
             throw new IllegalArgumentException("Required property not set: " + propName);
         }
@@ -201,11 +187,13 @@
             throw new IllegalArgumentException("Required property is not a string: " + propName);
         }
         try {
-            result = Long.parseLong((String)r);
+            return Long.parseLong((String)r);
         } catch (NumberFormatException e) {
-            throw new IllegalArgumentException("Required property cannot be parsed as a long: " + propName);
+            IllegalArgumentException iae =
+                new IllegalArgumentException("Required property cannot be parsed as a long: " + propName);
+            iae.initCause(e);
+            throw iae;
         }
-        return result;
     }
 
     /**
@@ -225,7 +213,7 @@
     }
 
     /**
-     * Answer the list of interfaces implemented by the exported service.
+     * 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.
@@ -236,43 +224,42 @@
      * @return The read only list of Java interface names accessible by this
      *         endpoint.
      */
-    public List/* <String> */getInterfaces() {
+    public List<String> getInterfaces() {
         return interfaces;
     }
 
     /**
-     * Answer the version of the given interface.
+     * Provide the version of the given interface.
      * 
      * The version is encoded by prefixing the given interface name with
      * <code>endpoint.version.</code>, and then using this as a property key.
-     * The value must then be the <code>Version</code> object. For example:
+     * For example:
      * 
      * <pre>
      * endpoint.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
      */
     public Version getInterfaceVersion(String name) {
-        String v = (String)properties.get("endpoint.version." + name);
-        if (v == null) {
-            return Version.emptyVersion;
-        } else {
-            return new Version(v);
-        }
+        String version = (String)properties.get("endpoint.version." + name);
+        return Version.parseVersion(version);
     }
 
     /**
-     * Returns the service id for the service exported through this
-     * endpoint.
+     * 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.
+     * 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.
      * 
-     * @return Service id of a service or 0 if this Endpoint
-     *         Description does not relate to an OSGi service
+     * @return Service id of a service or 0 if this Endpoint Description does
+     *         not relate to an OSGi service
      * 
      */
     public long getRemoteServiceID() {
@@ -293,12 +280,11 @@
      * This value represents the
      * {@link RemoteConstants#SERVICE_IMPORTED_CONFIGS}
      * 
-     * @return The configuration type used for the associated endpoint and
-     *         optionally synonyms.
+     * @return An unmodifiable list of the configuration types used for the
+     *         associated endpoint and optionally synonyms.
      */
-    public List/* <String> */getConfigurationTypes() {
-        // TODO
-        return null;
+    public List<String> getConfigurationTypes() {
+        return getStringPlusProperty(RemoteConstants.SERVICE_IMPORTED_CONFIGS);
     }
 
     /**
@@ -311,21 +297,66 @@
      * The property the intents come from is
      * {@link RemoteConstants#SERVICE_INTENTS}
      * 
-     * @return A list of expanded intents that are provided by this endpoint.
+     * @return An unmodifiable list of expanded intents that are provided by
+     *         this endpoint.
+     */
+    public List<String> getIntents() {
+        return getStringPlusProperty(RemoteConstants.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
+     * @throws Illegal
      */
-    public List/* <String> */getIntents() {
-        // TODO
-        return null;
+    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 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 result;
+        }
+
+        return Collections.EMPTY_LIST;
     }
 
     /**
-     * Return the framework UUID, if present.
+     * Return the framework UUID for the remote service, if present.
      * 
-     * The property the intents come from is
+     * The property the framework UUID comes from is
      * {@link RemoteConstants#SERVICE_REMOTE_FRAMEWORK_UUID}
      * 
-     * @return Remote Framework UUID, or null if this endpoint is not associated with an OSGi service
+     * @return Remote Framework UUID, or null if this endpoint is not associated
+     *         with an OSGi service
      */
     public String getRemoteFrameworkUUID() {
         return remoteFrameworkUUID;
@@ -337,9 +368,8 @@
      * @return An unmodifiable map referring to the properties of this Endpoint
      *         Description.
      */
-    public Map/* <String, Object> */getProperties() {
-        // TODO
-        return Collections.unmodifiableMap(properties);
+    public Map<String, Object> getProperties() {
+        return properties;
     }
 
     /**
@@ -366,20 +396,77 @@
     /**
      * Two endpoints are equal if their URIs are equal, the hash code is
      * therefore derived from the URI.
+     * 
+     * @return The hashcode of this endpoint.
      */
     public int hashCode() {
-        // TODO
         return getRemoteURI().hashCode();
     }
 
     /**
      * Two endpoints are equal if their URIs are equal.
+     * 
+     * @return
      */
     public boolean equals(Object other) {
-        if (other instanceof EndpointDescription) {
-            return getRemoteURI().equals(((EndpointDescription)other).getRemoteURI());
+        if (this == other) {
+            return true;
+        }
+        if (!(other instanceof EndpointDescription)) {
+            return false;
         }
-        return false;
+        return getRemoteURI().equals(((EndpointDescription)other).getRemoteURI());
+    }
+
+    /**
+     * TODO
+     * 
+     * @param filter
+     * @return
+     * @throws InvalidSyntaxException
+     */
+    public boolean match(String filter) throws InvalidSyntaxException {
+        Filter f = FrameworkUtil.createFilter(filter);
+        Dictionary<String, Object> d = new UnmodifiableDictionary<String, Object>(properties);
+        return f.matchCase(d);
     }
 
+    /**
+     * Unmodifiable wrapper for Dictionary.
+     */
+    private static class UnmodifiableDictionary<K, V> extends Dictionary<K, V> {
+        private final Map<? extends K, ? extends V> wrapped;
+
+        UnmodifiableDictionary(Map<? extends K, ? extends V> wrapped) {
+            this.wrapped = wrapped;
+        }
+
+        public Enumeration<V> elements() {
+            return (Enumeration<V>)Collections.enumeration(wrapped.values());
+        }
+
+        public V get(Object key) {
+            return wrapped.get(key);
+        }
+
+        public boolean isEmpty() {
+            return wrapped.isEmpty();
+        }
+
+        public Enumeration<K> keys() {
+            return (Enumeration<K>)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();
+        }
+    }
 }

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointPermission.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointPermission.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointPermission.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/EndpointPermission.java Wed Nov 11 01:33:53 2009
@@ -58,6 +58,12 @@
 import org.osgi.framework.InvalidSyntaxException;
 
 /**
+ * <pre>
+ * -------------------------------------------------------------
+ * THIS CLASS IS A PLACEHOLDER (COPIED FROM SERVICE PERMISSION)!
+ * -------------------------------------------------------------
+ * </pre>
+ * 
  * A bundle's authority to register or get a service.
  * <ul>
  * <li>The <code>register</code> action allows a bundle to register a service

Added: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java?rev=834738&view=auto
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java (added)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java Wed Nov 11 01:33:53 2009
@@ -0,0 +1,43 @@
+/*
+ * 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.apache.tuscany.sca.osgi.remoteserviceadmin;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * An Export Reference associates a service with a local endpoint.
+ * 
+ * The Export Reference can be used to reference an exported service. When the 
+ * service is no longer exported, all methods must return <code>null</code>;
+ * 
+ * @ThreadSafe
+ */
+public interface ExportReference {
+    /**
+     * Return the service being exported.
+     * 
+     * @return The service being exported, must be <code>null</code> when this
+     *         registration is unregistered.
+     */
+    ServiceReference getExportedService();
+
+    /**
+     * Return the Endpoint Description that is created for this registration.
+     * 
+     * @return the local Endpoint Description
+     */
+    EndpointDescription getEndpointDescription();
+}

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportReference.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportRegistration.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportRegistration.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportRegistration.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ExportRegistration.java Wed Nov 11 01:33:53 2009
@@ -31,21 +31,12 @@
  */
 public interface ExportRegistration {
     /**
-     * Return the service being exported.
+     * Return the Export Reference for the exported service.
      * 
-     * @return The service being exported, must be <code>null</code> when this
-     *         registration is unregistered.
+     * @return An Export Reference for this registration 
      * @throws IllegalStateException Thrown when this object was not properly initialized, see {@link #getException()}
      */
-    ServiceReference getExportedService() throws IllegalStateException;
-
-    /**
-     * Return the Endpoint Description that is created for this registration.
-     * 
-     * @return the local Endpoint Description
-     * @throws IllegalStateException Thrown when this object was not properly initialized, see {@link #getException()}
-     */
-    EndpointDescription getEndpointDescription();
+    ExportReference getExportReference() throws IllegalStateException;
 
     /**
      * Delete the local endpoint and disconnect any remote distribution

Added: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java?rev=834738&view=auto
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java (added)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java Wed Nov 11 01:33:53 2009
@@ -0,0 +1,42 @@
+/*
+ * 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.apache.tuscany.sca.osgi.remoteserviceadmin;
+
+import org.osgi.framework.ServiceReference;
+
+/**
+ * An Import Reference associates an active proxy service to a remote endpoint.
+ * 
+ * The Import Reference can be used to reference an imported service. When the
+ * service is no longer imported, all methods must return <code>null</code>;
+ * 
+ * @ThreadSafe
+ */
+public interface ImportReference {
+    /**
+     * Answer the associated Service Reference for the proxy to the endpoint.
+     * 
+     * @return A Service Reference to the proxy for the endpoint.
+     */
+    ServiceReference getImportedService();
+
+    /**
+     * Answer the associated remote Endpoint Description.
+     * 
+     * @return A Endpoint Description for the remote endpoint.
+     */
+    EndpointDescription getImportedEndpointDescription();
+}

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportReference.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportRegistration.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportRegistration.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportRegistration.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/ImportRegistration.java Wed Nov 11 01:33:53 2009
@@ -15,8 +15,6 @@
  */
 package org.apache.tuscany.sca.osgi.remoteserviceadmin;
 
-import org.osgi.framework.ServiceReference;
-
 /**
  * An Import Registration associates an active proxy service to a remote
  * endpoint.
@@ -29,20 +27,12 @@
  */
 public interface ImportRegistration {
     /**
-     * Answer the associated Service Reference for the proxy to the endpoint.
-     * 
-     * @return A Service Reference to the proxy for the endpoint.
-     * @throws IllegalStateException Thrown when this object was not properly initialized, see {@link #getException()}
-     */
-    ServiceReference getImportedService();
-
-    /**
-     * Answer the associated remote Endpoint Description.
+     * Answer the associated Export Reference.
      * 
-     * @return A Endpoint Description for the remote endpoint.
+     * @return An Import Reference for this registration
      * @throws IllegalStateException Thrown when this object was not properly initialized, see {@link #getException()}
      */
-    EndpointDescription getImportedEndpointDescription();
+    ImportReference getImportedReference();
 
     /**
      * Unregister this Import Registration. This must close the connection 

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteConstants.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteConstants.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteConstants.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteConstants.java Wed Nov 11 01:33:53 2009
@@ -131,7 +131,7 @@
      *
      * The value of this property is of type <code>String+</code>.
      */
-    public final String SERVICE_IMPORTED_CONFIGS = "service.imported.configs";
+    public final static String SERVICE_IMPORTED_CONFIGS = "service.imported.configs";
 
     /**
      * A list of intents that this service implements. This property has dual
@@ -152,19 +152,19 @@
      * endpoint following the URI syntax. As far as this specification is
      * concerned, this unique id is opaque.
      */
-    final public static String SERVICE_REMOTE_URI = "service.remote.uri";
+    public final static String SERVICE_REMOTE_URI = "service.remote.uri";
 
     /**
      * The property key for the endpoint service id. This is a unique id for a
      * service based on the framework id '.' service id or another model. As far as this specification is
      * concerned, this unique id is opaque.
      */
-    final public static String SERVICE_REMOTE_ID = "service.remote.id";
+    public final static String SERVICE_REMOTE_ID = "service.remote.id";
 
     /**
      * The property key for the endpoint service id. This is a unique id for a
      * service based on the framework id '.' service id or another model. As far as this specification is
      * concerned, this unique id is opaque.
      */
-    final public static String SERVICE_REMOTE_FRAMEWORK_UUID = "service.remote.framework.id";
+    public final static String SERVICE_REMOTE_FRAMEWORK_UUID = "service.remote.framework.id";
 }

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdmin.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdmin.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdmin.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdmin.java Wed Nov 11 01:33:53 2009
@@ -97,29 +97,23 @@
     ImportRegistration importService(EndpointDescription endpoint);
 
     /**
-     * Answer the currently active Export Registrations.
+     * Answer the currently active Export References.
      * 
      * @return A collection of Export Registrations that are currently active.
      * @throws SecurityException When the caller no
      *         {@link EndpointPermission#READ} could be obtained
-     *         
-     * TODO I guess we must ensure these registrations cannot be closed? Only the owners should be able to close them,
-     * TODO should we make sure that the list contains the registration objects that the caller created?
      */
-    Collection/* <ExportRegistration> */getExportedServices();
+    Collection/* <ExportReference> */getExportedServices();
 
     /**
-     * Answer the currently active Import Registrations.
+     * Answer the currently active Import References.
      * 
      * @throws SecurityException When the caller no EndpointPermission LIST
      *         could be obtained
      * @return A collection of Import Registrations that are currently active.
      * @throws SecurityException When the caller no
      *         {@link EndpointPermission#READ} could be obtained
-     *         
-     * TODO I guess we must ensure these registrations cannot be closed? Only the owners should be able to close them,
-     * TODO should we make sure that the list contains the registration objects that the caller created?
      */
-    Collection/* <ImportRegistration> */getImportedEndpoints();
+    Collection/* <ImportReference> */getImportedEndpoints();
 
 }

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdminEvent.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdminEvent.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdminEvent.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/RemoteServiceAdminEvent.java Wed Nov 11 01:33:53 2009
@@ -76,8 +76,8 @@
      */
     public static final int IMPORT_WARNING = 8;
 
-    private final ImportRegistration importRegistration;
-    private final ExportRegistration exportRegistration;
+    private final ImportReference importReference;
+    private final ExportReference exportReference;
     private final Throwable exception;
     private final int type;
     private final Bundle source;
@@ -87,19 +87,19 @@
      * 
      * @param type The event type
      * @param source The source bundle, must not be <code>null</code>.
-     * @param importRegistration The importRegistration, can be <code>null</code>.
-     * @param exportRegistration The exportRegistration, can be <code>null</code>.
+     * @param importReference The importReference, can be <code>null</code>.
+     * @param exportReference The exportReference, can be <code>null</code>.
      * @param exception Any exceptions encountered, can be <code>null</code>
      */
     RemoteServiceAdminEvent(int type,
                             Bundle source,
-                            ImportRegistration importRegistration,
-                            ExportRegistration exportRegistration,
+                            ImportReference importReference,
+                            ExportReference exportReference,
                             Throwable exception) {
         this.type = type;
         this.source = source;
-        this.importRegistration = importRegistration;
-        this.exportRegistration = exportRegistration;
+        this.importReference = importReference;
+        this.exportReference = exportReference;
         this.exception = exception;
     }
 
@@ -108,10 +108,11 @@
      * 
      * @param type The event type
      * @param source The source bundle, must not be <code>null</code>.
-     * @param exportRegistration The exportRegistration, can not be <code>null</code>.
+     * @param exportRegistration The exportRegistration, can not be
+     *        <code>null</code>.
      * @param exception Any exceptions encountered, can be <code>null</code>
      */
-    public RemoteServiceAdminEvent(int type, Bundle source, ExportRegistration exportRegistration, Throwable exception) {
+    public RemoteServiceAdminEvent(int type, Bundle source, ExportReference exportRegistration, Throwable exception) {
         this(type, source, null, exportRegistration, exception);
     }
 
@@ -120,25 +121,26 @@
      * 
      * @param type The event type
      * @param source The source bundle, must not be <code>null</code>.
-     * @param importRegistration The importRegistration, can not be <code>null</code>.
+     * @param importRegistration The importRegistration, can not be
+     *        <code>null</code>.
      * @param exception Any exceptions encountered, can be <code>null</code>
      */
-    public RemoteServiceAdminEvent(int type, Bundle source, ImportRegistration importRegistration, Throwable exception) {
+    public RemoteServiceAdminEvent(int type, Bundle source, ImportReference importRegistration, Throwable exception) {
         this(type, source, importRegistration, null, exception);
     }
 
     /**
      * @return the importRegistration or <code>null</code>
      */
-    public ImportRegistration getImportRegistration() {
-        return importRegistration;
+    public ImportReference getImportReference() {
+        return importReference;
     }
 
     /**
      * @return the exportRegistration or <code>null</code>
      */
-    public ExportRegistration getExportRegistration() {
-        return exportRegistration;
+    public ExportReference getExportReference() {
+        return exportReference;
     }
 
     /**

Added: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java?rev=834738&view=auto
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java (added)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java Wed Nov 11 01:33:53 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package 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;
+
+/**
+ * 
+ */
+public class ExportReferenceImpl implements ExportReference {
+    private final ServiceReference exportedService;
+    private final EndpointDescription endpointDescription;
+
+    /**
+     * @param exportedService
+     * @param endpointDescription
+     */
+    public ExportReferenceImpl(ServiceReference exportedService, EndpointDescription endpointDescription) {
+        super();
+        this.exportedService = exportedService;
+        this.endpointDescription = endpointDescription;
+    }
+
+    public ServiceReference getExportedService() {
+        return exportedService;
+    }
+
+    public EndpointDescription getEndpointDescription() {
+        return endpointDescription;
+    }
+
+
+}

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportReferenceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ExportRegistrationImpl.java Wed Nov 11 01:33:53 2009
@@ -21,6 +21,7 @@
 
 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;
 
@@ -32,6 +33,7 @@
     private ServiceReference exportedService;
     private EndpointDescription endpointDescription;
     private Throwable exception;
+    private ExportReference exportReference;
 
     /**
      * @param exportedService
@@ -86,4 +88,9 @@
         return node;
     }
 
+    public ExportReference getExportReference() throws IllegalStateException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Added: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java?rev=834738&view=auto
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java (added)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java Wed Nov 11 01:33:53 2009
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package 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;
+
+/**
+ * 
+ */
+public class ImportReferenceImpl implements ImportReference {
+
+    private final ServiceReference importedService;
+    private final EndpointDescription endpointDescription;
+
+    /**
+     * @param exportedService
+     * @param endpointDescription
+     */
+    public ImportReferenceImpl(ServiceReference importedService, EndpointDescription endpointDescription) {
+        super();
+        this.importedService = importedService;
+        this.endpointDescription = endpointDescription;
+    }
+
+    public ServiceReference getImportedService() {
+        return importedService;
+    }
+
+    public EndpointDescription getImportedEndpointDescription() {
+        return endpointDescription;
+    }
+
+}

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportReferenceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/ImportRegistrationImpl.java Wed Nov 11 01:33:53 2009
@@ -21,6 +21,7 @@
 
 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;
 
@@ -29,8 +30,7 @@
  */
 public class ImportRegistrationImpl implements ImportRegistration {
     private Node node;
-    private ServiceReference exportedService;
-    private EndpointDescription endpointDescription;
+    private ImportReference importReference;
     private Throwable exception;
 
     /**
@@ -39,13 +39,12 @@
      * @param exception
      */
     public ImportRegistrationImpl(Node node,
-                                  ServiceReference exportedService,
+                                  ServiceReference importedService,
                                   EndpointDescription endpointDescription,
                                   Throwable exception) {
         super();
         this.node = node;
-        this.exportedService = exportedService;
-        this.endpointDescription = endpointDescription;
+        this.importReference = new ImportReferenceImpl(importedService, endpointDescription);
         this.exception = exception;
     }
 
@@ -53,11 +52,10 @@
      * @param exportedService
      * @param endpointDescription
      */
-    public ImportRegistrationImpl(Node node, ServiceReference exportedService, EndpointDescription endpointDescription) {
+    public ImportRegistrationImpl(Node node, ServiceReference importedService, EndpointDescription endpointDescription) {
         super();
         this.node = node;
-        this.exportedService = exportedService;
-        this.endpointDescription = endpointDescription;
+        this.importReference = new ImportReferenceImpl(importedService, endpointDescription);
     }
 
     /**
@@ -69,16 +67,7 @@
             node = null;
         }
         exception = null;
-        endpointDescription = null;
-        exportedService = null;
-    }
-
-    public ServiceReference getImportedService() {
-        return exportedService;
-    }
-
-    public EndpointDescription getImportedEndpointDescription() {
-        return endpointDescription;
+        importReference = null;
     }
 
     public Throwable getException() {
@@ -89,4 +78,8 @@
         return node;
     }
 
+    public ImportReference getImportedReference() {
+        return importReference;
+    }
+
 }

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/OSGiServiceImporter.java Wed Nov 11 01:33:53 2009
@@ -88,7 +88,7 @@
     }
 
     public void unimportService(ImportRegistration importRegistration) {
-        Node node = (Node)importRegistration.getImportedService().getProperty("sca.node");
+        Node node = (Node)importRegistration.getImportedReference().getImportedService().getProperty("sca.node");
         node.stop();
     }
 

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java?rev=834738&r1=834737&r2=834738&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java (original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/remoteserviceadmin/impl/RemoteServiceAdminImpl.java Wed Nov 11 01:33:53 2009
@@ -131,7 +131,7 @@
     private void fireExportEvents(Bundle source, List<ExportRegistration> exportRegistrations) {
         for (ExportRegistration registration : exportRegistrations) {
             RemoteServiceAdminEvent rsaEvent =
-                new RemoteServiceAdminEvent(RemoteServiceAdminEvent.EXPORT_REGISTRATION, source, registration,
+                new RemoteServiceAdminEvent(RemoteServiceAdminEvent.EXPORT_REGISTRATION, source, registration.getExportReference(),
                                             registration.getException());
             EventAdmin eventAdmin = getEventAdmin();
             if (eventAdmin != null) {
@@ -211,13 +211,13 @@
         props.put("bundle-symbolicname", rsaBundle.getSymbolicName());
         props.put("bundle-version", rsaBundle.getHeaders().get(Constants.BUNDLE_VERSION));
         props.put("cause", rsaEvent.getException());
-        props.put("import.registration", rsaEvent.getImportRegistration());
-        props.put("export.registration", rsaEvent.getExportRegistration());
+        props.put("import.reference", rsaEvent.getImportReference());
+        props.put("export.reference", rsaEvent.getExportReference());
         EndpointDescription ep = null;
-        if (rsaEvent.getImportRegistration() != null) {
-            ep = rsaEvent.getImportRegistration().getImportedEndpointDescription();
+        if (rsaEvent.getImportReference() != null) {
+            ep = rsaEvent.getImportReference().getImportedEndpointDescription();
         } else {
-            ep = rsaEvent.getExportRegistration().getEndpointDescription();
+            ep = rsaEvent.getExportReference().getEndpointDescription();
         }
         props.put("service.remote.id", ep.getRemoteServiceID());
         props.put("service.remote.uuid", ep.getRemoteFrameworkUUID());
@@ -231,7 +231,7 @@
 
     private void fireImportEvents(Bundle source, ImportRegistration registration) {
         RemoteServiceAdminEvent rsaEvent =
-            new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_REGISTRATION, source, registration, registration
+            new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_REGISTRATION, source, registration.getImportedReference(), registration
                 .getException());
         EventAdmin eventAdmin = getEventAdmin();
         if (eventAdmin != null) {