Fix issue Felix-640.
- Allow an instance to send event without interacting directly with the event admin
- Add data-oriented event support. Instances can send and receive data (i.e. custom objects) instead of Event Admin event
- Support asynchronous and synchronous event sending
- Allow event to be "tracable"
- These two handlers are now in the 0.9.0-SNAPSHOT version

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@679039 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/event.admin.handler/LICENSE b/ipojo/event.admin.handler/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/ipojo/event.admin.handler/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/ipojo/event.admin.handler/NOTICE b/ipojo/event.admin.handler/NOTICE
new file mode 100644
index 0000000..6b1c994
--- /dev/null
+++ b/ipojo/event.admin.handler/NOTICE
@@ -0,0 +1,18 @@
+Apache Felix iPOJO Event Admin Handler
+Copyright 2008 The Apache Software Foundation
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+II. Used Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright 2006 The OSGi Alliance.
+Licensed under the Apache License 2.0.
+
+III. License Summary
+- Apache License 2.0
diff --git a/ipojo/event.admin.handler/metadata.xml b/ipojo/event.admin.handler/metadata.xml
new file mode 100644
index 0000000..db43296
--- /dev/null
+++ b/ipojo/event.admin.handler/metadata.xml
@@ -0,0 +1,15 @@
+<ipojo>

+	<handler

+		classname="org.apache.felix.ipojo.handlers.event.subscriber.EventAdminSubscriberHandler"

+		name="subscriber"

+		namespace="org.apache.felix.ipojo.handlers.event.EventAdminHandler">

+		<provides>

+			<property field="m_topics" name="event.topics" value=""/>

+		</provides>

+	</handler>

+	

+	<handler classname="org.apache.felix.ipojo.handlers.event.publisher.EventAdminPublisherHandler"

+		name="publisher"

+		namespace="org.apache.felix.ipojo.handlers.event.EventAdminHandler">

+	</handler>

+</ipojo>
\ No newline at end of file
diff --git a/ipojo/event.admin.handler/pom.xml b/ipojo/event.admin.handler/pom.xml
new file mode 100644
index 0000000..cbd5292
--- /dev/null
+++ b/ipojo/event.admin.handler/pom.xml
@@ -0,0 +1,90 @@
+<!--

+	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>

+	<modelVersion>4.0.0</modelVersion>

+	<packaging>bundle</packaging>

+	<name>Apache Felix iPOJO Event Admin Handler</name>

+	<artifactId>org.apache.felix.ipojo.handler.event</artifactId>

+	<groupId>org.apache.felix</groupId>

+	<version>0.9.0-SNAPSHOT</version>

+	

+	<dependencies>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.apache.felix.ipojo</artifactId>

+			<version>0.9.0-SNAPSHOT</version>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.apache.felix.ipojo.metadata</artifactId>

+			<version>0.9.0-SNAPSHOT</version>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.osgi.core</artifactId>

+			<version>1.0.0</version>

+		</dependency>

+		<dependency>

+			<groupId>org.apache.felix</groupId>

+			<artifactId>org.osgi.compendium</artifactId>

+			<version>1.0.0</version>

+		</dependency>

+	</dependencies>

+	

+	<build>

+		<plugins>

+			<plugin>

+				<groupId>org.apache.felix</groupId>

+				<artifactId>maven-bundle-plugin</artifactId>

+				<version>1.4.0</version>

+				<extensions>true</extensions>

+				<configuration>

+					<instructions>

+						<Export-Package>org.apache.felix.ipojo.handlers.event.*;

+							version="0.9.0"</Export-Package>

+						<Bundle-Name>${pom.name}</Bundle-Name>

+						<Bundle-SymbolicName> ipojo.event.admin.handler

+							</Bundle-SymbolicName>

+						<Bundle-Vendor>The Apache Software

+							Foundation</Bundle-Vendor>

+						<Include-Resource>

+							META-INF/LICENCE=LICENSE,

+							META-INF/NOTICE=NOTICE

+						</Include-Resource>

+					</instructions>

+				</configuration>

+			</plugin>

+			<plugin>

+				<groupId>org.apache.felix</groupId>

+				<artifactId>maven-ipojo-plugin</artifactId>

+				<version>0.9.0-SNAPSHOT</version>

+				<executions>

+					<execution>

+						<goals>

+							<goal>ipojo-bundle</goal>

+						</goals>

+						<configuration>

+							<metadata>metadata.xml</metadata>

+						</configuration>

+					</execution>

+				</executions>

+			</plugin>

+		</plugins>

+	</build>

+</project>

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberHandler.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberHandler.java
deleted file mode 100644
index 5c090c3..0000000
--- a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberHandler.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/* 

- * 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.felix.ipojo.handler.event;

-

-import java.util.ArrayList;

-import java.util.Dictionary;

-import java.util.Enumeration;

-import java.util.List;

-import java.util.Properties;

-

-import org.apache.felix.ipojo.ConfigurationException;

-import org.apache.felix.ipojo.InstanceManager;

-import org.apache.felix.ipojo.PrimitiveHandler;

-import org.apache.felix.ipojo.architecture.ComponentTypeDescription;

-import org.apache.felix.ipojo.architecture.PropertyDescription;

-import org.apache.felix.ipojo.metadata.Element;

-import org.apache.felix.ipojo.parser.MethodMetadata;

-import org.apache.felix.ipojo.parser.ParseUtils;

-import org.apache.felix.ipojo.parser.PojoMetadata;

-import org.apache.felix.ipojo.util.Callback;

-import org.osgi.framework.InvalidSyntaxException;

-import org.osgi.service.event.Event;

-import org.osgi.service.event.EventHandler;

-

-/** 

- * Event Subscriber Handler.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-public class EventAdminSubscriberHandler extends PrimitiveHandler implements EventHandler {

-

-    /**

-     * Handler Namespace. 

-     */

-    public static final String NAMESPACE = "org.apache.felix.ipojo.handler.event.EventAdminSubscriberHandler";

-

-    /**

-     * Instance Manager.

-     */

-    private InstanceManager m_manager;

-

-    /**

-     * List of subscriber.

-     */

-    private List m_subEvent = new ArrayList();

-

-    /**

-     * iPOJO Properties representing all the topics.

-     */

-    private String[] m_topics;

-

-    /**

-     * Initialize the component type.

-     * @param cd : component type description to populate.

-     * @param metadata : component type metadata.

-     * @throws ConfigurationException : metadata are incorrect.

-     * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentDescription, org.apache.felix.ipojo.metadata.Element)

-     */

-    public void initializeComponentFactory(ComponentTypeDescription cd, Element metadata) throws ConfigurationException {

-        // Update the current component description

-        Dictionary dict = new Properties();

-        cd.addProperty(new PropertyDescription("event.topics", Dictionary.class.getName(), dict.toString()));

-

-        // Update the current component description

-        dict = new Properties();

-        cd.addProperty(new PropertyDescription("event.filter", Dictionary.class.getName(), dict.toString()));

-

-    }

-

-    /**

-     * Constructor. 

-     * @param metadata : component type metadata

-     * @param conf : instance configuration

-     * @throws ConfigurationException : one event subscription is not correct

-     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager, org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)

-     */

