You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2010/12/22 17:54:23 UTC

svn commit: r1051980 - in /camel/trunk/components: ./ camel-eventadmin/ camel-eventadmin/src/ camel-eventadmin/src/main/ camel-eventadmin/src/main/java/ camel-eventadmin/src/main/java/org/ camel-eventadmin/src/main/java/org/apache/ camel-eventadmin/src...

Author: gnodet
Date: Wed Dec 22 16:54:22 2010
New Revision: 1051980

URL: http://svn.apache.org/viewvc?rev=1051980&view=rev
Log:
Add an event-admin camel component

Added:
    camel/trunk/components/camel-eventadmin/
    camel/trunk/components/camel-eventadmin/pom.xml
    camel/trunk/components/camel-eventadmin/src/
    camel/trunk/components/camel-eventadmin/src/main/
    camel/trunk/components/camel-eventadmin/src/main/java/
    camel/trunk/components/camel-eventadmin/src/main/java/org/
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/Activator.java
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponentResolver.java
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java
    camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminServiceFactory.java
Modified:
    camel/trunk/components/pom.xml

Added: camel/trunk/components/camel-eventadmin/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/pom.xml?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/pom.xml (added)
+++ camel/trunk/components/camel-eventadmin/pom.xml Wed Dec 22 16:54:22 2010
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-parent</artifactId>
+        <version>2.5-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-eventadmin</artifactId>
+    <packaging>bundle</packaging>
+    <name>Camel :: Event Admin</name>
+    <description>Camel Event Admin support</description>
+
+    <properties>
+		<camel.osgi.activator>org.apache.camel.component.eventadmin.Activator</camel.osgi.activator>
+        <camel.osgi.private.pkg>org.apache.camel.component.eventadmin</camel.osgi.private.pkg>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/Activator.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/Activator.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/Activator.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/Activator.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+import java.util.Properties;
+
+import org.apache.camel.spi.ComponentResolver;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * The bundle activator registers a ServiceFactory
+ * for creating a ComponentResolver.
+ */
+public class Activator implements BundleActivator {
+
+    private ServiceRegistration registration;
+
+    public void start(BundleContext bundleContext) throws Exception {
+        Properties props = new Properties();
+        props.put("component", EventAdminComponent.NAME);
+        registration = bundleContext.registerService(
+                            ComponentResolver.class.getName(),
+                            new EventAdminServiceFactory(),
+                            props);
+    }
+
+    public void stop(BundleContext bundleContext) throws Exception {
+        registration.unregister();
+    }
+
+}

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponent.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Endpoint;
+import org.apache.camel.impl.DefaultComponent;
+import org.osgi.framework.BundleContext;
+
+/**
+ * EventAdmin component.
+ */
+public class EventAdminComponent extends DefaultComponent {
+
+    public static final String NAME = "eventadmin";
+
+    private final BundleContext bundleContext;
+
+    public EventAdminComponent(CamelContext context, BundleContext bundleContext) {
+        super(context);
+        this.bundleContext = bundleContext;
+    }
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
+        EventAdminEndpoint endpoint = new EventAdminEndpoint(uri, this, remaining);
+        setProperties(endpoint, parameters);
+        return endpoint;
+    }
+
+}

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponentResolver.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponentResolver.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponentResolver.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminComponentResolver.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.spi.ComponentResolver;
+import org.osgi.framework.BundleContext;
+
+/**
+ * EventAdmin component resolver
+ */
+public class EventAdminComponentResolver implements ComponentResolver {
+
+    private final BundleContext bundleContext;
+
+    public EventAdminComponentResolver(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    public Component resolveComponent(String name, CamelContext context) throws Exception {
+        if (EventAdminComponent.NAME.equals(name)) {
+            return new EventAdminComponent(context, bundleContext);
+        }
+        return null;
+    }
+}

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConstants.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+/**
+ * EventAdmin constants
+ */
+public final class EventAdminConstants {
+
+    /**
+     * A header used to explicitely specify the target topic for the Exchange
+     */
+    public static final String EVENTADMIN_TOPIC = "CamelEventAdminTopic";
+
+}

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminConsumer.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+import java.util.Properties;
+import java.util.concurrent.Executor;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultConsumer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventConstants;
+import org.osgi.service.event.EventHandler;
+
+public class EventAdminConsumer extends DefaultConsumer implements EventHandler {
+
+    private static final transient Log LOG = LogFactory.getLog(EventAdminConsumer.class);
+    private final EventAdminEndpoint endpoint;
+    private ServiceRegistration registration;
+    private Executor executor;
+
+    public EventAdminConsumer(EventAdminEndpoint endpoint, Processor processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    public void handleEvent(Event event) {
+        Exchange exchange = endpoint.createExchange();
+        // TODO: populate exchange headers
+        exchange.getIn().setBody(event);
+
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("EventAdmin " + endpoint.getTopic() + " is firing");
+        }
+        try {
+            getProcessor().process(exchange);
+            // log exception if an exception occurred and was not handled
+            if (exchange.getException() != null) {
+                getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
+            }
+        } catch (Exception e) {
+            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        Properties props = new Properties();
+        props.put(EventConstants.EVENT_TOPIC, endpoint.getTopic());
+        registration = endpoint.getComponent().getBundleContext().registerService(EventHandler.class.getName(), this, props);
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        if (registration != null) {
+            registration.unregister();
+        }
+        super.doStop();
+    }
+}

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminEndpoint.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.impl.DefaultEndpoint;
+
+/**
+ * EventAdmin endpoint
+ */
+public class EventAdminEndpoint extends DefaultEndpoint {
+
+    private final String topic;
+    private boolean send;
+
+    public EventAdminEndpoint(String uri, EventAdminComponent component, String topic) {
+        super(uri, component);
+        this.topic = topic;
+    }
+
+    public String getTopic() {
+        return topic;
+    }
+
+    public boolean isSend() {
+        return send;
+    }
+
+    public void setSend(boolean send) {
+        this.send = send;
+    }
+
+    public EventAdminComponent getComponent() {
+        return (EventAdminComponent) super.getComponent();
+    }
+
+    public Producer createProducer() throws Exception {
+        return new EventAdminProducer(this);
+    }
+
+    public Consumer createConsumer(Processor processor) throws Exception {
+        return new EventAdminConsumer(this, processor);
+    }
+
+    public boolean isSingleton() {
+        return true;
+    }
+}

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminProducer.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelExchangeException;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultProducer;
+import org.apache.camel.util.CamelContextHelper;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * EventAdmin producer
+ */
+public class EventAdminProducer extends DefaultProducer {
+
+    private final EventAdminEndpoint endpoint;
+    private ServiceTracker tracker;
+
+    public EventAdminProducer(EventAdminEndpoint endpoint) {
+        super(endpoint);
+        this.endpoint = endpoint;
+        this.tracker = new ServiceTracker(endpoint.getComponent().getBundleContext(), EventAdmin.class.getName(), null);
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        this.tracker.open();
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        this.tracker.close();
+        super.doStop();
+    }
+
+    public void process(Exchange exchange) throws Exception {
+        EventAdmin admin = (EventAdmin) this.tracker.getService();
+        if (admin != null) {
+            Event event = getEvent(exchange);
+            if (endpoint.isSend()) {
+                admin.sendEvent(event);
+            } else {
+                admin.postEvent(event);
+            }
+        } else {
+            throw new CamelExchangeException("EventAdmin service not present", exchange);
+        }
+    }
+
+    protected String getTopic(Exchange exchange) {
+        Message in = exchange.getIn();
+        String topic = in.getHeader(EventAdminConstants.EVENTADMIN_TOPIC, String.class);
+        if (topic != null) {
+            in.removeHeader(EventAdminConstants.EVENTADMIN_TOPIC);
+        }
+        if (topic == null) {
+            topic = endpoint.getTopic();
+        }
+        return topic;
+    }
+
+    protected Event getEvent(Exchange exchange) {
+        Message in = exchange.getIn();
+        CamelContext context = endpoint.getCamelContext();
+        Event event = context.getTypeConverter().convertTo(Event.class, exchange, in.getBody());
+        if (event == null) {
+            String topic = getTopic(exchange);
+            Dictionary props = getProperties(exchange);
+            event = new Event(topic, props);
+        }
+        return event;
+    }
+
+    protected Dictionary getProperties(Exchange exchange) {
+        Message in = exchange.getIn();
+        CamelContext context = endpoint.getCamelContext();
+        Map map = context.getTypeConverter().convertTo(Map.class, exchange, in.getBody());
+        Dictionary dict = new Hashtable();
+        for (Object key : map.keySet()) {
+            String keyString = CamelContextHelper.convertTo(context, String.class, key);
+            if (keyString != null) {
+                Object val = map.get(key);
+                // TODO: convert to acceptable value
+                dict.put(keyString, val);
+            }
+        }
+        return dict;
+    }
+
+}

Added: camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminServiceFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminServiceFactory.java?rev=1051980&view=auto
==============================================================================
--- camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminServiceFactory.java (added)
+++ camel/trunk/components/camel-eventadmin/src/main/java/org/apache/camel/component/eventadmin/EventAdminServiceFactory.java Wed Dec 22 16:54:22 2010
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.component.eventadmin;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * EventAdmin service factory
+ */
+public class EventAdminServiceFactory implements ServiceFactory {
+
+    public Object getService(Bundle bundle, ServiceRegistration serviceRegistration) {
+        return new EventAdminComponentResolver(bundle.getBundleContext());
+    }
+
+    public void ungetService(Bundle bundle, ServiceRegistration serviceRegistration, Object o) {
+    }
+
+}

Modified: camel/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1051980&r1=1051979&r2=1051980&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Wed Dec 22 16:54:22 2010
@@ -48,6 +48,7 @@
     <module>camel-dozer</module>
     <module>camel-eclipse</module>
     <module>camel-ejb</module>
+    <module>camel-eventadmin</module>
     <module>camel-exec</module>
     <module>camel-flatpack</module>
     <module>camel-freemarker</module>