servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r383702 [1/3] - in /incubator/servicemix/trunk: servicemix-components/src/test/resources/org/apache/servicemix/components/email/ servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/ servicemix-core/src/main/java/org/apache/service...
Date Mon, 06 Mar 2006 23:19:38 GMT
Author: gnodet
Date: Mon Mar  6 15:19:33 2006
New Revision: 383702

URL: http://svn.apache.org/viewcvs?rev=383702&view=rev
Log:
SM-295: SA connections handling
SM-149: clustering on endpoints
SM-337: jms flow routes to components before they are started

Added:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentAdapter.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentEvent.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentListener.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointAdapter.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointEvent.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointListener.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeEvent.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeListener.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyAdapter.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyEvent.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyListener.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitAdapter.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitEvent.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitListener.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/nmr/ConnectionsTest.java
Removed:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentPacketEvent.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentPacketEventListener.java
Modified:
    incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/email/example.xml
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java
    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/container/SubscriptionSpec.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentConnector.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentPacket.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Endpoint.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/EndpointRegistry.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/LocalComponentConnector.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/ServiceAssemblyLifeCycle.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceAssemblyRegistry.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ServiceUnitLifeCycle.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/messaging/DeliveryChannelImpl.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/Broker.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/AbstractFlow.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jca/JCAFlow.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/jms/JMSFlow.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaFlow.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/AbstractServiceEndpoint.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/LinkedEndpoint.java
    incubator/servicemix/trunk/servicemix-core/src/test/components/logger-component-1.0-exploded.jar/META-INF/jbi.xml
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/framework/ComponentPacketTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/installation/DeploymentTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/ManagementAttributesTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/management/ManagementContextTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/nmr/flow/jms/JMSFlowTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/nmr/flow/jms/MultipleJMSFlowTest.java
    incubator/servicemix/trunk/servicemix-core/src/test/java/org/apache/servicemix/jbi/servicedesc/InternalEndpointTest.java

Modified: incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/email/example.xml
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/email/example.xml?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/email/example.xml (original)
+++ incubator/servicemix/trunk/servicemix-components/src/test/resources/org/apache/servicemix/components/email/example.xml Mon Mar  6 15:19:33 2006
@@ -7,7 +7,7 @@
     <sm:activationSpecs>
 
       <!-- START SNIPPET: mime -->
-      <sm:activationSpec componentName="emailSender" service="foo:emailSender">
+      <sm:activationSpec componentName="emailSender" service="foo:mimeSender">
         <sm:component><bean class="org.apache.servicemix.components.email.MimeMailSender">
           <property name="sender">
             <bean class="org.springframework.mail.javamail.JavaMailSenderImpl">

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/AbstractAuditor.java Mon Mar  6 15:19:33 2006
@@ -23,8 +23,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.MessageExchangeListener;
 import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.event.ExchangeListener;
 import org.apache.servicemix.jbi.management.AttributeInfoHelper;
 import org.apache.servicemix.jbi.management.BaseSystemService;
 import org.apache.servicemix.jbi.management.OperationInfoHelper;
@@ -37,7 +37,7 @@
  * @since 2.1
  * @version $Revision$
  */
-public abstract class AbstractAuditor extends BaseSystemService implements AuditorMBean, MessageExchangeListener {
+public abstract class AbstractAuditor extends BaseSystemService implements AuditorMBean, ExchangeListener {
 
     protected final Log log = LogFactory.getLog(getClass());
     

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/jdbc/JdbcAuditor.java Mon Mar  6 15:19:33 2006
@@ -23,7 +23,6 @@
 import java.sql.Statement;
 
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
 import javax.sql.DataSource;
 
 import org.apache.ddlutils.Platform;
@@ -33,6 +32,7 @@
 import org.apache.ddlutils.model.Table;
 import org.apache.servicemix.jbi.audit.AbstractAuditor;
 import org.apache.servicemix.jbi.audit.AuditorException;
+import org.apache.servicemix.jbi.event.ExchangeEvent;
 import org.apache.servicemix.jbi.messaging.ExchangePacket;
 import org.apache.servicemix.jbi.messaging.InOnlyImpl;
 import org.apache.servicemix.jbi.messaging.InOptionalOutImpl;
@@ -109,7 +109,8 @@
         return db;
     }
 
-    public void onMessageExchange(MessageExchange exchange) throws MessagingException {
+    public void exchangeSent(ExchangeEvent event) {
+        MessageExchange exchange = event.getExchange();
         if (exchange instanceof MessageExchangeImpl == false) {
             throw new IllegalArgumentException("exchange should be a MessageExchangeImpl");
         }
@@ -124,7 +125,7 @@
                 platform.returnConnection(connection);
             }
         } catch (Exception e) {
-            throw new MessagingException("Could not persist exchange", e);
+            log.error("Could not persist exchange", e);
         }
     }
     

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/audit/lucene/LuceneAuditor.java Mon Mar  6 15:19:33 2006
@@ -31,6 +31,8 @@
 import org.apache.servicemix.jbi.audit.AuditorException;
 import org.apache.servicemix.jbi.audit.AuditorMBean;
 import org.apache.servicemix.jbi.audit.AuditorQueryMBean;