-    public void configure(Element metadata, Dictionary conf) throws ConfigurationException {

-

-        // Store the component manager

-        m_manager = getInstanceManager();

-        PojoMetadata mm = getFactory().getPojoMetadata();

-

-        // Get Metadata subscribers

-        Element[] subscribers = metadata.getElements("subscriber", NAMESPACE);

-        if (subscribers != null) {

-            // then check publishers are well formed and fill the publishers'

-            // map

-            for (int i = 0; i < subscribers.length; i++) {

-                EventAdminSubscriberMetadata eventAdminSubscriberMetadata = new EventAdminSubscriberMetadata(m_manager, subscribers[i]);

-

-                if (eventAdminSubscriberMetadata.getCallbackStr() != null) {

-                    if (mm.getMethod(eventAdminSubscriberMetadata.getCallbackStr(), new String[] {Event.class.getName()}) != null) {

-                        MethodMetadata methodMetadata = mm.getMethod(eventAdminSubscriberMetadata.getCallbackStr(), new String[] {Event.class.getName()});

-                        Callback cb = new Callback(methodMetadata, m_manager);

-                        eventAdminSubscriberMetadata.setCallback(cb);

-                    } else {

-                        warn(" EVENT HANDLER SUBSCRIBERS : malformed subscriber : the method " + eventAdminSubscriberMetadata.getCallbackStr() + "(Event myEvent) is not present in the component");

-                        throw new ConfigurationException("EVENT HANDLER SUBSCRIBERS : malformed subscriber : the method " + eventAdminSubscriberMetadata.getCallbackStr() + "(Event myEvent) is not present in the component");

-                    }

-                    m_subEvent.add(eventAdminSubscriberMetadata);

-                } else {

-                    warn(" EVENT HANDLER SUBSCRIBERS : malformed subscriber !");

-                    throw new ConfigurationException("EVENT HANDLER SUBSCRIBERS : malformed subscriber !");

-                }

-            }

-        } else {

-            error(" EVENT HANDLER SUBSCRIBERS : no Suscribers detected !");

-            throw new ConfigurationException(" EVENT HANDLER SUBSCRIBERS : no Suscribers detected !");

-        }

-

-        // if well formed publishers or subscribers found

-        if (!m_subEvent.isEmpty()) {

-            // register the handler

-            info(" EVENT HANDLER SUBSCRIBERS has been configured !");

-        } else {

-            return;

-        }

-

-        // Check if the configuration has a event.topics property and update the

-        // topic if needed

-        if (conf.get("event.topics") != null) {

-            // Map <callbackName, topics>

-            Dictionary d = (Dictionary) conf.get("event.topics");

-            Enumeration e = d.keys();

-            while (e.hasMoreElements()) {

-                String myName = (String) e.nextElement(); // name

-                for (int i = 0; i < m_subEvent.size(); i++) {

-                    EventAdminSubscriberMetadata met = (EventAdminSubscriberMetadata) (m_subEvent.get(i));

-                    if (met.getName().equals(myName)) {

-                        met.setTopics((String) d.get(myName));

-                        break;

-                    }

-                }

-            }

-        }

-        // Check if the configuration has a event.filter property and update the

-        // filter if needed

-        if (conf.get("event.filter") != null) {

-            // Map <callbackName, topics>

-            Dictionary d = (Dictionary) conf.get("event.filter");

-            Enumeration e = d.keys();

-            while (e.hasMoreElements()) {

-                String myName = (String) e.nextElement(); // name

-                for (int i = 0; i < m_subEvent.size(); i++) {

-                    EventAdminSubscriberMetadata met = (EventAdminSubscriberMetadata) (m_subEvent.get(i));

-                    if (met.getName().equals(myName)) {

-                        try {

-                            met.setFilter((String) d.get(myName));

-                        } catch (InvalidSyntaxException e1) {

-                            e1.printStackTrace();

-                        }

-                        break;

-                    }

-                }

-            }

-        }

-    }

-

-    /** 

-     * Handler start method.

-     * Expose the EventHandler service. 

-     * @see org.apache.felix.ipojo.Handler#start()

-     */

-    public void start() {

-        if (!m_subEvent.isEmpty()) {

-            // build the topic to listen

-            // Topics is a merge of all required topics by subscribers

-            String topics = "";

-

-            // for all subscribers

-            for (int i = 0; i < m_subEvent.size(); i++) {

-                EventAdminSubscriberMetadata sub = (EventAdminSubscriberMetadata) m_subEvent.get(i);

-                String stopics = sub.getTopics();

-                // gets its topic

-                if (topics.length() > 0 && stopics.length() > 0) {

-                    topics += ",";

-                }

-                // concat to the main topic

-                topics += stopics;

-            }

-

-            // Put the m_topics properties to the good value

-            m_topics = ParseUtils.split(topics, ",");

-        }

-    }

-

-    /***************************************************************************************************************************************************************************************************

-     * Handler lifecycle management

-     **************************************************************************************************************************************************************************************************/

-

-    /**

-     * Handler state change method.

-     * register or unregister the EventHandler service according to the new state. 

-     * @param state : new state

-     * @see org.apache.felix.ipojo.Handler#stateChanged(int)

-     */

-    public void stateChanged(int state) {

-        if (state == InstanceManager.VALID) {

-            start();

-            return;

-        }

-        if (state == InstanceManager.INVALID) {

-            stop();

-            return;

-        }

-    }

-

-    /***************************************************************************************************************************************************************************************************

-     * OSGi EventHandler management

-     **************************************************************************************************************************************************************************************************/

-

-    /** 

-     * Receive an event.

-     * The event is dispatch to attached subscribers.

-     * @param event : the received event.

-     * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)

-     */

-    public void handleEvent(Event event) {

-        // for each subscribers

-        for (int i = 0; i < m_subEvent.size(); i++) {

-            EventAdminSubscriberMetadata eventSubscriberData = (EventAdminSubscriberMetadata) m_subEvent.get(i);

-            synchronized (this) {

-                // check if the subscribers topic match

-

-                if (eventSubscriberData.matchingTopic(event.getTopic()) && event.matches(eventSubscriberData.getFilter()) && m_manager.getState() == InstanceManager.VALID) {

-                    try {

-                        Callback c = eventSubscriberData.getCallback();

-                        if (c != null) {

-                            c.call(new Object[] { event });

-                        }

-                    } catch (Exception e) {

-                        error("EVENT HANDLER SUBSCRIBERS CALLBACK error : " + eventSubscriberData.getCallbackStr() + " exception :" + e.getMessage());

-                        // stop the component :

-                        m_manager.setState(InstanceManager.INVALID);

-                    }

-                }

-            }

-        }

-    }

-

-    /**

-     * The stop method of a handler.

-     * @see org.apache.felix.ipojo.Handler#stop()

-     */

-    public void stop() {

-    }

-

-}

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberMetadata.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberMetadata.java
deleted file mode 100644
index 826f547..0000000
--- a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventAdminSubscriberMetadata.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/* 

- * 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.felix.ipojo.handler.event;

-

-import org.apache.felix.ipojo.InstanceManager;

-import org.apache.felix.ipojo.metadata.Element;

-import org.apache.felix.ipojo.parser.ParseUtils;

-import org.apache.felix.ipojo.util.Callback;

-import org.apache.felix.ipojo.util.Logger;

-import org.osgi.framework.Filter;

-import org.osgi.framework.InvalidSyntaxException;

-import org.osgi.service.event.Event;

-

-/**

- * Represent an subscriber.

- * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

- */

