Commit the new iPOJO version (0.7.6).
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@642265 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/event.admin.handler/pom.xml b/ipojo/event.admin.handler/pom.xml
index fb69c57..840cf9f 100644
--- a/ipojo/event.admin.handler/pom.xml
+++ b/ipojo/event.admin.handler/pom.xml
@@ -1,84 +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.
--->
+<!--
+ 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>iPOJO Event Admin Handler</name>
- <groupId>org.apache.felix</groupId>
- <version>0.7.5-SNAPSHOT</version>
- <artifactId>org.apache.felix.ipojo.handler.event</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo</artifactId>
- <version>0.7.5-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.ipojo.metadata</artifactId>
- <version>0.7.5-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>1.0.0</version>
- </dependency>
- </dependencies>
-
+ <parent>
+ <artifactId>iPOJO</artifactId>
+ <groupId>org.apache.felix</groupId>
+ <version>0.7.6-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>bundle</packaging>
+ <name>Apache Felix iPOJO Event Admin Handler</name>
+ <artifactId>org.apache.felix.ipojo.handler.event</artifactId>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Private-Package>org.apache.felix.ipojo.handler.event</Private-Package>
- <Bundle-Name>${pom.name}</Bundle-Name>
- <Bundle-SymbolicName>ipojo.event.admin.handler</Bundle-SymbolicName>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-ipojo-plugin</artifactId>
- <version>${pom.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>ipojo-bundle</goal>
- </goals>
- <configuration>
- <metadata>metadata.xml</metadata>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.ipojo.metadata</artifactId>
+ <version>${pom.version}</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>
+ <Private-Package>
+ org.apache.felix.ipojo.handler.event
+ </Private-Package>
+ <Bundle-Name>${pom.name}</Bundle-Name>
+ <Bundle-SymbolicName>
+ ipojo.event.admin.handler
+ </Bundle-SymbolicName>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-ipojo-plugin</artifactId>
+ <version>${pom.version}</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
index b2654ca..5c090c3 100644
--- 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
@@ -27,13 +27,13 @@
import org.apache.felix.ipojo.ConfigurationException;
import org.apache.felix.ipojo.InstanceManager;
import org.apache.felix.ipojo.PrimitiveHandler;
-import org.apache.felix.ipojo.architecture.ComponentDescription;
+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.ManipulationMetadata;
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.apache.felix.ipojo.util.Logger;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
@@ -71,7 +71,7 @@
* @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(ComponentDescription cd, Element metadata) throws ConfigurationException {
+ 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()));
@@ -93,11 +93,11 @@
// Store the component manager
m_manager = getInstanceManager();
- ManipulationMetadata mm = new ManipulationMetadata(metadata);
+ PojoMetadata mm = getFactory().getPojoMetadata();
// Get Metadata subscribers
Element[] subscribers = metadata.getElements("subscriber", NAMESPACE);
- if (subscribers.length > 0) {
+ if (subscribers != null) {
// then check publishers are well formed and fill the publishers'
// map
for (int i = 0; i < subscribers.length; i++) {
@@ -109,25 +109,24 @@
Callback cb = new Callback(methodMetadata, m_manager);
eventAdminSubscriberMetadata.setCallback(cb);
} else {
- log(Logger.WARNING, " EVENT HANDLER SUBSCRIBERS : malformed subscriber : the method " + eventAdminSubscriberMetadata.getCallbackStr() + "(Event myEvent) is not present in the component");
+ 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 {
- log(Logger.WARNING, " EVENT HANDLER SUBSCRIBERS : malformed subscriber !");
+ warn(" EVENT HANDLER SUBSCRIBERS : malformed subscriber !");
throw new ConfigurationException("EVENT HANDLER SUBSCRIBERS : malformed subscriber !");
}
}
- log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS : Suscribers detected !");
} else {
- log(Logger.ERROR, " EVENT HANDLER SUBSCRIBERS : no Suscribers detected !");
+ 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
- log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS has been configured !");
+ info(" EVENT HANDLER SUBSCRIBERS has been configured !");
} else {
return;
}
@@ -178,8 +177,6 @@
* @see org.apache.felix.ipojo.Handler#start()
*/
public void start() {
- log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS STARTING!!!");
-
if (!m_subEvent.isEmpty()) {
// build the topic to listen
// Topics is a merge of all required topics by subscribers
@@ -198,9 +195,7 @@
}
// Put the m_topics properties to the good value
- m_topics = topics.split(",");
-
- log(Logger.INFO, " EVENT HANDLER SUBSCRIBERS : EventHandler registered object: " + this);
+ m_topics = ParseUtils.split(topics, ",");
}
}
@@ -249,7 +244,7 @@
c.call(new Object[] { event });
}
} catch (Exception e) {
- log(Logger.ERROR, "EVENT HANDLER SUBSCRIBERS CALLBACK error : " + eventSubscriberData.getCallbackStr() + " exception :" + e + " Cause : " + e.getCause());
+ error("EVENT HANDLER SUBSCRIBERS CALLBACK error : " + eventSubscriberData.getCallbackStr() + " exception :" + e.getMessage());
// stop the component :
m_manager.setState(InstanceManager.INVALID);
}
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
index 989f633..826f547 100644
--- 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
@@ -20,6 +20,7 @@
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;
@@ -43,7 +44,7 @@
private Callback m_callback;
/**
- * Listenned topics.
+ * Listened topics.
*/
private String m_topics;
@@ -112,12 +113,11 @@
* @return true if the given topic is a listenned topic.
*/
public boolean matchingTopic(String topic) {
- return EventUtil.matches(topic, m_topics.split(","));
+ 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.
+ * 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.
*/
@@ -174,8 +174,7 @@
}
/**
- * Create and set the filter.
- * The filter is create from the given argument.
+ * 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.
*/