You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2020/09/15 04:36:30 UTC

[felix-dev] branch master updated: Update webconsole event plugin to latest parent poim

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git


The following commit(s) were added to refs/heads/master by this push:
     new 6ee400e  Update webconsole event plugin to latest parent poim
6ee400e is described below

commit 6ee400ee85071306c5916a91f75efde345a749b5
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue Sep 15 06:36:14 2020 +0200

    Update webconsole event plugin to latest parent poim
---
 webconsole-plugins/event/pom.xml                   | 51 ++++++++++++++++------
 .../plugins/event/internal/Activator.java          |  8 ++--
 .../event/internal/ConfigurationListener.java      | 12 +++--
 .../plugins/event/internal/EventCollector.java     | 18 ++++----
 .../plugins/event/internal/EventHandler.java       |  9 ++--
 .../plugins/event/internal/EventInfo.java          |  4 +-
 .../event/internal/OptionalFeaturesHandler.java    | 31 ++++++++-----
 .../plugins/event/internal/OsgiUtil.java           | 30 +++++++------
 .../plugins/event/internal/PluginServlet.java      | 23 +++++-----
 .../event/internal/PropertiesEditorSupport.java    |  6 +--
 .../internal/converter/ServiceEventConverter.java  |  7 ++-
 11 files changed, 127 insertions(+), 72 deletions(-)

diff --git a/webconsole-plugins/event/pom.xml b/webconsole-plugins/event/pom.xml
index 6c2c384..26c9c2a 100644
--- a/webconsole-plugins/event/pom.xml
+++ b/webconsole-plugins/event/pom.xml
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>felix-parent</artifactId>
-        <version>4</version>
+        <version>7</version>
         <relativePath>../../../pom/pom.xml</relativePath>
     </parent>
 
@@ -32,8 +32,7 @@
 
     <name>Apache Felix Web Console Event Plugin</name>
     <description>
-        This is a plugin for the Apache Felix OSGi web console for displaying
-        OSGi events.
+        This is a plugin for the Apache Felix OSGi web console for displaying OSGi events.
     </description>
 
     <scm>
@@ -71,7 +70,7 @@
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>3.3.0</version>
+                <version>5.1.1</version>
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
@@ -82,24 +81,42 @@
                             org.apache.felix.webconsole.plugins.event.internal.Activator
                         </Bundle-Activator>
                         <Import-Package>
-                            org.osgi.service.cm;version="[1.2,2)";resolution:=optional,
-                            org.osgi.service.event;;version="[1.2,2)",*
+                            org.osgi.service.cm;version="[1.4,2)";resolution:=optional,*
                         </Import-Package>
                         <Private-Package>
                             org.apache.felix.webconsole.plugins.event.*
                         </Private-Package>
                         <DynamicImport-Package>
-                            org.osgi.service.cm;version="[1.2,2)",
-                            javax.servlet,
-                            javax.servlet.http
+                            org.osgi.service.cm;version="[1.4,2)"
                         </DynamicImport-Package>
-                        <Include-Resource>{maven-resources},OSGI-INF=target/classes/OSGI-INF</Include-Resource>
                         <Embed-Dependency>
                              org.apache.felix.utils;inline=org/apache/felix/utils/json/JSONWriter**
                         </Embed-Dependency>
                     </instructions>
                 </configuration>
             </plugin>
