Organize imports
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@566084 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java
index 9a91b2b..4bb8af5 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -20,8 +20,6 @@
import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
import org.osgi.framework.Bundle;
import org.osgi.framework.InvalidSyntaxException;
@@ -64,7 +62,7 @@
Bundle getBundle()
{
- return bundle;
+ return this.bundle;
}
@@ -75,7 +73,7 @@
*/
public Configuration createFactoryConfiguration( String factoryPid ) throws IOException
{
- return wrap( configurationManager.createFactoryConfiguration( this, factoryPid ) );
+ return this.wrap( this.configurationManager.createFactoryConfiguration( this, factoryPid ) );
}
@@ -84,9 +82,9 @@
*/
public Configuration createFactoryConfiguration( String factoryPid, String location ) throws IOException
{
- checkPermission();
+ this.checkPermission();
- return wrap( configurationManager.createFactoryConfiguration( factoryPid, location ) );
+ return this.wrap( this.configurationManager.createFactoryConfiguration( factoryPid, location ) );
}
@@ -95,18 +93,18 @@
*/
public Configuration getConfiguration( String pid ) throws IOException
{
- ConfigurationImpl config = configurationManager.getConfiguration( pid );
+ ConfigurationImpl config = this.configurationManager.getConfiguration( pid );
if ( config.getBundleLocation() == null )
{
- config.setBundleLocation( getBundle().getLocation() );
+ config.setBundleLocation( this.getBundle().getLocation() );
}
- else if ( !config.getBundleLocation().equals( getBundle().getLocation() ) )
+ else if ( !config.getBundleLocation().equals( this.getBundle().getLocation() ) )
{
- checkPermission();
+ this.checkPermission();
}
- return wrap( config );
+ return this.wrap( config );
}
@@ -115,9 +113,9 @@
*/
public Configuration getConfiguration( String pid, String location ) throws IOException
{
- checkPermission();
+ this.checkPermission();
- return wrap( configurationManager.getConfiguration( pid, location ) );
+ return this.wrap( this.configurationManager.getConfiguration( pid, location ) );
}
@@ -126,7 +124,7 @@
*/
public Configuration[] listConfigurations( String filter ) throws IOException, InvalidSyntaxException
{
- ConfigurationImpl ci[] = configurationManager.listConfigurations( this, filter );
+ ConfigurationImpl ci[] = this.configurationManager.listConfigurations( this, filter );
if ( ci == null )
{
return null;
@@ -135,7 +133,7 @@
Configuration[] cfgs = new Configuration[ci.length];
for ( int i = 0; i < cfgs.length; i++ )
{
- cfgs[i] = wrap( ci[i] );
+ cfgs[i] = this.wrap( ci[i] );
}
return cfgs;
@@ -157,7 +155,7 @@
*/
boolean hasPermission()
{
- return bundle.hasPermission( new ConfigurationPermission( "*", ConfigurationPermission.CONFIGURE ) );
+ return this.bundle.hasPermission( new ConfigurationPermission( "*", ConfigurationPermission.CONFIGURE ) );
}
@@ -165,15 +163,15 @@
* Checks whether the bundle to which this instance has been given has the
* <code>CONFIGURE</code> permission and throws a <code>SecurityException</code>
* if this is not the case.
- *
+ *
* @throws SecurityException if the bundle to which this instance belongs
* does not have the <code>CONFIGURE</code> permission.
*/
void checkPermission()
{
- if ( !hasPermission() )
+ if ( !this.hasPermission() )
{
- throw new SecurityException( "Bundle " + bundle.getSymbolicName()
+ throw new SecurityException( "Bundle " + this.bundle.getSymbolicName()
+ " not permitted for Configuration Tasks" );
}
}
diff --git a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
index b359652..5f28690 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationImpl.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -28,12 +28,8 @@
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.log.LogService;
-
-
-/**
- * The <code>ConfigurationImpl</code> is the implementation of the Configuration
+implementation of the Configuration
* Admin Service Specification <i>Configuration object</i> (section 104.4).
*
* @author fmeschbe
@@ -76,7 +72,7 @@
/**
* The <code>ServiceReference</code> of the serviceReference which first asked for
* this configuration. This field is <code>null</code> if the configuration
- * has not been handed to a serviceReference by way of the <code>ManagedService.update(Dictionary)</code>
+ * has not been handed to a serviceReference by way of the <code>ManagedService.update(Dictionary)</code>
* or <code>ManagedServiceFactory.updated(String, Dictionary)</code>
* method.
*/
@@ -101,7 +97,7 @@
this.factoryPID = ( String ) properties.remove( ConfigurationAdmin.SERVICE_FACTORYPID );
this.bundleLocation = ( String ) properties.remove( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
- configure( properties );
+ this.configure( properties );
}
@@ -120,12 +116,12 @@
*/
public void delete() throws IOException
{
- if ( !isDeleted() )
+ if ( !this.isDeleted() )
{
- persistenceManager.delete( pid );
- persistenceManager = null;
+ this.persistenceManager.delete( this.pid );
+ this.persistenceManager = null;
- configurationManager.deleted( this );
+ this.configurationManager.deleted( this );
}
}
@@ -135,7 +131,7 @@
*/
public String getPid()
{
- return pid;
+ return this.pid;
}
@@ -144,7 +140,7 @@
*/
public String getFactoryPid()
{
- return factoryPID;
+ return this.factoryPID;
}
@@ -153,7 +149,7 @@
*/
public String getBundleLocation()
{
- return bundleLocation;
+ return this.bundleLocation;
}
@@ -163,15 +159,15 @@
public Dictionary getProperties()
{
// no properties yet
- if ( properties == null )
+ if ( this.properties == null )
{
return null;
}
- CaseInsensitiveDictionary props = new CaseInsensitiveDictionary( properties );
+ CaseInsensitiveDictionary props = new CaseInsensitiveDictionary( this.properties );
// fix special properties (pid, factory PID, bundle location)
- setAutoProperties( props, false );
+ this.setAutoProperties( props, false );
return props;
}
@@ -182,18 +178,18 @@
*/
public void setBundleLocation( String bundleLocation )
{
- if ( !isDeleted() )
+ if ( !this.isDeleted() )
{
this.bundleLocation = bundleLocation;
// 104.15.2.8 The bundle location will be set persistently
try
{
- store();
+ this.store();
}
catch ( IOException ioe )
{
- configurationManager.log( LogService.LOG_ERROR, "Persisting new bundle location failed", ioe );
+ this.configurationManager.log( LogService.LOG_ERROR, "Persisting new bundle location failed", ioe );
}
}
}
@@ -204,22 +200,22 @@
*/
public void update() throws IOException
{
- if ( !isDeleted() )
+ if ( !this.isDeleted() )
{
// read configuration from persistence (again)
- Dictionary properties = persistenceManager.load( pid );
+ Dictionary properties = this.persistenceManager.load( this.pid );
// ensure serviceReference pid
String servicePid = ( String ) properties.get( Constants.SERVICE_PID );
- if ( servicePid != null && !pid.equals( servicePid ) )
+ if ( servicePid != null && !this.pid.equals( servicePid ) )
{
- throw new IOException( "PID of configuration file does match requested PID; expected " + pid + ", got "
+ throw new IOException( "PID of configuration file does match requested PID; expected " + this.pid + ", got "
+ servicePid );
}
- configure( properties );
+ this.configure( properties );
- configurationManager.updated( this );
+ this.configurationManager.updated( this );
}
}
@@ -229,17 +225,17 @@
*/
public void update( Dictionary properties ) throws IOException
{
- if ( !isDeleted() )
+ if ( !this.isDeleted() )
{
CaseInsensitiveDictionary newProperties = new CaseInsensitiveDictionary( properties );
- setAutoProperties( newProperties, true );
+ this.setAutoProperties( newProperties, true );
- persistenceManager.store( pid, newProperties );
+ this.persistenceManager.store( this.pid, newProperties );
- configure( newProperties );
+ this.configure( newProperties );
- configurationManager.updated( this );
+ this.configurationManager.updated( this );
}
}
@@ -255,7 +251,7 @@
if ( obj instanceof Configuration )
{
- return pid.equals( ( ( Configuration ) obj ).getPid() );
+ return this.pid.equals( ( ( Configuration ) obj ).getPid() );
}
return false;
@@ -264,13 +260,13 @@
public int hashCode()
{
- return pid.hashCode();
+ return this.pid.hashCode();
}
public String toString()
{
- return "Configuration PID=" + pid + ", factoryPID=" + factoryPID + ", bundleLocation=" + bundleLocation;
+ return "Configuration PID=" + this.pid + ", factoryPID=" + this.factoryPID + ", bundleLocation=" + this.bundleLocation;
}
@@ -284,13 +280,13 @@
ServiceReference getServiceReference()
{
- return serviceReference;
+ return this.serviceReference;
}
void store() throws IOException
{
- Dictionary props = getProperties();
+ Dictionary props = this.getProperties();
// if this is a new configuration, we just use an empty Dictionary
if ( props == null )
@@ -298,28 +294,28 @@
props = new Hashtable();
// add automatic properties including the bundle location (if set)
- setAutoProperties( props, true );
+ this.setAutoProperties( props, true );
}
- else if ( getBundleLocation() != null )
+ else if ( this.getBundleLocation() != null )
{
- props.put( ConfigurationAdmin.SERVICE_BUNDLELOCATION, getBundleLocation() );
+ props.put( ConfigurationAdmin.SERVICE_BUNDLELOCATION, this.getBundleLocation() );
}
// only store now, if this is not a new configuration
- persistenceManager.store( pid, props );
+ this.persistenceManager.store( this.pid, props );
}
boolean isDeleted()
{
- if ( persistenceManager != null )
+ if ( this.persistenceManager != null )
{
- if ( properties == null || persistenceManager.exists( pid ) )
+ if ( this.properties == null || this.persistenceManager.exists( this.pid ) )
{
return false;
}
- persistenceManager = null;
+ this.persistenceManager = null;
}
return true;
@@ -329,7 +325,7 @@
private void configure( Dictionary properties )
{
// remove predefined properties
- clearAutoProperties( properties );
+ this.clearAutoProperties( properties );
// ensure CaseInsensitiveDictionary
if ( properties instanceof CaseInsensitiveDictionary )
@@ -346,13 +342,13 @@
void setAutoProperties( Dictionary properties, boolean withBundleLocation )
{
// set pid and factory pid in the properties
- replaceProperty( properties, Constants.SERVICE_PID, pid );
- replaceProperty( properties, ConfigurationAdmin.SERVICE_FACTORYPID, factoryPID );
+ this.replaceProperty( properties, Constants.SERVICE_PID, this.pid );
+ this.replaceProperty( properties, ConfigurationAdmin.SERVICE_FACTORYPID, this.factoryPID );
// bundle location is not set here
if ( withBundleLocation )
{
- replaceProperty( properties, ConfigurationAdmin.SERVICE_BUNDLELOCATION, getBundleLocation() );
+ this.replaceProperty( properties, ConfigurationAdmin.SERVICE_BUNDLELOCATION, this.getBundleLocation() );
}
else
{
diff --git a/configadmin/src/main/java/org/apache/felix/cm/impl/Factory.java b/configadmin/src/main/java/org/apache/felix/cm/impl/Factory.java
index 0c18b7e..daad3b1 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/impl/Factory.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/impl/Factory.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -27,13 +27,12 @@
import org.apache.felix.cm.PersistenceManager;
import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.log.LogService;
/**
* The <code>Factory</code> class is used to manage mappings between factory
* PIDs the configuration PID belonging to it.
- *
+ *
* @author fmeschbe
*/
class Factory
@@ -101,7 +100,7 @@
this( persistenceManager, factoryPid );
// set bundle location
- bundleLocation = ( String ) props.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
+ this.bundleLocation = ( String ) props.get( ConfigurationAdmin.SERVICE_BUNDLELOCATION );
// set pids
String[] pidList = ( String[] ) props.get( FACTORY_PID_LIST );
@@ -109,7 +108,7 @@
{
for ( int i = 0; i < pidList.length; i++ )
{
- pids.add( pidList[i] );
+ this.pids.add( pidList[i] );
}
}
}
@@ -117,19 +116,19 @@
PersistenceManager getPersistenceManager()
{
- return persistenceManager;
+ return this.persistenceManager;
}
String getFactoryPid()
{
- return factoryPid;
+ return this.factoryPid;
}
String getBundleLocation()
{
- return bundleLocation;
+ return this.bundleLocation;
}
@@ -138,25 +137,25 @@
this.bundleLocation = bundleLocation;
// 104.15.2.8 The bundle location will be set persistently
- storeSilently();
+ this.storeSilently();
}
Set getPIDs()
{
- return new HashSet( pids );
+ return new HashSet( this.pids );
}
boolean addPID( String pid )
{
- return pids.add( pid );
+ return this.pids.add( pid );
}
boolean removePID( String pid )
{
- return pids.remove( pid );
+ return this.pids.remove( pid );
}
@@ -164,25 +163,25 @@
{
Hashtable props = new Hashtable();
- if ( bundleLocation != null )
+ if ( this.bundleLocation != null )
{
- props.put( ConfigurationAdmin.SERVICE_BUNDLELOCATION, getBundleLocation() );
+ props.put( ConfigurationAdmin.SERVICE_BUNDLELOCATION, this.getBundleLocation() );
}
- if ( !pids.isEmpty() )
+ if ( !this.pids.isEmpty() )
{
- props.put( FACTORY_PID_LIST, pids.toArray( new String[pids.size()] ) );
+ props.put( FACTORY_PID_LIST, this.pids.toArray( new String[this.pids.size()] ) );
}
- String id = factoryPidToIdentifier( getFactoryPid() );
+ String id = factoryPidToIdentifier( this.getFactoryPid() );
if ( props.isEmpty() )
{
- persistenceManager.delete( id );
+ this.persistenceManager.delete( id );
}
else
{
- props.put( FACTORY_PID, getFactoryPid() );
- persistenceManager.store( id, props );
+ props.put( FACTORY_PID, this.getFactoryPid() );
+ this.persistenceManager.store( id, props );
}
}
@@ -191,7 +190,7 @@
{
try
{
- store();
+ this.store();
}
catch ( IOException ioe )
{
diff --git a/configadmin/src/main/java/org/apache/felix/cm/impl/RankingComparator.java b/configadmin/src/main/java/org/apache/felix/cm/impl/RankingComparator.java
index c0da58c..8e60470 100644
--- a/configadmin/src/main/java/org/apache/felix/cm/impl/RankingComparator.java
+++ b/configadmin/src/main/java/org/apache/felix/cm/impl/RankingComparator.java
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -23,7 +23,6 @@
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.ConfigurationPlugin;
/**
@@ -58,15 +57,15 @@
return 0;
}
- long rank1 = getLong( ( ServiceReference ) obj1, rankProperty );
- long rank2 = getLong( ( ServiceReference ) obj2, rankProperty );
- boolean order = naturalOrder;
+ long rank1 = this.getLong( ( ServiceReference ) obj1, this.rankProperty );
+ long rank2 = this.getLong( ( ServiceReference ) obj2, this.rankProperty );
+ boolean order = this.naturalOrder;
// use service id, if rankings are equal
if ( rank1 == rank2 )
{
- rank1 = getLong( ( ServiceReference ) obj1, Constants.SERVICE_ID );
- rank2 = getLong( ( ServiceReference ) obj2, Constants.SERVICE_ID );
+ rank1 = this.getLong( ( ServiceReference ) obj1, Constants.SERVICE_ID );
+ rank2 = this.getLong( ( ServiceReference ) obj2, Constants.SERVICE_ID );
order = false; // always order lower service.id before higher
}