tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r810712 - in /tuscany/java/sca/modules: assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/ node-impl-osgi/src/main/java/org/apache/tuscany/sc...
Date Wed, 02 Sep 2009 22:09:42 GMT
Author: rfeng
Date: Wed Sep  2 22:09:41 2009
New Revision: 810712

URL: http://svn.apache.org/viewvc?rev=810712&view=rev
Log:
Remove the need to extend EndpointDescription

Added:
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointHelper.java
      - copied, changed from r810105, tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointDescriptionImpl.java
Removed:
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointDescriptionImpl.java
Modified:
    tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointIntrospector.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/OSGiServiceExporter.java
    tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/RemoteControllerImpl.java
    tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite

Modified: tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
(original)
+++ tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceEndpointReferenceBuilderImpl.java
Wed Sep  2 22:09:41 2009
@@ -423,7 +423,7 @@
                             break;
                         }
                     }
-                    if (!promoted && !componentReference.isForCallback()) {
+                    if (!promoted && !componentReference.isForCallback() &&
!componentReference.isWiredByImpl()) {
                         Monitor.error(monitor,
                                       this,
                                       "assembly-validation-messages",
@@ -475,7 +475,7 @@
             // then this reference is unwired, which is an error - the existing endpoint
references
             // will have been attached to a nested reference when a promoting reference has
its endpoint
             // references computed
-            if (endpoints.size() == 0 && !reference.isPromoted()) {
+            if (endpoints.size() == 0 && !reference.isPromoted() && !reference.isWiredByImpl())
{
                 warning(monitor, "ReferenceWithoutTargets", reference, composite.getName().toString(),
reference
                     .getName());
             } // end if

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/DomainDiscoveryService.java
Wed Sep  2 22:09:41 2009
@@ -19,12 +19,13 @@
 
 package org.apache.tuscany.sca.osgi.service.discovery.impl;
 
+import static org.apache.tuscany.sca.osgi.service.remoteadmin.impl.EndpointHelper.createEndpointDescription;
+
 import org.apache.tuscany.sca.assembly.Endpoint;
 import org.apache.tuscany.sca.assembly.Implementation;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
 import org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription;
-import org.apache.tuscany.sca.osgi.service.remoteadmin.impl.EndpointDescriptionImpl;
 import org.apache.tuscany.sca.runtime.EndpointListener;
 import org.apache.tuscany.sca.runtime.EndpointRegistry;
 import org.osgi.framework.BundleContext;
@@ -82,11 +83,6 @@
         }
     }
 
-    private EndpointDescription createEndpointDescription(Endpoint endpoint) {
-        EndpointDescription description = new EndpointDescriptionImpl(endpoint);
-        return description;
-    }
-
     public void endpointRemoved(Endpoint endpoint) {
         /*
         if (!endpoint.isRemote()) {

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/discovery/impl/LocalDiscoveryService.java
Wed Sep  2 22:09:41 2009
@@ -51,7 +51,6 @@
 import org.apache.tuscany.sca.monitor.MonitorFactory;
 import org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription;
 import org.apache.tuscany.sca.osgi.service.remoteadmin.RemoteConstants;
-import org.apache.tuscany.sca.osgi.service.remoteadmin.impl.EndpointDescriptionImpl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -162,7 +161,7 @@
             props.put(RemoteConstants.ENDPOINT_URI, UUID.randomUUID().toString());
         }
 
-        EndpointDescription sed = new EndpointDescriptionImpl(props);
+        EndpointDescription sed = new EndpointDescription(props);
         return sed;
     }
 

Copied: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointHelper.java
(from r810105, tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointDescriptionImpl.java)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointHelper.java?p2=tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointHelper.java&p1=tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointDescriptionImpl.java&r1=810105&r2=810712&rev=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointDescriptionImpl.java
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointHelper.java
Wed Sep  2 22:09:41 2009
@@ -19,91 +19,28 @@
 
 package org.apache.tuscany.sca.osgi.service.remoteadmin.impl;
 
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.assembly.Endpoint;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription;
 import org.apache.tuscany.sca.osgi.service.remoteadmin.RemoteConstants;
-import org.apache.tuscany.sca.policy.Intent;
 import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
 
 /**
  * Implementation of {@link EndpointDescription}
  */
-public class EndpointDescriptionImpl extends EndpointDescription {
-    private static final Logger logger = Logger.getLogger(EndpointDescriptionImpl.class.getName());
-    private Endpoint endpoint;
-
-    /**
-     * @param properties
-     * @throws IllegalArgumentException
-     */
-    public EndpointDescriptionImpl(Map properties) throws IllegalArgumentException {
-        super(properties);
-        this.endpoint = (Endpoint)getProperties().get(Endpoint.class.getName());
+public class EndpointHelper {
+    private EndpointHelper() {
     }
 
-    /**
-     * @param ref
-     * @throws IllegalArgumentException
-     */
-    public EndpointDescriptionImpl(ServiceReference ref) throws IllegalArgumentException
{
-        super(ref);
-        this.endpoint = (Endpoint)getProperties().get(Endpoint.class.getName());
-    }
-
-    public EndpointDescriptionImpl(Collection<String> interfaces, String remoteServiceId,
String uri) {
-        super(getProperties(interfaces, remoteServiceId, uri));
-        this.endpoint = (Endpoint)getProperties().get(Endpoint.class.getName());
-    }
-
-    private static Map<String, Object> getProperties(Collection<String> interfaces,
String remoteServiceId, String uri) {
-        Map<String, Object> props = new HashMap<String, Object>();
-        props.put(Constants.OBJECTCLASS, interfaces.toArray(new String[interfaces.size()]));
-        props.put(RemoteConstants.ENDPOINT_REMOTE_SERVICE_ID, remoteServiceId);
-        props.put(RemoteConstants.ENDPOINT_URI, uri);
-        return props;
-    }
-
-    public EndpointDescriptionImpl(Endpoint endpoint) {
-        this(getProperties(endpoint));
-        this.endpoint = endpoint;
-    }
-
-    /**
-     * @see org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription#getConfigurationTypes()
-     */
-    public List<String> getConfigurationTypes() {
-        return Collections.singletonList("sca");
-    }
-
-    /**
-     * @see org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription#getIntents()
-     */
-    public List<String> getIntents() {
-        List<String> intents = new ArrayList<String>();
-        for (Intent intent : endpoint.getRequiredIntents()) {
-            intents.add(intent.getName().toString());
-        }
-        return intents;
-    }
-
-    /**
-     * @see org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription#getInterfaceVersion(java.lang.String)
-     */
-    public Version getInterfaceVersion(String name) {
-        return Version.emptyVersion;
+    public static EndpointDescription createEndpointDescription(Endpoint endpoint) {
+        return new EndpointDescription(getProperties(endpoint));
     }
 
     private static List<String> getInterfaces(Endpoint endpoint) {
@@ -123,26 +60,8 @@
         return props;
     }
 
-    /**
-     * @see org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription#getRemoteServiceID()
-     */
-    public String getRemoteServiceID() {
-        return null; // endpoint.getService().getExtensions();
-    }
-
-    /**
-     * @see org.apache.tuscany.sca.osgi.service.remoteadmin.EndpointDescription#getURI()
-     */
-    public String getURI() {
-        if (endpoint != null) {
-            return endpoint.getURI();
-        } else {
-            return super.getURI();
-        }
-    }
-
-    public Endpoint getEndpoint() {
-        return endpoint;
+    public static Endpoint getEndpoint(EndpointDescription endpointDescription) {
+        return (Endpoint)endpointDescription.getProperties().get(Endpoint.class.getName());
     }
 
 }

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointIntrospector.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointIntrospector.java?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointIntrospector.java
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/EndpointIntrospector.java
Wed Sep  2 22:09:41 2009
@@ -292,12 +292,9 @@
     }
 
     public Contribution introspect(Bundle bundle, EndpointDescription endpoint) throws Exception
{
-        if (endpoint instanceof EndpointDescriptionImpl) {
-            EndpointDescriptionImpl impl = (EndpointDescriptionImpl)endpoint;
-            Endpoint ep = impl.getEndpoint();
-            if (ep != null) {
-                return introspect(bundle, ep);
-            }
+        Endpoint ep = (Endpoint) endpoint.getProperties().get(Endpoint.class.getName());
+        if (ep != null) {
+            return introspect(bundle, ep);
         }
         Map<String, Object> properties = endpoint.getProperties();
         List<String> remoteInterfaces = endpoint.getInterfaces();

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/OSGiServiceExporter.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/OSGiServiceExporter.java?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/OSGiServiceExporter.java
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/OSGiServiceExporter.java
Wed Sep  2 22:09:41 2009
@@ -19,6 +19,8 @@
 
 package org.apache.tuscany.sca.osgi.service.remoteadmin.impl;
 
+import static org.apache.tuscany.sca.osgi.service.remoteadmin.impl.EndpointHelper.createEndpointDescription;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -93,7 +95,7 @@
                 Component component = contribution.getDeployables().get(0).getComponents().get(0);
                 ComponentService service = component.getServices().get(0);
                 for (Endpoint endpoint : service.getEndpoints()) {
-                    EndpointDescription endpointDescription = new EndpointDescriptionImpl(endpoint);
+                    EndpointDescription endpointDescription = createEndpointDescription(endpoint);
                     ExportRegistration exportRegistration =
                         new ExportRegistrationImpl(node, reference, endpointDescription);
                     exportedServices.add(exportRegistration);

Modified: tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/RemoteControllerImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/RemoteControllerImpl.java?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/RemoteControllerImpl.java
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/main/java/org/apache/tuscany/sca/osgi/service/remoteadmin/impl/RemoteControllerImpl.java
Wed Sep  2 22:09:41 2009
@@ -352,7 +352,7 @@
             Map<String, Object> props = new HashMap<String, Object>(endpoint.getProperties());
             props.put(Bundle.class.getName(), bundle);
             props.put(Constants.OBJECTCLASS, new String[] {interfaceClass.getName()});
-            EndpointDescription description = new EndpointDescriptionImpl(props);
+            EndpointDescription description = new EndpointDescription(props);
 
             if (admins != null) {
                 for (Object ra : admins) {

Modified: tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/MANIFEST.MF?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/MANIFEST.MF
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/META-INF/MANIFEST.MF
Wed Sep  2 22:09:41 2009
@@ -8,3 +8,5 @@
 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
 Bundle-DocURL: http://www.apache.org/
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6
+Import-Package: calculator.dosgi;version="1.0.0",
+ calculator.dosgi.operations;version="1.0.0"

Modified: tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite?rev=810712&r1=810711&r2=810712&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite
(original)
+++ tuscany/java/sca/modules/node-impl-osgi/src/test/resources/calculator/dosgi/sca/OSGI-INF/sca/calculator.composite
Wed Sep  2 22:09:41 2009
@@ -48,6 +48,7 @@
         <reference name="divideService" target="OperationsComponent/DivideService">
         </reference>
          -->
+    </component>         
          
     <component name="OperationsComponent">
         <tuscany:implementation.osgi bundleSymbolicName="calculator.dosgi.operations"
bundleVersion="1.0.0" />
@@ -64,7 +65,6 @@
             <tuscany:binding.rmi uri="rmi://localhost:8085/DivideService"/>
         </service>
         
-    </component>         
     </component>
 
 </composite>



Mime
View raw message