servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r384298 - in /incubator/servicemix/trunk/servicemix-core/src: main/java/org/apache/servicemix/jbi/container/ main/java/org/apache/servicemix/jbi/framework/ test/java/org/apache/servicemix/jbi/framework/ test/java/org/apache/servicemix/jbi/s...
Date Wed, 08 Mar 2006 18:24:54 GMT
Author: gnodet
Date: Wed Mar  8 10:24:52 2006
New Revision: 384298

URL: http://svn.apache.org/viewcvs?rev=384298&view=rev
Log:
Remove the id part from the ComponentNameSpace as it is usually equals to the name and the
name is already unique

Removed:
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java
Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentNameSpace.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentRegistryTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/JBIContainer.java
Wed Mar  8 10:24:52 2006
@@ -898,7 +898,7 @@
      */
     public ObjectName activateComponent(Component component, String name) throws JBIException
{
         ActivationSpec activationSpec = new ActivationSpec();
-        ComponentNameSpace cns = new ComponentNameSpace(getName(), name, name);
+        ComponentNameSpace cns = new ComponentNameSpace(getName(), name);
         activationSpec.setComponent(component);
         activationSpec.setComponentName(cns.getName());
         return activateComponent(component, activationSpec);
@@ -949,7 +949,7 @@
      */
     public ObjectName activateComponent(Component component, String description, ActivationSpec
activationSpec,
                                         boolean pojo, boolean binding, boolean service) throws
JBIException {
-        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName(),
activationSpec.getId());
+        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName());
         if (registry.getComponent(cns) != null) {
             throw new JBIException("A component is already registered for " + cns);
         }
@@ -973,7 +973,7 @@
                                         ComponentContextImpl context, ActivationSpec activationSpec,