+import org.apache.servicemix.jbi.event.ExchangeEvent;
+import org.apache.servicemix.jbi.event.ExchangeListener;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 
 /**
@@ -53,6 +55,7 @@
  * @version $Revision$
  */
 public class LuceneAuditor extends AbstractAuditor implements AuditorQueryMBean {
+    
 	private AuditorMBean delegatedAuditor;
 	private LuceneIndexer luceneIndexer = new LuceneIndexer();
 
@@ -126,15 +129,16 @@
 		return this.delegatedAuditor.deleteExchanges(ids);
 	}
 
-	public void onMessageExchange(MessageExchange exchange) throws MessagingException {
+    public void exchangeSent(ExchangeEvent event) {
+        MessageExchange exchange = event.getExchange();
 		try {
 			Document doc = createDocument(exchange);
 			this.luceneIndexer.add(doc,exchange.getExchangeId());
-		} catch (IOException e) {
-			throw new MessagingException("Error while adding to lucene",e);
-		}
-		if (delegatedAuditor instanceof AbstractAuditor) {
-			((AbstractAuditor)delegatedAuditor).onMessageExchange(exchange);
+			if (delegatedAuditor instanceof ExchangeListener) {
+			    ((ExchangeListener) delegatedAuditor).exchangeSent(event);
+			}
+		} catch (Exception e) {
+			log.error("Error while adding to lucene", e);
 		}
 	}
 

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=383702&r1=383701&r2=383702&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 Mon Mar  6 15:19:33 2006
@@ -18,8 +18,7 @@
 import java.io.File;
 import java.util.Calendar;
 import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
+import java.util.EventListener;
 import java.util.MissingResourceException;
 import java.util.logging.Logger;
 
@@ -39,6 +38,7 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.resource.spi.work.WorkManager;
+import javax.swing.event.EventListenerList;
 import javax.transaction.TransactionManager;
 import javax.xml.namespace.QName;
 
@@ -53,6 +53,13 @@
 import org.apache.servicemix.components.util.ComponentSupport;
 import org.apache.servicemix.components.util.PojoLifecycleAdaptor;
 import org.apache.servicemix.components.util.PojoSupport;
+import org.apache.servicemix.jbi.event.ComponentListener;
+import org.apache.servicemix.jbi.event.EndpointListener;
+import org.apache.servicemix.jbi.event.ExchangeEvent;
+import org.apache.servicemix.jbi.event.ExchangeListener;
+import org.apache.servicemix.jbi.event.ServiceAssemblyListener;
+import org.apache.servicemix.jbi.event.ServiceUnitListener;
+import org.apache.servicemix.jbi.framework.AdminCommandsService;
 import org.apache.servicemix.jbi.framework.AutoDeploymentService;
 import org.apache.servicemix.jbi.framework.ComponentContextImpl;
 import org.apache.servicemix.jbi.framework.ComponentNameSpace;
@@ -60,7 +67,6 @@
 import org.apache.servicemix.jbi.framework.InstallationService;
 import org.apache.servicemix.jbi.framework.LocalComponentConnector;
 import org.apache.servicemix.jbi.framework.Registry;
-import org.apache.servicemix.jbi.framework.AdminCommandsService;
 import org.apache.servicemix.jbi.management.BaseLifeCycle;
 import org.apache.servicemix.jbi.management.ManagementContext;
 import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
@@ -69,7 +75,6 @@
 import org.jencks.factory.WorkManagerFactoryBean;
 import org.w3c.dom.DocumentFragment;
 
-import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList;
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
 
 /**
@@ -104,9 +109,9 @@
     protected boolean isWorkManagerCreated;
     protected boolean autoEnlistInTransaction = false;
     protected boolean persistent = false;
-    protected List listeners = new CopyOnWriteArrayList();
     protected boolean embedded = false;
     protected boolean notifyStatistics = false;
+    protected EventListenerList listeners = new EventListenerList();
     
     /**
      * Default Constructor
@@ -691,9 +696,9 @@
      * @param externalEndpoint
      * @throws JBIException
      */
-    public void registerExternalEndpoint(ComponentContextImpl context, ServiceEndpoint externalEndpoint)
+    public void registerExternalEndpoint(ComponentNameSpace cns, ServiceEndpoint externalEndpoint)
             throws JBIException {
-        registry.registerExternalEndpoint(context, externalEndpoint);
+        registry.registerExternalEndpoint(cns, externalEndpoint);
     }
 
     /**
@@ -701,9 +706,9 @@
      * @param externalEndpoint
      * @throws JBIException
      */
-    public void deregisterExternalEndpoint(ComponentContextImpl context, ServiceEndpoint externalEndpoint)
+    public void deregisterExternalEndpoint(ComponentNameSpace cns, ServiceEndpoint externalEndpoint)
             throws JBIException {
-        registry.deregisterExternalEndpoint(context, externalEndpoint);
+        registry.deregisterExternalEndpoint(cns, externalEndpoint);
     }
 
     /**
@@ -731,7 +736,7 @@
      * @return endpoints that match the interface name
      */
     public ServiceEndpoint[] getEndpoints(ComponentContextImpl context, QName interfaceName) {
-        return registry.getEndpoints(interfaceName);
+        return registry.getEndpointsForInterface(interfaceName);
     }
 
     /**
@@ -1114,19 +1119,52 @@
 		this.persistent = persistent;
 	}
     
-    public void addListener(MessageExchangeListener listener) {
-        listeners.add(listener);
+    public void addListener(EventListener listener) {
+        if (listener instanceof ExchangeListener) {
+            listeners.add(ExchangeListener.class, (ExchangeListener) listener);
+        }
+        if (listener instanceof ComponentListener) {
+            listeners.add(ComponentListener.class, (ComponentListener) listener);
+        }
+        if (listener instanceof ServiceAssemblyListener) {
+            listeners.add(ServiceAssemblyListener.class, (ServiceAssemblyListener) listener);
+        }
+        if (listener instanceof ServiceUnitListener) {
+            listeners.add(ServiceUnitListener.class, (ServiceUnitListener) listener);
+        }
+        if (listener instanceof EndpointListener) {
+            listeners.add(EndpointListener.class, (EndpointListener) listener);
+        }
+    }
+    
+    public void removeListener(EventListener listener) {
+        if (listener instanceof ExchangeListener) {
+            listeners.remove(ExchangeListener.class, (ExchangeListener) listener);
+        }
+        if (listener instanceof ComponentListener) {
+            listeners.remove(ComponentListener.class, (ComponentListener) listener);
+        }
+        if (listener instanceof ServiceAssemblyListener) {
+            listeners.remove(ServiceAssemblyListener.class, (ServiceAssemblyListener) listener);
+        }
+        if (listener instanceof ServiceUnitListener) {
+            listeners.remove(ServiceUnitListener.class, (ServiceUnitListener) listener);
+        }
+        if (listener instanceof EndpointListener) {
+            listeners.remove(EndpointListener.class, (EndpointListener) listener);
+        }
     }
     
-    public void removeListener(MessageExchangeListener listener) {
-        listeners.remove(listener);
+    public Object[] getListeners(Class lc) {
+        return listeners.getListeners(lc);
     }
     
     public void callListeners(MessageExchange exchange) {
-        for (Iterator iter = listeners.iterator(); iter.hasNext();) {
-            MessageExchangeListener listener = (MessageExchangeListener) iter.next();
+        ExchangeListener[] l = (ExchangeListener[]) listeners.getListeners(ExchangeListener.class);
+        ExchangeEvent event = new ExchangeEvent(exchange);
+        for (int i = 0; i < l.length; i++) {
             try {
-                listener.onMessageExchange(exchange);
+                l[i].exchangeSent(event);
             } catch (Exception e) {
                 log.warn("Error calling listener: " + e.getMessage(), e);
             }

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SubscriptionSpec.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SubscriptionSpec.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SubscriptionSpec.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/container/SubscriptionSpec.java Mon Mar  6 15:19:33 2006
@@ -132,7 +132,7 @@
                 }
             }
             if (result && interfaceName != null) {
-                ServiceEndpoint[] ses = registry.getEndpoints(interfaceName);
+                ServiceEndpoint[] ses = registry.getEndpointsForInterface(interfaceName);
                 if (ses != null) {
                     result = false;
                     for (int i = 0; i < ses.length; i++) {

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentAdapter.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentAdapter.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentAdapter.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+public abstract class ComponentAdapter implements ComponentListener {
+
+    public void componentInstalled(ComponentEvent event) {
+    }
+
+    public void componentStarted(ComponentEvent event) {
+    }
+
+    public void componentStopped(ComponentEvent event) {
+    }
+
+    public void componentShutDown(ComponentEvent event) {
+    }
+
+    public void componentUninstalled(ComponentEvent event) {
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentEvent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentEvent.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentEvent.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentEvent.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventObject;
+
+import org.apache.servicemix.jbi.framework.LocalComponentConnector;
+
+public class ComponentEvent extends EventObject {
+
+    private static final long serialVersionUID = -4075242868959881673L;
+    
+    public static final int COMPONENT_INSTALLED = 0;
+    public static final int COMPONENT_STARTED = 1;
+    public static final int COMPONENT_STOPPED = 2;
+    public static final int COMPONENT_SHUTDOWN = 3;
+    public static final int COMPONENT_UNINSTALLED = 4;
+    
+    private LocalComponentConnector lcc;
+    private int type;
+    
+    public ComponentEvent(LocalComponentConnector lcc, int type) {
+        super(lcc);
+        this.lcc = lcc;
+        this.type = type;
+    }
+    
+    public LocalComponentConnector getComponent() {
+        return lcc;
+    }
+    
+    public int getEventType() {
+        return type;
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentListener.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentListener.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentListener.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ComponentListener.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventListener;
+
+public interface ComponentListener extends EventListener {
+    
+    public void componentInstalled(ComponentEvent event);
+
+    public void componentStarted(ComponentEvent event);
+
+    public void componentStopped(ComponentEvent event);
+
+    public void componentShutDown(ComponentEvent event);
+    
+    public void componentUninstalled(ComponentEvent event);
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointAdapter.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointAdapter.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointAdapter.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+public class EndpointAdapter implements EndpointListener {
+
+    public void internalEndpointRegistered(EndpointEvent event) {
+    }
+
+    public void internalEndpointUnregistered(EndpointEvent event) {
+    }
+
+    public void externalEndpointRegistered(EndpointEvent event) {
+    }
+
+    public void externalEndpointUnregistered(EndpointEvent event) {
+    }
+
+    public void linkedEndpointRegistered(EndpointEvent event) {
+    }
+
+    public void linkedEndpointUnregistered(EndpointEvent event) {
+    }
+
+    public void remoteEndpointRegistered(EndpointEvent event) {
+    }
+
+    public void remoteEndpointUnregistered(EndpointEvent event) {
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointEvent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointEvent.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointEvent.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointEvent.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventObject;
+
+import javax.jbi.servicedesc.ServiceEndpoint;
+
+public class EndpointEvent extends EventObject {
+
+    private static final long serialVersionUID = -4480619483039133388L;
+    
+    public static final int INTERNAL_ENDPOINT_REGISTERED = 0;
+    public static final int INTERNAL_ENDPOINT_UNREGISTERED = 1;
+    public static final int EXTERNAL_ENDPOINT_REGISTERED = 2;
+    public static final int EXTERNAL_ENDPOINT_UNREGISTERED = 3;
+    public static final int LINKED_ENDPOINT_REGISTERED = 4;
+    public static final int LINKED_ENDPOINT_UNREGISTERED = 5;
+    public static final int REMOTE_ENDPOINT_REGISTERED = 6;
+    public static final int REMOTE_ENDPOINT_UNREGISTERED = 7;
+    
+    private ServiceEndpoint endpoint;
+    private int type;
+    
+    public EndpointEvent(ServiceEndpoint endpoint, int type) {
+        super(endpoint);
+        this.endpoint = endpoint;
+        this.type = type;
+    }
+    
+    public ServiceEndpoint getEndpoint() {
+        return endpoint;
+    }
+
+    public int getEventType() {
+        return type;
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointListener.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointListener.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointListener.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/EndpointListener.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventListener;
+
+public interface EndpointListener extends EventListener {
+
+    public void internalEndpointRegistered(EndpointEvent event);
+    
+    public void internalEndpointUnregistered(EndpointEvent event);
+    
+    public void externalEndpointRegistered(EndpointEvent event);
+    
+    public void externalEndpointUnregistered(EndpointEvent event);
+    
+    public void linkedEndpointRegistered(EndpointEvent event);
+    
+    public void linkedEndpointUnregistered(EndpointEvent event);
+    
+    public void remoteEndpointRegistered(EndpointEvent event);
+    
+    public void remoteEndpointUnregistered(EndpointEvent event);
+    
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeEvent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeEvent.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeEvent.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeEvent.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventObject;
+
+import javax.jbi.messaging.MessageExchange;
+
+public class ExchangeEvent extends EventObject {
+
+    private static final long serialVersionUID = -8349785806912334977L;
+
+    public ExchangeEvent(MessageExchange exchange) {
+        super(exchange);
+    }
+    
+    public MessageExchange getExchange() {
+        return (MessageExchange) getSource();
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeListener.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeListener.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeListener.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ExchangeListener.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventListener;
+
+public interface ExchangeListener extends EventListener {
+
+    public void exchangeSent(ExchangeEvent event);
+    
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyAdapter.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyAdapter.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyAdapter.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+public class ServiceAssemblyAdapter implements ServiceAssemblyListener {
+
+    public void assemblyDeployed(ServiceAssemblyEvent event) {
+    }
+
+    public void assemblyStarted(ServiceAssemblyEvent event) {
+    }
+
+    public void assemblyStopped(ServiceAssemblyEvent event) {
+    }
+
+    public void assemblyShutDown(ServiceAssemblyEvent event) {
+    }
+
+    public void assemblyUndeployed(ServiceAssemblyEvent event) {
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyEvent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyEvent.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyEvent.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyEvent.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventObject;
+
+import org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle;
+
+public class ServiceAssemblyEvent extends EventObject {
+
+    private static final long serialVersionUID = 8441830155548563543L;
+    
+    public static final int ASSEMBLY_DEPLOYED = 0;
+    public static final int ASSEMBLY_STARTED = 1;
+    public static final int ASSEMBLY_STOPPED = 2;
+    public static final int ASSEMBLY_SHUTDOWN = 3;
+    public static final int ASSEMBLY_UNDEPLOYED = 4;
+    
+    private ServiceAssemblyLifeCycle assembly;
+    private int type;
+    
+    public ServiceAssemblyEvent(ServiceAssemblyLifeCycle assembly, int type) {
+        super(assembly);
+        this.assembly = assembly;
+        this.type = type;
+    }
+    
+    public ServiceAssemblyLifeCycle getAssembly() {
+        return assembly;
+    }
+
+    public int getEventType() {
+        return type;
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyListener.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyListener.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyListener.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceAssemblyListener.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventListener;
+
+public interface ServiceAssemblyListener extends EventListener {
+
+    public void assemblyDeployed(ServiceAssemblyEvent event);
+
+    public void assemblyStarted(ServiceAssemblyEvent event);
+
+    public void assemblyStopped(ServiceAssemblyEvent event);
+
+    public void assemblyShutDown(ServiceAssemblyEvent event);
+
+    public void assemblyUndeployed(ServiceAssemblyEvent event);
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitAdapter.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitAdapter.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitAdapter.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+public class ServiceUnitAdapter implements ServiceUnitListener {
+
+    public void unitDeployed(ServiceUnitEvent event) {
+    }
+
+    public void unitStarted(ServiceUnitEvent event) {
+    }
+
+    public void unitStopped(ServiceUnitEvent event) {
+    }
+
+    public void unitShutDown(ServiceUnitEvent event) {
+    }
+
+    public void unitUndeployed(ServiceUnitEvent event) {
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitEvent.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitEvent.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitEvent.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitEvent.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventObject;
+
+import org.apache.servicemix.jbi.framework.ServiceUnitLifeCycle;
+
+public class ServiceUnitEvent extends EventObject {
+
+    private static final long serialVersionUID = 7825652001472392923L;
+    
+    public static final int UNIT_DEPLOYED = 0;
+    public static final int UNIT_STARTED = 1;
+    public static final int UNIT_STOPPED = 2;
+    public static final int UNIT_SHUTDOWN = 3;
+    public static final int UNIT_UNDEPLOYED = 4;
+    
+    private ServiceUnitLifeCycle unit;
+    private int type;
+    
+    public ServiceUnitEvent(ServiceUnitLifeCycle unit, int type) {
+        super(unit);
+        this.unit = unit;
+        this.type = type;
+    }
+    
+    public ServiceUnitLifeCycle getServiceUnit() {
+        return unit;
+    }
+
+    public int getEventType() {
+        return type;
+    }
+
+}

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitListener.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitListener.java?rev=383702&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitListener.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/event/ServiceUnitListener.java Mon Mar  6 15:19:33 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.event;
+
+import java.util.EventListener;
+
+public interface ServiceUnitListener extends EventListener {
+
+    public void unitDeployed(ServiceUnitEvent event);
+
+    public void unitStarted(ServiceUnitEvent event);
+
+    public void unitStopped(ServiceUnitEvent event);
+
+    public void unitShutDown(ServiceUnitEvent event);
+
+    public void unitUndeployed(ServiceUnitEvent event);
+
+}

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentConnector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentConnector.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentConnector.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentConnector.java Mon Mar  6 15:19:33 2006
@@ -15,9 +15,6 @@
  */
 package org.apache.servicemix.jbi.framework;
 
-import javax.jbi.servicedesc.ServiceEndpoint;
-
-import java.util.Set;
 
 /**
  * ComponentConnector is used internally for message routing
@@ -89,61 +86,6 @@
         return packet.getComponentNameSpace();
     }
 
-   
-    /**
-     * Get the Set of activated endpoints
-     * 
-     * @return the activated endpoint Set
-     */
-    public Set getActiveEndpoints() {
-        return packet.getActiveEndpoints();
-    }
-
-    /**
-     * Add an activated endpoint
-     * 
-     * @param endpoint
-     */
-    public void addActiveEndpoint(ServiceEndpoint endpoint) {
-        throw new RuntimeException("Not a LocalComponentConnector");
-    }
-
-    /**
-     * remove an activated endpoint
-     * 
-     * @param endpoint
-     */
-    public void removeActiveEndpoint(ServiceEndpoint endpoint) {
-        throw new RuntimeException("Not a LocalComponentConnector");
-    }
-
-    /**
-     * Add an external activated endpoint
-     * 
-     * @param endpoint
-     */
-    public void addExternalActiveEndpoint(ServiceEndpoint endpoint) {
-        throw new RuntimeException("Not a LocalComponentConnector");
-    }
-
-    /**
-     * remove an external activated endpoint
-     * 
-     * @param endpoint
-     */
-    public void removeExternalActiveEndpoint(ServiceEndpoint endpoint) {
-        throw new RuntimeException("Not a LocalComponentConnector");
-    }
-
-    /**
-     * Get the Set of external activated endpoints
-     * 
-     * @return the activated endpoint Set
-     */
-    public Set getExternalActiveEndpoints() {
-        return packet.getExternalActiveEndpoints();
-    }
-    
     /**
      * @return Returns the binding.
      */

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentContextImpl.java Mon Mar  6 15:19:33 2006
@@ -318,7 +318,7 @@
         if (externalEndpoint == null) {
             throw new IllegalArgumentException("externalEndpoint should be non null");
         }
-        container.registerExternalEndpoint(this, externalEndpoint);
+        container.getRegistry().registerExternalEndpoint(getComponentNameSpace(), externalEndpoint);
     }
 
     /**
@@ -331,7 +331,7 @@
      */
     public void deregisterExternalEndpoint(ServiceEndpoint externalEndpoint) throws JBIException {
         checkActivated();
-        container.deregisterExternalEndpoint(this, externalEndpoint);
+        container.getRegistry().deregisterExternalEndpoint(getComponentNameSpace(), externalEndpoint);
     }
 
     /**
@@ -348,7 +348,7 @@
      */
     public ServiceEndpoint resolveEndpointReference(DocumentFragment epr) {
         checkActivated();
-        return container.resolveEndpointReference(this, epr);
+        return container.getRegistry().resolveEndpointReference(epr);
     }
 
     /**
@@ -360,7 +360,7 @@
      */
     public ServiceEndpoint getEndpoint(QName service, String name) {
         checkActivated();
-        return container.getEndpoint(this, service, name);
+        return container.getRegistry().getEndpoint(service, name);
     }
 
     /**
@@ -388,7 +388,7 @@
      */
     public ServiceEndpoint[] getEndpoints(QName interfaceName) {
         checkActivated();
-        return container.getEndpoints(this, interfaceName);
+        return container.getRegistry().getEndpointsForInterface(interfaceName);
     }
 
     /**
@@ -400,7 +400,7 @@
      */
     public ServiceEndpoint[] getEndpointsForService(QName serviceName) {
         checkActivated();
-        return container.getEndpointsForService(this, serviceName);
+        return container.getRegistry().getEndpointsForService(serviceName);
     }
 
     /**
@@ -413,7 +413,7 @@
      */
     public ServiceEndpoint[] getExternalEndpoints(QName interfaceName) {
         checkActivated();
-        return container.getExternalEndpoints(this, interfaceName);
+        return container.getRegistry().getExternalEndpoints(interfaceName);
     }
 
     /**
@@ -424,7 +424,7 @@
      */
     public ServiceEndpoint[] getExternalEndpointsForService(QName serviceName) {
         checkActivated();
-        return container.getExternalEndpointsForService(this, serviceName);
+        return container.getRegistry().getExternalEndpointsForService(serviceName);
     }
 
     /**

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentMBeanImpl.java Mon Mar  6 15:19:33 2006
@@ -25,6 +25,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.container.JBIContainer;
+import org.apache.servicemix.jbi.event.ComponentEvent;
+import org.apache.servicemix.jbi.event.ComponentListener;
 import org.apache.servicemix.jbi.management.AttributeInfoHelper;
 import org.apache.servicemix.jbi.management.BaseLifeCycle;
 import org.apache.servicemix.jbi.management.OperationInfoHelper;
@@ -182,6 +184,7 @@
             initServiceAssemblies();
             startServiceAssemblies();
         }
+        fireEvent(ComponentEvent.COMPONENT_STARTED);
     }
 
     /**
@@ -196,6 +199,7 @@
 	        connector.getLifeCycle().stop();
 	        super.stop();
         }
+        fireEvent(ComponentEvent.COMPONENT_STOPPED);
     }
 
     /**
@@ -216,6 +220,7 @@
             }
         }
         super.shutDown();
+        fireEvent(ComponentEvent.COMPONENT_SHUTDOWN);
     }
     
     
@@ -362,7 +367,7 @@
             ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(sas[i]);
             if (sa.isStarted()) {
                 try {
-                    sa.stop(false);
+                    sa.stop(false, false);
                     // TODO: add sa to a list of pending sa 
                 } catch (Exception e) {
                     log.error("Error stopping service assembly " + sas[i]);
@@ -387,6 +392,25 @@
                 }
             }
         }
+    }
+    
+    protected void fireEvent(int type) {
+        ComponentEvent event = new ComponentEvent(connector, type);
+        ComponentListener[] listeners = (ComponentListener[]) connector.getContainer().getListeners(ComponentListener.class);
+        for (int i = 0; i < listeners.length; i++) {
+            switch (type) {
+            case ComponentEvent.COMPONENT_STARTED:
+                listeners[i].componentStarted(event);
+                break;
+            case ComponentEvent.COMPONENT_STOPPED:
+                listeners[i].componentStopped(event);
+                break;
+            case ComponentEvent.COMPONENT_SHUTDOWN:
+                listeners[i].componentShutDown(event);
+                break;
+            }
+        }
+        
     }
 
 }

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentPacket.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentPacket.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentPacket.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentPacket.java Mon Mar  6 15:19:33 2006
@@ -15,14 +15,12 @@
  */
 package org.apache.servicemix.jbi.framework;
 
