You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/01/23 10:17:42 UTC

svn commit: r614463 - in /servicemix/smx4/nmr/trunk: ./ jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/ jbi/itests/src/test/java/org/apache/servicemix/jbi/ jbi/osgi/src/main/resources/META-INF/spring/ jbi/runtime/src/main/java/or...

Author: gnodet
Date: Wed Jan 23 01:17:35 2008
New Revision: 614463

URL: http://svn.apache.org/viewvc?rev=614463&view=rev
Log:
SMX4NMR-15: Support for MBeans/JMX

Added:
    servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ManagementContext.java
Modified:
    servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java
    servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java
    servicemix/smx4/nmr/trunk/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml
    servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java
    servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java
    servicemix/smx4/nmr/trunk/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java
    servicemix/smx4/nmr/trunk/pom.xml

Modified: servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java?rev=614463&r1=614462&r2=614463&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/handler/Transformer.java Wed Jan 23 01:17:35 2008
@@ -54,8 +54,8 @@
         	name = desc.getServiceAssembly().getIdentification().getName();
         }
 
-        m.getMainAttributes().put(new Attributes.Name("Bundle-SymbolicName"), name);
-        m.getMainAttributes().put(new Attributes.Name("Bundle-Version"), version);
+        m.getMainAttributes().putValue("Bundle-SymbolicName", name);
+        m.getMainAttributes().putValue("Bundle-Version", version);
 
 		JarInputStream jis = new JarInputStream(new FileInputStream(jbiArtifact));
 		JarOutputStream jos = new JarOutputStream(new FileOutputStream(jbiBundle), m);

Modified: servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java?rev=614463&r1=614462&r2=614463&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/itests/src/test/java/org/apache/servicemix/jbi/IntegrationTest.java Wed Jan 23 01:17:35 2008
@@ -34,6 +34,8 @@
         System.setProperty("org.apache.servicemix.filemonitor.configDir", new File(f, "etc").getAbsolutePath());
         System.setProperty("org.apache.servicemix.filemonitor.monitorDir", new File(f, "deploy").getAbsolutePath());
         System.setProperty("org.apache.servicemix.filemonitor.generatedJarDir", new File(f, "data/generate-bundles").getAbsolutePath());
+        System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl");
+        System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
     }
 
     private Properties dependencies;

Modified: servicemix/smx4/nmr/trunk/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml?rev=614463&r1=614462&r2=614463&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml (original)
+++ servicemix/smx4/nmr/trunk/jbi/osgi/src/main/resources/META-INF/spring/servicemix-jbi.xml Wed Jan 23 01:17:35 2008
@@ -33,12 +33,20 @@
     <bean id="componentRegistry" class="org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl">
         <property name="nmr" ref="nmr" />
         <property name="documentRepository" ref="documentRepository" />
+        <property name="transactionManager" ref="transactionManager" />
+        <property name="managementContext" ref="managementContext" />
     </bean>
 
     <!-- URL handler for in memory documents -->
     <bean id="documentRepository" class="org.apache.servicemix.jbi.runtime.impl.DocumentRepositoryImpl">
     </bean>
 
+    <!-- Management context -->
+    <bean id="managementContext" class="org.apache.servicemix.jbi.runtime.impl.ManagementContext">
+        <property name="jmxDomainName" value="org.apache.servicemix" />
+        <property name="mbeanServers" ref="mbeanServers" />
+    </bean>
+
     <!-- Service tracker for JBI components -->
     <osgi:list id="components"
                interface="javax.jbi.component.Component"
@@ -49,6 +57,16 @@
     <!-- Reference to the ServiceMix NMR -->
     <osgi:reference id="nmr"
                     interface="org.apache.servicemix.nmr.api.NMR" />
