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

svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Author: rfeng
Date: Wed Jun 10 23:51:25 2009
New Revision: 783578

URL: http://svn.apache.org/viewvc?rev=783578&view=rev
Log:
Remove unused getEndpoints() method

Modified:
    tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
    tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Modified: tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java?rev=783578&r1=783577&r2=783578&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java (original)
+++ tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java Wed Jun 10 23:51:25 2009
@@ -19,7 +19,6 @@
 
 package org.apache.tuscany.sca.node.impl;
 
-import java.util.ArrayList;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -28,8 +27,6 @@
 import org.apache.tuscany.sca.assembly.ComponentService;
 import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Endpoint2;
-import org.apache.tuscany.sca.assembly.Service;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
 import org.apache.tuscany.sca.core.UtilityExtensionPoint;
 import org.apache.tuscany.sca.core.assembly.ActivationException;
@@ -41,7 +38,6 @@
 import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
 import org.apache.tuscany.sca.runtime.RuntimeComponent;
 import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 import org.oasisopen.sca.CallableReference;
 import org.oasisopen.sca.ServiceReference;
 import org.oasisopen.sca.ServiceRuntimeException;
@@ -208,30 +204,4 @@
         return manager.getExtensionPoints();
     }
 
-    /**
-     * Get the service endpoints in this Node
-     * TODO: needs review, works for the very simple testcase but i expect there are
-     *    other endpoints to be included
-     */
-    public List<Endpoint2> getServiceEndpoints() {
-        List<Endpoint2> endpoints = new ArrayList<Endpoint2>();
-        if (compositeActivator != null) {
-            Composite domainComposite = compositeActivator.getDomainComposite();
-            if (domainComposite != null) {
-                for (Composite composite : domainComposite.getIncludes()) {
-                    for (Component component : composite.getComponents()) {
-                        for (Service service : component.getServices()) {
-                        	// MJE 28/05/2009 - changed to RuntimeComponentService from RuntimeComponentServiceImpl
-                        	// - no need to access the Impl directly here
-                            if (service instanceof RuntimeComponentService) {
-                                endpoints.addAll(((RuntimeComponentService)service).getEndpoints());
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return endpoints;
-    }
-
 }

Modified: tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java?rev=783578&r1=783577&r2=783578&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java (original)
+++ tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java Wed Jun 10 23:51:25 2009
@@ -23,9 +23,7 @@
 
 import java.io.File;
 import java.io.StringReader;
-import java.util.List;
 
-import org.apache.tuscany.sca.assembly.Endpoint2;
 import org.apache.tuscany.sca.node.Contribution;
 import org.apache.tuscany.sca.node.Node;
 import org.apache.tuscany.sca.node.NodeFactory;
@@ -77,17 +75,6 @@
         testNode(new NodeFactoryImpl().createNode());
     }
 
-    @Test
-    public void testGetServiceEndpoints() {
-        NodeFactory factory = new NodeFactoryImpl();
-        Contribution contribution = new Contribution("c1", new File("target/test-classes").toURI().toString());
-        NodeImpl node = (NodeImpl)factory.createNode(new StringReader(composite), contribution);
-        node.start();
-        List<Endpoint2> endpoints = node.getServiceEndpoints();
-        Assert.assertEquals(1, endpoints.size());
-        Assert.assertEquals("/HelloWorld2", endpoints.get(0).getBinding().getURI());
-    }
-
     private void testNode(Node node) {
         node.start();
         HelloWorld hw = node.getService(HelloWorld.class, "HelloWorld");



Re: svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Posted by Raymond Feng <en...@gmail.com>.
 --------------------------------------------------
From: "ant elder" <an...@apache.org>
Sent: Monday, June 15, 2009 12:59 AM
To: <de...@tuscany.apache.org>
Subject: Re: svn commit: r783578 - in 
/tuscany/java/sca/modules/node-impl/src: 
main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java 
test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

> On Fri, Jun 12, 2009 at 4:45 PM, Raymond Feng<en...@gmail.com> wrote:
>> Can you point to me where the method is used in your code? I would like 
>> to
>> understand the use case.
>>
>
> I want to get the endpoint services in the node. I don't understand
> why you don't seem to like that?

I'm keen on not mixing too many functions on the Node interface as it is 
used as an API/SPI today. I understand the management function may require 
the list of endpoints that are published by a given node, but it could be 
provided via a separate layer.

As the Node has a
> getService(serviceName) method that throws a serviceName does not
> exist exception then its programming 101 to also have a way to get the
> available serviceNames isn't it?

Not really. For example, ClassLoader.loadClass(String className) which may 
throw ClassNotFoundException but there is no API for 
ClassLoader.getClasses().

>
>   ...ant 


Re: svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Posted by ant elder <an...@apache.org>.
On Fri, Jun 12, 2009 at 4:45 PM, Raymond Feng<en...@gmail.com> wrote:
> Can you point to me where the method is used in your code? I would like to
> understand the use case.
>

I want to get the endpoint services in the node. I don't understand
why you don't seem to like that? As the Node has a
getService(serviceName) method that throws a serviceName does not
exist exception then its programming 101 to also have a way to get the
available serviceNames isn't it?

   ...ant

Re: svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Posted by Raymond Feng <en...@gmail.com>.
Can you point to me where the method is used in your code? I would like to 
understand the use case.

Thanks,
Raymond
--------------------------------------------------
From: "ant elder" <an...@apache.org>
Sent: Friday, June 12, 2009 2:55 AM
To: <de...@tuscany.apache.org>
Subject: Re: svn commit: r783578 - in 
/tuscany/java/sca/modules/node-impl/src: 
main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java 
test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

> On Thu, Jun 11, 2009 at 4:32 PM, ant elder<an...@apache.org> wrote:
>> On Thu, Jun 11, 2009 at 4:25 PM, Raymond Feng<en...@gmail.com> wrote:
>>
>>> Node is the API/SPI to start/stop a node and lookup services. We should 
>>> try
>>> to keep the dependency minimum and not expose two many things. Can you 
>>> tell
>>> us why you need getEndpoints() from Node? We already have the
>>> EndpointRegistry, and it can potentially have a method to
>>> getEndpoints(nodeURI).
>>>
>>
>> I use in in some of the Tomcat integration I'm doing. Having a way to
>> query what endpoints a Node has seems quite natural and in keeping
>> with the exsiting start/stop/query services it already has, and that
>> seems a much nicer way of doing it than having a getEndpoints(nodeURI)
>> to the EndpointRegistry.
>>
>> So if that was all can we add this back then?
>>
>>   ...ant
>>
>
> I've put back this method now so that my other code keeps compiling.
> I'm totally fine with changing it or coming up with some new
> management interface or whatever else, but lets get consensus and
> implement that _before_ deleting this old method.
>
>   ...ant 


Re: svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Posted by ant elder <an...@apache.org>.
On Thu, Jun 11, 2009 at 4:32 PM, ant elder<an...@apache.org> wrote:
> On Thu, Jun 11, 2009 at 4:25 PM, Raymond Feng<en...@gmail.com> wrote:
>
>> Node is the API/SPI to start/stop a node and lookup services. We should try
>> to keep the dependency minimum and not expose two many things. Can you tell
>> us why you need getEndpoints() from Node? We already have the
>> EndpointRegistry, and it can potentially have a method to
>> getEndpoints(nodeURI).
>>
>
> I use in in some of the Tomcat integration I'm doing. Having a way to
> query what endpoints a Node has seems quite natural and in keeping
> with the exsiting start/stop/query services it already has, and that
> seems a much nicer way of doing it than having a getEndpoints(nodeURI)
> to the EndpointRegistry.
>
> So if that was all can we add this back then?
>
>   ...ant
>

I've put back this method now so that my other code keeps compiling.
I'm totally fine with changing it or coming up with some new
management interface or whatever else, but lets get consensus and
implement that _before_ deleting this old method.

   ...ant

getEndpoints() in Node? was: Re: svn commit: r783578

Posted by Raymond Feng <en...@gmail.com>.
How do you use the Endpoints looked up from Node? Is it a management 
interface?

Thanks,
Raymond
--------------------------------------------------
From: "ant elder" <an...@apache.org>
Sent: Thursday, June 11, 2009 8:32 AM
To: <de...@tuscany.apache.org>
Subject: Re: svn commit: r783578 - in 
/tuscany/java/sca/modules/node-impl/src: 
main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java 
test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

> On Thu, Jun 11, 2009 at 4:25 PM, Raymond Feng<en...@gmail.com> wrote:
>
>> Node is the API/SPI to start/stop a node and lookup services. We should 
>> try
>> to keep the dependency minimum and not expose two many things. Can you 
>> tell
>> us why you need getEndpoints() from Node? We already have the
>> EndpointRegistry, and it can potentially have a method to
>> getEndpoints(nodeURI).
>>
>
> I use in in some of the Tomcat integration I'm doing. Having a way to
> query what endpoints a Node has seems quite natural and in keeping
> with the exsiting start/stop/query services it already has, and that
> seems a much nicer way of doing it than having a getEndpoints(nodeURI)
> to the EndpointRegistry.
>
> So if that was all can we add this back then?
>
>   ...ant 


Re: svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Posted by ant elder <an...@apache.org>.
On Thu, Jun 11, 2009 at 4:25 PM, Raymond Feng<en...@gmail.com> wrote:

> Node is the API/SPI to start/stop a node and lookup services. We should try
> to keep the dependency minimum and not expose two many things. Can you tell
> us why you need getEndpoints() from Node? We already have the
> EndpointRegistry, and it can potentially have a method to
> getEndpoints(nodeURI).
>

I use in in some of the Tomcat integration I'm doing. Having a way to
query what endpoints a Node has seems quite natural and in keeping
with the exsiting start/stop/query services it already has, and that
seems a much nicer way of doing it than having a getEndpoints(nodeURI)
to the EndpointRegistry.

So if that was all can we add this back then?

   ...ant

Re: svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Posted by Raymond Feng <en...@gmail.com>.
You used it in SCAClientImpl but I have fixed the code to use 
Node.getService().

Node is the API/SPI to start/stop a node and lookup services. We should try 
to keep the dependency minimum and not expose two many things. Can you tell 
us why you need getEndpoints() from Node? We already have the 
EndpointRegistry, and it can potentially have a method to 
getEndpoints(nodeURI).

Thanks,
Raymond
--------------------------------------------------
From: "ant elder" <an...@gmail.com>
Sent: Wednesday, June 10, 2009 11:17 PM
To: <de...@tuscany.apache.org>
Subject: Re: svn commit: r783578 - in 
/tuscany/java/sca/modules/node-impl/src: 
main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java 
test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

> On Thu, Jun 11, 2009 at 12:51 AM, <rf...@apache.org> wrote:
>> Author: rfeng
>> Date: Wed Jun 10 23:51:25 2009
>> New Revision: 783578
>>
>> URL: http://svn.apache.org/viewvc?rev=783578&view=rev
>> Log:
>> Remove unused getEndpoints() method
>>
>> Modified:
>> 
>> tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
>> 
>> tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
>>
>
> Actually I am using this and was about to add the method to the Node
> API. Is there a problem with being able to get the endpoints in a
> Node?
>
>   ...ant 


Re: svn commit: r783578 - in /tuscany/java/sca/modules/node-impl/src: main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java

Posted by ant elder <an...@gmail.com>.
On Thu, Jun 11, 2009 at 12:51 AM, <rf...@apache.org> wrote:
> Author: rfeng
> Date: Wed Jun 10 23:51:25 2009
> New Revision: 783578
>
> URL: http://svn.apache.org/viewvc?rev=783578&view=rev
> Log:
> Remove unused getEndpoints() method
>
> Modified:
>    tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
>    tuscany/java/sca/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
>

Actually I am using this and was about to add the method to the Node
API. Is there a problem with being able to get the endpoints in a
Node?

   ...ant