+           <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>3.2.1</version>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <createDependencyReducedPom>false</createDependencyReducedPom>
+                            <relocations>
+                                <relocation>
+                                    <pattern>org.apache.felix.utils</pattern>
+                                    <shadedPattern>org.apache.felix.webconsole.plugins.event.utils</shadedPattern>
+                                </relocation>
+                            </relocations>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
@@ -127,19 +144,25 @@
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>osgi.core</artifactId>
-            <version>4.3.1</version>
+            <version>6.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
-            <version>4.3.1</version>
+            <artifactId>org.osgi.service.event</artifactId>
+            <version>1.4.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.cm</artifactId>
+            <version>1.5.0</version>
+            <scope>provided</scope>
+        </dependency>  
+        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.utils</artifactId>
-            <version>1.9.0</version>
+            <version>1.11.4</version>
             <scope>provided</scope>
         </dependency>
     </dependencies>
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/Activator.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/Activator.java
index 06be18b..ca7bbda 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/Activator.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/Activator.java
@@ -32,7 +32,7 @@ import org.osgi.framework.ServiceRegistration;
 public class Activator implements BundleActivator
 {
     /** Registration for the plugin. */
-    private ServiceRegistration pluginRegistration;
+    private ServiceRegistration<Servlet> pluginRegistration;
 
     /** Listener */
     private EventListener eventListener;
@@ -46,6 +46,7 @@ public class Activator implements BundleActivator
     /**
      * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
      */
+    @Override
     public void start(final BundleContext context) throws Exception
     {
         // we start with the plugin
@@ -58,14 +59,14 @@ public class Activator implements BundleActivator
         this.featuresHandler = new OptionalFeaturesHandler(this.plugin, context);
 
         // finally we register the plugin
-        final Dictionary props = new Hashtable();
+        final Dictionary<String, Object> props = new Hashtable<>();
         props.put( Constants.SERVICE_DESCRIPTION, "Event Plugin for the Apache Felix Web Console" );
         props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" );
         props.put( "felix.webconsole.label", "events");
         props.put( "felix.webconsole.title", "%plugin.events.title");
         props.put( "felix.webconsole.css", "/events/res/ui/events.css");
         props.put( "felix.webconsole.category", "OSGi");
-        this.pluginRegistration = context.registerService(Servlet.class.getName(),
+        this.pluginRegistration = context.registerService(Servlet.class,
                                 plugin,
                                 props);
     }
@@ -73,6 +74,7 @@ public class Activator implements BundleActivator
     /**
      * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
      */
+    @Override
     public void stop(final BundleContext context) throws Exception
     {
         if ( this.pluginRegistration != null )
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/ConfigurationListener.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/ConfigurationListener.java
index ecfbf7b..f8e3dfe 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/ConfigurationListener.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/ConfigurationListener.java
@@ -23,7 +23,9 @@ import java.util.Dictionary;
 import java.util.Hashtable;
 
 import org.apache.felix.webconsole.plugins.event.internal.converter.ConfigurationEventConverter;
-import org.osgi.framework.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.cm.ConfigurationEvent;
 import org.osgi.service.cm.ManagedService;
 
@@ -34,11 +36,11 @@ public class ConfigurationListener implements ManagedService, org.osgi.service.c
 
     private final String pid;
 
-    static ServiceRegistration create( final BundleContext context, final PluginServlet plugin )
+    static ServiceRegistration<?> create( final BundleContext context, final PluginServlet plugin )
     {
         ConfigurationListener cl = new ConfigurationListener( plugin );
 
-        Dictionary props = new Hashtable();
+        Dictionary<String, Object> props = new Hashtable<>();
         props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" );
         props.put( Constants.SERVICE_DESCRIPTION, "Event plugin for the Felix Web Console Configuration Receiver" );
         props.put( Constants.SERVICE_PID, cl.pid );
@@ -57,6 +59,7 @@ public class ConfigurationListener implements ManagedService, org.osgi.service.c
     /**
      * @see org.osgi.service.cm.ConfigurationListener#configurationEvent(org.osgi.service.cm.ConfigurationEvent)
      */
+    @Override
     public void configurationEvent(ConfigurationEvent event)
     {
         this.plugin.getCollector().add(ConfigurationEventConverter.getInfo(event));
@@ -68,7 +71,8 @@ public class ConfigurationListener implements ManagedService, org.osgi.service.c
     /**
      * @see org.osgi.service.cm.ManagedService#updated(java.util.Dictionary)
      */
-    public void updated( Dictionary config )
+    @Override
+    public void updated( Dictionary<String, ?> config )
     {
         plugin.updateConfiguration( config );
     }
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventCollector.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventCollector.java
index 14ae432..769c182 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventCollector.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventCollector.java
@@ -16,7 +16,9 @@
  */
 package org.apache.felix.webconsole.plugins.event.internal;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
 
 /**
  * This class collects events
@@ -27,16 +29,16 @@ public class EventCollector
     private static final String PROPERTY_MAX_SIZE = "max.size";
     private static final int DEFAULT_MAX_SIZE = 250;
 
-    private List eventInfos;
+    private List<EventInfo> eventInfos;
 
     private long startTime;
 
     private int maxSize;
 
-    public EventCollector(final Dictionary props)
+    public EventCollector()
     {
         this.clear();
-        this.updateConfiguration(props);
+        this.updateConfiguration(null);
     }
 
     public void add(final EventInfo info)
@@ -62,7 +64,7 @@ public class EventCollector
     {
         synchronized ( this )
         {
-            this.eventInfos = new ArrayList();
+            this.eventInfos = new ArrayList<>();
             this.startTime = System.currentTimeMillis();
         }
     }
@@ -70,15 +72,15 @@ public class EventCollector
     /**
      * Return a copy of the current event list
      */
-    public List getEvents()
+    public List<EventInfo> getEvents()
     {
         synchronized ( this )
         {
-            return new ArrayList(eventInfos);
+            return new ArrayList<>(eventInfos);
         }
     }
 
-    public void updateConfiguration( final Dictionary props)
+    public void updateConfiguration( final Dictionary<String, ?> props)
     {
         this.maxSize = OsgiUtil.toInteger(props, PROPERTY_MAX_SIZE, DEFAULT_MAX_SIZE);
         synchronized ( this )
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventHandler.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventHandler.java
index 07d9e52..9349889 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventHandler.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventHandler.java
@@ -20,7 +20,9 @@ package org.apache.felix.webconsole.plugins.event.internal;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.felix.webconsole.plugins.event.internal.converter.*;
+import org.apache.felix.webconsole.plugins.event.internal.converter.BundleEventConverter;
+import org.apache.felix.webconsole.plugins.event.internal.converter.FrameworkEventConverter;
+import org.apache.felix.webconsole.plugins.event.internal.converter.ServiceEventConverter;
 import org.osgi.service.event.Event;
 
 /**
@@ -49,6 +51,7 @@ public class EventHandler implements org.osgi.service.event.EventHandler
     /**
      * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event)
      */
+    @Override
     public void handleEvent( Event event )
     {
         boolean include = true;
@@ -62,11 +65,11 @@ public class EventHandler implements org.osgi.service.event.EventHandler
         }
         if ( include )
         {
-            Map props = null;
+            Map<String, Object> props = null;
             final String[] names = event.getPropertyNames();
             if ( names != null && names.length > 0 )
             {
-                props = new HashMap();
+                props = new HashMap<>();
                 for ( int i = 0; i < names.length; i++ )
                 {
                     props.put(names[i], event.getProperty(names[i]));
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventInfo.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventInfo.java
index 3e1405a..d2fc33c 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventInfo.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/EventInfo.java
@@ -37,7 +37,7 @@ public class EventInfo {
     public final long received;
 
     /** Properties. */
-    public final Map properties;
+    public final Map<String, Object> properties;
 
     /** The event class. */
     public final String category;
@@ -51,7 +51,7 @@ public class EventInfo {
         this.category = category;
     }
 
-    public EventInfo( final String topic, final String info, final String category, final Map props )
+    public EventInfo( final String topic, final String info, final String category, final Map<String, Object> props )
     {
         this.topic = topic;
         this.info = info;
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
index 7559f90..0f98f5a 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OptionalFeaturesHandler.java
@@ -20,7 +20,13 @@ package org.apache.felix.webconsole.plugins.event.internal;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.osgi.framework.*;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.event.EventAdmin;
 
 /**
@@ -40,16 +46,16 @@ public class OptionalFeaturesHandler
 
     /** Event admin service id */
     //private Long eventAdminServiceId;
-    private ServiceReference eventAdminServiceRef;
+    private ServiceReference<?> eventAdminServiceRef;
 
     /** Registration for the event handler. */
-    private ServiceRegistration eventHandlerRegistration;
+    private ServiceRegistration<?> eventHandlerRegistration;
 
     /** Configuration admin service id */
     private Long configAdminServiceId;
 
     /** Registration for the configuration listener. */
-    private ServiceRegistration configListenerRegistration;
+    private ServiceRegistration<?> configListenerRegistration;
 
     /** Bundle context. */
     private final BundleContext bundleContext;
@@ -62,7 +68,7 @@ public class OptionalFeaturesHandler
         this.plugin = plugin;
         this.bundleContext = context;
         // check if event admin is already available
-        final ServiceReference ref = this.bundleContext.getServiceReference(EVENT_ADMIN_CLASS_NAME);
+        final ServiceReference<?> ref = this.bundleContext.getServiceReference(EVENT_ADMIN_CLASS_NAME);
         if ( ref != null )
         {
             bindEventAdmin(ref);
@@ -70,7 +76,7 @@ public class OptionalFeaturesHandler
 
         // check if config admin is already available
         this.configAdminServiceId = null;
-        final ServiceReference cfaRef = this.bundleContext.getServiceReference(CONFIGURATION_ADMIN_CLASS_NAME);
+        final ServiceReference<?> cfaRef = this.bundleContext.getServiceReference(CONFIGURATION_ADMIN_CLASS_NAME);
         if ( cfaRef != null )
         {
             final Long id = (Long)cfaRef.getProperty(Constants.SERVICE_ID);
@@ -98,9 +104,10 @@ public class OptionalFeaturesHandler
     /**
      * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
      */
+    @Override
     public void serviceChanged(final ServiceEvent event)
     {
-        final ServiceReference ref = event.getServiceReference();
+        final ServiceReference<?> ref = event.getServiceReference();
         final String[] objectClasses =  (String[])ref.getProperty(Constants.OBJECTCLASS);
         if ( objectClasses != null)
         {
@@ -112,6 +119,7 @@ public class OptionalFeaturesHandler
                     {
                         new Thread()
                         {
+                            @Override
                             public void run()
                             {
                                 try {
@@ -125,6 +133,7 @@ public class OptionalFeaturesHandler
                     {
                         new Thread()
                         {
+                            @Override
                             public void run()
                             {
                                 try {
@@ -142,6 +151,7 @@ public class OptionalFeaturesHandler
                     {
                         new Thread()
                         {
+                            @Override
                             public void run()
                             {
                                 try {
@@ -155,6 +165,7 @@ public class OptionalFeaturesHandler
                     {
                         new Thread()
                         {
+                            @Override
                             public void run()
                             {
                                 try {
@@ -169,14 +180,14 @@ public class OptionalFeaturesHandler
         }
     }
 
-    synchronized void bindEventAdmin(ServiceReference ref)
+    synchronized void bindEventAdmin(ServiceReference<?> ref)
     {
         if ( this.eventAdminServiceRef != null)
         {
             this.unbindEventAdmin(this.eventAdminServiceRef);
         }
         this.eventAdminServiceRef = ref;
-        final Dictionary props = new Hashtable();
+        final Dictionary<String, Object> props = new Hashtable<>();
         props.put( Constants.SERVICE_DESCRIPTION, "Event handler for the Apache Felix Web Console" );
         props.put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" );
         props.put( "event.topics", "*"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -186,7 +197,7 @@ public class OptionalFeaturesHandler
                 new EventHandler(this.plugin.getCollector()), props);
     }
 
-    synchronized void unbindEventAdmin(ServiceReference ref)
+    synchronized void unbindEventAdmin(ServiceReference<?> ref)
     {
         if ( this.eventAdminServiceRef != null && this.eventAdminServiceRef.equals(ref) )
         {
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OsgiUtil.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OsgiUtil.java
index 3abac87..b4471f6 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OsgiUtil.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/OsgiUtil.java
@@ -18,7 +18,11 @@
  */
 package org.apache.felix.webconsole.plugins.event.internal;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.List;
 
 /**
  * The <code>OsgiUtil</code> is a utility class providing some usefull utility
@@ -26,7 +30,7 @@ import java.util.*;
  */
 public class OsgiUtil {
 
-    public static boolean toBoolean(Dictionary props, String key, boolean defaultValue)
+    public static boolean toBoolean(Dictionary<String, ?> props, String key, boolean defaultValue)
     {
         Object propValue = toObject( props, key );
         if (propValue instanceof Boolean)
@@ -41,13 +45,13 @@ public class OsgiUtil {
         return defaultValue;
     }
 
-    public static String toString(Dictionary props, String key, String defaultValue)
+    public static String toString(Dictionary<String, ?> props, String key, String defaultValue)
     {
         Object propValue = toObject( props, key );
         return (propValue != null) ? propValue.toString() : defaultValue;
     }
 
-    public static int toInteger(Dictionary props, String key, int defaultValue)
+    public static int toInteger(Dictionary<String, ?> props, String key, int defaultValue)
     {
         Object propValue = toObject( props, key );
         if (propValue instanceof Integer)
@@ -69,7 +73,7 @@ public class OsgiUtil {
         return defaultValue;
     }
 
-    public static Object toObject(Dictionary props, String key)
+    public static Object toObject(Dictionary<String, ?> props, String key)
     {
         if (props == null || key == null )
         {
@@ -87,7 +91,7 @@ public class OsgiUtil {
         }
         else if (propValue instanceof Collection)
         {
-            Collection prop = (Collection) propValue;
+            Collection<?> prop = (Collection<?>) propValue;
             return prop.isEmpty() ? null : prop.iterator().next();
         }
         else
@@ -96,7 +100,7 @@ public class OsgiUtil {
         }
     }
 
-    public static String[] toStringArray(Dictionary props, String key, String[] defaultArray)
+    public static String[] toStringArray(Dictionary<String, ?> props, String key, String[] defaultArray)
     {
         if (props == null || key == null )
         {
@@ -125,7 +129,7 @@ public class OsgiUtil {
         {
             // other array
             Object[] valueArray = (Object[]) propValue;
-            List values = new ArrayList(valueArray.length);
+            List<String> values = new ArrayList<>(valueArray.length);
             for(int i=0; i<valueArray.length; i++)
             {
                 final Object value = valueArray[i];
@@ -134,15 +138,15 @@ public class OsgiUtil {
                     values.add(value.toString());
                 }
             }
-            return (String[]) values.toArray(new String[values.size()]);
+            return values.toArray(new String[values.size()]);
 
         }
         else if (propValue instanceof Collection)
         {
             // collection
-            Collection valueCollection = (Collection) propValue;
-            List valueList = new ArrayList(valueCollection.size());
-            final Iterator i = valueCollection.iterator();
+            Collection<?> valueCollection = (Collection<?>) propValue;
+            List<String> valueList = new ArrayList<>(valueCollection.size());
+            final Iterator<?> i = valueCollection.iterator();
             while ( i.hasNext() )
             {
                 final Object value = i.next();
@@ -151,7 +155,7 @@ public class OsgiUtil {
                     valueList.add(value.toString());
                 }
             }
-            return (String[]) valueList.toArray(new String[valueList.size()]);
+            return valueList.toArray(new String[valueList.size()]);
         }
 
         return defaultArray;
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
index 15d7e61..92819a5 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PluginServlet.java
@@ -27,7 +27,6 @@ import java.util.Dictionary;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Map.Entry;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -44,6 +43,8 @@ import org.osgi.service.event.EventAdmin;
 public class PluginServlet extends HttpServlet
 {
 
+    private static final long serialVersionUID = -8601361741848077124L;
+
     private static final String ACTION_POST = "post"; //$NON-NLS-1$
     private static final String ACTION_SEND = "send"; //$NON-NLS-1$
     private static final String ACTION_CLEAR = "clear"; //$NON-NLS-1$
@@ -62,11 +63,11 @@ public class PluginServlet extends HttpServlet
 
     public PluginServlet()
     {
-        this.collector = new EventCollector(null);
+        this.collector = new EventCollector();
         TEMPLATE = readTemplateFile(getClass(), "/res/events.html"); //$NON-NLS-1$
     }
 
-    private final String readTemplateFile(final Class clazz, final String templateFile)
+    private final String readTemplateFile(final Class<?> clazz, final String templateFile)
     {
         InputStream templateStream = getClass().getResourceAsStream(templateFile);
         if (templateStream != null)
@@ -119,6 +120,7 @@ public class PluginServlet extends HttpServlet
     /**
      * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
      */
+    @Override
     protected void doPost( HttpServletRequest req, HttpServletResponse resp )
     throws ServletException, IOException
     {
@@ -141,7 +143,7 @@ public class PluginServlet extends HttpServlet
 
     private void renderJSON( final PrintWriter pw ) throws IOException
     {
-        List events = this.collector.getEvents();
+        List<EventInfo> events = this.collector.getEvents();
 
         StringBuffer statusLine = new StringBuffer();
         statusLine.append( events.size() );
@@ -155,7 +157,7 @@ public class PluginServlet extends HttpServlet
         {
             statusLine.append( " since " );
             Date d = new Date();
-            d.setTime( ( ( EventInfo ) events.get( 0 ) ).received );
+            d.setTime( events.get( 0 ).received );
             statusLine.append( d );
         }
         statusLine.append( ". (Event admin: " );
@@ -172,7 +174,7 @@ public class PluginServlet extends HttpServlet
 
         // Compute scale: startTime is 0, lastTimestamp is 100%
         final long startTime = this.collector.getStartTime();
-        final long endTime = (events.size() == 0 ? startTime : ((EventInfo)events.get(events.size() - 1)).received);
+        final long endTime = (events.size() == 0 ? startTime : events.get(events.size() - 1).received);
         final float scale = (endTime == startTime ? 100.0f : 100.0f / (endTime - startTime));
 
         final JSONWriter writer = new JSONWriter(pw);
@@ -186,7 +188,7 @@ public class PluginServlet extends HttpServlet
         // display list in reverse order
         for ( int index = events.size() - 1; index >= 0; index-- )
         {
-            eventJson( writer, ( EventInfo ) events.get( index ), index, startTime, scale );
+            eventJson( writer, events.get( index ), index, startTime, scale );
         }
 
         writer.endArray();
@@ -195,6 +197,7 @@ public class PluginServlet extends HttpServlet
     }
 
 
+    @Override
     protected void doGet( HttpServletRequest request, HttpServletResponse response )
     throws ServletException, IOException
     {
@@ -272,10 +275,10 @@ public class PluginServlet extends HttpServlet
         jw.object();
         if ( info.properties != null && info.properties.size() > 0 )
         {
-            final Iterator i = info.properties.entrySet().iterator();
+            final Iterator<Map.Entry<String, Object>> i = info.properties.entrySet().iterator();
             while ( i.hasNext() )
             {
-                final Map.Entry current = (Entry) i.next();
+                final Map.Entry<String, Object> current = i.next();
                 jw.key( current.getKey().toString() );
                 jw.value(current.getValue());
             }
@@ -285,7 +288,7 @@ public class PluginServlet extends HttpServlet
         jw.endObject();
     }
 
-    public void updateConfiguration( Dictionary dict)
+    public void updateConfiguration( Dictionary<String, ?> dict)
     {
         this.collector.updateConfiguration(dict);
     }
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PropertiesEditorSupport.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PropertiesEditorSupport.java
index 1105a7b..55d81fd 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PropertiesEditorSupport.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/PropertiesEditorSupport.java
@@ -39,13 +39,13 @@ public class PropertiesEditorSupport
      * @param request the request to process
      * @return the converted properties
      */
-    public static final Dictionary convertProperties(HttpServletRequest request)
+    public static final Dictionary<String, ?> convertProperties(HttpServletRequest request)
     {
         String keys[] = request.getParameterValues("key"); //$NON-NLS-1$
         String vals[] = request.getParameterValues("val"); //$NON-NLS-1$
         String types[] = request.getParameterValues("type"); //$NON-NLS-1$
 
-        final Hashtable properties = new Hashtable();
+        final Dictionary<String, Object> properties = new Hashtable<>();
         synchronized (properties)
         {
             for (int i = 0; keys != null && i < keys.length; i++)
@@ -85,7 +85,7 @@ public class PropertiesEditorSupport
         }
         else if ("char".equals(type)) //$NON-NLS-1$
         {
-            return new Character(value.toString().charAt(0));
+            return value.toString().charAt(0);
         }
         else if ("byte array".equals(type)) //$NON-NLS-1$
         {
diff --git a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ServiceEventConverter.java b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ServiceEventConverter.java
index 0092cd1..2ddb1e6 100644
--- a/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ServiceEventConverter.java
+++ b/webconsole-plugins/event/src/main/java/org/apache/felix/webconsole/plugins/event/internal/converter/ServiceEventConverter.java
@@ -17,7 +17,10 @@
 package org.apache.felix.webconsole.plugins.event.internal.converter;
 
 import org.apache.felix.webconsole.plugins.event.internal.EventInfo;
-import org.osgi.framework.*;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceReference;
 
 public class ServiceEventConverter {
 
@@ -29,7 +32,7 @@ public class ServiceEventConverter {
             return null;
         }
 
-        final ServiceReference ref = event.getServiceReference();
+        final ServiceReference<?> ref = event.getServiceReference();
 
         final StringBuffer buffer = new StringBuffer( "Service " );
         final Object pid = ref.getProperty( Constants.SERVICE_PID );