You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2017/01/13 15:40:46 UTC
svn commit: r1778618 - in
/felix/trunk/osgi-r7/configadmin/src/main/java/org: apache/felix/cm/impl/
osgi/service/cm/
Author: cziegeler
Date: Fri Jan 13 15:40:46 2017
New Revision: 1778618
URL: http://svn.apache.org/viewvc?rev=1778618&view=rev
Log:
Update to latest config admin api
Modified:
felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/Configuration.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationException.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationListener.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPermission.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ReadOnlyConfigurationException.java
felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/SynchronousConfigurationListener.java
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdapter.java Fri Jan 13 15:40:46 2017
@@ -28,7 +28,6 @@ import org.osgi.framework.ServiceReferen
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.cm.ConfigurationPermission;
-import org.osgi.service.cm.ManagedService;
import org.osgi.service.cm.ReadOnlyConfigurationException;
import org.osgi.service.log.LogService;
@@ -100,8 +99,8 @@ public class ConfigurationAdapter implem
public void setBundleLocation( String bundleLocation )
{
Log.logger.log( LogService.LOG_DEBUG, "setBundleLocation(bundleLocation={0})",
- new Object[]
- { bundleLocation } );
+ new Object[]
+ { bundleLocation } );
// CM 1.4 / 104.13.2.4
checkActive();
@@ -137,7 +136,7 @@ public class ConfigurationAdapter implem
public void update( Dictionary<String, ?> properties ) throws IOException
{
Log.logger.log( LogService.LOG_DEBUG, "update(properties={0})", new Object[]
- { properties } );
+ { properties } );
checkActive();
checkDeleted();
@@ -283,7 +282,7 @@ public class ConfigurationAdapter implem
* @see org.osgi.service.cm.Configuration#getProcessedProperties(ServiceReference)
*/
@Override
- public Dictionary<String, Object> getProcessedProperties(ServiceReference<ManagedService> sr)
+ public Dictionary<String, Object> getProcessedProperties(ServiceReference<?> sr)
{
final Dictionary<String, Object> props = this.getProperties();
@@ -336,7 +335,7 @@ public class ConfigurationAdapter implem
if ( !delegatee.isActive() )
{
throw new IllegalStateException( "Configuration " + delegatee.getPid()
- + " not backed by an active Configuration Admin Service" );
+ + " not backed by an active Configuration Admin Service" );
}
}
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/apache/felix/cm/impl/ConfigurationAdminImpl.java Fri Jan 13 15:40:46 2017
@@ -76,7 +76,7 @@ public class ConfigurationAdminImpl impl
final ConfigurationManager configurationManager = getConfigurationManager();
Log.logger.log( LogService.LOG_DEBUG, "createFactoryConfiguration(factoryPid={0})", new Object[]
- { factoryPid } );
+ { factoryPid } );
// FELIX-3360: new factory configuration with implicit binding is dynamic
ConfigurationImpl config = configurationManager.createFactoryConfiguration( factoryPid, null );
@@ -94,8 +94,8 @@ public class ConfigurationAdminImpl impl
final ConfigurationManager configurationManager = getConfigurationManager();
Log.logger.log( LogService.LOG_DEBUG, "createFactoryConfiguration(factoryPid={0}, location={1})",
- new Object[]
- { factoryPid, location } );
+ new Object[]
+ { factoryPid, location } );
// CM 1.4 / 104.13.2.3
this.checkPermission( configurationManager, ( location == null ) ? "*" : location, false );
@@ -114,7 +114,7 @@ public class ConfigurationAdminImpl impl
final ConfigurationManager configurationManager = getConfigurationManager();
Log.logger.log( LogService.LOG_DEBUG, "getConfiguration(pid={0})", new Object[]
- { pid } );
+ { pid } );
ConfigurationImpl config = configurationManager.getConfiguration( pid );
if ( config == null )
@@ -129,9 +129,9 @@ public class ConfigurationAdminImpl impl
if ( config.getBundleLocation() == null )
{
Log.logger.log( LogService.LOG_DEBUG, "Binding configuration {0} (isNew: {1}) to bundle {2}",
- new Object[]
- { config.getPid(), config.isNew() ? Boolean.TRUE : Boolean.FALSE,
- this.getBundle().getLocation() } );
+ new Object[]
+ { config.getPid(), config.isNew() ? Boolean.TRUE : Boolean.FALSE,
+ this.getBundle().getLocation() } );
// FELIX-3360: first implicit binding is dynamic
config.setDynamicBundleLocation( getBundle().getLocation(), true );
@@ -156,7 +156,7 @@ public class ConfigurationAdminImpl impl
final ConfigurationManager configurationManager = getConfigurationManager();
Log.logger.log( LogService.LOG_DEBUG, "getConfiguration(pid={0}, location={1})", new Object[]
- { pid, location } );
+ { pid, location } );
// CM 1.4 / 104.13.2.3
this.checkPermission( configurationManager, ( location == null ) ? "*" : location, false );
@@ -185,7 +185,7 @@ public class ConfigurationAdminImpl impl
final ConfigurationManager configurationManager = getConfigurationManager();
Log.logger.log( LogService.LOG_DEBUG, "listConfigurations(filter={0})", new Object[]
- { filter } );
+ { filter } );
ConfigurationImpl ci[] = configurationManager.listConfigurations( this, filter );
if ( ci == null || ci.length == 0 )
@@ -275,36 +275,36 @@ public class ConfigurationAdminImpl impl
sm.checkPermission( new ConfigurationPermission( name, action ) );
Log.logger.log( LogService.LOG_DEBUG,
- "Explicit Permission; grant {0} permission on configuration bound to {1} to bundle {2}",
- new Object[]
- { action, name, getBundle().getLocation() } );
+ "Explicit Permission; grant {0} permission on configuration bound to {1} to bundle {2}",
+ new Object[]
+ { action, name, getBundle().getLocation() } );
}
catch ( SecurityException se )
{
Log.logger
- .log(
+ .log(
LogService.LOG_DEBUG,
"No Permission; denied {0} permission on configuration bound to {1} to bundle {2}; reason: {3}",
new Object[]
- { action, name, getBundle().getLocation(), se.getMessage() } );
+ { action, name, getBundle().getLocation(), se.getMessage() } );
throw se;
}
}
else if ( Log.logger.isLogEnabled( LogService.LOG_DEBUG ) )
{
Log.logger.log( LogService.LOG_DEBUG,
- "Implicit Permission; grant {0} permission on configuration bound to {1} to bundle {2}",
- new Object[]
- { action, name, getBundle().getLocation() } );
+ "Implicit Permission; grant {0} permission on configuration bound to {1} to bundle {2}",
+ new Object[]
+ { action, name, getBundle().getLocation() } );
}
}
else if ( Log.logger.isLogEnabled( LogService.LOG_DEBUG ) )
{
Log.logger.log( LogService.LOG_DEBUG,
- "No SecurityManager installed; grant {0} permission on configuration bound to {1} to bundle {2}",
- new Object[]
- { action, name, getBundle().getLocation() } );
+ "No SecurityManager installed; grant {0} permission on configuration bound to {1} to bundle {2}",
+ new Object[]
+ { action, name, getBundle().getLocation() } );
}
}
@@ -333,14 +333,14 @@ public class ConfigurationAdminImpl impl
* @see org.osgi.service.cm.ConfigurationAdmin#getFactoryConfiguration(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
- public Configuration getFactoryConfiguration(String factoryPid, String alias, String location) throws IOException
+ public Configuration getFactoryConfiguration(String factoryPid, String name, String location) throws IOException
{
final ConfigurationManager configurationManager = getConfigurationManager();
- Log.logger.log( LogService.LOG_DEBUG, "getFactoryConfiguration(factoryPid={0}, alias={1}, location={2})", new Object[]
- { factoryPid, alias, location } );
+ Log.logger.log( LogService.LOG_DEBUG, "getFactoryConfiguration(factoryPid={0}, name={1}, location={2})", new Object[]
+ { factoryPid, name, location } );
- final String pid = factoryPid + '#' + alias;
+ final String pid = factoryPid + '~' + name;
// CM 1.4 / 104.13.2.3
this.checkPermission( configurationManager, ( location == null ) ? "*" : location, false );
@@ -357,20 +357,20 @@ public class ConfigurationAdminImpl impl
}
return this.wrap( config );
- }
+ }
/**
* @see org.osgi.service.cm.ConfigurationAdmin#getFactoryConfiguration(java.lang.String, java.lang.String)
*/
@Override
- public Configuration getFactoryConfiguration(String factoryPid, String alias) throws IOException {
+ public Configuration getFactoryConfiguration(String factoryPid, String name) throws IOException {
final ConfigurationManager configurationManager = getConfigurationManager();
- Log.logger.log( LogService.LOG_DEBUG, "getFactoryConfiguration(factoryPid={0}, alias={1})", new Object[]
- { factoryPid, alias } );
+ Log.logger.log( LogService.LOG_DEBUG, "getFactoryConfiguration(factoryPid={0}, name={1})", new Object[]
+ { factoryPid, name } );
- final String pid = factoryPid + '#' + alias;
+ final String pid = factoryPid + '~' + name;
ConfigurationImpl config = configurationManager.getConfiguration( pid );
if ( config == null )
@@ -385,9 +385,9 @@ public class ConfigurationAdminImpl impl
if ( config.getBundleLocation() == null )
{
Log.logger.log( LogService.LOG_DEBUG, "Binding configuration {0} (isNew: {1}) to bundle {2}",
- new Object[]
- { config.getPid(), config.isNew() ? Boolean.TRUE : Boolean.FALSE,
- this.getBundle().getLocation() } );
+ new Object[]
+ { config.getPid(), config.isNew() ? Boolean.TRUE : Boolean.FALSE,
+ this.getBundle().getLocation() } );
// FELIX-3360: first implicit binding is dynamic
config.setDynamicBundleLocation( getBundle().getLocation(), true );
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/Configuration.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/Configuration.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/Configuration.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/Configuration.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -74,10 +74,11 @@ import org.osgi.framework.ServiceReferen
public interface Configuration {
/**
* Configuration Attributes.
+ * @since 1.6
*/
enum ConfigurationAttribute {
/**
- * Mark the configuration as readonly.
+ * The configuration is read only.
*/
READ_ONLY
}
@@ -111,33 +112,35 @@ public interface Configuration {
public Dictionary<String, Object> getProperties();
/**
- * Return the modified properties of this {@code Configuration} object.
- *
- * The {@code Dictionary} object returned is a private copy for the caller
- * and may be changed without influencing the stored configuration. The keys
- * in the returned dictionary are case insensitive and are always of type
- * {@code String}.
- *
- * <p>
- * Before the properties are returned they are run through all
- * registered {@link ConfigurationPlugin}s handling the configuration
- * for this PID.
- *
- * <p>
- * If called just after the configuration is created and before update has
- * been called, this method returns {@code null}.
- *
- * @return A private copy of the properties for the caller or {@code null}.
- * These properties must not contain the "service.bundleLocation"
- * property. The value of this property may be obtained from the
- * {@link #getBundleLocation()} method.
- * @throws IllegalStateException If this configuration has been deleted.
- */
- public Dictionary<String, Object> getProcessedProperties(ServiceReference<ManagedService> reference);
+ * Return the processed properties of this {@code Configuration} object.
+ * <p>
+ * The {@code Dictionary} object returned is a private copy for the caller
+ * and may be changed without influencing the stored configuration. The keys
+ * in the returned dictionary are case insensitive and are always of type
+ * {@code String}.
+ * <p>
+ * Before the properties are returned they are processed by all the
+ * registered {@link ConfigurationPlugin}s handling this configuration.
+ * <p>
+ * If called just after the configuration is created and before update has
+ * been called, this method returns {@code null}.
+ *
+ * @param reference The reference to the Managed Service or Managed Service
+ * Factory to pass to the registered {@link ConfigurationPlugin}s
+ * handling this configuration. Must not be {@code null}.
+ * @return A private copy of the processed properties for the caller or
+ * {@code null}. These properties must not contain the
+ * "service.bundleLocation" property. The value of this property may
+ * be obtained from the {@link #getBundleLocation()} method.
+ * @throws IllegalStateException If this configuration has been deleted.
+ * @since 1.6
+ */
+ public Dictionary<String,Object> getProcessedProperties(
+ ServiceReference< ? > reference);
/**
* Update the properties of this {@code Configuration} object.
- *
+ * <p>
* Stores the properties in persistent storage after adding or overwriting
* the following properties:
* <ul>
@@ -146,41 +149,40 @@ public interface Configuration {
* to the factory PID else it is not set.</li>
* </ul>
* These system properties are all of type {@code String}.
- *
* <p>
* If the corresponding Managed Service/Managed Service Factory is
* registered, its updated method must be called asynchronously. Else, this
* callback is delayed until aforementioned registration occurs.
- *
* <p>
* Also notifies all Configuration Listeners with a
* {@link ConfigurationEvent#CM_UPDATED} event.
*
* @param properties the new set of properties for this configuration
- * @throws ReadOnlyConfigurationException if the configuration is locked
+ * @throws ReadOnlyConfigurationException If the configuration is
+ * {@link ConfigurationAttribute#READ_ONLY read only}.
* @throws IOException if update cannot be made persistent
* @throws IllegalArgumentException if the {@code Dictionary} object
- * contains invalid configuration types or contains case variants of
- * the same key name.
+ * contains invalid configuration types or contains case
+ * variants of the same key name.
* @throws IllegalStateException If this configuration has been deleted.
*/
public void update(Dictionary<String, ?> properties) throws IOException;
/**
* Delete this {@code Configuration} object.
- *
+ * <p>
* Removes this configuration object from the persistent store. Notify
* asynchronously the corresponding Managed Service or Managed Service
* Factory. A {@link ManagedService} object is notified by a call to its
* {@code updated} method with a {@code null} properties argument. A
* {@link ManagedServiceFactory} object is notified by a call to its
* {@code deleted} method.
- *
* <p>
* Also notifies all Configuration Listeners with a
* {@link ConfigurationEvent#CM_DELETED} event.
*
- * @throws ReadOnlyConfigurationException if the configuration is locked
+ * @throws ReadOnlyConfigurationException If the configuration is
+ * {@link ConfigurationAttribute#READ_ONLY read only}.
* @throws IOException If delete fails.
* @throws IllegalStateException If this configuration has been deleted.
*/
@@ -197,10 +199,8 @@ public interface Configuration {
/**
* Update the {@code Configuration} object with the current properties.
- *
* Initiate the {@code updated} callback to the Managed Service or Managed
* Service Factory with the current properties asynchronously.
- *
* <p>
* This is the only way for a bundle that uses a Configuration Plugin
* service to initiate a callback. For example, when that bundle detects a
@@ -209,27 +209,29 @@ public interface Configuration {
*
* @see ConfigurationPlugin
* @throws IOException if update cannot access the properties in persistent
- * storage
+ * storage
* @throws IllegalStateException If this configuration has been deleted.
*/
public void update() throws IOException;
/**
* Update the properties of this {@code Configuration} object if the
- * provided properties are different than the currently stored set
+ * provided properties are different than the currently stored set.
* Properties are compared as follows.
* <ul>
- * <li>scalars are compared using equals()
- * <li>arrays are compared using Arrays.equals()
- * <li>Collections are compared using equals()
+ * <li>scalars are compared using equals()</li>
+ * <li>arrays are compared using Arrays.equals()</li>
+ * <li>Collections are compared using equals()</li>
* </ul>
- * If the properties compare the same, no operation is performed, otherwise
- * the behaviour is identical to the update(Dictionary) method.
+ * If the new properties are not different than the current properties, no
+ * operation is performed. Otherwise, the behavior of this method is
+ * identical to the {@link #update(Dictionary)} method.
*
- * @param properties the new set of properties for this configuration
- * @throws ReadOnlyConfigurationException If the configuration is locked
- * @throws IOException if update cannot be made persistent
- * @throws IllegalArgumentException if the {@code Dictionary} object
+ * @param properties The new set of properties for this configuration.
+ * @throws ReadOnlyConfigurationException If the configuration is
+ * {@link ConfigurationAttribute#READ_ONLY read only}.
+ * @throws IOException If update cannot be made persistent.
+ * @throws IllegalArgumentException If the {@code Dictionary} object
* contains invalid configuration types or contains case
* variants of the same key name.
* @throws IllegalStateException If this configuration has been deleted.
@@ -265,7 +267,6 @@ public interface Configuration {
* @param location a location, region, or {@code null}
* @throws IllegalStateException If this configuration has been deleted.
* @throws SecurityException when the required permissions are not available
- * @throws SecurityException when the required permissions are not available
* @security ConfigurationPermission[this.location,CONFIGURE] if
* this.location is not {@code null}
* @security ConfigurationPermission[location,CONFIGURE] if location is not
@@ -310,12 +311,16 @@ public interface Configuration {
public long getChangeCount();
/**
- * Add attributes to the configuration. Currently the only supported
- * attribute is {@link ConfigurationAttribute#READ_ONLY}.
+ * Add attributes to the configuration.
*
* @param attrs The attributes to add.
* @throws IOException If the new state cannot be persisted.
* @throws IllegalStateException If this configuration has been deleted.
+ * @throws SecurityException when the required permissions are not available
+ * @security ConfigurationPermission[this.location,ATTRIBUTE] if
+ * this.location is not {@code null}
+ * @security ConfigurationPermission["*",ATTRIBUTE] if this.location is
+ * {@code null}
* @since 1.6
*/
public void addAttributes(ConfigurationAttribute... attrs)
@@ -336,6 +341,11 @@ public interface Configuration {
* @param attrs The attributes to remove.
* @throws IOException If the new state cannot be persisted.
* @throws IllegalStateException If this configuration has been deleted.
+ * @throws SecurityException when the required permissions are not available
+ * @security ConfigurationPermission[this.location,ATTRIBUTE] if
+ * this.location is not {@code null}
+ * @security ConfigurationPermission["*",ATTRIBUTE] if this.location is
+ * {@code null}
* @since 1.6
*/
public void removeAttributes(ConfigurationAttribute... attrs)
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java Fri Jan 13 15:40:46 2017
@@ -240,71 +240,65 @@ public interface ConfigurationAdmin {
public Configuration getConfiguration(String pid) throws IOException;
/**
- * Get an existing or new {@code Configuration} object from the persistent
- * store.
- *
- * The PID for this {@code Configuration} object is generated from the
- * provided factory PID and the alias by starting with the factory PID
- * appending the character # and then appending the alias.
- *
- * <p>
- * If a {@code Configuration} with this PID already exists in Configuration
- * Admin service return it. The location parameter is ignored in this case
- * though it is still used for a security check.
- *
- * <p>
- * Else, return a new {@code Configuration} object. This new object is bound
- * to the location and the properties are set to {@code null}. If the
- * location parameter is {@code null}, it will be set when a Managed Service
- * with the corresponding PID is registered for the first time. If the
- * location starts with {@code ?} then the configuration is bound to all
- * targets that are registered with the corresponding PID.
- *
- * @param factoryPid PID of factory (not {@code null}).
- * @param alias An alias for {@code Configuration} (not {@code null}).
- * @param location The bundle location string, or {@code null}.
- * @return An existing or new {@code Configuration} object.
- * @throws IOException if access to persistent storage fails.
- * @throws SecurityException when the require permissions are not available
- * @security ConfigurationPermission[*,CONFIGURE] if location is
- * {@code null} or if the returned configuration {@code c} already
- * exists and c.location is {@code null}
- * @security ConfigurationPermission[location,CONFIGURE] if location is not
- * {@code null}
- * @security ConfigurationPermission[c.location,CONFIGURE] if the returned
- * configuration {@code c} already exists and c.location is not
- * {@code null}
- * @since 1.6
- */
- public Configuration getFactoryConfiguration(String factoryPid, String alias, String location) throws IOException;
+ * Get an existing or new {@code Configuration} object from the persistent
+ * store. The PID for this {@code Configuration} object is generated from
+ * the provided factory PID and the name by starting with the factory PID
+ * appending the character ~ (tilde) and then appending the name.
+ * <p>
+ * If a {@code Configuration} with this PID already exists in Configuration
+ * Admin service return it. The location parameter is ignored in this case
+ * though it is still used for a security check.
+ * <p>
+ * Else, return a new {@code Configuration} object. This new object is bound
+ * to the location and the properties are set to {@code null}. If the
+ * location parameter is {@code null}, it will be set when a Managed Service
+ * with the corresponding PID is registered for the first time. If the
+ * location starts with {@code ?} then the configuration is bound to all
+ * targets that are registered with the corresponding PID.
+ *
+ * @param factoryPid PID of factory (not {@code null}).
+ * @param name A name for {@code Configuration} (not {@code null}).
+ * @param location The bundle location string, or {@code null}.
+ * @return An existing or new {@code Configuration} object.
+ * @throws IOException if access to persistent storage fails.
+ * @throws SecurityException when the require permissions are not available
+ * @security ConfigurationPermission[*,CONFIGURE] if location is
+ * {@code null} or if the returned configuration {@code c} already
+ * exists and c.location is {@code null}
+ * @security ConfigurationPermission[location,CONFIGURE] if location is not
+ * {@code null}
+ * @security ConfigurationPermission[c.location,CONFIGURE] if the returned
+ * configuration {@code c} already exists and c.location is not
+ * {@code null}
+ * @since 1.6
+ */
+ public Configuration getFactoryConfiguration(String factoryPid, String name,
+ String location) throws IOException;
/**
- * Get an existing or new {@code Configuration} object from the persistent
- * store.
- *
- * The PID for this {@code Configuration} object is generated from the
- * provided factory PID and the alias by starting with the factory PID
- * appending the character # and then appending the alias.
- *
- * If the {@code Configuration} object for this PID does not exist, create a
- * new {@code Configuration} object for that PID, where properties are
- * {@code null}. Bind its location to the calling bundle's location.
- *
- * <p>
- * Otherwise, if the location of the existing {@code Configuration} object
- * is {@code null}, set it to the calling bundle's location.
- *
- * @param factoryPid PID of factory (not {@code null}).
- * @param alias An alias for {@code Configuration} (not {@code null}).
- * @return an existing or new {@code Configuration} matching the PID.
- * @throws IOException if access to persistent storage fails.
- * @throws SecurityException when the required permission is not available
- * @security ConfigurationPermission[c.location,CONFIGURE] If the
- * configuration {@code c} already exists and c.location is not
- * {@code null}
- * @since 1.6
- */
- public Configuration getFactoryConfiguration(String factoryPid, String alias) throws IOException;
+ * Get an existing or new {@code Configuration} object from the persistent
+ * store. The PID for this {@code Configuration} object is generated from
+ * the provided factory PID and the name by starting with the factory PID
+ * appending the character ~ (tilde) and then appending the name. If the
+ * {@code Configuration} object for this PID does not exist, create a new
+ * {@code Configuration} object for that PID, where properties are
+ * {@code null}. Bind its location to the calling bundle's location.
+ * <p>
+ * Otherwise, if the location of the existing {@code Configuration} object
+ * is {@code null}, set it to the calling bundle's location.
+ *
+ * @param factoryPid PID of factory (not {@code null}).
+ * @param name A name for {@code Configuration} (not {@code null}).
+ * @return an existing or new {@code Configuration} matching the PID.
+ * @throws IOException if access to persistent storage fails.
+ * @throws SecurityException when the required permission is not available
+ * @security ConfigurationPermission[c.location,CONFIGURE] If the
+ * configuration {@code c} already exists and c.location is not
+ * {@code null}
+ * @since 1.6
+ */
+ public Configuration getFactoryConfiguration(String factoryPid, String name)
+ throws IOException;
/**
* List the current {@code Configuration} objects which match the filter.
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationException.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationException.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationException.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationException.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ package org.osgi.service.cm;
* @author $Id$
*/
public class ConfigurationException extends Exception {
- static final long serialVersionUID = -1690090413441769377L;
+ private static final long serialVersionUID = -1690090413441769377L;
private final String property;
private final String reason;
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationListener.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationListener.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationListener.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPermission.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPermission.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPermission.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,13 +38,12 @@ import org.osgi.framework.Filter;
* Configuration Admin.
*
* @ThreadSafe
- * @author $Id: ConfigurationPermission.java 1750478 2016-06-28 11:34:40Z
- * cziegeler $
+ * @author $Id$
* @since 1.2
*/
public final class ConfigurationPermission extends BasicPermission {
- static final long serialVersionUID = 5716868734811965383L;
+ private static final long serialVersionUID = 5716868734811965383L;
/**
* Provides permission to create new configurations for other bundles as
* well as manipulate them. The action string {@value #CONFIGURE}.
@@ -94,11 +93,11 @@ public final class ConfigurationPermissi
* Create a new ConfigurationPermission.
*
* @param name Name of the permission. Wildcards ({@code '*'}) are allowed
- * in the name. During {@link #implies(Permission)}, the name is
- * matched to the requested permission using the substring matching
- * rules used by {@link Filter}s.
+ * in the name. During {@link #implies(Permission)}, the name is
+ * matched to the requested permission using the substring
+ * matching rules used by {@link Filter}s.
* @param actions Comma separated list of {@link #CONFIGURE},
- * {@link #TARGET} (case insensitive).
+ * {@link #TARGET}, {@link #ATTRIBUTE} (case insensitive).
*/
public ConfigurationPermission(String name, String actions) {
@@ -415,10 +414,10 @@ public final class ConfigurationPermissi
/**
* Returns the canonical string representation of the
* {@code ConfigurationPermission} actions.
- *
* <p>
* Always returns present {@code ConfigurationPermission} actions in the
- * following order: {@value #CONFIGURE}, {@value #TARGET}
+ * following order: {@value #CONFIGURE}, {@value #TARGET},
+ * {@value #ATTRIBUTE}.
*
* @return Canonical string representation of the
* {@code ConfigurationPermission} actions.
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ReadOnlyConfigurationException.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ReadOnlyConfigurationException.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ReadOnlyConfigurationException.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/ReadOnlyConfigurationException.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,19 +16,21 @@
package org.osgi.service.cm;
+import org.osgi.service.cm.Configuration.ConfigurationAttribute;
+
/**
* An {@code Exception} class to inform the client of a {@code Configuration}
- * about the locked state of a configuration object.
+ * about the {@link ConfigurationAttribute#READ_ONLY read only} state of a
+ * configuration object.
*
- * @author $Id: LockedConfigurationException.java 1750478 2016-06-28 11:34:40Z
- * cziegeler $
+ * @author $Id$
* @since 1.6
*/
public class ReadOnlyConfigurationException extends RuntimeException {
- static final long serialVersionUID = 1898442024230518832L;
+ private static final long serialVersionUID = 1898442024230518832L;
/**
- * Create a {@code LockedConfigurationException} object.
+ * Create a {@code ReadOnlyConfigurationException} object.
*
* @param reason reason for failure
*/
Modified: felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/SynchronousConfigurationListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/SynchronousConfigurationListener.java?rev=1778618&r1=1778617&r2=1778618&view=diff
==============================================================================
--- felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/SynchronousConfigurationListener.java (original)
+++ felix/trunk/osgi-r7/configadmin/src/main/java/org/osgi/service/cm/SynchronousConfigurationListener.java Fri Jan 13 15:40:46 2017
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2012, 2016). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2012, 2017). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.