-import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet;
+import java.io.Serializable;
+import java.util.Set;
 
 import org.apache.servicemix.jbi.container.SubscriptionSpec;
 
-import javax.jbi.servicedesc.ServiceEndpoint;
-
-import java.io.Serializable;
-import java.util.Set;
+import edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArraySet;
 
 /**
  * ComponentPacket - potentially passed around clusters
@@ -38,8 +36,6 @@
     
     private ComponentNameSpace componentName;
     private String description = "POJO Component";
-    private Set endpoints = new CopyOnWriteArraySet();
-    private Set externalEndpoints = new CopyOnWriteArraySet();
     private Set subscriptionSpecs = new CopyOnWriteArraySet();
     private boolean binding;
     private boolean service;
@@ -73,60 +69,9 @@
         this.componentName = componentName;
     }
     
-    
-    /**
-     * Add an activated endpoint
-     * @param endpoint
-     */
-    public void addActiveEndpoint(ServiceEndpoint endpoint) {
-        endpoints.add(endpoint);
-    }
-    
-    /**
-     * remove an activated endpoint
-     * @param endpoint
-     */
-    public void removeActiveEndpoint(ServiceEndpoint endpoint) {
-        endpoints.remove(endpoint);
-    }
-    
-    /**
-     * Get the Set of activated endpoints
-     * @return the activated endpoint Set
-     */
-    public Set getActiveEndpoints() {
-        return endpoints;
-    }
-    
-    /**
-     * Add an external activated endpoint
-     * @param endpoint
-     */
-    public void addExternalActiveEndpoint(ServiceEndpoint endpoint) {
-        externalEndpoints.add(endpoint);
-    }
-    
-    /**
-     * remove an external activated endpoint
-     * @param endpoint
-     */
-    public void removeExternalActiveEndpoint(ServiceEndpoint endpoint) {
-        externalEndpoints.remove(endpoint);
-    }
-    
-    /**
-     * Get the Set of external activated endpoints
-     * @return the activated endpoint Set
-     */
-    public Set getExternalActiveEndpoints() {
-        return externalEndpoints;
-    }
-    
-    
     public void addSubscriptionSpec(SubscriptionSpec ss) {
         subscriptionSpecs.add(ss);
     }