-class EventAdminSubscriberMetadata {

-

-    /**

-     * Name of the callback method.

-     */

-    private String m_callbackStr;

-

-    /**

-     * Callback method.

-     */

-    private Callback m_callback;

-

-    /**

-     * Listened topics.

-     */

-    private String m_topics;

-

-    /**

-     * String form of the event filter.

-     */

-    private String m_filterStr;

-

-    /**

-     * Event filter.

-     */

-    private Filter m_filter;

-

-    /**

-     * Event object.

-     */

-    private Event m_value;

-

-    /**

-     * The name which acts as an identifier.

-     */

-    private String m_name;

-

-    /**

-     * Ths Instance Manager.

-     */

-    private InstanceManager m_instanceManager;

-

-    /**

-     * Constructor.

-     * @param instanceManager : instance manager.

-     * @param subscriber : subscriber metadata.

-     */

-    public EventAdminSubscriberMetadata(InstanceManager instanceManager, Element subscriber) {

-        this.m_callbackStr = null;

-        this.m_topics = null;

-        this.m_filterStr = "";

-        this.m_filter = null;

-        this.m_value = null;

-        this.m_name = null;

-        this.m_instanceManager = instanceManager;

-        if (checkValidity(subscriber)) {

-            try {

-                if (subscriber.containsAttribute("topics")) {

-                    this.m_topics = subscriber.getAttribute("topics");

-                }

-                this.m_callbackStr = subscriber.getAttribute("callback");

-                if (subscriber.containsAttribute("filter")) {

-                    this.m_filterStr = subscriber.getAttribute("filter");

-                } else {

-                    this.m_filterStr = "(event.topics=*)";

-                }

-                this.m_filter = instanceManager.getContext().createFilter(this.m_filterStr);

-

-                this.m_name = subscriber.getAttribute("name");

-            } catch (InvalidSyntaxException e) {

-                instanceManager.getFactory().getLogger().log(Logger.WARNING, "===> EVENT handler : " + e.getMessage());

-            }

-        }

-

-    }

-

-    /**

-     * Does the topic match with the listenned topics ?

-     * @param topic : topic to test.

-     * @return true if the given topic is a listenned topic.

-     */

-    public boolean matchingTopic(String topic) {

-        return EventUtil.matches(topic, ParseUtils.split(m_topics, ","));

-    }

-

-    /**

-     * Is the subscriber metadata valid ? This method check only the existence of a callback and a name attribute.

-     * @param subscriber : metadata.

-     * @return true if the metadata is valid.

-     */

-    private boolean checkValidity(Element subscriber) {

-        return subscriber.containsAttribute("callback") && subscriber.containsAttribute("name");

-    }

-

-    /**

-     * Get the callback method name.

-     * @return the callback method name.

-     */

-    public String getCallbackStr() {

-        return m_callbackStr;

-    }

-

-    /**

-     * Get the callback object.

-     * @return the callback object.

-     */

-    public Callback getCallback() {

-        return m_callback;

-    }

-

-    /**

-     * Set the callback object.

-     * @param c : callback.

-     */

-    public void setCallback(Callback c) {

-        this.m_callback = c;

-    }

-

-    /**

-     * Get listened topics.

-     * @return the string form of the listened topics.

-     */

-    public String getTopics() {

-        return m_topics;

-    }

-

-    public Event getValue() {

-        return m_value;

-    }

-

-    public void setValue(Event value) {

-        this.m_value = value;

-    }

-

-    public Filter getFilter() {

-        return m_filter;

-    }

-

-    public void setTopics(String top) {

-        m_topics = top;

-    }

-

-    /**

-     * Create and set the filter. The filter is create from the given argument.

-     * @param filter : the String form of the LDAP filter.

-     * @throws InvalidSyntaxException : occurs when the given filter is invalid.

-     */

-    public void setFilter(String filter) throws InvalidSyntaxException {

-        this.m_filterStr = filter;

-        this.m_filter = m_instanceManager.getContext().createFilter(this.m_filterStr);

-    }

-

-    public String getName() {

-        return m_name;

-    }

-

-    public void setName(String name) {

-        this.m_name = name;

-    }

-

-}

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventUtil.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
similarity index 82%
rename from ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventUtil.java
rename to ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
index 698e8fb..85b35f7 100644
--- a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handler/event/EventUtil.java
+++ b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java
@@ -16,23 +16,28 @@
  * specific language governing permissions and limitations

  * under the License.

  */

-package org.apache.felix.ipojo.handler.event;

-