boolean pojo, boolean binding, boolean service)
             throws JBIException {
         ObjectName result = null;
-        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName(),
activationSpec.getId());
+        ComponentNameSpace cns = new ComponentNameSpace(getName(), activationSpec.getComponentName());
         if (log.isDebugEnabled()) {
             log.info("Activating component for: " + cns + " with service: " + activationSpec.getService()
+ " component: "
                     + component);

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentNameSpace.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentNameSpace.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentNameSpace.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentNameSpace.java
Wed Mar  8 10:24:52 2006
@@ -34,7 +34,6 @@
     
     protected String containerName;
     protected String name;
-    protected String componentId;
 
     /**
      * Default Constructor
@@ -49,33 +48,12 @@
      * @param componentName
      * @param componentId
      */
-    public ComponentNameSpace(String containerName, String componentName, String componentId)
{
+    public ComponentNameSpace(String containerName, String componentName) {
         this.containerName = containerName;
         this.name = componentName;
-        this.componentId = componentId;
-        if (this.name == null) {
-            this.name = this.componentId;
-        }
-        if (this.componentId == null) {
-            this.componentId = this.name;
-        }
     }
     
     /**
-     * @return Returns the componentId.
-     */
-    public String getComponentId() {
-        return componentId;
-    }
-
-    /**
-     * @param componentId The componentId to set.
-     */
-    public void setComponentId(String componentId) {
-        this.componentId = componentId;
-    }
-
-    /**
      * @return Returns the componentName.
      */
     public String getName() {
@@ -111,8 +89,8 @@
         boolean result = false;
         if (obj != null && obj instanceof ComponentNameSpace) {
             ComponentNameSpace other = (ComponentNameSpace) obj;
-            result = other.getContainerName().equals(this.containerName)
-                    && other.getComponentId().equals(this.componentId);
+            result = other.containerName.equals(this.containerName)
+                    && other.name.equals(this.name);
         }
         return result;
     }
@@ -121,14 +99,14 @@
      * @return the hashCode
      */
     public int hashCode() {
-        return containerName.hashCode() ^ componentId.hashCode();
+        return containerName.hashCode() ^ name.hashCode();
     }
     
     /**
      * @return pretty print
      */
     public String toString() {
-        return "[container=" + containerName + ",name=" + name + ",id=" + componentId + "]";
+        return "[container=" + containerName + ",name=" + name + "]";
     }
 
     /**
@@ -139,7 +117,6 @@
     public void writeExternal(ObjectOutput out) throws IOException {
         out.writeUTF(containerName != null ? containerName : "");
         out.writeUTF(name != null ? name : "");
-        out.writeUTF(componentId != null ? componentId : "");
     }
 
     /**
@@ -151,15 +128,14 @@
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         containerName = in.readUTF();
         name = in.readUTF();
-        componentId = in.readUTF();
     }
     
     /**
      * copy this
      * @return
      */
-    public ComponentNameSpace copy(){
-        ComponentNameSpace result = new ComponentNameSpace(containerName,name,componentId);
+    public ComponentNameSpace copy() {
+        ComponentNameSpace result = new ComponentNameSpace(containerName, name);
         return result;
     }
     

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/InstallationService.java
Wed Mar  8 10:24:52 2006
@@ -631,7 +631,7 @@
     }
 
     protected ComponentContextImpl buildComponentContext(File componentRoot,String name)
throws IOException{
-        ComponentNameSpace cns=new ComponentNameSpace(container.getName(),name,name);
+        ComponentNameSpace cns=new ComponentNameSpace(container.getName(),name);
         ComponentContextImpl context=new ComponentContextImpl(container,cns);
         ComponentEnvironment env=new ComponentEnvironment();
         FileUtil.buildDirectory(componentRoot);

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Registry.java
Wed Mar  8 10:24:52 2006
@@ -329,7 +329,7 @@
      * @return the Componment
      */
     public ComponentMBeanImpl getComponent(String name) {
-        ComponentNameSpace cns = new ComponentNameSpace(container.getName(), name, name);
+        ComponentNameSpace cns = new ComponentNameSpace(container.getName(), name);
         return getComponent(cns);
     }
     
@@ -498,7 +498,17 @@
      * @return List of deployed service units
      */
     public ServiceUnitLifeCycle[] getDeployedServiceUnits(String componentName)  {
-        return serviceAssemblyRegistry.getDeployedServiceUnits(componentName);
+        Collection sus = serviceUnits.values();
+        List tmpList = new ArrayList();
+        for (Iterator iter = sus.iterator(); iter.hasNext();) {
+            ServiceUnitLifeCycle su = (ServiceUnitLifeCycle) iter.next();
+            if (su.getComponentName().equals(componentName)) {
+                tmpList.add(su);
+            }
+        }
+        ServiceUnitLifeCycle[] result = new ServiceUnitLifeCycle[tmpList.size()];
+        tmpList.toArray(result);
+        return result;
     }
 
     /**

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
Wed Mar  8 10:24:52 2006
@@ -142,32 +142,6 @@
     }
     
    /**
-    * Returns a list of Service Units that are currently deployed to the given component.
-    * 
-    * @param componentName name of the component.
-    * @return List of deployed ASA Ids.
-    */
-   public ServiceUnitLifeCycle[] getDeployedServiceUnits(String componentName) {
-       ServiceUnitLifeCycle[] result = null;
-       // iterate through the service assembilies
-       List tmpList = new ArrayList();
-       for (Iterator iter = serviceAssemblies.values().iterator();iter.hasNext();) {
-           ServiceAssemblyLifeCycle salc = (ServiceAssemblyLifeCycle) iter.next();
-           ServiceUnitLifeCycle[] sus = salc.getDeployedSUs();
-           if (sus != null) {
-               for (int i = 0; i < sus.length; i++) {
-                   if (sus[i].getComponentName().equals(componentName)) {
-                       tmpList.add(sus[i]);
-                   }
-               }
-           }
-       }
-       result = new ServiceUnitLifeCycle[tmpList.size()];
-       tmpList.toArray(result);
-       return result;
-   }
-
-   /**
     * Returns a list of Service Assemblies deployed to the JBI enviroment.
     * 
     * @return list of Service Assembly Name's.

Modified: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentNameSpaceTest.java
Wed Mar  8 10:24:52 2006
@@ -32,10 +32,7 @@
     public void testAccessors() {
         ComponentNameSpace cns = new ComponentNameSpace();
         assertNull(cns.getContainerName());
-        assertNull(cns.getComponentId());
         assertNull(cns.getName());
-        cns.setComponentId("id");
-        assertEquals("id", cns.getComponentId());
         cns.setContainerName("container");
         assertEquals("container", cns.getContainerName());
         cns.setName("name");
@@ -47,18 +44,18 @@
      * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.hashCode()'
      */
     public void testHashCodeEqualsObject() {
-        ComponentNameSpace cns1 = new ComponentNameSpace("container", "name1", "id");
-        ComponentNameSpace cns2 = new ComponentNameSpace("container", "name2", "id");
+        ComponentNameSpace cns1 = new ComponentNameSpace("container", "name");
+        ComponentNameSpace cns2 = new ComponentNameSpace("container", "name");
         assertTrue(cns1.equals(cns2));
         assertTrue(cns1.hashCode() == cns2.hashCode());
 
-        ComponentNameSpace cns3 = new ComponentNameSpace("container1", "name", "id");
-        ComponentNameSpace cns4 = new ComponentNameSpace("container2", "name", "id");
+        ComponentNameSpace cns3 = new ComponentNameSpace("container1", "name");
+        ComponentNameSpace cns4 = new ComponentNameSpace("container2", "name");
         assertFalse(cns3.equals(cns4));
         assertFalse(cns3.hashCode() == cns4.hashCode());
 
-        ComponentNameSpace cns5 = new ComponentNameSpace("container", "name", "id1");
-        ComponentNameSpace cns6 = new ComponentNameSpace("container", "name", "id2");
+        ComponentNameSpace cns5 = new ComponentNameSpace("container", "name1");
+        ComponentNameSpace cns6 = new ComponentNameSpace("container", "name2");
         assertFalse(cns5.equals(cns6));
         assertFalse(cns5.hashCode() == cns6.hashCode());
     }
@@ -68,7 +65,7 @@
      * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.readExternal(ObjectInput)'
      */
     public void testSerialize() throws Exception {
-        ComponentNameSpace cns = new ComponentNameSpace("container", "name", "id");
+        ComponentNameSpace cns = new ComponentNameSpace("container", "name");
         
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream oos = new ObjectOutputStream(baos);
@@ -90,7 +87,7 @@
      * Test method for 'org.apache.servicemix.jbi.framework.ComponentNameSpace.copy()'
      */
     public void testCopy() {
-        ComponentNameSpace cns1 = new ComponentNameSpace("container", "name", "id");
+        ComponentNameSpace cns1 = new ComponentNameSpace("container", "name");
         ComponentNameSpace cns2 = cns1.copy();
         assertEquals(cns1, cns1);
         assertEquals(cns1.getName(), cns2.getName());

Modified: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentRegistryTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentRegistryTest.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentRegistryTest.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentRegistryTest.java
Wed Mar  8 10:24:52 2006
@@ -32,14 +32,14 @@
         ComponentRegistry reg = new ComponentRegistry(container.getRegistry());
         Component component = new SenderComponent();
         ComponentMBeanImpl con = reg.registerComponent(
-                              new ComponentNameSpace("container", "name", "id"),
+                              new ComponentNameSpace("container", "name"),
                               "description",
                               component,
                               false,
                               false);
         assertNotNull(con);
-        assertEquals(con, reg.getComponent(new ComponentNameSpace("container", null, "id")));
-        assertEquals(component, reg.getComponent(new ComponentNameSpace("container", null,
"id")).getComponent());
+        assertEquals(con, reg.getComponent(new ComponentNameSpace("container", "name")));
+        assertEquals(component, reg.getComponent(new ComponentNameSpace("container", "name")).getComponent());
         assertEquals(1, reg.getComponents().size());
     }
 

Modified: incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java?rev=384298&r1=384297&r2=384298&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java
(original)
+++ incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java
Wed Mar  8 10:24:52 2006
@@ -30,7 +30,7 @@
 public class InternalEndpointTest extends TestCase {
 
     public void testSerializeDeserialize() throws Exception {
-        ComponentNameSpace cns = new ComponentNameSpace("myContainer", "myName", "myId");
+        ComponentNameSpace cns = new ComponentNameSpace("myContainer", "myName");
         InternalEndpoint e = new InternalEndpoint(cns, "myEndpoint", new QName("myService"));
         
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -51,16 +51,16 @@
     }
     
     public void testEquals() throws Exception {
-        ComponentNameSpace cns = new ComponentNameSpace("myContainer", "myName", "myId");
+        ComponentNameSpace cns = new ComponentNameSpace("myContainer", "myName");
         InternalEndpoint e1 = new InternalEndpoint(cns, "myEndpoint1", new QName("myService"));
         InternalEndpoint e2 = new InternalEndpoint(cns, "myEndpoint2", new QName("myService"));
         assertFalse(e1.equals(e2));
         e2 = new InternalEndpoint(cns, "myEndpoint", new QName("myService2"));
         assertFalse(e1.equals(e2));
-        ComponentNameSpace cns2 = new ComponentNameSpace("myContainer", "myName", "myId2");
+        ComponentNameSpace cns2 = new ComponentNameSpace("myContainer2", "myId2");
         e2 = new InternalEndpoint(cns2, "myEndpoint1", new QName("myService"));
         assertTrue(e1.equals(e2));
-        cns2 = new ComponentNameSpace("myContainer", "myName", "myId");
+        cns2 = new ComponentNameSpace("myContainer", "myName");
         e2 = new InternalEndpoint(cns2, "myEndpoint1", new QName("myService"));
         assertTrue(e1.equals(e2));
     }



Mime
View raw message