+
+    <!-- Reference to the Transaction Manager -->
+    <osgi:list id="transactionManager"
+               interface="javax.transaction.TransactionManager"
+               cardinality="0..N" />
+
+    <!-- Reference to the JMX server -->
+    <osgi:list id="mbeanServers"
+               interface="javax.management.MBeanServer"
+               cardinality="0..N" />
 
     <!-- Expose the JBI components registry in OSGi -->
     <osgi:service ref="componentRegistry">

Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java?rev=614463&r1=614462&r2=614463&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java Wed Jan 23 01:17:35 2008
@@ -36,6 +36,7 @@
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.management.MBeanServer;
+import javax.management.ObjectName;
 import javax.naming.InitialContext;
 import javax.xml.namespace.QName;
 import javax.xml.transform.TransformerException;
@@ -60,14 +61,20 @@
 /**
  * The ComponentContext implementation
  */
-public class ComponentContextImpl implements ComponentContext {
+public class ComponentContextImpl implements ComponentContext, MBeanNames {
 
-    public int DEFAULT_QUEUE_CAPACITY = 100;
+    public static final String JBI_NAMESPACE = "http://java.sun.com/jbi/end-point-reference";
+    public static final String JBI_PREFIX = "jbi:";
+    public static final String JBI_ENDPOINT_REFERENCE = "end-point-reference";
+    public static final String JBI_SERVICE_NAME = "service-name";
+    public static final String JBI_ENDPOINT_NAME = "end-point-name";
+    public static final String XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
+    public static final int DEFAULT_QUEUE_CAPACITY = 100;
 
     private static final Log LOG = LogFactory.getLog(ComponentContextImpl.class);
 
     private NMR nmr;
-    private ComponentRegistry componentRegistry;
+    private ComponentRegistryImpl componentRegistry;
     private DocumentRepository documentRepository;
     private Component component;
     private Map<String,?> properties;
@@ -77,10 +84,10 @@
     private EndpointImpl componentEndpoint;
     private String name;
 
-    public ComponentContextImpl(NMR nmr, ComponentRegistry componentRegistry, DocumentRepository documentRepository, Component component, Map<String,?> properties) {
-        this.nmr = nmr;
+    public ComponentContextImpl(ComponentRegistryImpl componentRegistry, Component component, Map<String,?> properties) {
         this.componentRegistry = componentRegistry;
-        this.documentRepository = documentRepository;
+        this.nmr = componentRegistry.getNmr();
+        this.documentRepository = componentRegistry.getDocumentRepository();
         this.component = component;
         this.properties = properties;
         this.endpoints = new ArrayList<EndpointImpl>();
@@ -217,39 +224,61 @@
     }
 
     public ServiceEndpoint[] getExternalEndpoints(QName interfaceName) {
-        return new ServiceEndpoint[0];  //To change body of implemented methods use File | Settings | File Templates.
+        return new ServiceEndpoint[0];  // TODO
     }
 
     public ServiceEndpoint[] getExternalEndpointsForService(QName serviceName) {
-        return new ServiceEndpoint[0];  //To change body of implemented methods use File | Settings | File Templates.
+        return new ServiceEndpoint[0];  // TODO
     }
 
     public String getInstallRoot() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;  // TODO
     }
 
     public Logger getLogger(String suffix, String resourceBundleName) throws MissingResourceException, JBIException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        try {
+            String name = suffix != null ? this.name + suffix : this.name;
+            return Logger.getLogger(name, resourceBundleName);
+        } catch (IllegalArgumentException e) {
+            throw new JBIException("A logger can not be created using resource bundle " + resourceBundleName);
+        }
     }
 
     public MBeanNames getMBeanNames() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return this;
     }
 
     public MBeanServer getMBeanServer() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        if (this.componentRegistry.getManagementContext() != null) {
+            return this.componentRegistry.getManagementContext().getMbeanServer();
+        }
+        return null;
     }
 
     public InitialContext getNamingContext() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return this.componentRegistry.getNamingContext();
     }
 
     public Object getTransactionManager() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return this.componentRegistry.getTransactionManager();
     }
 
     public String getWorkspaceRoot() {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;  // TODO
+    }
+
+    public ObjectName createCustomComponentMBeanName(String customName) {
+        if (this.componentRegistry.getManagementContext() != null) {
+            return componentRegistry.getManagementContext().createCustomComponentMBeanName(customName, this.name);
+        }
+        return null;
+    }
+
+    public String getJmxDomainName() {
+        if (this.componentRegistry.getManagementContext() != null) {
+            return componentRegistry.getManagementContext().getJmxDomainName();
+        }
+        return null;
     }
 
     /**
@@ -283,18 +312,18 @@
             }
             Element el = (Element) n;
             // Namespace should be "http://java.sun.com/jbi/end-point-reference"
-            if (el.getNamespaceURI() == null || !el.getNamespaceURI().equals("http://java.sun.com/jbi/end-point-reference")) {
+            if (el.getNamespaceURI() == null || !el.getNamespaceURI().equals(JBI_NAMESPACE)) {
                 continue;
             }
-            if (el.getLocalName() == null || !el.getLocalName().equals("end-point-reference")) {
+            if (el.getLocalName() == null || !el.getLocalName().equals(JBI_ENDPOINT_REFERENCE)) {
                 continue;
             }
-            String serviceName = el.getAttributeNS(el.getNamespaceURI(), "service-name");
+            String serviceName = el.getAttributeNS(el.getNamespaceURI(), JBI_SERVICE_NAME);
             // Now the DOM pain-in-the-you-know-what: we need to come up with QName for this;
             // fortunately, there is only one place where the xmlns:xxx attribute could be, on
             // the end-point-reference element!
             QName serviceQName = DOMUtil.createQName(el, serviceName);
-            String endpointName = el.getAttributeNS(el.getNamespaceURI(), "end-point-name");
+            String endpointName = el.getAttributeNS(el.getNamespaceURI(), JBI_ENDPOINT_NAME);
             return getEndpoint(serviceQName, endpointName);
         }
         return null;
@@ -405,7 +434,19 @@
         }
 
         public DocumentFragment getAsReference(QName operationName) {
-            return null;  //To change body of implemented methods use File | Settings | File Templates.
+            try {
+                Document doc = DOMUtil.newDocument();
+                DocumentFragment fragment = doc.createDocumentFragment();
+                Element epr = doc.createElementNS(JBI_NAMESPACE, JBI_PREFIX + JBI_ENDPOINT_REFERENCE);
+                epr.setAttributeNS(XMLNS_NAMESPACE, "xmlns:sns", endpoint.getServiceName().getNamespaceURI());
+                epr.setAttributeNS(JBI_NAMESPACE, JBI_PREFIX + JBI_SERVICE_NAME, "sns:" + endpoint.getServiceName().getLocalPart());
+                epr.setAttributeNS(JBI_NAMESPACE, JBI_PREFIX + JBI_ENDPOINT_NAME, endpoint.getEndpointName());
+                fragment.appendChild(epr);
+                return fragment;
+            } catch (Exception e) {
+                LOG.warn("Unable to create reference for ServiceEndpoint " + endpoint, e);
+                return null;
+            }
         }
 
         public String getEndpointName() {
@@ -413,7 +454,8 @@
         }
 
         public QName[] getInterfaces() {
-            return new QName[0];  //To change body of implemented methods use File | Settings | File Templates.
+            QName itf = (QName) properties.get(Endpoint.INTERFACE_NAME);
+            return itf != null ? new QName[] { itf } : new QName[0];
         }
 
         public QName getServiceName() {

Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java?rev=614463&r1=614462&r2=614463&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java Wed Jan 23 01:17:35 2008
@@ -17,13 +17,17 @@
 package org.apache.servicemix.jbi.runtime.impl;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import javax.jbi.JBIException;
 import javax.jbi.component.Component;
 import javax.jbi.component.ComponentContext;
+import javax.naming.InitialContext;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.runtime.ComponentRegistry;
 import org.apache.servicemix.jbi.runtime.DocumentRepository;
 import org.apache.servicemix.nmr.api.NMR;
@@ -35,9 +39,15 @@
  */
 public class ComponentRegistryImpl extends ServiceRegistryImpl<Component>  implements ComponentRegistry {
 
+    private static final Log LOGGER = LogFactory.getLog(ComponentRegistryImpl.class);
+
     private NMR nmr;
     private DocumentRepository documentRepository;
     private Map<String, Component> components;
+    private Object transactionManager;
+    private List transactionManagers;
+    private InitialContext namingContext;
+    private ManagementContext managementContext;
 
     public ComponentRegistryImpl() {
         components = new ConcurrentHashMap<String, Component>();
@@ -59,6 +69,44 @@
         this.documentRepository = documentRepository;
     }
 
+    public ManagementContext getManagementContext() {
+        return managementContext;
+    }
+
+    public void setManagementContext(ManagementContext managementContext) {
+        this.managementContext = managementContext;
+    }
+
+    public Object getTransactionManager() {
+        if (transactionManager != null) {
+            return transactionManager;
+        }
+        if (transactionManagers != null && !transactionManagers.isEmpty()) {
+            return transactionManagers.get(0);
+        }
+        return null;
+    }
+
+    public void setTransactionManager(Object transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
+    public List getTransactionManagers() {
+        return transactionManagers;
+    }
+
+    public void setTransactionManagers(List transactionManagers) {
+        this.transactionManagers = transactionManagers;
+    }
+
+    public InitialContext getNamingContext() {
+        return namingContext;
+    }
+
+    public void setNamingContext(InitialContext namingContext) {
+        this.namingContext = namingContext;
+    }
+
     /**
      * Register a service with the given metadata.
      *
@@ -77,12 +125,12 @@
                 properties = new HashMap<String, Object>();
             }
             String name = (String) properties.get(NAME);
-            ComponentContext context = new ComponentContextImpl(nmr, this, documentRepository, component, properties);
+            ComponentContext context = new ComponentContextImpl(this, component, properties);
             component.getLifeCycle().init(context);
             if (name != null) {
                 components.put(name, component);
             } else {
-                // TODO: log a warning
+                LOGGER.warn("Component has no name!");
             }
         } catch (JBIException e) {
             throw new ServiceMixException(e);
@@ -106,4 +154,5 @@
     public Component getComponent(String name) {
         return components.get(name);
     }
+
 }

Added: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ManagementContext.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ManagementContext.java?rev=614463&view=auto
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ManagementContext.java (added)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ManagementContext.java Wed Jan 23 01:17:35 2008
@@ -0,0 +1,127 @@
+package org.apache.servicemix.jbi.runtime.impl;
+
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: gnodet
+ * Date: Jan 22, 2008
+ * Time: 10:15:56 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class ManagementContext {
+
+    private static final Log LOGGER = LogFactory.getLog(ComponentRegistryImpl.class);
+    
+    private String jmxDomainName;
+    private MBeanServer mbeanServer;
+    private List<MBeanServer> mbeanServers;
+
+    public MBeanServer getMbeanServer() {
+        if (mbeanServer != null) {
+            return mbeanServer;
+        }
+        if (mbeanServers != null && !mbeanServers.isEmpty()) {
+            return mbeanServers.get(0);
+        }
+        return null;
+    }
+
+    public void setMbeanServer(MBeanServer mbeanServer) {
+        this.mbeanServer = mbeanServer;
+    }
+
+    public List<MBeanServer> getMbeanServers() {
+        return mbeanServers;
+    }
+
+    public void setMbeanServers(List<MBeanServer> mbeanServers) {
+        this.mbeanServers = mbeanServers;
+    }
+
+    public String getJmxDomainName() {
+        return jmxDomainName;
+    }
+
+    public void setJmxDomainName(String jmxDomainName) {
+        this.jmxDomainName = jmxDomainName;
+    }
+
+    public ObjectName createCustomComponentMBeanName(String type, String name) {
+        Map<String, String> result = new LinkedHashMap<String, String>();
+        result.put("Type", "Component");
+        result.put("Name", sanitizeString(name));
+        result.put("SubType", sanitizeString(type));
+        return createObjectName(result);
+    }
+
+    /**
+     * Create an ObjectName
+     *
+     * @param props
+     * @return the ObjectName
+     */
+    public ObjectName createObjectName(Map<String, String> props) {
+        return createObjectName(getJmxDomainName(), props);
+    }
+
+    /**
+     * The ':' and '/' characters are reserved in ObjectNames
+     *
+     * @param in
+     * @return sanitized String
+     */
+    public static String sanitizeString(String in) {
+        String result = null;
+        if (in != null) {
+            result = in.replace(':', '_');
+            result = result.replace('/', '_');
+            result = result.replace('\\', '_');
+            result = result.replace('?', '_');
+            result = result.replace('=', '_');
+            result = result.replace(',', '_');
+        }
+        return result;
+    }
+
+    /**
+     * Create an ObjectName
+     *
+     * @param domain
+     *
+     * @return the ObjectName
+     */
+    public static ObjectName createObjectName(String domain, Map<String, String> props) {
+        StringBuffer sb = new StringBuffer();
+        sb.append(domain).append(':');
+        int i = 0;
+        for (Iterator it = props.entrySet().iterator(); it.hasNext();) {
+            Map.Entry entry = (Map.Entry) it.next();
+            if (i++ > 0) {
+                sb.append(",");
+            }
+            sb.append(entry.getKey()).append("=").append(entry.getValue());
+        }
+        ObjectName result = null;
+        try {
+            result = new ObjectName(sb.toString());
+        } catch (MalformedObjectNameException e) {
+            // shouldn't happen
+            String error = "Could not create ObjectName for " + props;
+            LOGGER.error(error, e);
+            throw new RuntimeException(error);
+        }
+        return result;
+    }
+
+}

Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java?rev=614463&r1=614462&r2=614463&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/test/java/org/apache/servicemix/jbi/runtime/IntegrationTest.java Wed Jan 23 01:17:35 2008
@@ -18,9 +18,16 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Properties;
 
 import javax.xml.namespace.QName;
 
+import org.apache.servicemix.eip.EIPComponent;
+import org.apache.servicemix.eip.EIPEndpoint;
+import org.apache.servicemix.eip.patterns.WireTap;
+import org.apache.servicemix.eip.support.ExchangeTarget;
+import org.apache.servicemix.jbi.runtime.impl.ComponentContextImpl;
+import org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl;
 import org.apache.servicemix.nmr.api.Channel;
 import org.apache.servicemix.nmr.api.Endpoint;
 import org.apache.servicemix.nmr.api.Exchange;
@@ -28,11 +35,6 @@
 import org.apache.servicemix.nmr.api.Status;
 import org.apache.servicemix.nmr.api.service.ServiceHelper;
 import org.apache.servicemix.nmr.core.ServiceMix;
-import org.apache.servicemix.eip.EIPComponent;
-import org.apache.servicemix.eip.EIPEndpoint;
-import org.apache.servicemix.eip.patterns.WireTap;
-import org.apache.servicemix.eip.support.ExchangeTarget;
-import org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl;
 import org.junit.Test;
 
 /**
@@ -75,7 +77,7 @@
         ep.setTarget(new ExchangeTarget());
         ep.getTarget().setService(new QName("target"));
         eip.setEndpoints(new EIPEndpoint[] { ep });
-        reg.register(eip, null);
+        eip.init(new ComponentContextImpl(reg, eip, new HashMap()));
         eip.getLifeCycle().start();
 
         Channel channel = smx.createChannel();

Modified: servicemix/smx4/nmr/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/pom.xml?rev=614463&r1=614462&r2=614463&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/pom.xml Wed Jan 23 01:17:35 2008
@@ -65,7 +65,7 @@
       <commons.logging.version>1.1</commons.logging.version>
       <felix.configadmin.version>0.9.0-r605854</felix.configadmin.version>
       <felix.main.version>1.1.0-r605854</felix.main.version>
-      <felix.plugin.version>1.1.0-r605854</felix.plugin.version>
+      <felix.plugin.version>1.2.0</felix.plugin.version>
       <felix.framework.version>1.1.0-r605854-patched</felix.framework.version>
       <felix.osgi.version>1.0.0</felix.osgi.version>
       <felix.compendium.version>0.9.0-r605854</felix.compendium.version>