+package org.apache.felix.ipojo.handlers.event;

 

 /**

  * Utility methods.

+ * 

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

 public class EventUtil {

 

     /**

      * Test that the given topic match with the given topic pattern.

-     * @param topic : topic to test.

-     * @param topicPattern : topic pattern

+     * 

+     * @param topic :

+     *            topic to test.

+     * @param topicPattern :

+     *            topic pattern

      * @return true if it matches.

      */

     public static boolean matches(String topic, String topicPattern) {

-        if (topicPattern.equals("*")) { return true; }

+        if (topicPattern.equals("*")) {

+            return true;

+        }

         int star;

         if ((star = topicPattern.indexOf("*")) > 0) {

             return topic.startsWith(topicPattern.substring(0, star - 1));

@@ -43,8 +48,11 @@
 

     /**

      * Test that the given topic match with the given topic patterns.

-     * @param topic : topic to test.

-     * @param topicPatterns : topic patterns

+     * 

+     * @param topic :

+     *            topic to test.

+     * @param topicPatterns :

+     *            topic patterns

      * @return true if it matches.

      */

     public static boolean matches(String topic, String[] topicPatterns) {

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
new file mode 100644
index 0000000..e77924d
--- /dev/null
+++ b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
@@ -0,0 +1,323 @@
+/* 

+ * 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.felix.ipojo.handlers.event.publisher;

+

+import java.util.Dictionary;

+import java.util.Hashtable;

+import java.util.Map;

+import java.util.Properties;

+

+import org.apache.felix.ipojo.ConfigurationException;

+import org.apache.felix.ipojo.InstanceManager;

+import org.apache.felix.ipojo.PrimitiveHandler;

+import org.apache.felix.ipojo.architecture.ComponentTypeDescription;

+import org.apache.felix.ipojo.architecture.PropertyDescription;

+import org.apache.felix.ipojo.metadata.Element;

+import org.apache.felix.ipojo.parser.FieldMetadata;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.InvalidSyntaxException;

+import org.osgi.framework.ServiceEvent;

+import org.osgi.framework.ServiceListener;

+import org.osgi.framework.ServiceReference;

+import org.osgi.service.event.EventAdmin;

+

+/**

+ * Event Publisher Handler.

+ * 

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

+ */

+public class EventAdminPublisherHandler extends PrimitiveHandler implements

+        ServiceListener {

+

+    /**

+     * Handler Namespace.

+     */

+    public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event.EventAdminHandler";

+

+    /**

+     * Names of instance configuration properties.

+     */

+    public static final String TOPICS_PROPERTY = "event.topics";

+

+    /**

+     * Prefix for logged messages.

+     */

+    private static final String LOG_PREFIX = "EVENT ADMIN PUBLISHER HANDLER : ";

+

+    /**

+     * The Instance Manager.

+     */

+    private InstanceManager m_manager;

+

+    /**

+     * The bundle context.

+     */

+    private BundleContext m_context;

+

+    /**

+     * The current Event Admin service reference.

+     */

+    private ServiceReference m_eaReference;

+

+    /**

+     * The current Event Admin service.

+     */

+    private EventAdmin m_ea;

+

+    /**

+     * The publishers accessible by their names.

+     */

+    private Map m_publishersByName = new Hashtable();

+

+    /**

+     * The publishers accessible by their fields.

+     */

+    private Map m_publishersByField = new Hashtable();

+

+    /**

+     * Initialize the component type.

+     * 

+     * @param cd :

+     *            component type description to populate.

+     * @param metadata :

+     *            component type metadata.

+     * @throws ConfigurationException :

+     *             metadata are incorrect.

+     * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentDescription,

+     *      org.apache.felix.ipojo.metadata.Element)

+     */

+    // @Override

+    public void initializeComponentFactory(ComponentTypeDescription cd,

+            Element metadata)

+        throws ConfigurationException {

+

+        // Update the current component description

+        Dictionary dict = new Properties();

+        cd.addProperty(new PropertyDescription(TOPICS_PROPERTY,

+                Dictionary.class.getName(), dict.toString()));

+    }

+

+    /**

+     * Constructor.

+     * 

+     * @param metadata :

+     *            component type metadata

+     * @param conf :

+     *            instance configuration

+     * @throws ConfigurationException :

+     *             one event publication is not correct

+     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager,

+     *      org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)

+     */

+    // @Override

+    public void configure(Element metadata, Dictionary conf)

+        throws ConfigurationException {

+

+        // Store the component manager

+        m_manager = getInstanceManager();

+

+        // Get Metadata publishers

+        Element[] publishers = metadata.getElements("publisher", NAMESPACE);

+

+        if (publishers != null) {

+            // then check publishers are well formed and fill the publishers'

+            // map

+            for (int i = 0; i < publishers.length; i++) {

+

+                try {

+                    // Extract the publisher configuration

+                    EventAdminPublisherMetadata publisherMetadata = new EventAdminPublisherMetadata(

+                            publishers[i], conf);

+                    String name = publisherMetadata.getName();

+                    info(LOG_PREFIX + "configuring publisher " + name);

+

+                    // Create the associated Publisher

+                    Publisher publisher = new PublisherImpl(this,

+                            publisherMetadata.getTopics(), publisherMetadata

+                                    .isSynchronous(), publisherMetadata

+                                    .getDataKey(), m_manager.getInstanceName());

+

+                    // Check field existence and type

+                    String field = publisherMetadata.getField();

+                    FieldMetadata fieldMetadata = getPojoMetadata().getField(

+                            publisherMetadata.getField(),

+                            Publisher.class.getName());

+                    if (fieldMetadata == null) {

+                        throw new ConfigurationException(

+                                "Field not found in the component : "

+                                        + Publisher.class.getName() + " "

+                                        + field);

+                    }

+

+                    // Insert in the publisher tables.

+                    Object old;

+                    if ((old = m_publishersByName.put(name, publisher)) != null) {

+                        m_publishersByName.put(name, old);

+                        throw new ConfigurationException("The publisher "

+                                + name + "already exists");

+                    }

+                    if ((old = m_publishersByField.put(field, publisher)) != null) {

+                        m_publishersByField.put(field, old);

+                        m_publishersByName.remove(name);

+                        throw new ConfigurationException("The field " + field

+                                + " is already associated to a publisher");

+                    }

+

+                    // Register the callback that return the publisher

+                    // reference when the specified field is read by the

+                    // POJO.

+                    m_manager.register(fieldMetadata, this);

+

+                } catch (Exception e) {

+                    // Ignore invalid publishers

+                    warn(LOG_PREFIX

+                            + "Ignoring publisher : Error in configuration", e);

+                }

+            }

+        } else {

+            info(LOG_PREFIX + "no publisher detected !");

+        }

+    }

+

+    /**

+     * Start the handler instance. This method tries to get an initial reference

+     * of the EventAdmin service.

+     */

+    // @Override

+    public void start() {

+        info(LOG_PREFIX + "STARTING");

+

+        // Look for the EventAdmin service at startup

+        m_context = m_manager.getContext();

+        m_eaReference = m_context.getServiceReference(EventAdmin.class

+                .getName());

+        if (m_eaReference != null) {

+            m_ea = (EventAdmin) m_context.getService(m_eaReference);

+            if (m_ea != null) {

+                info(LOG_PREFIX + "EventAdmin service caught");

+            }

+        }

+

+        // Update handler validity

+        setValidity(m_ea != null);

+

+        // Register service listener for EventAdmin services

+        try {

+            m_context.addServiceListener(this, "(OBJECTCLASS="

+                    + EventAdmin.class.getName() + ")");

+        } catch (InvalidSyntaxException e) {

+            error(LOG_PREFIX + "Cannot register ServiceListener", e);

+        }

+        info(LOG_PREFIX + "STARTED");

+    }

+

+    /**

+     * Stop the handler instance. This method release the used EventAdmin

+     * service (if any).

+     */

+    // @Override

+    public void stop() {

+        info(LOG_PREFIX + "STOPPING");

+

+        // Unregister service

+        if (m_ea != null) {

+            m_ea = null;

+            m_context.ungetService(m_eaReference);

+            info(LOG_PREFIX + "EventAdmin service released");

+        }

+

+        info(LOG_PREFIX + "STOPPED");

+    }

+

+    /***************************************************************************

+     * OSGi ServiceListener callback

+     **************************************************************************/

+

+    /**

+     * Service listener callback. This method check the

+     * registration/unregistration of EventAdmin services and update the

+     * valididy of the handler.

+     * 

+     * @param event

+     *            the concerned service reference

+     */

+    // @Override

+    public void serviceChanged(ServiceEvent event) {

+        warn(LOG_PREFIX + "serviceChanged()");

+

+        if (m_eaReference == null && event.getType() == ServiceEvent.REGISTERED) {

+            // An EventAdmin service appeared and was expected

+            m_eaReference = event.getServiceReference();

+            m_ea = (EventAdmin) m_context.getService(m_eaReference);

+            info(LOG_PREFIX + "EventAdmin service caught");

+        } else if (m_eaReference != null

+                && event.getType() == ServiceEvent.UNREGISTERING

+                && m_eaReference == event.getServiceReference()) {

+            // The used EventAdmin service disappeared

+            m_ea = null;

+            m_context.ungetService(m_eaReference);

+            info(LOG_PREFIX + "EventAdmin service released");

+

+            // Find another EventAdmin service if available

+            m_eaReference = m_context.getServiceReference(EventAdmin.class

+                    .getName());

+            if (m_eaReference != null) {

+                m_ea = (EventAdmin) m_context.getService(m_eaReference);

+                info(LOG_PREFIX + "EventAdmin service caught");

+            }

+        }

+

+        // Update handler validity

+        setValidity(m_ea != null);

+    }

+

+    /**

+     * Field interceptor callback. This method is called when the component

+     * attempt to one of its Publisher field.

+     * 

+     * @param pojo

+     *            the accessed field

+     * @param fieldName

+     *            the name of the accessed field

+     * @param value

+     *            the value of the field (useless here)

+     * 

+     * @return the Publisher associated with the accessed field's name

+     */

+    // @Override

+    public Object onGet(Object pojo, String fieldName, Object value) {

+        // Retrieve the publisher associated to the given field name

+        Publisher pub = (Publisher) m_publishersByField.get(fieldName);

+        if (pub == null) {

+            error(LOG_PREFIX + "No publisher associated to the field "

+                    + fieldName);

+        }

+        return pub;

+    }

+

+    /**

+     * This method is called by managed publishers to obtain the current

+     * EventAdmin service.

+     * 

+     * @return the current EventAdmin service or {@code null} if unavailable.

+     */

+    public EventAdmin getEventAdminService() {

+        return m_ea;

+    }

+}

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
new file mode 100644
index 0000000..0408abf
--- /dev/null
+++ b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
@@ -0,0 +1,225 @@
+/* 

+ * 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.felix.ipojo.handlers.event.publisher;

+

+import java.util.Dictionary;

+import java.util.Enumeration;

+

+import org.apache.felix.ipojo.ConfigurationException;

+import org.apache.felix.ipojo.handlers.event.subscriber.EventAdminSubscriberHandler;

+import org.apache.felix.ipojo.metadata.Element;

+import org.apache.felix.ipojo.parser.ParseUtils;

+

+/**

+ * Represent a publisher.

+ * 

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

+ */

+class EventAdminPublisherMetadata {

+

+    // Names of metadata attributes

+

+    /**

+     * The name attribute in the component metadata.

+     */

+    public static final String NAME_ATTRIBUTE = "name";

+

+    /**

+     * The field attribute in the component metadata.

+     */

+    public static final String FIELD_ATTRIBUTE = "field";

+

+    /**

+     * The topics attribute in the component metadata.

+     */

+    public static final String TOPICS_ATTRIBUTE = "topics";

+

+    /**

+     * The synchronous attribute in the component metadata.

+     */

+    public static final String SYNCHRONOUS_ATTRIBUTE = "synchronous";

+

+    /**

+     * The data key attribute in the component metadata.

+     */

+    public static final String DATA_KEY_ATTRIBUTE = "data-key";

+

+    // Default values

+

+    /**

+     * The data key attribute's default value.

+     */

+    public static final String DEFAULT_DATA_KEY_VALUE = "user.data";

+

+    /**

+     * The synchronous attribute's default value.

+     */

+    public static final boolean DEFAULT_SYNCHRONOUS_VALUE = false;

+

+    /**

+     * The name which acts as an identifier.

+     */

+    private final String m_name;

+

+    /**

+     * The name of the field representing the publisher in the component.

+     */

+    private final String m_field;

+

+    /**

+     * Topics to which events are sent.

+     */

+    private final String[] m_topics;

+

+    /**

+     * Events sending mode.

+     */

+    private final boolean m_synchronous;

+

+    /**

+     * The key where user data are stored in the event dictionary.

+     */

+    private final String m_dataKey;

+

+    /**

+     * Construct a publisher from its metadata description.

+     * 

+     * @param publisher :

+     *            publisher metadata description.

+     * @param instanceConf :

+     *            the configuration of the component instance

+     * @throws ConfigurationException

+     *             if the configuration of the component or the instance is

+     *             invalid.

+     */

+    public EventAdminPublisherMetadata(Element publisher,

+            Dictionary instanceConf) throws ConfigurationException {

+

+        /**

+         * Setup required attributes

+         */

+

+        // NAME_ATTRIBUTE

+        if (publisher.containsAttribute(NAME_ATTRIBUTE)) {

+            m_name = publisher.getAttribute(NAME_ATTRIBUTE);

+        } else {

+            throw new ConfigurationException(

+                    "Missing required attribute in component configuration : "

+                            + NAME_ATTRIBUTE);

+        }

+

+        // FIELD_ATTRIBUTE

+        if (publisher.containsAttribute(FIELD_ATTRIBUTE)) {

+            m_field = publisher.getAttribute(FIELD_ATTRIBUTE);

+        } else {

+            throw new ConfigurationException(

+                    "Missing required attribute in component configuration : "

+                            + FIELD_ATTRIBUTE);

+        }

+

+        // TOPICS_ATTRIBUTE

+        String topicsString = null;

+        if (publisher.containsAttribute(TOPICS_ATTRIBUTE)) {

+            topicsString = publisher.getAttribute(TOPICS_ATTRIBUTE);

+        }

+        // Check TOPICS_PROPERTY in the instance configuration

+        Dictionary instanceTopics = (Dictionary) instanceConf

+                .get(EventAdminSubscriberHandler.TOPICS_PROPERTY);

+        if (instanceTopics != null) {

+            Enumeration e = instanceTopics.keys();

+            while (e.hasMoreElements()) {

+                String myName = (String) e.nextElement(); // name

+                if (m_name.equals(myName)) {

+                    topicsString = (String) instanceTopics.get(myName);

+                    break;

+                }

+            }

+        }

+        if (topicsString != null) {

+            m_topics = ParseUtils.split(topicsString, ",");

+        } else {

+            throw new ConfigurationException(

+                    "Missing required attribute in component or instance configuration : "

+                            + TOPICS_ATTRIBUTE);

+        }

+

+        /**

+         * Setup optional attributes

+         */

+        // SYNCHRONOUS_ATTRIBUTE

+        if (publisher.containsAttribute(SYNCHRONOUS_ATTRIBUTE)) {

+            m_synchronous = "true".equalsIgnoreCase(publisher

+                    .getAttribute(SYNCHRONOUS_ATTRIBUTE));

+        } else {

+            m_synchronous = DEFAULT_SYNCHRONOUS_VALUE;

+        }

+

+        // DATA_KEY_ATTRIBUTE

+        if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) {

+            m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE);

+        } else {

+            m_dataKey = DEFAULT_DATA_KEY_VALUE;

+        }

+    }

+

+    /**

+     * Get the name attribute of the publisher.

+     * 

+     * @return the name

+     */

+    public String getName() {

+        return m_name;

+    }

+

+    /**

+     * Get the field attribute of the publisher.

+     * 

+     * @return the field

+     */

+    public String getField() {

+        return m_field;

+    }

+

+    /**

+     * Get the topics attribute of the publisher.

+     * 

+     * @return the topics

+     */

+    public String[] getTopics() {

+        return m_topics;

+    }

+

+    /**

+     * Get the synchronous attribute of the publisher.

+     * 

+     * @return the synchronous

+     */

+    public boolean isSynchronous() {

+        return m_synchronous;

+    }

+

+    /**

+     * Get the dataKey attribute of the publisher.

+     * 

+     * @return the dataKey

+     */

+    public String getDataKey() {

+        return m_dataKey;

+    }

+}

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
new file mode 100644
index 0000000..c9cdfdb
--- /dev/null
+++ b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java
@@ -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.felix.ipojo.handlers.event.publisher;

+

+import java.util.Dictionary;

+

+/**

+ * An Publisher is the interface between the EventAdminPublisherHandler and a

+ * component instance. The POJO can send event through the handler by calling a

+ * {@code send} method.

+ * 

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

+ */

+public interface Publisher {

+

+    /**

+     * Send an event with the specified content.

+     * 

+     * @param content

+     *            the content of the event

+     */

+    void send(Dictionary content);

+

+    /**

+     * Send a data event.

+     * 

+     * @param o

+     *            the data to send

+     */

+    void sendData(Object o);

+}

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
new file mode 100644
index 0000000..265c0a5
--- /dev/null
+++ b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java
@@ -0,0 +1,139 @@
+/* 

+ * 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.felix.ipojo.handlers.event.publisher;

+

+import java.util.Dictionary;

+import java.util.Hashtable;

+

+import org.osgi.service.event.Event;

+

+/**

+ * The PublisherImpl class is the implementation of the Publisher object used by

+ * components to send events.

+ * 

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

+ */

+public class PublisherImpl implements Publisher {

+

+    /**

+     * The key where the component instance name is stored.

+     */

+    public static final String INSTANCE_NAME_PROPERTY = "publisher.instance.name";

+

+    /**

+     * The managing handler.

+     */

+    private EventAdminPublisherHandler m_handler;

+

+    /**

+     * The topics of sent events.

+     */

+    private final String[] m_topics;

+

+    /**

+     * The sending mode of events.

+     */

+    private final boolean m_synchronous;

+

+    /**

+     * The key, in the content of the event, where user data are stored.

+     */

+    private final String m_dataKey;

+

+    /**

+     * The name of the component instance using this publisher.

+     */

+    private final String m_instanceName;

+

+    /**

+     * Construct an Publisher with given parameters.

+     * 

+     * @param handler

+     *            the handler that will manage this publisher

+     * @param topics

+     *            the topics on which events are sent

+     * @param synchronous

+     *            the sending mode of events

+     * @param dataKey

+     *            The key, in the content of the event, where user data are

+     *            stored (may be {@code null})

+     * @param instanceName

+     *            the name of the instance creating this publisher.

+     */

+    public PublisherImpl(EventAdminPublisherHandler handler, String[] topics,

+            boolean synchronous, String dataKey, String instanceName) {

+

+        // Check parameters

+        if (topics.length == 0) {

+            throw new IllegalArgumentException(

+                    "At least one topic must be specified");

+        }

+        // Test validity of each topic

+        for (int i = 0; i < topics.length; i++) {

+            try {

+                new Event(topics[i], null);

+            } catch (IllegalArgumentException e) {

+                throw new IllegalArgumentException("Malformed topic : "

+                        + e.getMessage());

+            }

+        }

+

+        // Initialize the publisher's fields

+        m_handler = handler;

+        m_topics = topics;

+        m_synchronous = synchronous;

+        m_dataKey = dataKey;

+        m_instanceName = instanceName;

+    }

+

+    /**

+     * Send an event with the specified content.

+     * 

+     * @param content

+     *            the content of the event

+     */

+    public void send(Dictionary content) {

+        // Add instance information in the event

+        content.put(INSTANCE_NAME_PROPERTY, m_instanceName);

+        // We sent the event on each topic

+        for (int i = 0; i < m_topics.length; i++) {

+            // Create an event with the given topic and content

+            Event e = new Event(m_topics[i], content);

+            // Send the event, depending on the sending mode

+            if (!m_synchronous) {

+                m_handler.getEventAdminService().postEvent(e); // Asynchronous

+            } else {

+                m_handler.getEventAdminService().sendEvent(e); // Synchronous

+            }

+        }

+    }

+

+    /**

+     * Send a data event.

+     * 

+     * @param object

+     *            the data to send

+     */

+    public void sendData(Object object) {

+        // Construct the content of the event with the given object

+        Dictionary content = new Hashtable();

+        content.put(m_dataKey, object);

+        send(content);

+    }

+}

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
new file mode 100644
index 0000000..d9e6cdc
--- /dev/null
+++ b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
@@ -0,0 +1,343 @@
+/* 

+ * 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.felix.ipojo.handlers.event.subscriber;

+

+import java.util.Collection;

+import java.util.Dictionary;

+import java.util.HashMap;

+import java.util.Hashtable;

+import java.util.Iterator;

+import java.util.Map;

+import java.util.Properties;

+import java.util.Set;

+import java.util.TreeSet;

+

+import org.apache.felix.ipojo.ConfigurationException;

+import org.apache.felix.ipojo.InstanceManager;

+import org.apache.felix.ipojo.PrimitiveHandler;

+import org.apache.felix.ipojo.architecture.ComponentTypeDescription;

+import org.apache.felix.ipojo.architecture.PropertyDescription;

+import org.apache.felix.ipojo.handlers.event.EventUtil;

+import org.apache.felix.ipojo.metadata.Element;

+import org.apache.felix.ipojo.parser.MethodMetadata;

+import org.apache.felix.ipojo.parser.PojoMetadata;

+import org.apache.felix.ipojo.util.Callback;

+import org.osgi.framework.Filter;

+import org.osgi.service.event.Event;

+import org.osgi.service.event.EventHandler;

+

+/**

+ * Event Subscriber Handler.

+ * 

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

+ */

+public class EventAdminSubscriberHandler extends PrimitiveHandler implements

+        EventHandler {

+

+    /**

+     * Handler Namespace.

+     */

+    public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event.EventAdminHandler";

+

+    // Names of instance configuration properties.

+

+    /**

+     * The event's topics instance configuration property.

+     */

+    public static final String TOPICS_PROPERTY = "event.topics";

+

+    /**

+     * The event's filter instance configuration property.

+     */

+    public static final String FILTER_PROPERTY = "event.filter";

+

+    /**

+     * Prefix for logged messages.

+     */

+    private static final String LOG_PREFIX = "EVENT ADMIN SUBSCRIBER HANDLER : ";

+

+    /**

+     * Instance Manager.

+     */

+    private InstanceManager m_manager;

+

+    /**

+     * List of subscriber accessible by name.

+     */

+    private Map m_subscribersByName = new HashMap();

+

+    /**

+     * List of callbacks accessible by subscribers' names.

+     */

+    private Map m_callbacks = new Hashtable();

+

+    /**

+     * iPOJO Properties representing all the topics.

+     */

+    private String[] m_topics;

+

+    /**

+     * Initialize the component type.

+     * 

+     * @param cd :

+     *            component type description to populate.

+     * @param metadata :

+     *            component type metadata.

+     * @throws ConfigurationException :

+     *             metadata are incorrect.

+     * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentDescription,

+     *      org.apache.felix.ipojo.metadata.Element)

+     */

+    // @Override

+    public void initializeComponentFactory(ComponentTypeDescription cd,

+            Element metadata)

+        throws ConfigurationException {

+

+        // Update the current component description

+        Dictionary dict = new Properties();

+        cd.addProperty(new PropertyDescription(TOPICS_PROPERTY,

+                Dictionary.class.getName(), dict.toString()));

+        dict = new Properties();

+        cd.addProperty(new PropertyDescription(FILTER_PROPERTY,

+                Dictionary.class.getName(), dict.toString()));

+    }

+

+    /**

+     * Constructor.

+     * 

+     * @param metadata :

+     *            component type metadata

+     * @param conf :

+     *            instance configuration

+     * @throws ConfigurationException :

+     *             one event subscription is not correct

+     * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager,

+     *      org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)

+     */

+    // @Override

+    public void configure(Element metadata, Dictionary conf)

+        throws ConfigurationException {

+

+        // Store the component manager

+        m_manager = getInstanceManager();

+

+        // Get Metadata subscribers

+        Element[] subscribers = metadata.getElements("subscriber", NAMESPACE);

+

+        if (subscribers != null) {

+

+            // then check subscribers are well formed and fill the subscriber'

+            // map

+            for (int i = 0; i < subscribers.length; i++) {

+

+                try {

+                    // Extract the subscriber configuration

+                    EventAdminSubscriberMetadata subscriberMetadata = new EventAdminSubscriberMetadata(

+                            m_manager, subscribers[i], conf);

+                    String subscriberName = subscriberMetadata.getName();

+                    info(LOG_PREFIX + "configuring subscriber "

+                            + subscriberName);

+

+                    // Determine the callback prototype

+                    PojoMetadata pojoMetadata = getFactory().getPojoMetadata();

+                    String callbackType;

+                    if (subscriberMetadata.getDataKey() == null) {

+                        callbackType = Event.class.getName();

+                    } else {

+                        callbackType = subscriberMetadata.getDataType()

+                                .getName();

+                    }

+

+                    // Find the specified callback

+                    MethodMetadata methodMetadata = pojoMetadata.getMethod(

+                            subscriberMetadata.getCallback(),

+                            new String[] { callbackType });

+                    if (methodMetadata == null) {

+                        throw new ConfigurationException(

+                                "Unable to find callback "

+                                        + subscriberMetadata.getCallback()

+                                        + "(" + callbackType + ")");

+                    }

+                    Callback callback = new Callback(methodMetadata, m_manager);

+

+                    // Add the subscriber to the subscriber list and

+                    // register callback

+                    Object old;

+                    if ((old = m_subscribersByName.put(subscriberName,

+                            subscriberMetadata)) != null) {

+                        m_subscribersByName.put(subscriberName, old);

+                        throw new ConfigurationException("The subscriber "

+                                + subscriberName + "already exists");

+                    }

+                    m_callbacks.put(subscriberName, callback);

+

+                } catch (Exception e) {

+                    // Ignore invalid subscribers

+                    warn(LOG_PREFIX

+                            + "Ignoring subscriber : Error in configuration", e);

+                }

+            }

+        } else {

+            info(LOG_PREFIX + "no subscriber detected !");

+        }

+    }

+

+    /**

+     * Handler start method.

+     * 

+     * @see org.apache.felix.ipojo.Handler#start()

+     */

+    // @Override

+    public void start() {

+

+        Set topics = new TreeSet();

+

+        // Build the topic to listen

+        // Topics is a merge of all required topics by subscribers

+        if (!m_subscribersByName.isEmpty()) {

+            Collection subscribers = m_subscribersByName.values();

+            for (Iterator i = subscribers.iterator(); i.hasNext();) {

+                String[] subTopics = ((EventAdminSubscriberMetadata) i.next())

+                        .getTopics();

+                for (int j = 0; j < subTopics.length; j++) {

+                    topics.add(subTopics[j]);

+                }

+            }

+        }

+

+        m_topics = new String[topics.size()];

+        int i = 0;

+        for (Iterator iterator = topics.iterator(); iterator.hasNext();) {

+            String tmp = (String) iterator.next();

+            m_topics[i++] = tmp;

+        }

+    }

+

+    /**

+     * Handler stop method.

+     * 

+     * @see org.apache.felix.ipojo.Handler#stop()

+     */

+    // @Override

+    public void stop() {

+    }

+

+    /***************************************************************************

+     * OSGi EventHandler callback

+     **************************************************************************/

+

+    /**

+     * Receive an event. The event is dispatch to attached subscribers.

+     * 

+     * @param event :

+     *            the received event.

+     * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)

+     */

+    public void handleEvent(Event event) {

+

+        // Retrieve the event's topic

+        String topic = event.getTopic();

+

+        // For each subscribers

+        Collection subscribers = m_subscribersByName.values();

+        for (Iterator i = subscribers.iterator(); i.hasNext();) {

+            EventAdminSubscriberMetadata subscriberMetadata = (EventAdminSubscriberMetadata) i

+                    .next();

+

+            synchronized (this) {

+                // Check if the subscriber's topic and filter match

+                Filter filter = subscriberMetadata.getFilter();

+

+                if (EventUtil.matches(topic, subscriberMetadata.getTopics())

+                        && (filter == null || event.matches(filter))) {

+

+                    String name = subscriberMetadata.getName();

+                    String dataKey = subscriberMetadata.getDataKey();

+                    Callback callback = (Callback) m_callbacks.get(name);

+                    Object callbackParam;

+

+                    try {

+                        // Depending on the subscriber type...

+                        if (dataKey == null) {

+

+                            // Generic event subscriber : pass the event to the

+                            // registered

+                            // callback

+                            callbackParam = event;

+

+                        } else {

+

+                            // Check for a data key in the event

+                            boolean dataKeyPresent = false;

+                            String[] properties = event.getPropertyNames();

+                            for (int j = 0; j < properties.length

+                                    && !dataKeyPresent; j++) {

+                                if (dataKey.equals(properties[j])) {

+                                    dataKeyPresent = true;

+                                }

+                            }

+

+                            if (dataKeyPresent) {

+                                // Data event : check type compatibility and

+                                // pass the given object to the registered

+                                // callback

+                                Object data = event.getProperty(dataKey);

+                                Class dataType = subscriberMetadata

+                                        .getDataType();

+                                Class dataClazz = data.getClass();

+                                if (dataType.isAssignableFrom(dataClazz)) {

+                                    callbackParam = data;

+                                } else {

+                                    throw new ClassCastException(

+                                            "Cannot convert "

+                                                    + dataClazz.getName()

+                                                    + " to "

+                                                    + dataType.getName());

+                                }

+

+                            } else {

+                                throw new java.lang.NoSuchFieldException(

+                                        dataKey);

+                            }

+                        }

+

+                        // Run the callback

+                        callback.call(new Object[] { callbackParam });

+

+                    } catch (ClassCastException e) {

+                        // Ignore the data event if type doesn't match

+                        warn(

+                                LOG_PREFIX

+                                        + "Ignoring data event : Bad data type",

+                                e);

+                    } catch (NoSuchFieldException e) {

+                        // Ignore events without data field for data events

+                        // subscriber

+                        warn(LOG_PREFIX + "Ignoring data event : No data", e);

+                    } catch (Exception e) {

+                        // Unexpected exception

+                        error(LOG_PREFIX

+                                + "Unexpected exception when calling callback",

+                                e);

+                    }

+                }

+            }

+        }

+    }

+}

diff --git a/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
new file mode 100644
index 0000000..de221f4
--- /dev/null
+++ b/ipojo/event.admin.handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
@@ -0,0 +1,295 @@
+/* 

+ * 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.felix.ipojo.handlers.event.subscriber;

+

+import java.util.Dictionary;

+import java.util.Enumeration;

+

+import org.apache.felix.ipojo.ConfigurationException;

+import org.apache.felix.ipojo.InstanceManager;

+import org.apache.felix.ipojo.metadata.Element;

+import org.apache.felix.ipojo.parser.ParseUtils;

+import org.apache.felix.ipojo.util.Logger;

+import org.osgi.framework.Filter;

+import org.osgi.framework.InvalidSyntaxException;

+

+/**

+ * Represent an subscriber.

+ * 

+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

+ */

+class EventAdminSubscriberMetadata {

+

+    // Names of metadata attributes

+

+    /**

+     * The name attribute in the component metadata.

+     */

+    public static final String NAME_ATTRIBUTE = "name";

+

+    /**

+     * The callback attribute in the component metadata.

+     */

+    public static final String CALLBACK_ATTRIBUTE = "callback";

+

+    /**

+     * The topics attribute in the component metadata.

+     */

+    public static final String TOPICS_ATTRIBUTE = "topics";

+

+    /**

+     * The data key attribute in the component metadata.

+     */

+    public static final String DATA_KEY_ATTRIBUTE = "data-key";

+

+    /**

+     * The data type attribute in the component metadata.

+     */

+    public static final String DATA_TYPE_ATTRIBUTE = "data-type";

+

+    /**

+     * The filter attribute in the component metadata.

+     */

+    public static final String FILTER_ATTRIBUTE = "filter";

+

+    // Default values

+

+    /**

+     * The data type atttribute's default value.

+     */

+    public static final Class DEFAULT_DATA_TYPE_VALUE = java.lang.Object.class;

+

+    /**

+     * The name which acts as an identifier.

+     */

+    private final String m_name;

+

+    /**

+     * Name of the callback method.

+     */

+    private final String m_callback;

+

+    /**

+     * Listened topics.

+     */

+    private final String[] m_topics;

+

+    /**

+     * The key where user data are stored in the event dictionary.

+     */

+    private final String m_dataKey;

+

+    /**

+     * The type of received data.

+     */

+    private final Class m_dataType;

+

+    /**

+     * Event filter.

+     */

+    private final Filter m_filter;

+

+    /**

+     * The Instance Manager.

+     */

+    private final InstanceManager m_instanceManager;

+

+    /**

+     * Constructor.

+     * 

+     * @param instanceManager :

+     *            instance manager.

+     * @param subscriber :

+     *            subscriber metadata.

+     * @param instanceConf :

+     *            the configuration of the component instance

+     * @throws ConfigurationException

+     *             if the configuration of the component or the instance is

+     *             invalid.

+     */

+    public EventAdminSubscriberMetadata(InstanceManager instanceManager,

+            Element subscriber, Dictionary instanceConf)

+        throws ConfigurationException {

+

+        m_instanceManager = instanceManager;

+

+        /**

+         * Setup required attributes

+         */

+

+        // NAME_ATTRIBUTE

+        if (subscriber.containsAttribute(NAME_ATTRIBUTE)) {

+            m_name = subscriber.getAttribute(NAME_ATTRIBUTE);

+        } else {

+            throw new ConfigurationException(

+                    "Missing required attribute in component configuration : "

+                            + NAME_ATTRIBUTE);

+        }

+

+        // CALLBACK_ATTRIBUTE

+        if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) {

+            m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE);

+        } else {

+            throw new ConfigurationException(

+                    "Missing required attribute in component configuration : "

+                            + CALLBACK_ATTRIBUTE);

+        }

+

+        // TOPICS_ATTRIBUTE

+        String topicsString = null;

+        if (subscriber.containsAttribute(TOPICS_ATTRIBUTE)) {

+            topicsString = subscriber.getAttribute(TOPICS_ATTRIBUTE);

+        }

+        // Check TOPICS_PROPERTY in the instance configuration

+        Dictionary instanceTopics = (Dictionary) instanceConf

+                .get(EventAdminSubscriberHandler.TOPICS_PROPERTY);

+        if (instanceTopics != null) {

+            Enumeration e = instanceTopics.keys();

+            while (e.hasMoreElements()) {

+                String myName = (String) e.nextElement(); // name

+                if (m_name.equals(myName)) {

+                    topicsString = (String) instanceTopics.get(myName);

+                    break;

+                }

+            }

+        }

+        if (topicsString != null) {

+            m_topics = ParseUtils.split(topicsString, ",");

+        } else {

+            throw new ConfigurationException(

+                    "Missing required attribute in component or instance configuration : "

+                            + TOPICS_ATTRIBUTE);

+        }

+

+        /**

+         * Setup optional attributes

+         */

+

+        // DATA_KEY_ATTRIBUTE

+        m_dataKey = subscriber.getAttribute(DATA_KEY_ATTRIBUTE);

+        if (subscriber.containsAttribute(DATA_TYPE_ATTRIBUTE)) {

+            Class type;

+            try {

+                type = m_instanceManager.getContext().getBundle().loadClass(

+                        subscriber.getAttribute(DATA_TYPE_ATTRIBUTE));

+            } catch (ClassNotFoundException e) {

+                m_instanceManager

+                        .getFactory()

+                        .getLogger()

+                        .log(

+                                Logger.WARNING,

+                                "Ignoring data-type (using default) : Malformed attribute in metadata",

+                                e);

+                type = DEFAULT_DATA_TYPE_VALUE;

+            }

+            m_dataType = type;

+        } else {

+            m_dataType = DEFAULT_DATA_TYPE_VALUE;

+        }

+

+        // FILTER_ATTRIBUTE

+        String filterString = null;

+        if (subscriber.containsAttribute(FILTER_ATTRIBUTE)) {

+            filterString = subscriber.getAttribute(FILTER_ATTRIBUTE);

+        }

+        // Check FILTER_PROPERTY in the instance configuration

+        Dictionary instanceFilter = (Dictionary) instanceConf

+                .get(EventAdminSubscriberHandler.FILTER_PROPERTY);

+        if (instanceFilter != null) {

+            Enumeration e = instanceFilter.keys();

+            while (e.hasMoreElements()) {

+                String myName = (String) e.nextElement(); // name

+                if (m_name.equals(myName)) {

+                    filterString = (String) instanceFilter.get(myName);

+                    break;

+                }

+            }

+        }

+        Filter filter;

+        if (filterString != null) {

+            try {

+                filter = m_instanceManager.getContext().createFilter(

+                        filterString);

+            } catch (InvalidSyntaxException e) {

+                // Ignore filter if malformed

+                m_instanceManager.getFactory().getLogger().log(Logger.WARNING,

+                        "Ignoring filter : Malformed attribute in metadata", e);

+                filter = null;

+            }

+        } else {

+            filter = null;

+        }

+        m_filter = filter;

+    }