-    
     
     public void removeSubscriptionSpec(SubscriptionSpec ss) {
         subscriptionSpecs.remove(ss);

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/ComponentRegistry.java Mon Mar  6 15:19:33 2006
@@ -18,7 +18,6 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.Map;
 import java.util.Set;
 
@@ -39,7 +38,6 @@
     private Map componentByNameMap = new ConcurrentHashMap();
     private Map idMap = new ConcurrentHashMap();
     private Map localIdMap = new ConcurrentHashMap();
-    private Map loadBalancedComponentMap = new ConcurrentHashMap();
     private boolean runningStateInitialized = false;
     private Registry registry;
     
@@ -69,7 +67,6 @@
             localIdMap.put(name, result);
             addComponentConnector(result);
             componentByNameMap.put(name, component);
-            addToLoadBalancedMap(name);
         }
         return result;
     }
@@ -128,7 +125,6 @@
             removeComponentConnector(result.getComponentNameSpace());
             localIdMap.remove(result.getComponentNameSpace());
             componentByNameMap.remove(result.getComponentNameSpace());
-            removeFromLoadBalancedMap(result.getComponentNameSpace());
         }
         return result;
     }
@@ -168,15 +164,6 @@
     }
     
     /**
-     * For distributed containers, get a ComponentConnector by round-robin
-     * @param id
-     * @return the ComponentConnector or null
-     */
-    public ComponentConnector getLoadBalancedComponentConnector(ComponentNameSpace id){
-        return getComponentConnector(getLoadBalancedComponentName(id));
-    }
-    
-    /**
      * Add a ComponentConnector
      * @param connector
      */
