Fix issue Felix-834.
Provides annotations for the whiteboard, extender and event admin handlers.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@720508 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/handler/eventadmin/metadata.xml b/ipojo/handler/eventadmin/metadata.xml
index 1b373fd..945451e 100644
--- a/ipojo/handler/eventadmin/metadata.xml
+++ b/ipojo/handler/eventadmin/metadata.xml
@@ -20,7 +20,7 @@
<handler
classname="org.apache.felix.ipojo.handlers.event.subscriber.EventAdminSubscriberHandler"
name="subscriber"
- namespace="org.apache.felix.ipojo.handlers.event.EventAdminHandler">
+ namespace="org.apache.felix.ipojo.handlers.event">
<provides>
<property field="m_topics" name="event.topics"/>
</provides>
@@ -28,7 +28,7 @@
<handler classname="org.apache.felix.ipojo.handlers.event.publisher.EventAdminPublisherHandler"
name="publisher"
- namespace="org.apache.felix.ipojo.handlers.event.EventAdminHandler">
+ namespace="org.apache.felix.ipojo.handlers.event">
<requires field="m_ea"/>
</handler>
</ipojo>
\ No newline at end of file
diff --git a/ipojo/handler/eventadmin/obr.xml b/ipojo/handler/eventadmin/obr.xml
index 8d0ec1d..4e53bb3 100644
--- a/ipojo/handler/eventadmin/obr.xml
+++ b/ipojo/handler/eventadmin/obr.xml
@@ -19,12 +19,12 @@
<obr>
<capability name="ipojo.handler">
<p n="name" v="publisher"/>
- <p n="namespace" v="org.apache.felix.ipojo.handlers.event.EventAdminHandler"/>
+ <p n="namespace" v="org.apache.felix.ipojo.handlers.event"/>
<p n="type" v="primitive"/>
</capability>
<capability name="ipojo.handler">
<p n="name" v="subscriber"/>
- <p n="namespace" v="org.apache.felix.ipojo.handlers.event.EventAdminHandler"/>
+ <p n="namespace" v="org.apache.felix.ipojo.handlers.event"/>
<p n="type" v="primitive"/>
</capability>
<require extend="false" filter="(service=org.osgi.service.event.EventAdmin)" multiple="false" name="service" optional="false">Import Event Admin service</require>
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
index bccba24..8880bf7 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java
@@ -44,7 +44,7 @@
/**
* The handler Namespace.
*/
- public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event.EventAdminHandler";
+ public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event";
/**
* The names of instance configuration properties.
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
index 72ec765..4358836 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java
@@ -150,6 +150,8 @@
// DATA_KEY_ATTRIBUTE
if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) {
m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE);
+ } else if (publisher.containsAttribute("data_key")) {
+ m_dataKey = publisher.getAttribute("data_key");
} else {
m_dataKey = DEFAULT_DATA_KEY_VALUE;
}
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
index 92e69ae..993934c 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java
@@ -54,7 +54,7 @@
/**
* The handler namespace.
*/
- public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event.EventAdminHandler";
+ public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event";
// Names of instance configuration properties.
diff --git a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
index bf17914..e94d640 100644
--- a/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
+++ b/ipojo/handler/eventadmin/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java
@@ -90,7 +90,7 @@
/**
* The key where user data are stored in the event dictionary.
*/
- private final String m_dataKey;
+ private String m_dataKey;
/**
* The type of received data.
@@ -135,6 +135,8 @@
// CALLBACK_ATTRIBUTE
if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) {
m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE);
+ } else if (subscriber.containsAttribute("method")) {
+ m_callback = subscriber.getAttribute("method");
} else {
throw new ConfigurationException(
"Missing required attribute in component configuration : "
@@ -156,14 +158,21 @@
// DATA_KEY_ATTRIBUTE
m_dataKey = subscriber.getAttribute(DATA_KEY_ATTRIBUTE);
- if (subscriber.containsAttribute(DATA_TYPE_ATTRIBUTE)) {
+ if (m_dataKey == null) { // Alternative configuration
+ m_dataKey = subscriber.getAttribute("data_key");
+ }
+
+ String t = subscriber.getAttribute(DATA_TYPE_ATTRIBUTE);
+ if (t == null) { // Alternative configuration
+ t = subscriber.getAttribute("data_type");
+ }
+ if (t != null) {
Class type;
- String typeName = subscriber.getAttribute(DATA_TYPE_ATTRIBUTE);
try {
- type = m_bundleContext.getBundle().loadClass(typeName);
+ type = m_bundleContext.getBundle().loadClass(t);
} catch (ClassNotFoundException e) {
throw new ConfigurationException("Data type class not found : "
- + typeName);
+ + t);
}
m_dataType = type;
} else {
diff --git a/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd b/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd
index 78406b3..b9c8271 100644
--- a/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd
+++ b/ipojo/handler/eventadmin/src/main/resources/event-admin.xsd
@@ -16,8 +16,8 @@
specific language governing permissions and limitations
under the License.
-->
-<xs:schema targetNamespace="org.apache.felix.ipojo.handlers.event.EventAdminHandler"
- xmlns="org.apache.felix.ipojo.handlers.event.EventAdminHandler"
+<xs:schema targetNamespace="org.apache.felix.ipojo.handlers.event"
+ xmlns="org.apache.felix.ipojo.handlers.event"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">