FELIX-3283 Revert generification, using annotations, and improved for-loops (commit #1215540)
- keep Java 1.4 animal sniffer plugin
- export webconsole from pom again (but add provide:=true for proper re-import)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1228221 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/pom.xml b/webconsole/pom.xml
index 8fd55e2..b6f4107 100644
--- a/webconsole/pom.xml
+++ b/webconsole/pom.xml
@@ -81,14 +81,6 @@
</execution>
</executions>
</plugin>
- <!-- Allow certain Java 5 features, generate Java 1.4 class files -->
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>5</source>
- <target>jsr14</target>
- </configuration>
- </plugin>
<!-- Make sure to not use non Java 1.4 API -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -129,6 +121,9 @@
<Bundle-Activator>
org.apache.felix.webconsole.internal.OsgiManagerActivator
</Bundle-Activator>
+ <Export-Package>
+ org.apache.felix.webconsole;version=3.1.2;provide:=true
+ </Export-Package>
<Import-Package>
org.osgi.service.metatype;resolution:=optional,
javax.servlet.*;version=2.4,
@@ -276,13 +271,5 @@
<optional>true</optional>
</dependency>
- <!-- BND annotations -->
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bndlib</artifactId>
- <version>1.50.0</version>
- <scope>provided</scope>
- </dependency>
-
</dependencies>
</project>
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
index 089c2bd..baa9c7d 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/AbstractWebConsolePlugin.java
@@ -22,7 +22,6 @@
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
-import java.util.Map.Entry;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
@@ -175,7 +174,7 @@
* @param request the original request passed from the HTTP server
* @return <code>true</code> if the page should have headers and footers rendered
*/
- protected boolean isHtmlRequest( @SuppressWarnings("unused") final HttpServletRequest request )
+ protected boolean isHtmlRequest( final HttpServletRequest request )
{
return true;
}
@@ -338,7 +337,7 @@
{
try
{
- Class<?> cl = resourceProvider.getClass();
+ Class cl = resourceProvider.getClass();
while ( tmpGetResourceMethod == null && cl != Object.class )
{
Method[] methods = cl.getDeclaredMethods();
@@ -622,14 +621,15 @@
boolean disabled = false;
String appRoot = ( String ) request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT );
- @SuppressWarnings("unchecked")
- Map<String, String> labelMap = ( Map<String, String> ) request.getAttribute( WebConsoleConstants.ATTR_LABEL_MAP );
+ Map labelMap = ( Map ) request.getAttribute( WebConsoleConstants.ATTR_LABEL_MAP );
if ( labelMap != null )
{
// prepare the navigation
- SortedMap<String, String> map = new TreeMap<String, String>( String.CASE_INSENSITIVE_ORDER );
- for (Entry<String, String> labelMapEntry : labelMap.entrySet()) {
+ SortedMap map = new TreeMap( String.CASE_INSENSITIVE_ORDER );
+ for ( Iterator ri = labelMap.entrySet().iterator(); ri.hasNext(); )
+ {
+ Map.Entry labelMapEntry = ( Map.Entry ) ri.next();
if ( labelMapEntry.getKey() == null )
{
// ignore renders without a label
@@ -656,7 +656,7 @@
// render the navigation
pw.println("<div id='technav' class='ui-widget ui-widget-header'>"); //$NON-NLS-1$
- for ( Iterator<String> li = map.values().iterator(); li.hasNext(); )
+ for ( Iterator li = map.values().iterator(); li.hasNext(); )
{
pw.print(' ');
pw.println( li.next() );
@@ -666,8 +666,7 @@
}
// render lang-box
- @SuppressWarnings("unchecked")
- Map<String, String> langMap = (Map<String, String>) request.getAttribute(WebConsoleConstants.ATTR_LANG_MAP);
+ Map langMap = (Map) request.getAttribute(WebConsoleConstants.ATTR_LANG_MAP);
if (null != langMap && !langMap.isEmpty())
{
// determine the currently selected locale from the request and fail-back
@@ -690,7 +689,7 @@
printLocaleElement(pw, appRoot, locale, langMap.get(locale));
pw.println(" </span>"); //$NON-NLS-1$
pw.println(" <span class='flags ui-helper-hidden'>"); //$NON-NLS-1$
- for (Iterator<String> li = langMap.keySet().iterator(); li.hasNext();)
+ for (Iterator li = langMap.keySet().iterator(); li.hasNext();)
{
// <img src="us.gif" alt="en" title="English"/>
final Object l = li.next();
@@ -870,7 +869,7 @@
return readTemplateFile( getClass(), templateFile );
}
- private final String readTemplateFile( final Class<?> clazz, final String templateFile)
+ private final String readTemplateFile( final Class clazz, final String templateFile)
{
InputStream templateStream = clazz.getResourceAsStream( templateFile );
if ( templateStream != null )
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
index 3e95e5f..baf7f67 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/DefaultVariableResolver.java
@@ -31,7 +31,7 @@
* {@link WebConsoleUtil#getVariableResolver(javax.servlet.ServletRequest)}
* as the variable resolver if none has yet been assigned to the request.
*/
-public class DefaultVariableResolver extends HashMap<String, String> implements VariableResolver
+public class DefaultVariableResolver extends HashMap implements VariableResolver
{
private static final long serialVersionUID = 4148807223433047780L;
@@ -48,7 +48,7 @@
/**
* Creates a new variable resolver and initializes both - capacity & load factor
- *
+ *
* @param initialCapacity the initial capacity of the variable container
* @param loadFactor the load factor of the variable container
* @see HashMap#HashMap(int, float)
@@ -61,7 +61,7 @@
/**
* Creates a new variable resolver with specified initial capacity
- *
+ *
* @param initialCapacity the initial capacity of the variable container
* @see HashMap#HashMap(int)
*/
@@ -73,11 +73,11 @@
/**
* Creates a new variable resolver copying the variables from the given map.
- *
+ *
* @param source the map whose variables are to be placed in this resolver.
* @see HashMap#HashMap(Map)
*/
- public DefaultVariableResolver( final Map<String, String> source )
+ public DefaultVariableResolver( final Map source )
{
super( source );
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java b/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
index 1d61bd9..8bb3a60 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/SimpleWebConsolePlugin.java
@@ -22,6 +22,7 @@
import java.net.URL;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Map;
import org.osgi.framework.BundleContext;
@@ -56,7 +57,7 @@
private ServiceRegistration reg;
// used to obtain services. Structure is: service name -> ServiceTracker
- private final Map<String, ServiceTracker> services = new HashMap<String, ServiceTracker>();
+ private final Map services = new HashMap();
/**
@@ -150,7 +151,7 @@
{
activate( bc ); // don't know why this is needed!
- Hashtable<String, String> props = new Hashtable<String, String>();
+ Hashtable props = new Hashtable();
props.put( WebConsoleConstants.PLUGIN_LABEL, label );
props.put( WebConsoleConstants.PLUGIN_TITLE, title );
reg = bc.registerService( "javax.servlet.Servlet", this, props ); //$NON-NLS-1$
@@ -189,7 +190,7 @@
*/
public final Object getService( String serviceName )
{
- ServiceTracker serviceTracker = services.get( serviceName );
+ ServiceTracker serviceTracker = ( ServiceTracker ) services.get( serviceName );
if ( serviceTracker == null )
{
serviceTracker = new ServiceTracker( getBundleContext(), serviceName, null );
@@ -211,11 +212,12 @@
*/
public void deactivate()
{
- for ( ServiceTracker tracker : services.values() )
+ for ( Iterator ti = services.values().iterator(); ti.hasNext(); )
{
+ ServiceTracker tracker = ( ServiceTracker ) ti.next();
tracker.close();
+ ti.remove();
}
- services.clear();
super.deactivate();
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
index d97678d..6fb96d1 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/WebConsoleUtil.java
@@ -23,6 +23,7 @@
import java.lang.reflect.Array;
import java.net.URLDecoder;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -83,8 +84,8 @@
final DefaultVariableResolver resolver = new DefaultVariableResolver();
// FIXME: don't we need a constant for the values below?
- resolver.put( "appRoot", (String) request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT ) ); //$NON-NLS-1$
- resolver.put( "pluginRoot", (String) request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT ) ); //$NON-NLS-1$
+ resolver.put( "appRoot", request.getAttribute( WebConsoleConstants.ATTR_APP_ROOT ) ); //$NON-NLS-1$
+ resolver.put( "pluginRoot", request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT ) ); //$NON-NLS-1$
setVariableResolver( request, resolver );
return resolver;
}
@@ -130,8 +131,7 @@
}
// check, whether we already have the parameters
- @SuppressWarnings("unchecked")
- Map<String, FileItem[]> params = ( Map<String, FileItem[]> ) request.getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
+ Map params = ( Map ) request.getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
if ( params == null )
{
// parameters not read yet, read now
@@ -144,13 +144,14 @@
upload.setSizeMax( -1 );
// Parse the request
- params = new HashMap<String, FileItem[]>();
+ params = new HashMap();
try
{
- @SuppressWarnings("unchecked")
- List<FileItem> items = upload.parseRequest( request );
- for (final FileItem fi : items) {
- FileItem[] current = params.get( fi.getFieldName() );
+ List items = upload.parseRequest( request );
+ for ( Iterator fiter = items.iterator(); fiter.hasNext(); )
+ {
+ FileItem fi = ( FileItem ) fiter.next();
+ FileItem[] current = ( FileItem[] ) params.get( fi.getFieldName() );
if ( current == null )
{
current = new FileItem[]
@@ -173,7 +174,7 @@
request.setAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD, params );
}
- FileItem[] param = params.get( name );
+ FileItem[] param = ( FileItem[] ) params.get( name );
if ( param != null )
{
for ( int i = 0; i < param.length; i++ )
@@ -349,7 +350,6 @@
* @param value the value to decode
* @return the decoded string
*/
- @SuppressWarnings("deprecation")
public static String urlDecode( final String value )
{
// shortcut for empty or missing values
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
index f897d55..c90cb63 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/Util.java
@@ -133,21 +133,21 @@
* @param e the enumeration which to convert
* @return the list containing all enumeration entries.
*/
- public static final <T> ArrayList<T> list( Enumeration<T> e )
+ public static final ArrayList list( Enumeration e )
{
- ArrayList<T> l = new ArrayList<T>();
+ ArrayList l = new ArrayList();
while ( e.hasMoreElements() )
{
l.add( e.nextElement() );
}
return l;
}
-
+
/**
* This method expects a locale string in format language_COUNTRY, or
* language. The method will determine which is the correct form of locale
* string and construct a <code>Locale</code> object.
- *
+ *
* @param locale the locale string, if <code>null</code> - default locale is
* returned
* @return a locale object
@@ -180,7 +180,7 @@
return new Locale(language, country);
}
- private static final class BundleNameComparator implements Comparator<Bundle>
+ private static final class BundleNameComparator implements Comparator
{
private final Locale locale;
@@ -191,6 +191,12 @@
}
+ public int compare( Object o1, Object o2 )
+ {
+ return compare( ( Bundle ) o1, ( Bundle ) o2 );
+ }
+
+
public int compare( Bundle b1, Bundle b2 )
{
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
index 06ba761..2d1c57c 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/WebConsolePluginAdapter.java
@@ -248,14 +248,14 @@
}
else if ( value != null )
{
- final Collection<?> cssListColl;
+ final Collection cssListColl;
if ( value.getClass().isArray() )
{
cssListColl = Arrays.asList( ( Object[] ) value );
}
else if ( value instanceof Collection )
{
- cssListColl = ( Collection<?> ) value;
+ cssListColl = ( Collection ) value;
}
else
{
@@ -266,7 +266,7 @@
{
String[] entries = new String[cssListColl.size()];
int i = 0;
- for ( Iterator<?> cli = cssListColl.iterator(); cli.hasNext(); i++ )
+ for ( Iterator cli = cssListColl.iterator(); cli.hasNext(); i++ )
{
entries[i] = String.valueOf( cli.next() );
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
index f66b120..a806e6a 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
@@ -26,6 +26,7 @@
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -64,7 +65,6 @@
/**
* The <code>ConfigManager</code> TODO
*/
-@SuppressWarnings("serial")
public class ConfigManager extends ConfigManagerBase
{
private static final String LABEL = "configMgr"; // was name
@@ -286,10 +286,11 @@
try
{
pw.write( "[" );
- final Map<String, String> services = this.getServices( pid, pidFilter, locale, false );
+ final Map services = this.getServices( pid, pidFilter, locale, false );
boolean printColon = false;
- for ( final String servicePid : services.keySet() )
+ for ( Iterator spi = services.keySet().iterator(); spi.hasNext(); )
{
+ final String servicePid = ( String ) spi.next();
final Configuration config = getConfiguration( ca, servicePid );
if ( config != null )
{
@@ -438,12 +439,13 @@
{
try
{
- Map<String, String> optionsFactory = getServices(ManagedServiceFactory.class.getName(),
+ Map optionsFactory = getServices(ManagedServiceFactory.class.getName(),
pidFilter, locale, true);
addMetaTypeNames(optionsFactory, getFactoryPidObjectClasses(locale),
pidFilter, ConfigurationAdmin.SERVICE_FACTORYPID);
- for ( String id : optionsFactory.keySet() )
+ for ( Iterator ii = optionsFactory.keySet().iterator(); ii.hasNext(); )
{
+ String id = ( String ) ii.next();
Object name = optionsFactory.get( id );
json.append( "fpids", new JSONObject().put( "id", id ).put( "name", name ) );
}
@@ -460,7 +462,7 @@
try
{
// start with ManagedService instances
- Map<String, String> optionsPlain = getServices(ManagedService.class.getName(), pidFilter,
+ Map optionsPlain = getServices(ManagedService.class.getName(), pidFilter,
locale, true);
// next are the MetaType informations without ManagedService
@@ -504,8 +506,9 @@
}
}
- for ( String id : optionsPlain.keySet() )
+ for ( Iterator ii = optionsPlain.keySet().iterator(); ii.hasNext(); )
{
+ String id = ( String ) ii.next();
Object name = optionsPlain.get( id );
final Configuration config = getConfiguration( ca, id );
@@ -554,11 +557,11 @@
}
- private SortedMap<String, String> getServices( String serviceClass, String serviceFilter, String locale,
+ private SortedMap getServices( String serviceClass, String serviceFilter, String locale,
boolean ocdRequired ) throws InvalidSyntaxException
{
// sorted map of options
- SortedMap<String, String> optionsFactory = new TreeMap<String, String>( String.CASE_INSENSITIVE_ORDER );
+ SortedMap optionsFactory = new TreeMap( String.CASE_INSENSITIVE_ORDER );
// find all ManagedServiceFactories to get the factoryPIDs
ServiceReference[] refs = this.getBundleContext().getServiceReferences( serviceClass, serviceFilter );
@@ -590,7 +593,7 @@
}
- private void addMetaTypeNames( final Map<String, String> pidMap, final Map<String, ObjectClassDefinition> ocdCollection, final String filterSpec, final String type )
+ private void addMetaTypeNames( final Map pidMap, final Map ocdCollection, final String filterSpec, final String type )
{
Filter filter = null;
if ( filterSpec != null )
@@ -605,17 +608,18 @@
}
}
- for ( Entry<String, ObjectClassDefinition> ociEntry : ocdCollection.entrySet() )
+ for ( Iterator ei = ocdCollection.entrySet().iterator(); ei.hasNext(); )
{
- final String pid = ociEntry.getKey();
- final ObjectClassDefinition ocd = ociEntry.getValue();
+ Entry ociEntry = ( Entry ) ei.next();
+ final String pid = ( String ) ociEntry.getKey();
+ final ObjectClassDefinition ocd = ( ObjectClassDefinition ) ociEntry.getValue();
if ( filter == null )
{
pidMap.put( pid, ocd.getName() );
}
else
{
- final Dictionary<String, String> props = new Hashtable<String, String>();
+ final Dictionary props = new Hashtable();
props.put( type, pid );
if ( filter.match( props ) )
{
@@ -649,7 +653,6 @@
}
- @SuppressWarnings("unchecked")
private void configForm( JSONWriter json, String pid, Configuration config, String pidFilter, String locale )
throws JSONException
{
@@ -663,7 +666,7 @@
json.value( pidFilter );
}
- Dictionary<String, ?> props = null;
+ Dictionary props = null;
ObjectClassDefinition ocd;
if ( config != null )
{
@@ -677,7 +680,7 @@
if ( props == null )
{
- props = new Hashtable<String, Object>();
+ props = new Hashtable();
}
if ( ocd != null )
@@ -693,9 +696,9 @@
+ "of the OSGi Metatype Service or the absence of a MetaType descriptor for this configuration." );
json.key( "properties" ).object();
- for ( Enumeration<String> pe = props.keys(); pe.hasMoreElements(); )
+ for ( Enumeration pe = props.keys(); pe.hasMoreElements(); )
{
- final String id = pe.nextElement();
+ final String id = ( String ) pe.nextElement();
// ignore well known special properties
if ( !id.equals( Constants.SERVICE_PID ) && !id.equals( Constants.SERVICE_DESCRIPTION )
@@ -719,7 +722,7 @@
}
- private void mergeWithMetaType( Dictionary<String, ?> props, ObjectClassDefinition ocd, JSONWriter json ) throws JSONException
+ private void mergeWithMetaType( Dictionary props, ObjectClassDefinition ocd, JSONWriter json ) throws JSONException
{
json.key( "title" ).value( ocd.getName() );
@@ -732,8 +735,9 @@
if ( ad != null )
{
json.key( "properties" ).object();
- for ( AttributeDefinition adi : ad )
+ for ( int i = 0; i < ad.length; i++ )
{
+ final AttributeDefinition adi = ad[i];
final String attrId = adi.getID();
json.key( attrId );
attributeToJson( json, adi, props.get( attrId ) );
@@ -769,8 +773,7 @@
}
else
{
- @SuppressWarnings("unchecked")
- Dictionary<String, ?> headers = bundle.getHeaders( locale );
+ Dictionary headers = bundle.getHeaders( locale );
String name = ( String ) headers.get( Constants.BUNDLE_NAME );
if ( name == null )
{
@@ -839,19 +842,18 @@
{
config = getConfiguration( ca, pid, factoryPid );
- @SuppressWarnings("unchecked")
- Dictionary<String, Object> props = config.getProperties();
+ Dictionary props = config.getProperties();
if ( props == null )
{
- props = new Hashtable<String, Object>();
+ props = new Hashtable();
}
- Map<String, AttributeDefinition> adMap = this.getAttributeDefinitionMap( config, null );
+ Map adMap = this.getAttributeDefinitionMap( config, null );
StringTokenizer propTokens = new StringTokenizer( propertyList, "," );
while ( propTokens.hasMoreTokens() )
{
String propName = propTokens.nextToken();
- AttributeDefinition ad = adMap.get( propName );
+ AttributeDefinition ad = (AttributeDefinition) adMap.get( propName );
// try to derive from current value
if (ad == null) {
@@ -890,7 +892,7 @@
else
{
// array or vector of any type
- Vector<Object> vec = new Vector<Object>();
+ Vector vec = new Vector();
String[] properties = request.getParameterValues( propName );
if ( properties != null )
@@ -1019,7 +1021,7 @@
}
else if ( value instanceof Vector )
{
- value = ( ( Vector<?> ) value ).get( 0 );
+ value = ( ( Vector ) value ).get( 0 );
}
else if ( value.getClass().isArray() )
{
@@ -1057,7 +1059,7 @@
{
int attrType;
int attrCardinality;
- Class<?> type;
+ Class type;
if ( value == null )
{
@@ -1067,7 +1069,7 @@
else if ( value instanceof Collection )
{
attrCardinality = Integer.MIN_VALUE;
- Collection<?> coll = ( Collection<?> ) value;
+ Collection coll = ( Collection ) value;
if ( coll.isEmpty() )
{
type = String.class;
@@ -1172,11 +1174,11 @@
}
- private static List<?> toList( Object value )
+ private static List toList( Object value )
{
if ( value instanceof Vector )
{
- return ( Vector<?> ) value;
+ return ( Vector ) value;
}
else if ( value.getClass().isArray() )
{
@@ -1199,9 +1201,9 @@
}
- private static void setPasswordProps( final Vector<Object> vec, final String[] properties, Object props )
+ private static void setPasswordProps( final Vector vec, final String[] properties, Object props )
{
- List<?> propList = toList( props );
+ List propList = toList( props );
for ( int i = 0; i < properties.length; i++ )
{
if ( PASSWORD_PLACEHOLDER_VALUE.equals( properties[i] ) )
@@ -1219,7 +1221,7 @@
}
- private static final Object toArray( int type, Vector<?> values )
+ private static final Object toArray( int type, Vector values )
{
int size = values.size();
@@ -1306,7 +1308,6 @@
}
- @SuppressWarnings("rawtypes")
public Dictionary getProperties()
{
// dummy configuration has no properties
@@ -1320,7 +1321,7 @@
}
- public void update( @SuppressWarnings("rawtypes") Dictionary properties )
+ public void update( Dictionary properties )
{
// dummy configuration cannot be updated
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
index d6aaac1..99cbf8e 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManagerBase.java
@@ -75,7 +75,7 @@
* @param locale The name of the locale to get the meta data for.
* @return see the method description
*/
- protected Map<String, ObjectClassDefinition> getPidObjectClasses( final String locale )
+ protected Map getPidObjectClasses( final String locale )
{
return getObjectClassDefinitions( PID_GETTER, locale );
}
@@ -90,7 +90,7 @@
* @param locale The name of the locale to get the meta data for.
* @return see the method description
*/
- protected Map<String, ObjectClassDefinition> getFactoryPidObjectClasses( final String locale )
+ protected Map getFactoryPidObjectClasses( final String locale )
{
return getObjectClassDefinitions( FACTORY_PID_GETTER, locale );
}
@@ -109,9 +109,9 @@
* @return Map of <code>ObjectClassDefinition</code> objects indexed by the
* PID (or factory PID) to which they pertain
*/
- private Map<String, ObjectClassDefinition> getObjectClassDefinitions( final IdGetter idGetter, final String locale )
+ private Map getObjectClassDefinitions( final IdGetter idGetter, final String locale )
{
- final Map<String, ObjectClassDefinition> objectClassesDefinitions = new HashMap<String, ObjectClassDefinition>();
+ final Map objectClassesDefinitions = new HashMap();
final MetaTypeService mts = this.getMetaTypeService();
if ( mts != null )
{
@@ -242,9 +242,9 @@
}
- protected Map<String, AttributeDefinition> getAttributeDefinitionMap( Configuration config, String locale )
+ protected Map getAttributeDefinitionMap( Configuration config, String locale )
{
- Map<String, AttributeDefinition> adMap = new HashMap<String, AttributeDefinition>();
+ Map adMap = new HashMap();
ObjectClassDefinition ocd = this.getObjectClassDefinition( config, locale );
if ( ocd != null )
{
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
index d14eabe..05acf2e 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigurationAdminConfigurationPrinter.java
@@ -71,15 +71,15 @@
Configuration[] configs = ca.listConfigurations( null );
if ( configs != null && configs.length > 0 )
{
- SortedMap<String, Configuration> sm = new TreeMap<String, Configuration>();
+ SortedMap sm = new TreeMap();
for ( int i = 0; i < configs.length; i++ )
{
sm.put( configs[i].getPid(), configs[i] );
}
- for ( Iterator<Configuration> mi = sm.values().iterator(); mi.hasNext(); )
+ for ( Iterator mi = sm.values().iterator(); mi.hasNext(); )
{
- this.printConfiguration( pw, mi.next() );
+ this.printConfiguration( pw, ( Configuration ) mi.next() );
}
}
else
@@ -111,18 +111,18 @@
String loc = ( config.getBundleLocation() != null ) ? config.getBundleLocation() : "Unbound";
ConfigurationRender.infoLine( pw, " ", "BundleLocation", loc );
- @SuppressWarnings("unchecked")
- Dictionary<String, ?> props = config.getProperties();
+ Dictionary props = config.getProperties();
if ( props != null )
{
- SortedSet<String> keys = new TreeSet<String>();
- for ( Enumeration<String> ke = props.keys(); ke.hasMoreElements(); )
+ SortedSet keys = new TreeSet();
+ for ( Enumeration ke = props.keys(); ke.hasMoreElements(); )
{
keys.add( ke.nextElement() );
}
- for ( String key : keys )
+ for ( Iterator ki = keys.iterator(); ki.hasNext(); )
{
+ String key = ( String ) ki.next();
ConfigurationRender.infoLine( pw, " ", key, props.get( key ) );
}
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
index 06dc5ff..db2c660 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/LogServlet.java
@@ -39,7 +39,6 @@
/**
* LogServlet provides support for reading the log messages.
*/
-@SuppressWarnings("serial")
public class LogServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin
{
private static final String LABEL = "logs";
@@ -95,7 +94,7 @@
if ( logReaderService != null )
{
int index = 0;
- for ( Enumeration<?> logEntries = logReaderService.getLog(); logEntries.hasMoreElements()
+ for ( Enumeration logEntries = logReaderService.getLog(); logEntries.hasMoreElements()
&& index < MAX_LOGS; )
{
LogEntry nextLog = ( LogEntry ) logEntries.nextElement();
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
index 8a5fd2b..acf26d5 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/WireAdminConfigurationPrinter.java
@@ -170,7 +170,7 @@
}
}
- Class<?>[] flavors = wire.getFlavors();
+ Class[] flavors = wire.getFlavors();
if (flavors == null)
{
pw.println(" Flavors: none");
@@ -187,7 +187,7 @@
pw.println();
}
- Dictionary<?, ?> props = wire.getProperties();
+ Dictionary props = wire.getProperties();
if (props == null)
{
pw.println(" Properties: none");
@@ -195,7 +195,7 @@
else
{
pw.println(" Properties: ");
- for (Enumeration<?> e = props.keys(); e.hasMoreElements();)
+ for (Enumeration e = props.keys(); e.hasMoreElements();)
{
final Object key = e.nextElement();
pw.print(" "); //$NON-NLS-1$
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
index 2c5f135..d1abb70 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesConfigurationPrinter.java
@@ -20,6 +20,7 @@
import java.io.PrintWriter;
import java.text.MessageFormat;
import java.util.*;
+
import org.apache.felix.webconsole.internal.AbstractConfigurationPrinter;
import org.osgi.framework.*;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -102,7 +103,7 @@
{
final Bundle[] bundles = this.getBundleContext().getBundles();
// create a map for sorting first
- final TreeMap<String, String> bundlesMap = new TreeMap<String, String>();
+ final TreeMap bundlesMap = new TreeMap();
int active = 0, installed = 0, resolved = 0, fragments = 0;
for( int i =0; i<bundles.length; i++)
{
@@ -175,9 +176,12 @@
}
pw.println(buffer.toString());
pw.println("-----------------------------------------------------------------------------");
- for ( final String bundle : bundlesMap.values() )
+ final Iterator i = bundlesMap.entrySet().iterator();
+ while ( i.hasNext() )
{
- pw.println( bundle );
+ final Map.Entry entry = (Map.Entry)i.next();
+ pw.println(entry.getValue());
+
}
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
index a13698d..2bbdf49 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
@@ -49,7 +49,6 @@
* the list of bundles, installed on the framework. It also adds ability to control
* the lifecycle of the bundles, like start, stop, uninstall, install.
*/
-@SuppressWarnings("serial")
public class BundlesServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin, ConfigurationPrinter
{
@@ -119,7 +118,7 @@
bootPkgs[i] = bootDelegation;
}
- Hashtable<String, Object> props = new Hashtable<String, Object>();
+ Hashtable props = new Hashtable();
props.put( WebConsoleConstants.CONFIG_PRINTER_MODES, new String[] { ConfigurationPrinter.MODE_TXT,
ConfigurationPrinter.MODE_ZIP } );
configurationPrinter = bundleContext.registerService( ConfigurationPrinter.SERVICE, this, props );
@@ -466,7 +465,7 @@
// prepare variables
DefaultVariableResolver vars = ( ( DefaultVariableResolver ) WebConsoleUtil.getVariableResolver( request ) );
vars.put( "startLevel", String.valueOf(startLevel));
- vars.put( "drawDetails", String.valueOf(reqInfo.bundleRequested));
+ vars.put( "drawDetails", reqInfo.bundleRequested ? Boolean.TRUE : Boolean.FALSE );
vars.put( "currentBundle", (reqInfo.bundleRequested && reqInfo.bundle != null ? String.valueOf(reqInfo.bundle.getBundleId()) : "null"));
final String pluginRoot = ( String ) request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT );
@@ -519,7 +518,7 @@
else if (filter != null)
{
Filter f = getBundleContext().createFilter(filter);
- ArrayList<Bundle> list = new ArrayList<Bundle>(allBundles.length);
+ ArrayList list = new ArrayList(allBundles.length);
final String localeString = locale.toString();
for (int i = 0, size = allBundles.length; i < size; i++)
{
@@ -719,8 +718,7 @@
private final void bundleDetails( JSONWriter jw, Bundle bundle, final String pluginRoot, final String servicesRoot, final Locale locale)
throws JSONException
{
- @SuppressWarnings("unchecked")
- Dictionary<String, String> headers = bundle.getHeaders( locale == null ? null : locale.toString() );
+ Dictionary headers = bundle.getHeaders( locale == null ? null : locale.toString() );
jw.key( "props" );
jw.array();
@@ -729,7 +727,7 @@
WebConsoleUtil.keyVal( jw, "Bundle Location", bundle.getLocation() );
WebConsoleUtil.keyVal( jw, "Last Modification", new Date( bundle.getLastModified() ) );
- String docUrl = headers.get( Constants.BUNDLE_DOCURL );
+ String docUrl = ( String ) headers.get( Constants.BUNDLE_DOCURL );
if ( docUrl != null )
{
WebConsoleUtil.keyVal( jw, "Bundle Documentation", docUrl );
@@ -789,18 +787,24 @@
return;
}
- Map<String, Bundle> usingBundles = new TreeMap<String, Bundle>();
+ Map usingBundles = new TreeMap();
ExportedPackage[] exports = packageAdmin.getExportedPackages( bundle );
if ( exports != null && exports.length > 0 )
{
// do alphabetical sort
- Arrays.sort( exports, new Comparator<ExportedPackage>()
+ Arrays.sort( exports, new Comparator()
{
public int compare( ExportedPackage p1, ExportedPackage p2 )
{
return p1.getName().compareTo( p2.getName() );
}
+
+
+ public int compare( Object o1, Object o2 )
+ {
+ return compare( ( ExportedPackage ) o1, ( ExportedPackage ) o2 );
+ }
} );
JSONArray val = new JSONArray();
@@ -831,7 +835,7 @@
if ( exports != null && exports.length > 0 )
{
// collect import packages first
- final List<ExportedPackage> imports = new ArrayList<ExportedPackage>();
+ final List imports = new ArrayList();
for ( int i = 0; i < exports.length; i++ )
{
final ExportedPackage ep = exports[i];
@@ -850,14 +854,20 @@
JSONArray val = new JSONArray();
if ( imports.size() > 0 )
{
- final ExportedPackage[] packages = imports.toArray( new ExportedPackage[imports
+ final ExportedPackage[] packages = ( ExportedPackage[] ) imports.toArray( new ExportedPackage[imports
.size()] );
- Arrays.sort( packages, new Comparator<ExportedPackage>()
+ Arrays.sort( packages, new Comparator()
{
public int compare( ExportedPackage p1, ExportedPackage p2 )
{
return p1.getName().compareTo( p2.getName() );
}
+
+
+ public int compare( Object o1, Object o2 )
+ {
+ return compare( ( ExportedPackage ) o1, ( ExportedPackage ) o2 );
+ }
} );
// and finally print out
for ( int i = 0; i < packages.length; i++ )
@@ -878,8 +888,9 @@
if ( !usingBundles.isEmpty() )
{
JSONArray val = new JSONArray();
- for ( final Bundle usingBundle : usingBundles.values() )
+ for ( Iterator ui = usingBundles.values().iterator(); ui.hasNext(); )
{
+ Bundle usingBundle = ( Bundle ) ui.next();
val.put( getBundleDescriptor( usingBundle, pluginRoot ) );
}
WebConsoleUtil.keyVal( jw, "Importing Bundles", val );
@@ -889,22 +900,27 @@
private void listImportExportsUnresolved( JSONWriter jw, Bundle bundle, final String pluginRoot ) throws JSONException
{
- @SuppressWarnings("unchecked")
- Dictionary<String, String> dict = bundle.getHeaders();
+ Dictionary dict = bundle.getHeaders();
- String target = dict.get( Constants.EXPORT_PACKAGE );
+ String target = ( String ) dict.get( Constants.EXPORT_PACKAGE );
if ( target != null )
{
Clause[] pkgs = Parser.parseHeader( target );
if ( pkgs != null && pkgs.length > 0 )
{
// do alphabetical sort
- Arrays.sort( pkgs, new Comparator<Clause>()
+ Arrays.sort( pkgs, new Comparator()
{
public int compare( Clause p1, Clause p2 )
{
return p1.getName().compareTo( p2.getName() );
}
+
+
+ public int compare( Object o1, Object o2 )
+ {
+ return compare( ( Clause) o1, ( Clause ) o2 );
+ }
} );
JSONArray val = new JSONArray();
@@ -921,13 +937,13 @@
}
}
- target = dict.get( Constants.IMPORT_PACKAGE );
+ target = ( String ) dict.get( Constants.IMPORT_PACKAGE );
if ( target != null )
{
Clause[] pkgs = Parser.parseHeader( target );
if ( pkgs != null && pkgs.length > 0 )
{
- Map<String, Clause> imports = new TreeMap<String, Clause>();
+ Map imports = new TreeMap();
for ( int i = 0; i < pkgs.length; i++ )
{
Clause pkg = pkgs[i];
@@ -935,7 +951,7 @@
}
// collect import packages first
- final Map<String, ExportedPackage> candidates = new HashMap<String, ExportedPackage>();
+ final Map candidates = new HashMap();
PackageAdmin packageAdmin = getPackageAdmin();
if ( packageAdmin != null )
{
@@ -947,7 +963,7 @@
{
final ExportedPackage ep = exports[i];
- Clause imp = imports.get( ep.getName() );
+ Clause imp = ( Clause ) imports.get( ep.getName() );
if ( imp != null && isSatisfied( imp, ep ) )
{
candidates.put( ep.getName(), ep );
@@ -960,8 +976,10 @@
JSONArray val = new JSONArray();
if ( imports.size() > 0 )
{
- for (final Clause r4Import : imports.values()) {
- ExportedPackage ep = candidates.get( r4Import.getName() );
+ for ( Iterator ii = imports.values().iterator(); ii.hasNext(); )
+ {
+ Clause r4Import = ( Clause ) ii.next();
+ ExportedPackage ep = ( ExportedPackage ) candidates.get( r4Import.getName() );
// if there is no matching export, check whether this
// bundle has the package, ignore the entry in this case
@@ -990,11 +1008,13 @@
}
}
- private String getServiceID(ServiceReference ref, final String servicesRoot) {
+ private String getServiceID(ServiceReference ref, final String servicesRoot)
+ {
String id = ref.getProperty( Constants.SERVICE_ID ).toString();
StringBuffer val = new StringBuffer();
- if ( servicesRoot != null ) {
+ if ( servicesRoot != null )
+ {
val.append( "<a href='" ).append( servicesRoot ).append( id ).append( "'>" );
val.append( id );
val.append( "</a>" );
@@ -1040,9 +1060,8 @@
{
JSONArray val = new JSONArray();
- @SuppressWarnings("unchecked")
- Dictionary<String, String> headers = bundle.getHeaders(""); // don't localize at all - raw headers
- Enumeration<String> he = headers.keys();
+ Dictionary headers = bundle.getHeaders(""); // don't localize at all - raw headers
+ Enumeration he = headers.keys();
while ( he.hasMoreElements() )
{
Object header = he.nextElement();
@@ -1396,9 +1415,7 @@
{
// get the uploaded data
- @SuppressWarnings("unchecked")
- final Map<String, FileItem[]> params = ( Map<String, FileItem[]> ) request
- .getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
+ final Map params = ( Map ) request.getAttribute( AbstractWebConsolePlugin.ATTR_FILEUPLOAD );
if ( params == null )
{
return;
@@ -1471,9 +1488,9 @@
}
- private FileItem getParameter( Map<String, FileItem[]> params, String name )
+ private FileItem getParameter( Map params, String name )
{
- FileItem[] items = params.get( name );
+ FileItem[] items = ( FileItem[] ) params.get( name );
if ( items != null )
{
for ( int i = 0; i < items.length; i++ )
@@ -1490,10 +1507,10 @@
}
- private FileItem[] getFileItems( Map<String, FileItem[]> params, String name )
+ private FileItem[] getFileItems( Map params, String name )
{
- final List<FileItem> files = new ArrayList<FileItem>();
- FileItem[] items = params.get( name );
+ final List files = new ArrayList();
+ FileItem[] items = ( FileItem[] ) params.get( name );
if ( items != null )
{
for ( int i = 0; i < items.length; i++ )
@@ -1505,7 +1522,7 @@
}
}
- return files.toArray( new FileItem[files.size()] );
+ return ( FileItem[] ) files.toArray( new FileItem[files.size()] );
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
index 83b282d..1701350 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/PermissionsConfigurationPrinter.java
@@ -102,7 +102,7 @@
try
{
getAccessDecision = ConditionalPermissionInfo.class.getMethod( "getAccessDecision",
- ( Class<?>[] ) null );
+ ( Class[] ) null );
}
catch (Throwable t)
{
@@ -112,7 +112,7 @@
boolean hasPermissions = false;
//final java.util.List list = cpa.newConditionalPermissionUpdate().getConditionalPermissionInfos();
//for (int i = 0; list != null && i < list.size(); i++)
- for (Enumeration<?> e = cpa.getConditionalPermissionInfos(); e.hasMoreElements();)
+ for (Enumeration e = cpa.getConditionalPermissionInfos(); e.hasMoreElements();)
{
hasPermissions = true;
//final ConditionalPermissionInfo info = (ConditionalPermissionInfo) list.get(i);
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
index bde64de..2771c72 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
@@ -46,7 +46,6 @@
/**
* ServicesServlet provides a plugin for inspecting the registered services.
*/
-@SuppressWarnings("serial")
public class ServicesServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin
{
// don't create empty reference array all the time, create it only once - it is immutable
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
index 9fee9c2..5d0441b 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedEnumeration.java
@@ -32,28 +32,28 @@
* So if both enumerations would produce the same result, say "123", only the
* first would be returned.
*/
-class CombinedEnumeration<E> implements Enumeration<E>
+class CombinedEnumeration implements Enumeration
{
// the first enumeration to iterate
- private final Enumeration<E> first;
+ private final Enumeration first;
// the second enumeration to iterate once the first is exhausted
- private final Enumeration<E> second;
+ private final Enumeration second;
// the set of values already returned to prevent duplicate entries
- private final Set<E> seenKeys;
+ private final Set seenKeys;
// preview to the next return value for nextElement(), null at the end
- private E nextKey;
+ private Object nextKey;
- CombinedEnumeration( final Enumeration<E> first, final Enumeration<E> second )
+ CombinedEnumeration( final Enumeration first, final Enumeration second )
{
this.first = first;
this.second = second;
- this.seenKeys = new HashSet<E>();
+ this.seenKeys = new HashSet();
this.nextKey = seek();
}
@@ -64,14 +64,14 @@
}
- public E nextElement()
+ public Object nextElement()
{
if ( !hasMoreElements() )
{
throw new NoSuchElementException();
}
- E result = nextKey;
+ Object result = nextKey;
nextKey = seek();
return result;
}
@@ -82,11 +82,11 @@
* (unique) element is available, null is returned. The element returned
* is also added to the set of seen elements to prevent duplicate provision
*/
- private E seek()
+ private Object seek()
{
while ( first.hasMoreElements() )
{
- final E next = first.nextElement();
+ final Object next = first.nextElement();
if ( !seenKeys.contains( next ) )
{
seenKeys.add( next );
@@ -95,7 +95,7 @@
}
while ( second.hasMoreElements() )
{
- final E next = second.nextElement();
+ final Object next = second.nextElement();
if ( !seenKeys.contains( next ) )
{
seenKeys.add( next );
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
index a28ec5c..eafc68e 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/CombinedResourceBundle.java
@@ -48,9 +48,9 @@
}
- public Enumeration<String> getKeys()
+ public Enumeration getKeys()
{
- return new CombinedEnumeration<String>( resourceBundle.getKeys(), defaultResourceBundle.getKeys() );
+ return new CombinedEnumeration( resourceBundle.getKeys(), defaultResourceBundle.getKeys() );
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
index f31f18d..f70b07e 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ConsolePropertyResourceBundle.java
@@ -22,10 +22,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.Dictionary;
import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Map.Entry;
import java.util.Properties;
import java.util.ResourceBundle;
@@ -35,14 +32,14 @@
class ConsolePropertyResourceBundle extends ResourceBundle
{
- private final Dictionary<String, String> props;
+ private final Properties props;
ConsolePropertyResourceBundle( final ResourceBundle parent, final URL source )
{
setParent( parent );
- Properties props = new Properties();
+ props = new Properties();
if ( source != null )
{
InputStream ins = null;
@@ -58,19 +55,14 @@
{
IOUtils.closeQuietly( ins );
}
- }
- this.props = new Hashtable<String, String>();
- for ( Entry<?, ?> entry : props.entrySet() )
- {
- this.props.put( ( String ) entry.getKey(), ( String ) entry.getValue() );
}
}
- public Enumeration<String> getKeys()
+ public Enumeration getKeys()
{
- return new CombinedEnumeration<String>( props.keys(), parent.getKeys() );
+ return new CombinedEnumeration( props.keys(), parent.getKeys() );
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
index eb84ead..bf3514e 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
@@ -46,15 +46,15 @@
private final Bundle bundle;
- private final Map<Locale, ResourceBundle> resourceBundles;
+ private final Map resourceBundles;
- private Map<String, URL> resourceBundleEntries;
+ private Map resourceBundleEntries;
ResourceBundleCache( final Bundle bundle )
{
this.bundle = bundle;
- this.resourceBundles = new HashMap<Locale, ResourceBundle>();
+ this.resourceBundles = new HashMap();
}
@@ -78,7 +78,7 @@
synchronized ( resourceBundles )
{
- ResourceBundle bundle = resourceBundles.get( locale );
+ ResourceBundle bundle = ( ResourceBundle ) resourceBundles.get( locale );
if ( bundle != null )
{
return bundle;
@@ -99,12 +99,12 @@
private ResourceBundle loadResourceBundle( final ResourceBundle parent, final Locale locale )
{
final String path = "_" + locale.toString(); //$NON-NLS-1$
- final URL source = getResourceBundleEntries().get( path );
+ final URL source = ( URL ) getResourceBundleEntries().get( path );
return new ConsolePropertyResourceBundle( parent, source );
}
- private synchronized Map<String, URL> getResourceBundleEntries()
+ private synchronized Map getResourceBundleEntries()
{
if ( this.resourceBundleEntries == null )
{
@@ -125,15 +125,14 @@
String fileName = file.substring( slash + 1 );
String path = ( slash <= 0 ) ? "/" : file.substring( 0, slash ); //$NON-NLS-1$
- HashMap<String, URL> resourceBundleEntries = new HashMap<String, URL>();
+ HashMap resourceBundleEntries = new HashMap();
- @SuppressWarnings("unchecked")
- Enumeration<URL> locales = bundle.findEntries( path, fileName + "*.properties", false ); //$NON-NLS-1$
+ Enumeration locales = bundle.findEntries( path, fileName + "*.properties", false ); //$NON-NLS-1$
if ( locales != null )
{
while ( locales.hasMoreElements() )
{
- URL entry = locales.nextElement();
+ URL entry = ( URL ) locales.nextElement();
// calculate the key
String entryPath = entry.getPath();
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
index c5b29cf..03c9e70 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleManager.java
@@ -42,7 +42,7 @@
private final ResourceBundleCache consoleResourceBundleCache;
- private final Map<Long, ResourceBundleCache> resourceBundleCaches;
+ private final Map resourceBundleCaches;
/**
@@ -54,7 +54,7 @@
{
this.bundleContext = bundleContext;
this.consoleResourceBundleCache = new ResourceBundleCache( bundleContext.getBundle() );
- this.resourceBundleCaches = new HashMap<Long, ResourceBundleCache>();
+ this.resourceBundleCaches = new HashMap();
bundleContext.addBundleListener( this );
}
@@ -75,7 +75,7 @@
*
* @param provider the bundle, provider of the resources
* @param locale the requested locale.
- * @return the resource bundle - if not bundle with the requested locale exists,
+ * @return the resource bundle - if not bundle with the requested locale exists,
* the default locale is used.
*/
public ResourceBundle getResourceBundle( final Bundle provider, final Locale locale )
@@ -92,7 +92,7 @@
synchronized ( resourceBundleCaches )
{
Long key = new Long( provider.getBundleId() );
- cache = resourceBundleCaches.get( key );
+ cache = ( ResourceBundleCache ) resourceBundleCaches.get( key );
if ( cache == null )
{
cache = new ResourceBundleCache( provider );
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
index 99f1aef..fecafe0 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationPrinterAdapter.java
@@ -41,7 +41,7 @@
private Method attachmentMethod;
private boolean checkedAttachmentMethod = false;
- private static final List<String> CUSTOM_MODES = new ArrayList<String>();
+ private static final List CUSTOM_MODES = new ArrayList();
static
{
CUSTOM_MODES.add( ConfigurationPrinter.MODE_TXT );
@@ -49,7 +49,6 @@
CUSTOM_MODES.add( ConfigurationPrinter.MODE_ZIP );
}
- @SuppressWarnings("deprecation")
public static ConfigurationPrinterAdapter createAdapter(
final Object service,
final ServiceReference ref)
@@ -259,7 +258,7 @@
/**
* Search a method with the given name and signature
*/
- private static Method searchMethod(final Object obj, final String mName, final Class<?>[] params)
+ private static Method searchMethod(final Object obj, final String mName, final Class[] params)
{
try
{
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
index 3c21d35..e000fac 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ConfigurationRender.java
@@ -42,7 +42,6 @@
* representation of the current framework status. The content itself is
* internally generated by the {@link ConfigurationPrinter} plugins.
*/
-@SuppressWarnings("serial")
public class ConfigurationRender extends SimpleWebConsolePlugin implements OsgiManagerPlugin
{
@@ -69,7 +68,7 @@
private int cfgPrinterTrackerCount;
- private ArrayList<ConfigurationPrinterAdapter> configurationPrinters;
+ private ArrayList configurationPrinters;
/** Default constructor */
public ConfigurationRender( final ResourceBundleManager resourceBundleManager )
@@ -157,12 +156,12 @@
pw.println ( "<html xmlns=\"http://www.w3.org/1999/xhtml\">" );
pw.println ( "<head><title>dummy</title></head><body><div>" );
- Collection<ConfigurationPrinterAdapter> printers = getPrintersForLabel(name);
+ Collection printers = getPrintersForLabel(name);
if ( printers != null )
{
- for (Iterator<ConfigurationPrinterAdapter> i = printers.iterator(); i.hasNext();)
+ for (Iterator i = printers.iterator(); i.hasNext();)
{
- final ConfigurationPrinterAdapter desc = i.next();
+ final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) i.next();
pw.enableFilter( desc.escapeHtml() );
printConfigurationPrinter( pw, desc, ConfigurationPrinter.MODE_WEB );
pw.enableFilter( false );
@@ -212,14 +211,15 @@
// print headers only
final String pluginRoot = request.getAttribute( WebConsoleConstants.ATTR_PLUGIN_ROOT ) + "/";
- for ( final ConfigurationPrinterAdapter desc : getConfigurationPrinters() )
+ Collection printers = getConfigurationPrinters();
+ for (Iterator i = printers.iterator(); i.hasNext();)
{
+ final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) i.next();
if ( desc.match( ConfigurationPrinter.MODE_WEB ) )
{
final String label = desc.label;
final String title = desc.title;
- pw.print( "<li><a href='" + pluginRoot + URLEncoder.encode( label, "utf-8" ) + ".nfo'>" + title
- + "</a></li>" );
+ pw.print("<li><a href='" + pluginRoot + URLEncoder.encode(label) + ".nfo'>" + title + "</a></li>" );
}
}
pw.println("</ul> <!-- end tabs on top -->");
@@ -232,17 +232,17 @@
pw.flush();
}
- private List<ConfigurationPrinterAdapter> getPrintersForLabel(final String label)
+ private List getPrintersForLabel(final String label)
{
- List<ConfigurationPrinterAdapter> list = null;
- for ( Iterator<ConfigurationPrinterAdapter> cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
+ List list = null;
+ for ( Iterator cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
{
- final ConfigurationPrinterAdapter desc = cpi.next();
+ final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) cpi.next();
if (desc.label.equals( label ) )
{
if ( list == null )
{
- list = new ArrayList<ConfigurationPrinterAdapter>();
+ list = new ArrayList();
list.add(desc);
}
}
@@ -253,16 +253,16 @@
private void printConfigurationStatus( ConfigurationWriter pw, final String mode, final String optionalLabel )
{
// check if we have printers for that label
- Collection<ConfigurationPrinterAdapter> printers = getPrintersForLabel(optionalLabel);
+ Collection printers = getPrintersForLabel(optionalLabel);
if ( printers == null )
{
// if not use all
printers = getConfigurationPrinters();
}
- for ( Iterator<ConfigurationPrinterAdapter> cpi = printers.iterator(); cpi.hasNext(); )
+ for ( Iterator cpi = printers.iterator(); cpi.hasNext(); )
{
- final ConfigurationPrinterAdapter desc = cpi.next();
+ final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) cpi.next();
if ( desc.match(mode) )
{
printConfigurationPrinter( pw, desc, mode );
@@ -270,7 +270,7 @@
}
}
- private final synchronized List<ConfigurationPrinterAdapter> getConfigurationPrinters()
+ private final synchronized List getConfigurationPrinters()
{
if ( cfgPrinterTracker == null )
{
@@ -293,7 +293,7 @@
if ( cfgPrinterTrackerCount != cfgPrinterTracker.getTrackingCount() )
{
- SortedMap<String, ConfigurationPrinterAdapter> cp = new TreeMap<String, ConfigurationPrinterAdapter>();
+ SortedMap cp = new TreeMap();
ServiceReference[] refs = cfgPrinterTracker.getServiceReferences();
if ( refs != null )
{
@@ -311,7 +311,7 @@
}
}
}
- configurationPrinters = new ArrayList<ConfigurationPrinterAdapter>(cp.values());
+ configurationPrinters = new ArrayList(cp.values());
cfgPrinterTrackerCount = cfgPrinterTracker.getTrackingCount();
}
@@ -319,7 +319,7 @@
}
- private final void addConfigurationPrinter( final SortedMap<String, ConfigurationPrinterAdapter> printers,
+ private final void addConfigurationPrinter( final SortedMap printers,
final ConfigurationPrinterAdapter desc,
final Bundle provider)
{
@@ -455,7 +455,6 @@
abstract void end();
- @SuppressWarnings("unused")
public void handleAttachments( final String title, final URL[] urls ) throws IOException
{
throw new UnsupportedOperationException( "handleAttachments not supported by this configuration writer: "
@@ -557,17 +556,20 @@
private void addAttachments( final ConfigurationWriter cf, final String mode )
throws IOException
{
- for ( final ConfigurationPrinterAdapter desc : getConfigurationPrinters() )
+ for ( Iterator cpi = getConfigurationPrinters().iterator(); cpi.hasNext(); )
{
- if ( desc.match( mode ) )
+ // check if printer supports zip mode
+ final ConfigurationPrinterAdapter desc = (ConfigurationPrinterAdapter) cpi.next();
+ if ( desc.match(mode) )
{
- final URL[] attachments = desc.getAttachments( mode );
+ final URL[] attachments = desc.getAttachments(mode);
if ( attachments != null )
{
cf.handleAttachments( desc.title, attachments );
}
}
}
+
}
private static class PlainTextConfigurationWriter extends ConfigurationWriter
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
index b2cd890..ca5c742 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
@@ -51,7 +51,6 @@
*
* TODO: add support for 'Bundle-License' manifest header
*/
-@SuppressWarnings("serial")
public final class LicenseServlet extends SimpleWebConsolePlugin implements OsgiManagerPlugin
{
// common names (without extension) of the license files.
@@ -192,13 +191,12 @@
for ( int i = 0; i < patterns.length; i++ )
{
- @SuppressWarnings("unchecked")
- Enumeration<URL> entries = bundle.findEntries( "/", patterns[i] + "*", true );
+ Enumeration entries = bundle.findEntries( "/", patterns[i] + "*", true );
if ( entries != null )
{
while ( entries.hasMoreElements() )
{
- URL url = entries.nextElement();
+ URL url = ( URL ) entries.nextElement();
JSONObject entry = new JSONObject();
entry.put( "path", url.getPath() );
entry.put( "url", getName( url.getPath() ) );
@@ -207,13 +205,12 @@
}
}
- @SuppressWarnings("unchecked")
- Enumeration<URL> entries = bundle.findEntries( "/", "*.jar", true );
+ Enumeration entries = bundle.findEntries( "/", "*.jar", true );
if ( entries != null )
{
while ( entries.hasMoreElements() )
{
- URL url = entries.nextElement();
+ URL url = ( URL ) entries.nextElement();
final String resName = getName( url.getPath() );
InputStream ins = null;
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
index 09afb0c..dbd71c6 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/SystemPropertiesPrinter.java
@@ -33,7 +33,6 @@
private static final String TITLE = "System Properties";
- @SuppressWarnings("unused")
private static final String LABEL = "_systemproperties";
@@ -46,12 +45,13 @@
public void printConfiguration( PrintWriter printWriter )
{
Properties props = System.getProperties();
- SortedSet<Object> keys = new TreeSet<Object>( props.keySet() );
- for ( Iterator<Object> ki = keys.iterator(); ki.hasNext(); )
+ SortedSet keys = new TreeSet( props.keySet() );
+ for ( Iterator ki = keys.iterator(); ki.hasNext(); )
{
Object key = ki.next();
ConfigurationRender.infoLine( printWriter, null, ( String ) key, props.get( key ) );
}
+
}
}
\ No newline at end of file
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
index 116e1e3..2ea8f35 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/ThreadPrinter.java
@@ -29,7 +29,6 @@
private static final String TITLE = "Threads";
- @SuppressWarnings("unused")
private static final String LABEL = "_threads";
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java
index 6536fcc..31afe70 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationSupport.java
@@ -61,8 +61,7 @@
//---------- ManagedService
- @SuppressWarnings("unchecked")
- public void updated( @SuppressWarnings("rawtypes") Dictionary config )
+ public void updated( Dictionary config )
{
osgiManager.updateConfiguration( config );
}
@@ -108,10 +107,10 @@
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 @@
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 @@
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 @@
xocd = new ObjectClassDefinition()
{
- private final AttributeDefinition[] attrs = adList
+ private final AttributeDefinition[] attrs = ( AttributeDefinition[] ) adList
.toArray( new AttributeDefinition[adList.size()] );
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
index e50e215..7a1b086 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/ConfigurationUtil.java
@@ -91,7 +91,7 @@
* @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 @@
* @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 @@
* @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 @@
}
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++;
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
index 5379d20..2fb276b 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/OsgiManager.java
@@ -196,7 +196,7 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
{
// do nothing
}
- }, new Hashtable<String, String>()
+ }, new Hashtable()
{
{
put( Constants.SERVICE_VENDOR, "The Apache Software Foundation" ); //$NON-NLS-1$
@@ -362,9 +361,10 @@
}
// 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 @@
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 @@
return;
}
- Map<String, ?> config = getConfiguration();
+ Map config = getConfiguration();
// get authentication details
String realm = ConfigurationUtil.getProperty(config, PROP_REALM, DEFAULT_REALM);
@@ -788,7 +789,7 @@
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 @@
}
}
- 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 @@
// 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 @@
*/
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? */
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
index 04a3879..ade46d8 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/servlet/PluginHolder.java
@@ -57,7 +57,7 @@
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 @@
PluginHolder( final BundleContext context )
{
this.bundleContext = context;
- this.plugins = new HashMap<String, Plugin>();
+ this.plugins = new HashMap();
}
@@ -197,7 +197,7 @@
final Plugin plugin;
synchronized ( plugins )
{
- plugin = plugins.get( label );
+ plugin = ( Plugin ) plugins.get( label );
}
if ( plugin != null )
@@ -232,9 +232,9 @@
*
* @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 @@
final Plugin oldPlugin;
synchronized ( plugins )
{
- oldPlugin = plugins.remove( label );
+ oldPlugin = ( Plugin ) plugins.remove( label );
}
if ( oldPlugin != null )
@@ -400,7 +400,7 @@
{
synchronized ( plugins )
{
- return plugins.values().toArray( new Plugin[plugins.size()] );
+ return ( Plugin[] ) plugins.values().toArray( new Plugin[plugins.size()] );
}
}
@@ -562,7 +562,7 @@
}
- protected void doUngetConsolePlugin( @SuppressWarnings("unused") AbstractWebConsolePlugin consolePlugin )
+ protected void doUngetConsolePlugin( AbstractWebConsolePlugin consolePlugin )
{
}
@@ -575,9 +575,9 @@
}
- public Enumeration<String> getInitParameterNames()
+ public Enumeration getInitParameterNames()
{
- return new Enumeration<String>()
+ return new Enumeration()
{
public boolean hasMoreElements()
{
@@ -585,7 +585,7 @@
}
- public String nextElement()
+ public Object nextElement()
{
throw new NoSuchElementException();
}
@@ -682,10 +682,10 @@
}
- 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 @@
}
- public String nextElement()
+ public Object nextElement()
{
if ( hasMoreElements() )
{
@@ -744,7 +744,7 @@
try
{
- Class<?> pluginClass = getClass().getClassLoader().loadClass(pluginClassName);
+ Class pluginClass = getClass().getClassLoader().loadClass(pluginClassName);
plugin = (AbstractWebConsolePlugin) pluginClass.newInstance();
if (plugin instanceof OsgiManagerPlugin)
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
index ad8da4b..46a6f63 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/system/VMStatPlugin.java
@@ -43,7 +43,6 @@
* VMStatPlugin provides the System Information tab. This particular plugin uses
* more than one templates.
*/
-@SuppressWarnings("serial")
public class VMStatPlugin extends SimpleWebConsolePlugin implements OsgiManagerPlugin
{
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java b/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java
deleted file mode 100644
index 43d3c28..0000000
--- a/webconsole/src/main/java/org/apache/felix/webconsole/package-info.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Provides the plugin and extension API for the Apache Felix Web Console:
- * <dl>
- * <dt>{@link org.apache.felix.webconsole.AbstractWebConsolePlugin}</dt>
- * <dd>Service API for plugins.</dd>
- * <dt>{@link org.apache.felix.webconsole.ConfigurationPrinter}</dt>
- * <dd>Service API for plugins for the Configuration Status page.</dd>
- * <dt>{@link org.apache.felix.webconsole.BrandingPlugin}</dt>
- * <dd>Service API for the branding of the Web Console.</dd>
- * <dt>{@link org.apache.felix.webconsole.WebConsoleSecurityProvider}</dt>
- * <dd>Service API to provide custom authentication and access control.</dd>
- * </dl>
- */
-@Version("3.1.4")
-@Export(optional = "provide:=true")
-package org.apache.felix.webconsole;
-
-import aQute.bnd.annotation.Export;
-import aQute.bnd.annotation.Version;
-
diff --git a/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java b/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
index 4052081..02270e5 100644
--- a/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
+++ b/webconsole/src/test/java/org/apache/felix/webconsole/AbstractWebConsolePluginTest.java
@@ -28,7 +28,6 @@
import junit.framework.TestCase;
-@SuppressWarnings("serial")
public class AbstractWebConsolePluginTest extends TestCase
{
@@ -40,7 +39,7 @@
super.setUp();
getGetResourceMethod = AbstractWebConsolePlugin.class.getDeclaredMethod( "getGetResourceMethod",
- ( Class<?>[] ) null );
+ ( Class[] ) null );
getGetResourceMethod.setAccessible( true );
}
@@ -123,7 +122,6 @@
private static class PrivateTestPlugin extends TestPlugin
{
- @SuppressWarnings("unused")
private URL getResource( String name )
{
return null;
@@ -132,7 +130,6 @@
private static class ProtectedTestPlugin extends TestPlugin
{
- @SuppressWarnings("unused")
protected URL getResource( String name )
{
return null;
@@ -141,7 +138,6 @@
private static class PackageTestPlugin extends TestPlugin
{
- @SuppressWarnings("unused")
URL getResource( String name )
{
return null;
@@ -150,7 +146,6 @@
private static class PublicTestPlugin extends TestPlugin
{
- @SuppressWarnings("unused")
public URL getResource( String name )
{
return null;