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 2010/01/20 07:22:18 UTC

svn commit: r901079 - in /tuscany/sca-java-2.x/trunk/modules: builder/src/main/java/org/apache/tuscany/sca/builder/impl/ core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/ implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/imple...

Author: rfeng
Date: Wed Jan 20 06:20:53 2010
New Revision: 901079

URL: http://svn.apache.org/viewvc?rev=901079&view=rev
Log:
Update to the latest version of OSGi Remote Service Admin
Fix the issues to pass OSGi SCA configuration type TCK

Modified:
    tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java
    tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
    tuscany/sca-java-2.x/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
    tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java
    tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java
    tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
    tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.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/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
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
    tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
    tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml

Modified: tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ComponentPolicyBuilderImpl.java Wed Jan 20 06:20:53 2010
@@ -294,7 +294,7 @@
                 if (resolved != null) {
                     intents.add(resolved);
                 } else {
-                    warning(context.getMonitor(), "IntentNotFound", subject, i);
+                    error(context.getMonitor(), "IntentNotFound", subject, i);
                     // Intent cannot be resolved
                 }
             }

Modified: tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java Wed Jan 20 06:20:53 2010
@@ -329,6 +329,7 @@
                         // resolved binding
                         endpoint = createEndpoint(false);
                         endpoint.setURI(uri);
+                        endpoint.setBinding(binding);
                         endpointRef.setStatus(EndpointReference.RESOLVED_BINDING);
                     }
                     

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java Wed Jan 20 06:20:53 2010
@@ -459,7 +459,9 @@
      */
     public boolean isOutOfDate(EndpointRegistry endpointRegistry, EndpointReference endpointReference) {
         Endpoint te = endpointReference.getTargetEndpoint();
-        if (te!= null && !te.isUnresolved() && te.getURI()!= null) {
+        if (te != null && !te.isUnresolved()
+            && te.getURI() != null
+            && endpointReference.getStatus() != EndpointReference.RESOLVED_BINDING) {
             List<Endpoint> endpoints = endpointRegistry.findEndpoint(endpointReference);
             return ! endpoints.contains(endpointReference.getTargetEndpoint());
         }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java Wed Jan 20 06:20:53 2010
@@ -25,6 +25,10 @@
 import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_IMPORTED_CONFIGS;
 import static org.osgi.framework.Constants.SERVICE_RANKING;
 
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
@@ -54,6 +58,7 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceException;
 import org.osgi.framework.ServiceFactory;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
@@ -130,7 +135,7 @@
                 registrations.add(registration);
             }
         }
-        
+
         // Set the OSGi service reference properties into the SCA service
         for (ComponentService service : component.getServices()) {
             // The properties might have been set by the export service
@@ -229,6 +234,66 @@
         return implementation;
     }
 
+    /**
+     * A proxy invocation handler that wrap exceptions into OSGi ServiceException
+     */
+    private static class InvocationHandlerDelegate implements InvocationHandler {
+        private final Object instance;
+
+        public InvocationHandlerDelegate(Object instance) {
+            super();
+            this.instance = instance;
+        }
+
+        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            if (!Proxy.isProxyClass(instance.getClass())) {
+                Method m = instance.getClass().getMethod(method.getName(), method.getParameterTypes());
+                try {
+                    return m.invoke(instance, args);
+                } catch (InvocationTargetException e) {
+                    wrapException(method, e.getCause());
+                    return null;
+                }
+            } else {
+                InvocationHandler handler = Proxy.getInvocationHandler(instance);
+                try {
+                    return handler.invoke(instance, method, args);
+                } catch (Throwable e) {
+                    wrapException(method, e);
+                    return null;
+                }
+            }
+        }
+
+        private void wrapException(Method method, Throwable e) throws Throwable {
+            for (Class<?> exType : method.getExceptionTypes()) {
+                if (exType.isInstance(e)) {
+                    throw e;
+                }
+            }
+            throw new ServiceException(e.getMessage(), ServiceException.REMOTE, e);
+        }
+
+        /**
+         * A utility to cast the object to the given interface. If the class for the object
+         * is loaded by a different classloader, a proxy will be created.
+         *
+         * @param <T>
+         * @param obj
+         * @param cls
+         * @return
+         */
+        static <T> T cast(Object obj, Class<T> cls) {
+            if (obj == null) {
+                return null;
+            } else {
+                return cls.cast(Proxy.newProxyInstance(cls.getClassLoader(),
+                                                       new Class<?>[] {cls},
+                                                       new InvocationHandlerDelegate(obj)));
+            }
+        }
+    }
+
     public class OSGiServiceFactory implements ServiceFactory {
         private RuntimeEndpointReference epr;
         private String interfaceName;
@@ -240,22 +305,26 @@
         public OSGiServiceFactory(String interfaceName, EndpointReference epr) {
             super();
             this.interfaceName = interfaceName;
-            this.epr = (RuntimeEndpointReference) epr;
+            this.epr = (RuntimeEndpointReference)epr;
         }
 
         public Object getService(Bundle bundle, ServiceRegistration registration) {
-            Class<?> interfaceClass = null;
             try {
-                interfaceClass = bundle.loadClass(interfaceName);
-            } catch (ClassNotFoundException e) {
-                return null;
-            }
-            ProxyFactory proxyService = proxyFactoryExtensionPoint.getInterfaceProxyFactory();
-            if (!interfaceClass.isInterface()) {
-                proxyService = proxyFactoryExtensionPoint.getClassProxyFactory();
+                Class<?> interfaceClass = null;
+                try {
+                    interfaceClass = bundle.loadClass(interfaceName);
+                } catch (ClassNotFoundException e) {
+                    return null;
+                }
+                ProxyFactory proxyService = proxyFactoryExtensionPoint.getInterfaceProxyFactory();
+                if (!interfaceClass.isInterface()) {
+                    proxyService = proxyFactoryExtensionPoint.getClassProxyFactory();
+                }
+                Object proxy = proxyService.createProxy(interfaceClass, epr);
+                return InvocationHandlerDelegate.cast(proxy, interfaceClass);
+            } catch (Throwable e) {
+                throw new ServiceException(e.getMessage(), ServiceException.FACTORY_EXCEPTION, e);
             }
-            Object proxy = proxyService.createProxy(interfaceClass, epr);
-            return proxy;
         }
 
         public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementationFactory.java Wed Jan 20 06:20:53 2010
@@ -20,6 +20,7 @@
 package org.apache.tuscany.sca.implementation.osgi;
 
 import java.util.Collection;
+import java.util.Map;
 
 import org.osgi.framework.ServiceReference;
 
@@ -41,4 +42,6 @@
     OSGiProperty createOSGiProperty(String name, String stringValue, String type);
     OSGiProperty createOSGiProperty(String name, Object value);
     Collection<OSGiProperty> createOSGiProperties(ServiceReference reference); 
+    Collection<OSGiProperty> createOSGiProperties(Map<String, Object> properties);
+
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationFactoryImpl.java Wed Jan 20 06:20:53 2010
@@ -22,6 +22,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
@@ -112,5 +113,13 @@
         }
         return props;
     }        