@@ -254,38 +241,6 @@
      */
     public void setContainerName(String containerName) {
         this.containerName = containerName;
-    }
-    
-    private synchronized void addToLoadBalancedMap(ComponentNameSpace cns){
-        String key = cns.getName();
-        LinkedList list = (LinkedList)loadBalancedComponentMap.get(key);
-        if (list == null){
-            list = new LinkedList();
-        }
-        list.add(cns);
-        
-    }
-    
-    private synchronized void removeFromLoadBalancedMap(ComponentNameSpace cns){
-        String key = cns.getName();
-        LinkedList list = (LinkedList)loadBalancedComponentMap.get(key);
-        if (list != null){
-            list.remove(cns);
-            if (list.isEmpty()){
-                loadBalancedComponentMap.remove(key);
-            }
-        }
-    }
-    
-    private synchronized ComponentNameSpace getLoadBalancedComponentName(ComponentNameSpace cns){
-        ComponentNameSpace result = null;
-        String key = cns.getName();
-        LinkedList list = (LinkedList)loadBalancedComponentMap.get(key);
-        if (list != null && !list.isEmpty()){
-            result = (ComponentNameSpace) list.removeFirst();
-            list.addLast(result);
-        }
-        return result;
     }
     
     private boolean setInitialRunningStateFromStart() throws JBIException{

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/DeploymentService.java Mon Mar  6 15:19:33 2006
@@ -382,7 +382,7 @@
     public String stop(String serviceAssemblyName) throws Exception {
         try {
             ServiceAssemblyLifeCycle sa = registry.getServiceAssembly(serviceAssemblyName);
-            return sa.stop(true);
+            return sa.stop(true, false);
         } catch (Exception e) {
             log.info("Error in stop", e);
             throw e;
@@ -539,7 +539,8 @@
         else {
             // Register SA
             String[] deployedSUs = (String[]) suKeys.toArray(new String[suKeys.size()]);
-            registry.registerServiceAssembly(sa, deployedSUs);
+            ServiceAssemblyLifeCycle salc = registry.registerServiceAssembly(sa, deployedSUs);
+            salc.writeRunningState();
             // Build result string
             if (nbFailures > 0) {
                 return ManagementSupport.createWarningMessage("deploy", "Failed to deploy some service units", componentResults);

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Endpoint.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Endpoint.java?rev=383702&r1=383701&r2=383702&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Endpoint.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/framework/Endpoint.java Mon Mar  6 15:19:33 2006
@@ -27,16 +27,19 @@
 import org.apache.servicemix.jbi.management.MBeanInfoProvider;
 import org.apache.servicemix.jbi.management.OperationInfoHelper;
 import org.apache.servicemix.jbi.servicedesc.AbstractServiceEndpoint;
+import org.apache.servicemix.jbi.servicedesc.ExternalEndpoint;
+import org.apache.servicemix.jbi.servicedesc.InternalEndpoint;
+import org.apache.servicemix.jbi.servicedesc.LinkedEndpoint;
 import org.apache.servicemix.jbi.util.DOMUtil;
 
 public class Endpoint implements EndpointMBean, MBeanInfoProvider {
 
     private AbstractServiceEndpoint endpoint;
-    private EndpointRegistry endpointRegistry;
+    private Registry registry;
     
-    public Endpoint(AbstractServiceEndpoint endpoint, EndpointRegistry endpointRegistry) {
+    public Endpoint(AbstractServiceEndpoint endpoint, Registry registry) {
         this.endpoint = endpoint;
-        this.endpointRegistry = endpointRegistry;
+        this.registry = registry;
     }
 
     public String getEndpointName() {
@@ -61,14 +64,18 @@
     
     public String getWSDL() {
         try {
-            return DOMUtil.asXML(endpointRegistry.getEndpointDescriptor(endpoint));
+            return DOMUtil.asXML(registry.getEndpointDescriptor(endpoint));
         } catch (Exception e) {
             return null;
         }
     }
 
     public String getComponentName() {
-        return endpoint.getComponentNameSpace().getName();
+        if (endpoint.getComponentNameSpace() != null) {
+            return endpoint.getComponentNameSpace().getName();
+        } else {
+            return null;
+        }
     }
 
     public MBeanAttributeInfo[] getAttributeInfos() throws JMException {
@@ -92,7 +99,7 @@
     }
 
     public String getName() {
-        return endpoint.getServiceName().toString() + endpoint.getEndpointName();
+        return endpoint.getServiceName() + endpoint.getEndpointName();
     }
 
     public String getType() {
@@ -100,7 +107,13 @@
     }
 
     public String getSubType() {
-        // TODO: return internal, external, linked ?
+        if (endpoint instanceof InternalEndpoint) {
+            return "Internal";
+        } else if (endpoint instanceof LinkedEndpoint) {
+            return "Linked";
+        } else if (endpoint instanceof ExternalEndpoint) {
+            return "External";
+        }
         return null;
     }
 
@@ -109,6 +122,10 @@
     }
 
     public void setPropertyChangeListener(PropertyChangeListener l) {
+    }
+
+    protected AbstractServiceEndpoint getEndpoint() {
+        return endpoint;
     }
 
 }



Mime
View raw message