You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2012/01/06 16:03:19 UTC

svn commit: r1228221 [2/2] - in /felix/trunk/webconsole: ./ src/main/java/org/apache/felix/webconsole/ src/main/java/org/apache/felix/webconsole/internal/ src/main/java/org/apache/felix/webconsole/internal/compendium/ src/main/java/org/apache/felix/web...

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java?rev=1228221&r1=1228220&r2=1228221&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java Fri Jan  6 15:03:17 2012
@@ -61,8 +61,7 @@ class ConfigurationSupport implements Ma
 
     //---------- ManagedService
 
-    @SuppressWarnings("unchecked")
-    public void updated( @SuppressWarnings("rawtypes") Dictionary config )
+    public void updated( Dictionary config )
     {
         osgiManager.updateConfiguration( config );
     }
@@ -108,10 +107,10 @@ class ConfigurationSupport implements Ma
         ObjectClassDefinition xocd = null;
         final Locale localeObj = Util.parseLocaleString(locale);
         final ResourceBundle rb = osgiManager.resourceBundleManager.getResourceBundle(osgiManager.getBundleContext().getBundle(), localeObj);
-        final Map<String, ?> defaultConfig = osgiManager.getDefaultConfiguration();
+        final Map defaultConfig = osgiManager.getDefaultConfiguration();
 
         // simple configuration properties