-    
+
+    public Collection<OSGiProperty> createOSGiProperties(Map<String, Object> properties) {
+        List<OSGiProperty> props = new ArrayList<OSGiProperty>();
+        for (Map.Entry<String, Object> e : properties.entrySet()) {
+            OSGiProperty prop = createOSGiProperty(e.getKey(), e.getValue());
+            props.add(prop);
+        }
+        return props;
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/ServiceDescriptionImpl.java Wed Jan 20 06:20:53 2010
@@ -46,6 +46,6 @@
     }
 
     public String toString() {
-        return "service-description: " + properties;
+        return "endpoint-description: " + properties;
     }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiPropertyProcessor.java Wed Jan 20 06:20:53 2010
@@ -94,11 +94,15 @@
     }
 
     public void write(OSGiProperty model, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException {
-        writer.writeStartElement(PROPERTY_QNAME.getNamespaceURI(), PROPERTY_QNAME.getLocalPart());
-        writer.writeAttribute(NAME, model.getName());
-        writer.writeAttribute(TYPE, model.getType());
-        writer.writeCharacters(model.getStringValue());
-        writer.writeEndElement();
+        if (model.getStringValue() != null) {
+            writer.writeStartElement(PROPERTY_QNAME.getNamespaceURI(), PROPERTY_QNAME.getLocalPart());
+            writer.writeAttribute(NAME, model.getName());
+            if (model.getType() != null) {
+                writer.writeAttribute(TYPE, model.getType());
+            }
+            writer.writeAttribute(VALUE, model.getStringValue());
+            writer.writeEndElement();
+        }
     }
 
     public Class<OSGiProperty> getModelType() {

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -21,9 +21,6 @@
 
 import static org.apache.tuscany.sca.assembly.Base.SCA11_TUSCANY_NS;
 import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SCA_BINDINGS;
-import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_INTENTS;
-import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_INTENTS_EXTRA;
-import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_EXPORTED_INTERFACES;
 import static org.apache.tuscany.sca.osgi.remoteserviceadmin.impl.OSGiHelper.getStringArray;
 import static org.osgi.framework.Constants.OBJECTCLASS;
 import static org.osgi.framework.Constants.SERVICE_ID;
@@ -77,9 +74,9 @@
 import org.oasisopen.sca.ServiceRuntimeException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
 import org.osgi.util.tracker.ServiceTracker;
 
 /**
@@ -128,7 +125,6 @@
         super();
         // this.context = context;
         this.discoveryTracker = discoveryTracker;
-        // this.registry = registry;
         this.factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
         this.modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
 //        this.compositeProcessor =
@@ -192,10 +188,10 @@
                 }
             }
             for (Map.Entry<String, Object> p : props.entrySet()) {
-                if (Constants.OBJECTCLASS.equalsIgnoreCase(p.getKey())) {
-                    throw new IllegalArgumentException(Constants.OBJECTCLASS + " property cannot be overridden.");
-                } else if (Constants.SERVICE_ID.equalsIgnoreCase(p.getKey())) {
-                    throw new IllegalArgumentException(Constants.SERVICE_ID + " property cannot be overridden.");
+                if (OBJECTCLASS.equalsIgnoreCase(p.getKey())) {
+                    throw new IllegalArgumentException(OBJECTCLASS + " property cannot be overridden.");
+                } else if (SERVICE_ID.equalsIgnoreCase(p.getKey())) {
+                    throw new IllegalArgumentException(SERVICE_ID + " property cannot be overridden.");
                 }
                 String key = nameMap.get(p.getKey().toLowerCase());
                 if (key != null) {
@@ -238,11 +234,12 @@
     public Contribution introspect(ServiceReference reference, Map<String, Object> props) throws Exception {
         Bundle bundle = reference.getBundle();
         Map<String, Object> properties = getProperties(reference, props);
+        Collection<OSGiProperty> osgiProps = implementationFactory.createOSGiProperties(reference);
         Long sid = (Long)reference.getProperty(SERVICE_ID);
 
-        String[] requiredIntents = getStringArray(properties.get(SERVICE_EXPORTED_INTENTS));
+        String[] requiredIntents = getStringArray(properties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
         List<Intent> intents = getIntents(requiredIntents);
-        String[] requiredIntentsExtra = getStringArray(properties.get(SERVICE_EXPORTED_INTENTS_EXTRA));
+        String[] requiredIntentsExtra = getStringArray(properties.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
         List<Intent> extraIntents = getIntents(requiredIntentsExtra);
         Set<Intent> allIntents = new HashSet<Intent>(intents);
         allIntents.addAll(extraIntents);
@@ -250,7 +247,7 @@
         String[] bindingNames = getStringArray(properties.get(SCA_BINDINGS));
         Collection<Binding> bindings = loadBindings(bindingNames);
 
-        String[] remoteInterfaces = getStringArray(reference.getProperty(SERVICE_EXPORTED_INTERFACES));
+        String[] remoteInterfaces = getStringArray(reference.getProperty(RemoteConstants.SERVICE_EXPORTED_INTERFACES));
         if (remoteInterfaces == null || remoteInterfaces.length > 0 && "*".equals(remoteInterfaces[0])) {
             remoteInterfaces = getStringArray(reference.getProperty(OBJECTCLASS));
         } else {
@@ -263,7 +260,7 @@
             }
         }
 
-        Contribution contribution = generateContribution(bundle, sid, remoteInterfaces, bindings, allIntents);
+        Contribution contribution = generateContribution(bundle, sid, remoteInterfaces, bindings, allIntents, osgiProps);
         return contribution;
     }
 
@@ -282,7 +279,8 @@
                                               Long sid,
                                               String[] remoteInterfaces,
                                               Collection<Binding> bindings,
-                                              Set<Intent> allIntents) throws ClassNotFoundException,
+                                              Set<Intent> allIntents,
+                                              Collection<OSGiProperty> osgiProps) throws ClassNotFoundException,
         InvalidInterfaceException {
         String id = "osgi.service." + UUID.randomUUID();
         Composite composite = assemblyFactory.createComposite();
@@ -311,12 +309,13 @@
             service.setName(name);
             service.setInterfaceContract(interfaceContract);
 
-            service.getExtensions().add(serviceID);
-
             implementation.getServices().add(service);
 
             ComponentService componentService = assemblyFactory.createComponentService();
             componentService.setName(service.getName());
+            componentService.getExtensions().add(serviceID);
+            componentService.getExtensions().addAll(osgiProps);
+
             component.getServices().add(componentService);
             componentService.setService(service);
         }
@@ -355,28 +354,31 @@
         Collection<String> interfaces = Collections.emptyList();
         Collection<Intent> intents = Collections.emptyList();
         Endpoint ep = (Endpoint)endpoint.getProperties().get(Endpoint.class.getName());
+        Collection<OSGiProperty> osgiProps = implementationFactory.createOSGiProperties(endpoint.getProperties());
         if (ep != null) {
             bindings = Collections.singletonList(ep.getBinding());
             interfaces = Collections.singletonList(((JavaInterface)ep.getComponentServiceInterfaceContract().getInterface()).getName());
-            intents = ep.getRequiredIntents();
+            // FIXME: [rfeng] We need to build the in-memory composite so that intents are calculated at the ep level
+            intents = ep.getService().getRequiredIntents();
         } else {
             Map<String, Object> properties = endpoint.getProperties();
             interfaces = endpoint.getInterfaces();
-            String[] requiredIntents = getStringArray(properties.get(SERVICE_EXPORTED_INTENTS));
+            String[] requiredIntents = getStringArray(properties.get(RemoteConstants.SERVICE_INTENTS));
             intents = getIntents(requiredIntents);
 
             String[] bindingNames = getStringArray(properties.get(SCA_BINDINGS));
             bindings = loadBindings(bindingNames);
         }
 
-        Contribution contribution = generateContribution(bundle, interfaces, bindings, intents);
+        Contribution contribution = generateContribution(bundle, interfaces, bindings, intents, osgiProps);
         return contribution;
     }
 
     private Contribution generateContribution(Bundle bundle,
                                               Collection<String> remoteInterfaces,
                                               Collection<Binding> bindings,
-                                              Collection<Intent> intents) throws ClassNotFoundException,
+                                              Collection<Intent> intents,
+                                              Collection<OSGiProperty> osgiProps) throws ClassNotFoundException,
         InvalidInterfaceException, ContributionResolveException {
         String id = "osgi.reference." + UUID.randomUUID();
         Composite composite = assemblyFactory.createComposite();
@@ -406,6 +408,7 @@
 
             ComponentReference componentReference = assemblyFactory.createComponentReference();
             componentReference.setName(reference.getName());
+            componentReference.getExtensions().addAll(osgiProps);
             component.getReferences().add(componentReference);
             componentReference.setReference(reference);
             componentReference.setWiredByImpl(true);

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -19,23 +19,28 @@
 
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
+import org.apache.tuscany.sca.node.Node;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.ExportReference;
+import org.osgi.service.remoteserviceadmin.ExportRegistration;
 
 /**
  * 
  */
 public class ExportReferenceImpl implements ExportReference {
+    private Node node;
     private final ServiceReference exportedService;
     private final EndpointDescription endpointDescription;
+    private int count;
 
     /**
      * @param exportedService
      * @param endpointDescription
      */
-    public ExportReferenceImpl(ServiceReference exportedService, EndpointDescription endpointDescription) {
+    public ExportReferenceImpl(Node node, ServiceReference exportedService, EndpointDescription endpointDescription) {
         super();
+        this.node = node;
         this.exportedService = exportedService;
         this.endpointDescription = endpointDescription;
     }
@@ -47,6 +52,22 @@
     public EndpointDescription getExportedEndpoint() {
         return endpointDescription;
     }
+    
+    public synchronized ExportRegistration register() {
+        count++;
+        return new ExportRegistrationImpl(this);
+    }
 
+    public synchronized void unregister() {
+        if (count > 0) {
+            count--;
+        }
+        if (count == 0) {
+            if (node != null) {
+                node.stop();
+                node = null;
+            }
+        }
+    }
 
 }

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -19,7 +19,6 @@
 
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
-import org.apache.tuscany.sca.node.Node;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.ExportReference;
@@ -29,8 +28,7 @@
  * Implementation of {@link ExportRegistration}
  */
 public class ExportRegistrationImpl implements ExportRegistration {
-    private Node node;
-    private ExportReference exportReference;
+    private ExportReferenceImpl exportReference;
     private Throwable exception;
 
     /**
@@ -38,13 +36,9 @@
      * @param endpointDescription
      * @param exception
      */
-    public ExportRegistrationImpl(Node node,
-                                  ServiceReference exportedService,
-                                  EndpointDescription endpointDescription,
-                                  Throwable exception) {
+    public ExportRegistrationImpl(ExportReferenceImpl exportReference, Throwable exception) {
         super();
-        this.node = node;
-        this.exportReference = new ExportReferenceImpl(exportedService, endpointDescription);
+        this.exportReference = exportReference;
         this.exception = exception;
     }
 
@@ -52,20 +46,19 @@
      * @param exportedService
      * @param endpointDescription
      */
-    public ExportRegistrationImpl(Node node, ServiceReference exportedService, EndpointDescription endpointDescription) {
-        this(node, exportedService, endpointDescription, null);
+    public ExportRegistrationImpl(ExportReferenceImpl exportReference) {
+        this(exportReference, null);
     }
 
     /**
      * @see org.osgi.remoteserviceadmin.ExportRegistration#close()
      */
     public void close() {
-        if (node != null) {
-            node.stop();
-            node = null;
+        if (exportReference != null) {
+            exportReference.unregister();
         }
         exception = null;
-        exportReference = new ExportReferenceImpl(null, null);
+        exportReference = null;
     }
 
     public ServiceReference getExportedService() {
@@ -80,10 +73,6 @@
         return exception;
     }
 
-    public Node getNode() {
-        return node;
-    }
-
     public ExportReference getExportReference() throws IllegalStateException {
         return exportReference;
     }

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -19,24 +19,28 @@
 
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
+import org.apache.tuscany.sca.node.Node;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.ImportReference;
+import org.osgi.service.remoteserviceadmin.ImportRegistration;
 
 /**
- * 
+ * Implementation of ImportReference. It keeps a reference count of ImportRegistrations
  */
 public class ImportReferenceImpl implements ImportReference {
-
+    private Node node;
     private final ServiceReference importedService;
     private final EndpointDescription endpointDescription;
+    private int count = 0;
 
     /**
      * @param exportedService
      * @param endpointDescription
      */
-    public ImportReferenceImpl(ServiceReference importedService, EndpointDescription endpointDescription) {
+    public ImportReferenceImpl(Node node, ServiceReference importedService, EndpointDescription endpointDescription) {
         super();
+        this.node = node;
         this.importedService = importedService;
         this.endpointDescription = endpointDescription;
     }
@@ -48,5 +52,21 @@
     public EndpointDescription getImportedEndpoint() {
         return endpointDescription;
     }
+    
+    public synchronized ImportRegistration register() {
+        count++;
+        return new ImportRegistrationImpl(this);
+    }
 
+    public synchronized void unregister() {
+        if (count > 0) {
+            count--;
+        }
+        if (count == 0) {
+            if (node != null) {
+                node.stop();
+                node = null;
+            }
+        }
+    }
 }

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -19,9 +19,6 @@
 
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
-import org.apache.tuscany.sca.node.Node;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.ImportReference;
 import org.osgi.service.remoteserviceadmin.ImportRegistration;
 
@@ -29,55 +26,43 @@
  * 
  */
 public class ImportRegistrationImpl implements ImportRegistration {
-    private Node node;
-    private ImportReference importReference;
+    private ImportReferenceImpl importReference;
     private Throwable exception;
 
     /**
-     * @param exportedService
-     * @param endpointDescription
-     * @param exception
+     * @param importReference
      */
-    public ImportRegistrationImpl(Node node,
-                                  ServiceReference importedService,
-                                  EndpointDescription endpointDescription,
-                                  Throwable exception) {
+    public ImportRegistrationImpl(ImportReferenceImpl importReference) {
         super();
-        this.node = node;
-        this.importReference = new ImportReferenceImpl(importedService, endpointDescription);
-        this.exception = exception;
+        this.importReference = importReference;
     }
 
     /**
      * @param exportedService
      * @param endpointDescription
+     * @param exception
      */
-    public ImportRegistrationImpl(Node node, ServiceReference importedService, EndpointDescription endpointDescription) {
+    public ImportRegistrationImpl(ImportReferenceImpl importReference, Throwable exception) {
         super();
-        this.node = node;
-        this.importReference = new ImportReferenceImpl(importedService, endpointDescription);
+        this.importReference = importReference;
+        this.exception = exception;
     }
 
     /**
      * @see org.osgi.remoteserviceadmin.ImportRegistration#close()
      */
     public void close() {
-        if (node != null) {
-            node.stop();
-            node = null;
+        if (importReference != null) {
+            importReference.unregister();
         }
         exception = null;
-        importReference = new ImportReferenceImpl(null, null);
+        importReference = null;
     }
 
     public Throwable getException() {
         return exception;
     }
 
-    public Node getNode() {
-        return node;
-    }
-
     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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -31,6 +31,9 @@
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.assembly.Component;
 import org.apache.tuscany.sca.assembly.ComponentService;
@@ -48,6 +51,10 @@
  * Watching and exporting OSGi services 
  */
 public class OSGiServiceExporter extends AbstractOSGiServiceHandler implements ServiceTrackerCustomizer {
+    private final static Logger logger = Logger.getLogger(OSGiServiceExporter.class.getName());
+
+    private Map<EndpointDescription, ExportReferenceImpl> exportReferences =
+        new ConcurrentHashMap<EndpointDescription, ExportReferenceImpl>();
 
     /**
      * @param context
@@ -62,6 +69,11 @@
         init();
     }
 
+    public void stop() {
+        exportReferences.clear();
+        super.stop();
+    }
+
     public Object addingService(ServiceReference reference) {
         return exportService(reference, null);
     }
@@ -97,17 +109,23 @@
                 List<ExportRegistration> exportedServices = new ArrayList<ExportRegistration>();
                 for (Endpoint endpoint : service.getEndpoints()) {
                     EndpointDescription endpointDescription = createEndpointDescription(context, endpoint);
-                    ExportRegistration exportRegistration =
-                        new ExportRegistrationImpl(node, reference, endpointDescription);
-                    exportedServices.add(exportRegistration);
+                    synchronized (this) {
+                        ExportReferenceImpl exportReference = exportReferences.get(endpointDescription);
+                        if (exportReference == null) {
+                            exportReference = new ExportReferenceImpl(node, reference, endpointDescription);
+                        }
+                        ExportRegistration exportRegistration = exportReference.register();
+                        exportedServices.add(exportRegistration);
+                    }
                 }
                 return exportedServices;
             } else {
                 return null;
             }
         } catch (Exception e) {
-            e.printStackTrace();
-            return null;
+            logger.log(Level.SEVERE, e.getMessage(), e);
+            ExportRegistration exportRegistration = new ExportRegistrationImpl(null, e);
+            return Collections.singletonList(exportRegistration);
         }
     }
 
@@ -118,7 +136,7 @@
 
     public void removedService(ServiceReference reference, Object service) {
         List<ExportRegistration> exportedServices = (List<ExportRegistration>)service;
-        for(ExportRegistration exportRegistration: exportedServices) {
+        for (ExportRegistration exportRegistration : exportedServices) {
             exportRegistration.close();
         }
     }

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -20,11 +20,14 @@
 package org.apache.tuscany.sca.osgi.remoteserviceadmin.impl;
 
 import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.assembly.Component;
 import org.apache.tuscany.sca.assembly.ComponentReference;
 import org.apache.tuscany.sca.contribution.Contribution;
-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.osgi.framework.Bundle;
@@ -37,6 +40,9 @@
  * Watching and exporting OSGi services 
  */
 public class OSGiServiceImporter extends AbstractOSGiServiceHandler {
+    private final static Logger logger = Logger.getLogger(OSGiServiceImporter.class.getName());
+    private Map<EndpointDescription, ImportReferenceImpl> importReferences =
+        new ConcurrentHashMap<EndpointDescription, ImportReferenceImpl>();
 
     /**
      * @param context
@@ -51,6 +57,11 @@
         // Defer init() to importService()
     }
 
+    public void stop() {
+        importReferences.clear();
+        super.stop();
+    }
+
     public ImportRegistration importService(Bundle bundle, EndpointDescription endpointDescription) {
         init();
         try {
@@ -77,19 +88,27 @@
                         + "#reference("
                         + componentReference.getName()
                         + ")");
-                return new ImportRegistrationImpl(node, serviceReference, endpointDescription);
+                synchronized (this) {
+                    ImportReferenceImpl importReference = importReferences.get(endpointDescription);
+                    if (importReference == null) {
+                        importReference = new ImportReferenceImpl(node, serviceReference, endpointDescription);
+                        importReferences.put(endpointDescription, importReference);
+                    }
+                    return importReference.register();
+                }
             } else {
                 return null;
             }
         } catch (Exception e) {
-            e.printStackTrace();
-            return null;
+            logger.log(Level.SEVERE, e.getMessage(), e);
+            return new ImportRegistrationImpl(null, e);
         }
     }
 
     public void unimportService(ImportRegistration importRegistration) {
-        Node node = (Node)importRegistration.getImportReference().getImportedService().getProperty("sca.node");
-        node.stop();
+        if (importRegistration != null) {
+            importRegistration.close();
+        }
     }
 
 }

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -253,9 +253,9 @@
         } else {
             ep = rsaEvent.getExportReference().getExportedEndpoint();
         }
-        props.put("endpoint.service.id", ep.getRemoteServiceID());
-        props.put("endpoint.framework.uuid", ep.getRemoteFrameworkUUID());
-        props.put("endpoint.id", ep.getRemoteID());
+        props.put("endpoint.service.id", ep.getServiceId());
+        props.put("endpoint.framework.uuid", ep.getFrameworkUUID());
+        props.put("endpoint.id", ep.getId());
         props.put("objectClass", ep.getInterfaces());
         props.put("service.imported.configs", ep.getConfigurationTypes());
         props.put("timestamp", new Long(System.currentTimeMillis()));

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -64,7 +64,7 @@
     private Map<String, List<EndpointListener>> filtersToListeners = new HashMap<String, List<EndpointListener>>();
     // this is effectively a set which allows for multiple service descriptions with the
     // same interface name but different properties and takes care of itself with respect to concurrency
-    protected Map<EndpointDescription, Bundle> servicesInfo = new ConcurrentHashMap<EndpointDescription, Bundle>();
+    protected Map<EndpointDescription, Bundle> endpointDescriptions = new ConcurrentHashMap<EndpointDescription, Bundle>();
     private Map<EndpointListener, Collection<String>> listenersToFilters =
         new HashMap<EndpointListener, Collection<String>>();
     private ServiceTracker trackerTracker;
@@ -176,7 +176,7 @@
         }
 
         if (logger.isLoggable(Level.FINE)) {
-            if (servicesInfo.size() > 0) {
+            if (endpointDescriptions.size() > 0) {
                 logger.fine("search for matches to trigger callbacks with delta: " + deltaInterest);
             } else {
                 logger.fine("nothing to search for matches to trigger callbacks with delta: " + deltaInterest);
@@ -185,7 +185,7 @@
         Iterator<String> i = deltaInterest.iterator();
         while (i.hasNext()) {
             String next = i.next();
-            for (EndpointDescription sd : servicesInfo.keySet()) {
+            for (EndpointDescription sd : endpointDescriptions.keySet()) {
                 triggerCallbacks(listener, next, sd, ADDED);
             }
         }
@@ -267,7 +267,7 @@
         return collection;
     }
 
-    protected void endpointChanged(EndpointDescription sd, int type) {
+    protected synchronized void endpointChanged(EndpointDescription sd, int type) {
         for (Map.Entry<EndpointListener, Collection<String>> entry : listenersToFilters.entrySet()) {
             for (String filter : entry.getValue()) {
                 if (filterMatches(filter, sd)) {

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -65,7 +65,7 @@
         thread.start();
     }
 
-    private void startEndpointRegistry() {
+    private synchronized void startEndpointRegistry() {
         // The following code forced the start() of the domain registry in absense of services
         String domainRegistry = context.getProperty("org.osgi.sca.domain.registry");
         if (domainRegistry == null) {
@@ -80,7 +80,7 @@
         }
     }
 
-    public void endpointAdded(Endpoint endpoint) {
+    public synchronized void endpointAdded(Endpoint endpoint) {
         Implementation impl = endpoint.getComponent().getImplementation();
         if (!(impl instanceof OSGiImplementation)) {
             return;
@@ -94,59 +94,35 @@
             bundleContext = bundle != null ? bundle.getBundleContext() : null;
         }
 
-        /*
-        if (!endpoint.isRemote()) {
-            Interface intf = endpoint.getService().getInterfaceContract().getInterface();
-            JavaInterface javaInterface = (JavaInterface)intf;
-            // String filter = getOSGiFilter(provider.getOSGiProperties(service));
-            // FIXME: What is the filter?
-            String filter = "(!(sca.reference=*))";
-            // "(sca.service=" + component.getURI() + "#service-name\\(" + service.getName() + "\\))";
-            ServiceReference ref = null;
-            try {
-                ref = bundleContext.getServiceReferences(javaInterface.getName(), filter)[0];
-            } catch (InvalidSyntaxException e) {
-                // Ignore
-            }
-            if (ref != null) {
-
-            }
-        } else
-        */ 
-        {
             // Notify the endpoint listeners
             EndpointDescription description = createEndpointDescription(bundleContext, endpoint);
             // Set the owning bundle to runtime bundle to avoid NPE
-            servicesInfo.put(description, context.getBundle());
+            endpointDescriptions.put(description, context.getBundle());
             endpointChanged(description, ADDED);
-        }
     }
 
-    public void endpointRemoved(Endpoint endpoint) {
-        /*
-        if (!endpoint.isRemote()) {
-            // export services
-        } else
-        */ 
-        {
+    public synchronized void endpointRemoved(Endpoint endpoint) {
             EndpointDescription description = createEndpointDescription(context, endpoint);
-            servicesInfo.remove(description);
+            endpointDescriptions.remove(description);
             endpointChanged(description, REMOVED);
-        }
     }
 
-    public void endpointUpdated(Endpoint oldEndpoint, Endpoint newEndpoint) {
+    public synchronized void endpointUpdated(Endpoint oldEndpoint, Endpoint newEndpoint) {
         // FIXME: This is a quick and dirty way for the update
         endpointRemoved(oldEndpoint);
         endpointAdded(newEndpoint);
     }
 
     public void stop() {
-        domainRegistryFactory.removeListener(this);
-        if (endpointRegistry instanceof LifeCycleListener) {
-            ((LifeCycleListener)endpointRegistry).stop();
+        if (domainRegistryFactory != null) {
+            domainRegistryFactory.removeListener(this);
+            if (endpointRegistry instanceof LifeCycleListener) {
+                ((LifeCycleListener)endpointRegistry).stop();
+            }
+            domainRegistryFactory = null;
+            endpointRegistry = null;
+            super.stop();
         }
-        super.stop();
     }
     
     @Override

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=901079&r1=901078&r2=901079&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 Wed Jan 20 06:20:53 2010
@@ -105,7 +105,7 @@
     }
 
     private void removeServicesDeclaredInBundle(Bundle bundle) {
-        for (Iterator<Map.Entry<EndpointDescription, Bundle>> i = servicesInfo.entrySet().iterator(); i.hasNext();) {
+        for (Iterator<Map.Entry<EndpointDescription, Bundle>> i = endpointDescriptions.entrySet().iterator(); i.hasNext();) {
             Entry<EndpointDescription, Bundle> entry = i.next();
             if (entry.getValue().equals(bundle)) {
                 serviceDescriptionRemoved(entry.getKey());
@@ -163,7 +163,7 @@
         for (ServiceDescriptions sds : extender.getRemoteServiceDescriptions()) {
             for (ServiceDescription sd : sds) {
                 EndpointDescription sed = createEndpointDescription(sd);
-                servicesInfo.put(sed, bundle);
+                endpointDescriptions.put(sed, bundle);
                 serviceDescriptionAdded(sed);
             }
         }

Modified: 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=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java Wed Jan 20 06:20:53 2010
@@ -65,9 +65,9 @@
 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				remoteID;
+	private final long					serviceId;
+	private final String				frameworkUUID;
+	private final String				id;
 
 	/**
 	 * Create an Endpoint Description from a Map.
@@ -110,10 +110,10 @@
 		this.properties = Collections.unmodifiableMap(props);
 		/* properties must be initialized before calling the following methods */
 		interfaces = verifyObjectClassProperty();
-		remoteServiceID = verifyLongProperty(ENDPOINT_SERVICE_ID);
-		remoteFrameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
-		remoteID = verifyStringProperty(ENDPOINT_ID);
-		if (remoteID == null) {
+		serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID);
+		frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
+		id = verifyStringProperty(ENDPOINT_ID);
+		if (id == null) {
 			throw new IllegalArgumentException(ENDPOINT_ID
 					+ " property must be set");
 		}
@@ -204,10 +204,10 @@
 		this.properties = Collections.unmodifiableMap(props);
 		/* properties must be initialized before calling the following methods */
 		interfaces = verifyObjectClassProperty();
-		remoteServiceID = verifyLongProperty(ENDPOINT_SERVICE_ID);
-		remoteFrameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
-		remoteID = verifyStringProperty(ENDPOINT_ID);
-		if (remoteID == null) {
+		serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID);
+		frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
+		id = verifyStringProperty(ENDPOINT_ID);
+		if (id == null) {
 			throw new IllegalArgumentException(ENDPOINT_ID
 					+ " property must be set");
 		}
@@ -312,8 +312,8 @@
 	 * 
 	 * @return The id of the endpoint, never <code>null</code>.
 	 */
-	public String getRemoteID() {
-		return remoteID;
+	public String getId() {
+		return id;
 	}
 
 	/**
@@ -382,8 +382,8 @@
 	 *         not relate to an OSGi service.
 	 * 
 	 */
-	public long getRemoteServiceID() {
-		return remoteServiceID;
+	public long getServiceId() {
+		return serviceId;
 	}
 
 	/**
@@ -477,8 +477,8 @@
 	 * @return Remote Framework UUID, or null if this endpoint is not associated
 	 *         with an OSGi framework having a framework uuid.
 	 */
-	public String getRemoteFrameworkUUID() {
-		return remoteFrameworkUUID;
+	public String getFrameworkUUID() {
+		return frameworkUUID;
 	}
 
 	/**
@@ -507,13 +507,13 @@
 			return true;
 		}
 
-		if (this.getRemoteFrameworkUUID() == null) {
+		if (this.getFrameworkUUID() == null) {
 			return false;
 		}
 
-		return (this.getRemoteServiceID() == other.getRemoteServiceID())
-				&& this.getRemoteFrameworkUUID().equals(
-						other.getRemoteFrameworkUUID());
+		return (this.getServiceId() == other.getServiceId())
+				&& this.getFrameworkUUID().equals(
+						other.getFrameworkUUID());
 	}
 
 	/**
@@ -522,7 +522,7 @@
 	 * @return An integer which is a hash code value for this object.
 	 */
 	public int hashCode() {
-		return getRemoteID().hashCode();
+		return getId().hashCode();
 	}
 
 	/**
@@ -544,8 +544,8 @@
 		if (!(other instanceof EndpointDescription)) {
 			return false;
 		}
-		return getRemoteID().equals(
-				((EndpointDescription) other).getRemoteID());
+		return getId().equals(
+				((EndpointDescription) other).getId());
 	}
 
 	/**
@@ -580,6 +580,63 @@
 	}
 
 	/**
+	 * Returns the string representation of this EndpointDescription.
+	 * 
+	 * @return String form of this EndpointDescription.
+	 */
+	public String toString() {
+		StringBuffer sb = new StringBuffer();
+		sb.append('{');
+		Iterator<Map.Entry<String, Object>> iter = properties.entrySet()
+				.iterator();
+		boolean comma = false;
+		while (iter.hasNext()) {
+			Map.Entry<String, Object> entry = iter.next();
+			if (comma) {
+				sb.append(", ");
+			}
+			else {
+				comma = true;
+			}
+			sb.append(entry.getKey());
+			sb.append('=');
+			Object value = entry.getValue();
+			if (value != null) {
+				Class< ? > valueType = value.getClass();
+				if (Object[].class.isAssignableFrom(valueType)) {
+					append(sb, (Object[]) value);
+					continue;
+				}
+			}
+			sb.append(value);
+		}
+		sb.append('}');
+		return sb.toString();
+	}
+
+	/**
+	 * Append the specified Object array to the specified StringBuffer.
+	 * 
+	 * @param sb Receiving StringBuffer.
+	 * @param value Object array to append to the specified StringBuffer.
+	 */
+	private static void append(StringBuffer sb, Object[] value) {
+		sb.append('[');
+		boolean comma = false;
+		final int length = value.length;
+		for (int i = 0; i < length; i++) {
+			if (comma) {
+				sb.append(", ");
+			}
+			else {
+				comma = true;
+			}
+			sb.append(String.valueOf(value[i]));
+		}
+		sb.append(']');
+	}
+
+	/**
 	 * Unmodifiable Dictionary wrapper for a Map. This class is also used by
 	 * EndpointPermission.
 	 */

Modified: 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=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointListener.java Wed Jan 20 06:20:53 2010
@@ -23,17 +23,17 @@
  * 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
+ * the primary use case is to allow a remote manager to be informed of Endpoint
  * Descriptions available in the network and inform the network about available
- * End Point Descriptions.
+ * Endpoint 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
+ * service. The manager informs the network bundle about Endpoints 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
+ * protocol, then it sends an Endpoint Description to all the Endpoint
  * Listener services that are registered (except its own) that have specified an
  * interest in that endpoint.
  * 

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java Wed Jan 20 06:20:53 2010
@@ -165,11 +165,11 @@
 		setTransients(null, parseActions(actions));
 		Map<String, Object> props;
 		if ((localFrameworkUUID != null)
-				&& localFrameworkUUID.equals(endpoint.getRemoteFrameworkUUID())) {
+				&& localFrameworkUUID.equals(endpoint.getFrameworkUUID())) {
 			props = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
 			props.putAll(endpoint.getProperties());
 			props.put(ENDPOINT_FRAMEWORK_UUID, new String[] {
-					endpoint.getRemoteFrameworkUUID(), "<<LOCAL>>"});
+					endpoint.getFrameworkUUID(), "<<LOCAL>>"});
 		}
 		else {
 			props = endpoint.getProperties();
@@ -190,7 +190,7 @@
 			throw new IllegalArgumentException("invalid endpoint: null");
 		}
 		StringBuffer sb = new StringBuffer("(" + ENDPOINT_ID + "=");
-		sb.append(endpoint.getRemoteID());
+		sb.append(endpoint.getId());
 		sb.append(")");
 		return sb.toString();
 	}

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java Wed Jan 20 06:20:53 2010
@@ -36,15 +36,13 @@
 public interface RemoteServiceAdmin {
 
 	/**
-	 * Export a service to a given endpoint. The Remote Service Admin must
-	 * create an endpoint from the given description that can be used by other
+	 * Export a service to a given Endpoint. The Remote Service Admin must
+	 * create an Endpoint from the given description that can be used by other
 	 * Distrbution Providers to connect to this Remote Service Admin and use the
 	 * exported service. This method can return null if the service could not be
-	 * exported because the endpoint could not be implemented by this Remote
+	 * exported because the Endpoint could not be implemented by this Remote
 	 * Service Admin.
 	 * 
-	 * TODO Peter to update for case insensitive properties
-	 * 
 	 * The properties on a Service Reference are case insensitive while the
 	 * properties on a <code>properties</code> are case sensitive. A value in
 	 * the <code>properties</code> must therefore override any case variant in
@@ -52,26 +50,23 @@
 	 * 
 	 * <p>
 	 * If the caller does not have the appropriate
-	 * <code>EndpointPermission[endpoint,EXPORT]</code> for an endpoint, and the
+	 * <code>EndpointPermission[endpoint,EXPORT]</code> for an Endpoint, and the
 	 * Java Runtime Environment supports permissions, then the
 	 * {@link ExportRegistration#getException() getException} method on the
 	 * corresponding returned {@link ExportRegistration} will return a
 	 * <code>SecurityException</code>.
 	 * 
 	 * @param reference The Service Reference to export.
-	 * @param properties The properties to create a local endpoint that can be
+	 * @param properties The properties to create a local Endpoint that can be
 	 *        implemented by this Remote Service Admin. If this is null, the
-	 *        endpoint will be determined by the properties on the service. The
+	 *        Endpoint will be determined by the properties on the service. The
 	 *        properties are the same as given for an exported service. They are
 	 *        overlaid over any properties the service defines (case
 	 *        insensitive). This parameter can be <code>null</code>, this should
 	 *        be treated as an empty map.
 	 * 
-	 *        TODO Peter The return description does not mesh with returning a
-	 *        list! Why a list and not just one?
 	 * @return An Export Registration that combines the Endpoint Description and
-	 *         the Service Reference or <code>null</code> if the service could
-	 *         not be exported.
+	 *         the Service Reference. Is never <code>null</code>.
 	 * @throws IllegalArgumentException If any of the properties has a value
 	 *         that is not syntactically correct or if the service properties
 	 *         and the overlaid properties do not contain a
@@ -84,17 +79,17 @@
 			Map<String, Object> properties);
 
 	/**
-	 * Import a service from an endpoint. The Remote Service Admin must use the
-	 * given endpoint to create a proxy. This method can return null if the
+	 * Import a service from an Endpoint. The Remote Service Admin must use the
+	 * given Endpoint to create a proxy. This method can return null if the
 	 * service could not be imported.
 	 * 
 	 * @param endpoint The Endpoint Description to be used for import.
 	 * @return An Import Registration that combines the Endpoint Description and
-	 *         the Service Reference or <code>null</code> if the endpoint could
+	 *         the Service Reference or <code>null</code> if the Endpoint could
 	 *         not be imported.
 	 * @throws SecurityException If the caller does not have the appropriate
 	 *         <code>EndpointPermission[endpoint,IMPORT]</code> for the
-	 *         endpoint, and the Java Runtime Environment supports permissions.
+	 *         Endpoint, and the Java Runtime Environment supports permissions.
 	 */
 	ImportRegistration importService(EndpointDescription endpoint);
 
@@ -103,9 +98,9 @@
 	 * 
 	 * <p>
 	 * If the caller does not have the appropriate
-	 * <code>EndpointPermission[endpoint,READ]</code> for an endpoint, and the
+	 * <code>EndpointPermission[endpoint,READ]</code> for an Endpoint, and the
 	 * Java Runtime Environment supports permissions, then returned collection
-	 * will not contain a reference to the exported endpoint.
+	 * will not contain a reference to the exported Endpoint.
 	 * 
 	 * @return A <code>Collection</code> of {@link ExportReference}s that are
 	 *         currently active.
@@ -117,9 +112,9 @@
 	 * 
 	 * <p>
 	 * If the caller does not have the appropriate
-	 * <code>EndpointPermission[endpoint,READ]</code> for an endpoint, and the
+	 * <code>EndpointPermission[endpoint,READ]</code> for an Endpoint, and the
 	 * Java Runtime Environment supports permissions, then returned collection
-	 * will not contain a reference to the imported endpoint.
+	 * will not contain a reference to the imported Endpoint.
 	 * 
 	 * @return A <code>Collection</code> of {@link ImportReference}s that are
 	 *         currently active.

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl-osgi/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java Wed Jan 20 06:20:53 2010
@@ -17,7 +17,7 @@
 package org.osgi.service.remoteserviceadmin;
 
 /**
- * A {@link RemoteServiceAdminEvent} listener is notified asynchronously of any
+ * A {@link RemoteServiceAdminEvent} listener is notified synchronously of any
  * export or import registrations and unregistrations.
  * 
  * <p>
@@ -36,7 +36,7 @@
 public interface RemoteServiceAdminListener {
 	/**
 	 * Receive notification of any export or import registrations and
-	 * unregistrations.
+	 * unregistrations as well as errors and warnings.
 	 * 
 	 * @param event The {@link RemoteServiceAdminEvent} object.
 	 */

Modified: tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml?rev=901079&r1=901078&r2=901079&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml Wed Jan 20 06:20:53 2010
@@ -18,13 +18,21 @@
  * under the License.    
 -->
 <definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
-            targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1">
+            targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
+            xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1">
 
-	<!-- Policy Intents Defined by the SCA Runtime -->
+	<!-- Policy Intents Defined by the Tuscany Runtime -->
 	<intent name="logging" constrains="implementation binding">
 		<description>
 			All messages to and from this implementation must be logged
 		</description>
 	</intent>
     
+    <!-- Policy Intents Defined by the Tuscany Runtime -->
+    <intent name="noLogging" constrains="implementation binding" excludes="tuscany:logging">
+        <description>
+            All messages to and from this implementation must be logged
+        </description>
+    </intent>
+    
 </definitions>
\ No newline at end of file