Update config admin bridge to R5

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1686177 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/eventadmin/bridge.configuration/pom.xml b/eventadmin/bridge.configuration/pom.xml
index 30b7b18..9bc7b56 100644
--- a/eventadmin/bridge.configuration/pom.xml
+++ b/eventadmin/bridge.configuration/pom.xml
@@ -19,8 +19,8 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache.felix</groupId>
-    <artifactId>felix</artifactId>
-    <version>1.0.4</version>
+    <artifactId>felix-parent</artifactId>
+    <version>2.1</version>
     <relativePath>../../pom/pom.xml</relativePath>
   </parent>
   <modelVersion>4.0.0</modelVersion>
@@ -33,14 +33,14 @@
   </description>
   <dependencies>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
+      <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
-      <version>1.0.0</version>
+      <version>5.0.0</version>
     </dependency>
     <dependency>
-      <groupId>${pom.groupId}</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
-      <version>1.0.0</version>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.enterprise</artifactId>
+      <version>5.0.0</version>
     </dependency>
   </dependencies>
   <build>
@@ -48,7 +48,7 @@
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
-        <version>1.4.0</version>
+        <version>2.5.3</version>
         <extensions>true</extensions>
         <configuration>
           <instructions>
diff --git a/eventadmin/bridge.configuration/src/main/java/org/apache/felix/eventadmin/bridge/configuration/ConfigurationEventToEventAdminBridge.java b/eventadmin/bridge.configuration/src/main/java/org/apache/felix/eventadmin/bridge/configuration/ConfigurationEventToEventAdminBridge.java
index 467fe87..c8120d7 100644
--- a/eventadmin/bridge.configuration/src/main/java/org/apache/felix/eventadmin/bridge/configuration/ConfigurationEventToEventAdminBridge.java
+++ b/eventadmin/bridge.configuration/src/main/java/org/apache/felix/eventadmin/bridge/configuration/ConfigurationEventToEventAdminBridge.java
@@ -1,4 +1,4 @@
-/* 
+/*
  * 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
@@ -19,6 +19,7 @@
 package org.apache.felix.eventadmin.bridge.configuration;
 
 import java.util.Arrays;
+import java.util.Dictionary;
 import java.util.Hashtable;
 
 import org.osgi.framework.BundleContext;
@@ -49,72 +50,77 @@
 
     public void configurationEvent(final ConfigurationEvent event)
     {
-        final ServiceReference ref = m_context
-            .getServiceReference(EventAdmin.class.getName());
+        final ServiceReference ref = m_context.getServiceReference(EventAdmin.class.getName());
 
-        if(null != ref)
+        if (null != ref)
         {
-            final EventAdmin eventAdmin = (EventAdmin) m_context
-                .getService(ref);
+            final EventAdmin eventAdmin = (EventAdmin) m_context.getService(ref);
 
-            if(null != eventAdmin)
+            if (null != eventAdmin)
             {
-                final String topic;
-
-                switch(event.getType())
+                try
                 {
-                    case ConfigurationEvent.CM_UPDATED:
-                        topic = "org/osgi/service/cm/ConfigurationEvent/CM_UPDATED";
-                        break;
-                    case ConfigurationEvent.CM_DELETED:
-                        topic = "org/osgi/service/cm/ConfigurationEvent/CM_DELETED";
-                        break;
-                    default:
-                        m_context.ungetService(ref);
-                        return;
+                    final String topic;
+
+                    switch (event.getType())
+                    {
+                        case ConfigurationEvent.CM_UPDATED:
+                            topic = "org/osgi/service/cm/ConfigurationEvent/CM_UPDATED";
+                            break;
+                        case ConfigurationEvent.CM_DELETED:
+                            topic = "org/osgi/service/cm/ConfigurationEvent/CM_DELETED";
+                            break;
+                        case ConfigurationEvent.CM_LOCATION_CHANGED:
+                            topic = "org/osgi/service/cm/ConfigurationEvent/CM_LOCATION_CHANGED";
+                            break;
+                        default:
+                            return;
+                    }
+
+                    final Hashtable properties = new Hashtable();
+
+                    if (null != event.getFactoryPid())
+                    {
+                        properties.put("cm.factoryPid", event.getFactoryPid());
+                    }
+
+                    properties.put("cm.pid", event.getPid());
+
+                    final ServiceReference eventRef = event.getReference();
+
+                    if (null == eventRef)
+                    {
+                        throw new IllegalArgumentException(
+                            "ConfigurationEvent.getReference() may not be null");
+                    }
+
+                    properties.put(EventConstants.SERVICE, eventRef);
+
+                    properties.put(EventConstants.SERVICE_ID, eventRef.getProperty(
+                        EventConstants.SERVICE_ID));
+
+                    final Object objectClass = eventRef.getProperty(
+                        Constants.OBJECTCLASS);
+
+                    if(!(objectClass instanceof String[])
+                        || !Arrays.asList((String[]) objectClass).contains(
+                        ConfigurationAdmin.class.getName()))
+                    {
+                        throw new IllegalArgumentException(
+                            "Bad objectclass: " + objectClass);
+                    }
+
+                    properties.put(EventConstants.SERVICE_OBJECTCLASS, objectClass);
+
+                    properties.put(EventConstants.SERVICE_PID, eventRef.getProperty(
+                        EventConstants.SERVICE_PID));
+
+                    eventAdmin.postEvent(new Event(topic, (Dictionary)properties));
                 }
-                
-                final Hashtable properties = new Hashtable();
-                
-                if(null != event.getFactoryPid())
+                finally
                 {
-                    properties.put("cm.factoryPid", event.getFactoryPid());
+                    m_context.ungetService(ref);
                 }
-                
-                properties.put("cm.pid", event.getPid());
-                
-                final ServiceReference eventRef = event.getReference();
-
-                if(null == eventRef)
-                {
-                    throw new IllegalArgumentException(
-                        "ConfigurationEvent.getReference() may not be null");
-                }
-
-                properties.put(EventConstants.SERVICE, eventRef);
-
-                properties.put(EventConstants.SERVICE_ID, eventRef.getProperty(
-                    EventConstants.SERVICE_ID));
-
-                final Object objectClass = eventRef.getProperty(
-                    Constants.OBJECTCLASS);
-
-                if(!(objectClass instanceof String[])
-                    || !Arrays.asList((String[]) objectClass).contains(
-                    ConfigurationAdmin.class.getName()))
-                {
-                    throw new IllegalArgumentException(
-                        "Bad objectclass: " + objectClass);
-                }
-
-                properties.put(EventConstants.SERVICE_OBJECTCLASS, objectClass);
-
-                properties.put(EventConstants.SERVICE_PID, eventRef.getProperty(
-                    EventConstants.SERVICE_PID));
-                
-                eventAdmin.postEvent(new Event(topic, properties));
-
-                m_context.ungetService(ref);
             }
         }
     }