+

+    /**

+     * Get the name attribute of the subscriber.

+     * 

+     * @return the name

+     */

+    public String getName() {

+        return m_name;

+    }

+

+    /**

+     * Get the topics attribute of the subscriber.

+     * 

+     * @return the topics

+     */

+    public String[] getTopics() {

+        return m_topics;

+    }

+

+    /**

+     * Get the callback attribute of the subscriber.

+     * 

+     * @return the callback

+     */

+    public String getCallback() {

+        return m_callback;

+    }

+

+    /**

+     * Get the data key attribute of the subscriber.

+     * 

+     * @return the dataKey

+     */

+    public String getDataKey() {

+        return m_dataKey;

+    }

+

+    /**

+     * Get the data type attribute of the subscriber.

+     * 

+     * @return the dataType

+     */

+    public Class getDataType() {

+        return m_dataType;

+    }

+

+    /**

+     * Get the filter attribute of the subscriber.

+     * 

+     * @return the filter

+     */

+    public Filter getFilter() {

+        return m_filter;

+    }

+

+}

diff --git a/ipojo/event.admin.handler/src/main/resources/metadata.xml b/ipojo/event.admin.handler/src/main/resources/metadata.xml
deleted file mode 100644
index 0c11767..0000000
--- a/ipojo/event.admin.handler/src/main/resources/metadata.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<ipojo>

-<!-- Primitives handler -->

-<handler classname="org.apache.felix.ipojo.handler.event.EventAdminSubscriberHandler" name="subscriber" namespace="org.apache.felix.ipojo.handler.event.EventAdminSubscriberHandler">

-	<provides>

-		<property field="m_topics" name="event.topics" value=""/>

-	</provides>

-</handler>

-</ipojo>
\ No newline at end of file