-        final ArrayList<AttributeDefinition> adList = new ArrayList<AttributeDefinition>();
+        final ArrayList adList = new ArrayList();
         for (int i = 0; i < CONF_PROPS.length; i++)
         {
             final String key = CONF_PROPS[i++];
@@ -139,7 +138,7 @@ class ConfigurationSupport implements Ma
             new String[] { "4", "3", "2", "1" } ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 
         // list plugins - requires localized plugin titles
-        final TreeMap<String, String> namesByClassName = new TreeMap<String, String>();
+        final TreeMap namesByClassName = new TreeMap();
         final String[] defaultPluginsClasses = OsgiManager.PLUGIN_MAP;
         for ( int i = 0; i < defaultPluginsClasses.length; i++ )
         {
@@ -148,9 +147,8 @@ class ConfigurationSupport implements Ma
             final String name = getString(rb, label + ".pluginTitle", label); //$NON-NLS-1$
             namesByClassName.put(clazz, name);
         }
-        final String[] classes = namesByClassName.keySet().toArray(
-            new String[namesByClassName.size()] );
-        final String[] names = namesByClassName.values().toArray( new String[namesByClassName.size()] );
+        final String[] classes = ( String[] ) namesByClassName.keySet().toArray( new String[namesByClassName.size()] );
+        final String[] names = ( String[] ) namesByClassName.values().toArray( new String[namesByClassName.size()] );
 
         adList.add( new AttributeDefinitionImpl( OsgiManager.PROP_ENABLED_PLUGINS,
             getString(rb, "metadata.plugins.name", OsgiManager.PROP_ENABLED_PLUGINS), //$NON-NLS-1$
@@ -160,7 +158,7 @@ class ConfigurationSupport implements Ma
         xocd = new ObjectClassDefinition()
         {
 
-            private final AttributeDefinition[] attrs = adList
+            private final AttributeDefinition[] attrs = ( AttributeDefinition[] ) adList
                 .toArray( new AttributeDefinition[adList.size()] );
 
 

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java?rev=1228221&r1=1228220&r2=1228221&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java Fri Jan  6 15:03:17 2012
@@ -91,7 +91,7 @@ public class ConfigurationUtil
      * @return The value of the named property as a string or <code>def</code>
      *         if the property does not exist
      */
-    public static final String getProperty(Map<String, ?> config, String name, String def)
+    public static final String getProperty(Map config, String name, String def)
     {
         Object value = config.get(name);
         if (value instanceof String)
@@ -117,7 +117,7 @@ public class ConfigurationUtil
      * @return The value of the named property as a string or <code>def</code>
      *         if the property does not exist
      */
-    public static final int getProperty(Map<String, ?> config, String name, int def)
+    public static final int getProperty(Map config, String name, int def)
     {
         Object value = config.get(name);
         if (value instanceof Number)
@@ -149,7 +149,7 @@ public class ConfigurationUtil
      * @param name The name of the property to return
      * @return the property value as string array - no matter if originally it was other kind of array, collection or comma-separated string. Returns <code>null</code> if the property is not set.
      */
-    public static final String[] getStringArrayProperty(Map<String, ?> config, String name)
+    public static final String[] getStringArrayProperty(Map config, String name)
     {
         Object value = config.get(name);
         if (value == null)
@@ -169,10 +169,10 @@ public class ConfigurationUtil
         }
         else if (value instanceof Collection)
         {
-            Collection<?> collection = (Collection<?>) value;
+            Collection collection = (Collection) value;
             ret = new String[collection.size()];
             int i = 0;
-            for (Iterator<?> iter = collection.iterator(); iter.hasNext();)
+            for (Iterator iter = collection.iterator(); iter.hasNext();)
             {
                 ret[i] = String.valueOf(iter.next());
                 i++;

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java?rev=1228221&r1=1228220&r2=1228221&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java Fri Jan  6 15:03:17 2012
@@ -196,7 +196,7 @@ public class OsgiManager extends Generic
 
     // list of OsgiManagerPlugin instances activated during init. All these
     // instances will have to be deactivated during destroy
-    private List<OsgiManagerPlugin> osgiManagerPlugins = new ArrayList<OsgiManagerPlugin>();
+    private List osgiManagerPlugins = new ArrayList();
 
     private String webManagerRoot;
 
@@ -207,21 +207,20 @@ public class OsgiManager extends Generic
     private boolean httpResourcesRegistered;
 
     // default configuration from framework properties
-    private HashMap<String, Object> defaultConfiguration;
+    private HashMap defaultConfiguration;
 
     // configuration from Configuration Admin
-    private HashMap<String, ?> configuration;
+    private HashMap configuration;
 
     // See https://issues.apache.org/jira/browse/FELIX-2267
     private Locale configuredLocale;
 
-    private Set<String> enabledPlugins;
+    private Set enabledPlugins;
 
     ResourceBundleManager resourceBundleManager;
 
     private int logLevel = DEFAULT_LOG_LEVEL;
 
-    @SuppressWarnings("serial")
     public OsgiManager(BundleContext bundleContext)
     {
         this.bundleContext = bundleContext;
@@ -243,13 +242,13 @@ public class OsgiManager extends Generic
 
             try
             {
-                Class<?> pluginClass = classLoader.loadClass(pluginClassName);
+                Class pluginClass = classLoader.loadClass(pluginClassName);
                 Object plugin = pluginClass.newInstance();
 
                 if (plugin instanceof OsgiManagerPlugin)
                 {
                     ((OsgiManagerPlugin) plugin).activate(bundleContext);
-                    osgiManagerPlugins.add((OsgiManagerPlugin) plugin);
+                    osgiManagerPlugins.add(plugin);
                 }
                 if (plugin instanceof BrandingPlugin)
                 {
@@ -301,7 +300,7 @@ public class OsgiManager extends Generic
         securityProviderTracker.open();
 
         // load the default configuration from the framework
-        this.defaultConfiguration = new HashMap<String, Object>();
+        this.defaultConfiguration = new HashMap();
         this.defaultConfiguration.put( PROP_MANAGER_ROOT,
             ConfigurationUtil.getProperty( bundleContext, FRAMEWORK_PROP_MANAGER_ROOT, DEFAULT_MANAGER_ROOT ) );
         this.defaultConfiguration.put( PROP_REALM,
@@ -311,7 +310,7 @@ public class OsgiManager extends Generic
         this.defaultConfiguration.put( PROP_PASSWORD,
             ConfigurationUtil.getProperty( bundleContext, FRAMEWORK_PROP_PASSWORD, DEFAULT_PASSWORD ) );
         this.defaultConfiguration.put( PROP_LOG_LEVEL,
-            ConfigurationUtil.getProperty( bundleContext, FRAMEWORK_PROP_LOG_LEVEL, DEFAULT_LOG_LEVEL) );
+            new Integer( ConfigurationUtil.getProperty( bundleContext, FRAMEWORK_PROP_LOG_LEVEL, DEFAULT_LOG_LEVEL ) ) );
         this.defaultConfiguration.put( PROP_LOCALE,
             ConfigurationUtil.getProperty( bundleContext, FRAMEWORK_PROP_LOCALE, null ) );
 
@@ -332,7 +331,7 @@ public class OsgiManager extends Generic
                 {
                     // do nothing
                 }
-            }, new Hashtable<String, String>()
+            }, new Hashtable()
             {
                 {
                     put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" ); //$NON-NLS-1$
@@ -362,9 +361,10 @@ public class OsgiManager extends Generic
         }
 
         // deactivate any remaining plugins
-        for ( Iterator<OsgiManagerPlugin> pi = osgiManagerPlugins.iterator(); pi.hasNext(); )
+        for (Iterator pi = osgiManagerPlugins.iterator(); pi.hasNext();)
         {
-            pi.next().deactivate();
+            Object plugin = pi.next();
+            ((OsgiManagerPlugin) plugin).deactivate();
         }
 
         // simply remove all operations, we should not be used anymore
@@ -450,7 +450,8 @@ public class OsgiManager extends Generic
         AbstractWebConsolePlugin plugin = getConsolePlugin(label);
         if (plugin != null)
         {
-            final Map<String, String> labelMap = holder.getLocalizedLabelMap( resourceBundleManager, locale );
+            final Map labelMap = holder.getLocalizedLabelMap(resourceBundleManager,
+                locale);
 
             // the official request attributes
             request.setAttribute(WebConsoleConstants.ATTR_LANG_MAP, getLangMap());
@@ -775,7 +776,7 @@ public class OsgiManager extends Generic
             return;
         }
 
-        Map<String, ?> config = getConfiguration();
+        Map config = getConfiguration();
 
         // get authentication details
         String realm = ConfigurationUtil.getProperty(config, PROP_REALM, DEFAULT_REALM);
@@ -788,7 +789,7 @@ public class OsgiManager extends Generic
             HttpContext httpContext = new OsgiManagerHttpContext(httpService,
                 securityProviderTracker, userId, password, realm);
 
-            Dictionary<String, String> servletConfig = toStringConfig(config);
+            Dictionary servletConfig = toStringConfig(config);
 
             // register this servlet and take note of this
             httpService.registerServlet(this.webManagerRoot, this, servletConfig,
@@ -850,27 +851,28 @@ public class OsgiManager extends Generic
         }
     }
 
-    private Map<String, ?> getConfiguration()
+
+    private Map getConfiguration()
     {
         return configuration;
     }
 
 
-    Map<String, ?> getDefaultConfiguration()
+    Map getDefaultConfiguration()
     {
         return defaultConfiguration;
     }
 
 
-    synchronized void updateConfiguration(Dictionary<String, ?> osgiConfig)
+    synchronized void updateConfiguration( Dictionary osgiConfig )
     {
-        HashMap<String, Object> config = new HashMap<String, Object>(this.defaultConfiguration);
+        HashMap config = new HashMap( this.defaultConfiguration );
 
         if ( osgiConfig != null )
         {
-            for ( Enumeration<String> keys = osgiConfig.keys(); keys.hasMoreElements(); )
+            for ( Enumeration keys = osgiConfig.keys(); keys.hasMoreElements(); )
             {
-                final String key = keys.nextElement();
+                final Object key = keys.nextElement();
                 config.put( key, osgiConfig.get( key ) );
             }
         }
@@ -907,7 +909,7 @@ public class OsgiManager extends Generic
 
         // get enabled plugins
         String[] plugins = ConfigurationUtil.getStringArrayProperty(config, PROP_ENABLED_PLUGINS);
-        enabledPlugins = null == plugins ? null : new HashSet<String>(Arrays.asList(plugins));
+        enabledPlugins = null == plugins ? null : new HashSet(Arrays.asList(plugins));
         initInternalPlugins();
 
         // might update HTTP service registration
@@ -970,44 +972,41 @@ public class OsgiManager extends Generic
      */
     boolean isPluginDisabled(String pluginClass)
     {
-        return enabledPlugins != null && !enabledPlugins.contains(pluginClass);
+        return enabledPlugins != null && !enabledPlugins.contains( pluginClass );
     }
 
 
-    private Dictionary<String, String> toStringConfig( Map<String, ?> config )
+    private Dictionary toStringConfig( Map config )
     {
-        Dictionary<String, String> stringConfig = new Hashtable<String, String>();
-        for ( Entry<String, ?> entry : config.entrySet() )
+        Dictionary stringConfig = new Hashtable();
+        for ( Iterator ei = config.entrySet().iterator(); ei.hasNext(); )
         {
+            Entry entry = ( Entry ) ei.next();
             stringConfig.put( entry.getKey(), String.valueOf( entry.getValue() ) );
         }
         return stringConfig;
     }
 
-    private Map<String, String> langMap;
+    private Map langMap;
 
 
-    private final Map<String, String> getLangMap()
+    private final Map getLangMap()
     {
-        if ( null != langMap )
-        {
+        if (null != langMap)
             return langMap;
-        }
-
-        final Map<String, String> map = new HashMap<String, String>();
+        final Map map = new HashMap();
         final Bundle bundle = bundleContext.getBundle();
-        @SuppressWarnings("unchecked")
-        final Enumeration<URL> e = bundle.findEntries( "res/flags", null, false ); //$NON-NLS-1$
-        while ( e != null && e.hasMoreElements() )
+        final Enumeration e = bundle.findEntries("res/flags", null, false); //$NON-NLS-1$
+        while (e != null && e.hasMoreElements())
         {
-            final URL img = e.nextElement();
-            final String name = FilenameUtils.getBaseName( img.getFile() );
+            final URL img = (URL) e.nextElement();
+            final String name = FilenameUtils.getBaseName(img.getFile());
             try
             {
-                final String locale = new Locale( name, "" ).getDisplayLanguage(); //$NON-NLS-1$
-                map.put( name, null != locale ? locale : name );
+                final String locale = new Locale(name, "").getDisplayLanguage(); //$NON-NLS-1$
+                map.put(name, null != locale ? locale : name);
             }
-            catch ( Throwable t )
+            catch (Throwable t)
             {
                 t.printStackTrace();
                 /* ignore invalid locale? */

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java?rev=1228221&r1=1228220&r2=1228221&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java Fri Jan  6 15:03:17 2012
@@ -57,7 +57,7 @@ class PluginHolder implements ServiceLis
     private final BundleContext bundleContext;
 
     // registered plugins (Map<String label, Plugin plugin>)
-    private final Map<String, Plugin> plugins;
+    private final Map plugins;
 
     // The servlet context used to initialize plugin services
     private ServletContext servletContext;
@@ -69,7 +69,7 @@ class PluginHolder implements ServiceLis
     PluginHolder( final BundleContext context )
     {
         this.bundleContext = context;
-        this.plugins = new HashMap<String, Plugin>();
+        this.plugins = new HashMap();
     }
 
 
@@ -197,7 +197,7 @@ class PluginHolder implements ServiceLis
             final Plugin plugin;
             synchronized ( plugins )
             {
-                plugin = plugins.get( label );
+                plugin = ( Plugin ) plugins.get( label );
             }
 
             if ( plugin != null )
@@ -232,9 +232,9 @@ class PluginHolder implements ServiceLis
      *
      * @return The localized map of labels to titles
      */
-    Map<String, String> getLocalizedLabelMap( final ResourceBundleManager resourceBundleManager, final Locale locale )
+    Map getLocalizedLabelMap( final ResourceBundleManager resourceBundleManager, final Locale locale )
     {
-        final Map<String, String> map = new HashMap<String, String>();
+        final Map map = new HashMap();
         Plugin[] plugins = getPlugins();
         for ( int i = 0; i < plugins.length; i++ )
         {
@@ -386,7 +386,7 @@ class PluginHolder implements ServiceLis
         final Plugin oldPlugin;
         synchronized ( plugins )
         {
-            oldPlugin = plugins.remove( label );
+            oldPlugin = ( Plugin ) plugins.remove( label );
         }
 
         if ( oldPlugin != null )
@@ -400,7 +400,7 @@ class PluginHolder implements ServiceLis
     {
         synchronized ( plugins )
         {
-            return plugins.values().toArray( new Plugin[plugins.size()] );
+            return ( Plugin[] ) plugins.values().toArray( new Plugin[plugins.size()] );
         }
     }
 
@@ -562,7 +562,7 @@ class PluginHolder implements ServiceLis
         }
 
 
-        protected void doUngetConsolePlugin( @SuppressWarnings("unused") AbstractWebConsolePlugin consolePlugin )
+        protected void doUngetConsolePlugin( AbstractWebConsolePlugin consolePlugin )
         {
         }
 
@@ -575,9 +575,9 @@ class PluginHolder implements ServiceLis
         }
 
 
-        public Enumeration<String> getInitParameterNames()
+        public Enumeration getInitParameterNames()
         {
-            return new Enumeration<String>()
+            return new Enumeration()
             {
                 public boolean hasMoreElements()
                 {
@@ -585,7 +585,7 @@ class PluginHolder implements ServiceLis
                 }
 
 
-                public String nextElement()
+                public Object nextElement()
                 {
                     throw new NoSuchElementException();
                 }
@@ -682,10 +682,10 @@ class PluginHolder implements ServiceLis
         }
 
 
-        public Enumeration<String> getInitParameterNames()
+        public Enumeration getInitParameterNames()
         {
             final String[] keys = serviceReference.getPropertyKeys();
-            return new Enumeration<String>()
+            return new Enumeration()
             {
                 int idx = 0;
 
@@ -696,7 +696,7 @@ class PluginHolder implements ServiceLis
                 }
 
 
-                public String nextElement()
+                public Object nextElement()
                 {
                     if ( hasMoreElements() )
                     {
@@ -744,7 +744,7 @@ class PluginHolder implements ServiceLis
 
                 try
                 {
-                    Class<?> pluginClass = getClass().getClassLoader().loadClass(pluginClassName);
+                    Class pluginClass = getClass().getClassLoader().loadClass(pluginClassName);
                     plugin = (AbstractWebConsolePlugin) pluginClass.newInstance();
 
                     if (plugin instanceof OsgiManagerPlugin)

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java?rev=1228221&r1=1228220&r2=1228221&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java (original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java Fri Jan  6 15:03:17 2012
@@ -43,7 +43,6 @@ import org.osgi.service.startlevel.Start
  * VMStatPlugin provides the System Information tab. This particular plugin uses
  * more than one templates.
  */
-@SuppressWarnings("serial")
 public class VMStatPlugin extends SimpleWebConsolePlugin implements OsgiManagerPlugin
 {
 

Modified: felix/trunk/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java?rev=1228221&r1=1228220&r2=1228221&view=diff
==============================================================================
--- felix/trunk/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java (original)
+++ felix/trunk/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java Fri Jan  6 15:03:17 2012
@@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletRes
 import junit.framework.TestCase;
 
 
-@SuppressWarnings("serial")
 public class AbstractWebConsolePluginTest extends TestCase
 {
 
@@ -40,7 +39,7 @@ public class AbstractWebConsolePluginTes
         super.setUp();
 
         getGetResourceMethod = AbstractWebConsolePlugin.class.getDeclaredMethod( "getGetResourceMethod",
-            ( Class<?>[] ) null );
+            ( Class[] ) null );
         getGetResourceMethod.setAccessible( true );
     }
 
@@ -123,7 +122,6 @@ public class AbstractWebConsolePluginTes
 
     private static class PrivateTestPlugin extends TestPlugin
     {
-        @SuppressWarnings("unused")
         private URL getResource( String name )
         {
             return null;
@@ -132,7 +130,6 @@ public class AbstractWebConsolePluginTes
 
     private static class ProtectedTestPlugin extends TestPlugin
     {
-        @SuppressWarnings("unused")
         protected URL getResource( String name )
         {
             return null;
@@ -141,7 +138,6 @@ public class AbstractWebConsolePluginTes
 
     private static class PackageTestPlugin extends TestPlugin
     {
-        @SuppressWarnings("unused")
         URL getResource( String name )
         {
             return null;
@@ -150,7 +146,6 @@ public class AbstractWebConsolePluginTes
 
     private static class PublicTestPlugin extends TestPlugin
     {
-        @SuppressWarnings("unused")
         public URL getResource( String name )
         {
             return null;