You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2007/04/17 16:31:47 UTC
svn commit: r529623 [8/9] - in /incubator/felix/trunk: ./ ipojo.arch/
ipojo.arch/src/main/java/org/apache/felix/ipojo/arch/ ipojo.metadata/
ipojo.metadata/src/main/java/org/apache/felix/ipojo/metadata/ ipojo.plugin/
ipojo.plugin/src/main/java/org/apach...
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java Tue Apr 17 07:31:35 2007
@@ -20,30 +20,34 @@
/**
* Parse Utils Methods.
+ *
* @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
*/
public class ParseUtils {
-
- /**
- * Parse the string form of an array as {a, b, c}.
- * @param str : the string form
- * @return the resulting string array
- */
- public static String[] parseArrays(String str) {
- // Remove { and }
- if (str.startsWith("{") && str.endsWith("}")) {
- String m = str.substring(1, str.length() - 1);
- // Check empty array
- m = m.trim();
- if (m.length() == 0) { return new String[0]; }
- String[] values = m.split(",");
- for (int i = 0; i < values.length; i++) {
- values[i] = values[i].trim();
- }
- return values;
- } else {
- return new String[] {str};
- }
- }
+
+ /**
+ * Parse the string form of an array as {a, b, c}.
+ *
+ * @param str : the string form
+ * @return the resulting string array
+ */
+ public static String[] parseArrays(String str) {
+ // Remove { and }
+ if (str.startsWith("{") && str.endsWith("}")) {
+ String m = str.substring(1, str.length() - 1);
+ // Check empty array
+ m = m.trim();
+ if (m.length() == 0) {
+ return new String[0];
+ }
+ String[] values = m.split(",");
+ for (int i = 0; i < values.length; i++) {
+ values[i] = values[i].trim();
+ }
+ return values;
+ } else {
+ return new String[] { str };
+ }
+ }
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Callback.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Callback.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Callback.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Callback.java Tue Apr 17 07:31:35 2007
@@ -23,10 +23,9 @@
import org.apache.felix.ipojo.InstanceManager;
-
-
/**
* A callback allows calling a method on the component instances.
+ *
* @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
*/
public class Callback {
@@ -48,6 +47,7 @@
/**
* LifecycleCallback constructor.
+ *
* @param method : the name of the method to call
* @param isStatic : is the method a static method
* @param im : the instance manager of the component containing the method
@@ -60,28 +60,31 @@
/**
* Call the method.
+ *
* @throws NoSuchMethodException : Method is not found in the class
* @throws InvocationTargetException : The method is not static
* @throws IllegalAccessException : The method can not be invoked
*/
public void call() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- m_manager.getFactory().getLogger().log(Logger.INFO, "[" + m_manager.getClassName() + "] Call an callback method : " + m_method);
+ m_manager.getFactory().getLogger().log(Logger.INFO, "[" + m_manager.getClassName() + "] Call an callback method : " + m_method);
Method method = m_manager.getClazz().getDeclaredMethod(m_method, new Class[] {});
method.setAccessible(true);
- if (m_isStatic) {
- method.invoke(null, new Object[]{});
+ if (m_isStatic) {
+ method.invoke(null, new Object[] {});
} else {
// Two cases :
// - if instances already exists : call on each instances
// - if no instance exists : create an instance
if (m_manager.getPojoObjects().length == 0) {
- m_manager.getFactory().getLogger().log(Logger.INFO, "[" + m_manager.getClassName() + "] Create the first instance " + m_manager.getPojoObject());
- method.invoke(m_manager.getPojoObject(), new Object[]{});
+ m_manager.getFactory().getLogger()
+ .log(Logger.INFO, "[" + m_manager.getClassName() + "] Create the first instance " + m_manager.getPojoObject());
+ method.invoke(m_manager.getPojoObject(), new Object[] {});
} else {
for (int i = 0; i < m_manager.getPojoObjects().length; i++) {
- m_manager.getFactory().getLogger().log(Logger.INFO, "[" + m_manager.getClassName() + "] Call the callback on the instance " + m_manager.getPojoObjects()[i]);
- method.invoke(m_manager.getPojoObjects()[i], new Object[]{});
+ m_manager.getFactory().getLogger().log(Logger.INFO,
+ "[" + m_manager.getClassName() + "] Call the callback on the instance " + m_manager.getPojoObjects()[i]);
+ method.invoke(m_manager.getPojoObjects()[i], new Object[] {});
}
}
}
@@ -89,13 +92,13 @@
/**
* Call the current callback method on the instance given in parameter.
+ *
* @param instance : instance on which call the callbakc
* @throws NoSuchMethodException : the method was not found
* @throws IllegalAccessException : the method cannont be called
* @throws InvocationTargetException : an error happens in the method
*/
- public void call(Object instance) throws NoSuchMethodException,
- IllegalAccessException, InvocationTargetException {
+ public void call(Object instance) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Method method = m_manager.getClazz().getDeclaredMethod(m_method, new Class[] {});
method.setAccessible(true);
method.invoke(instance, new Object[] {});
@@ -103,32 +106,35 @@
/**
* Call the callback on the method with the argument given in parameter.
+ *
* @param arg : the parameters
* @throws NoSuchMethodException : the callback method is not found
* @throws IllegalAccessException : the callbback method cannot be called
- * @throws InvocationTargetException : an error occurs inside the called method
+ * @throws InvocationTargetException : an error occurs inside the called
+ * method
*/
public void call(Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- m_manager.getFactory().getLogger().log(Logger.INFO, "[" + m_manager.getClassName() + "] Call an callback method : " + m_method);
+ m_manager.getFactory().getLogger().log(Logger.INFO, "[" + m_manager.getClassName() + "] Call an callback method : " + m_method);
// Build an array of call for arg :
Class[] classes = new Class[arg.length];
for (int i = 0; i < arg.length; i++) {
classes[i] = arg[i].getClass();
}
-
+
Method method = m_manager.getClazz().getDeclaredMethod(m_method, classes);
method.setAccessible(true);
- if (m_isStatic) {
- method.invoke(null, arg);
+ if (m_isStatic) {
+ method.invoke(null, arg);
} else {
// Two cases :
// - if instances already exists : call on each instances
// - if no instance exists : create an instance
if (m_manager.getPojoObjects().length == 0) {
- m_manager.getFactory().getLogger().log(Logger.INFO, "[" + m_manager.getClassName() + "] Create the first instance " + m_manager.getPojoObject());
- method.invoke(m_manager.getPojoObject(), new Object[]{});
+ m_manager.getFactory().getLogger()
+ .log(Logger.INFO, "[" + m_manager.getClassName() + "] Create the first instance " + m_manager.getPojoObject());
+ method.invoke(m_manager.getPojoObject(), new Object[] {});
} else {
for (int i = 0; i < m_manager.getPojoObjects().length; i++) {
method.invoke(m_manager.getPojoObjects()[i], arg);
@@ -138,12 +144,15 @@
}
/**
- * Call the callback on the method with the argument given in parameter and with the arguments given in parameter too.
+ * Call the callback on the method with the argument given in parameter and
+ * with the arguments given in parameter too.
+ *
* @param instance : instance on which call the callback
* @param arg : the argument array
* @throws NoSuchMethodException : the callback method is not found
* @throws IllegalAccessException : the callbback method cannot be called
- * @throws InvocationTargetException : an error occurs inside the called method
+ * @throws InvocationTargetException : an error occurs inside the called
+ * method
*/
public void call(Object instance, Object[] arg) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Build an array of call for arg :
Modified: incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Logger.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Logger.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Logger.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/apache/felix/ipojo/util/Logger.java Tue Apr 17 07:31:35 2007
@@ -26,152 +26,178 @@
import org.osgi.service.log.LogService;
/**
- * iPOJO Logger.
- * This logger send log message to a log service if presents.
+ * iPOJO Logger. This logger send log message to a log service if presents.
+ *
* @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
*/
public class Logger implements ServiceListener {
-
- // TODO how to stop the logging (remove listener ...)
-
- /**
- * Log Level ERROR.
- */
- public static final int ERROR = 1;
-
- /**
- * Log Level WARNING.
+
+ // TODO how to stop the logging (remove listener ...)
+
+ /**
+ * Log Level ERROR.
+ */
+ public static final int ERROR = 1;
+
+ /**
+ * Log Level WARNING.
*/
public static final int WARNING = 2;
-
+
/**
* Log Level INFO.
*/
public static final int INFO = 3;
-
+
/**
- * Log Level DEBUG.
+ * Log Level DEBUG.
*/
public static final int DEBUG = 4;
-
+
/**
* Bundle Context.
*/
private BundleContext m_context;
-
+
/**
- * Service Reference of the log service is available.
+ * Service Reference of the log service is available.
*/
private ServiceReference m_ref;
-
+
/**
- * Log service object.
+ * Log service object.
*/
private LogService m_log;
-
+
/**
- * Name of the logger.
+ * Name of the logger.
*/
private String m_name;
-
+
/**
- * trace level of this logger.
+ * trace level of this logger.
*/
private int m_level;
-
+
/**
* Constructor.
+ *
* @param bc : bundle context
* @param name : name of the logger
* @param level : trace level
*/
- public Logger(BundleContext bc, String name, int level) {
- m_name = name;
- m_level = level;
- m_context = bc;
-
- m_ref = m_context.getServiceReference(LogService.class.getName());
- if (m_ref != null) { m_log = (LogService) m_context.getService(m_ref); }
-
- try {
- m_context.addServiceListener(this, "(objectClass=" + LogService.class.getName() + ")");
- } catch (InvalidSyntaxException e) { e.printStackTrace(); }
+ public Logger(BundleContext bc, String name, int level) {
+ m_name = name;
+ m_level = level;
+ m_context = bc;
+
+ m_ref = m_context.getServiceReference(LogService.class.getName());
+ if (m_ref != null) {
+ m_log = (LogService) m_context.getService(m_ref);
+ }
+
+ try {
+ m_context.addServiceListener(this, "(objectClass=" + LogService.class.getName() + ")");
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+ }
}
-
+
/**
* Log a message.
+ *
* @param level : level of the message
* @param msg : the message to log
*/
public void log(int level, String msg) {
- if (m_level >= level) {
- synchronized (this) { _log(level, msg, null); }
- }
+ if (m_level >= level) {
+ synchronized (this) {
+ dispatch(level, msg, null);
+ }
+ }
}
-
+
/**
* Log a message with an exception.
+ *
* @param level : level of the message
* @param msg : message to log
* @param ex : exception attached to the message
*/
public void log(int level, String msg, Throwable ex) {
- if (m_level >= level) {
- synchronized (this) { _log(level, msg, ex); }
- }
+ if (m_level >= level) {
+ synchronized (this) {
+ dispatch(level, msg, ex);
+ }
+ }
}
-
+
/**
* Internal log method.
+ *
* @param level : level of the message.
* @param msg : message to log
* @param ex : exception attached to the message
*/
- private void _log(int level, String msg, Throwable ex) {
+ private void dispatch(int level, String msg, Throwable ex) {
String s = msg;
- s = (ex == null) ? s : s + " (" + ex.getMessage() + ")";
+ if (ex != null) {
+ s += " (" + ex.getMessage() + ")";
+ }
String message;
switch (level) {
case DEBUG:
- message = "[" + m_name + "] DEBUG: " + s;
- if (m_log != null) { m_log.log(LogService.LOG_DEBUG, message); }
+ message = "[" + m_name + "] DEBUG: " + s;
+ if (m_log != null) {
+ m_log.log(LogService.LOG_DEBUG, message);
+ }
System.err.println(message);
break;
case ERROR:
- message = "[" + m_name + "] ERROR: " + s;
- if (m_log != null) { m_log.log(LogService.LOG_ERROR, message); }
+ message = "[" + m_name + "] ERROR: " + s;
+ if (m_log != null) {
+ m_log.log(LogService.LOG_ERROR, message);
+ }
System.err.println(message);
break;
case INFO:
message = "[" + m_name + "] INFO: " + s;
- if (m_log != null) { m_log.log(LogService.LOG_INFO, message); }
- System.err.println(message);
+ if (m_log != null) {
+ m_log.log(LogService.LOG_INFO, message);
+ }
+ System.err.println(message);
break;
case WARNING:
- message = "[" + m_name + "] WARNING: " + s;
- if (m_log != null) { m_log.log(LogService.LOG_WARNING, message); }
+ message = "[" + m_name + "] WARNING: " + s;
+ if (m_log != null) {
+ m_log.log(LogService.LOG_WARNING, message);
+ }
System.err.println(message);
break;
default:
System.err.println("[" + m_name + "] UNKNOWN[" + level + "]: " + s);
- break;
+ break;
}
}
- /**
- * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
- */
- public void serviceChanged(ServiceEvent ev) {
- if (ev.getType() == ServiceEvent.REGISTERED && m_ref == null) {
- m_ref = ev.getServiceReference();
- m_log = (LogService) m_context.getService(m_ref);
- }
- if (ev.getType() == ServiceEvent.UNREGISTERING && m_ref == ev.getServiceReference()) {
- m_context.ungetService(m_ref);
- m_log = null;
- m_ref = m_context.getServiceReference(LogService.class.getName());
- if (m_ref != null) { m_log = (LogService) m_context.getService(m_ref); }
- }
-
- }
+ /**
+ * Service Listener implementation.
+ * @param ev : the service event
+ * @see org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.ServiceEvent)
+ */
+ public void serviceChanged(ServiceEvent ev) {
+ if (ev.getType() == ServiceEvent.REGISTERED && m_ref == null) {
+ m_ref = ev.getServiceReference();
+ m_log = (LogService) m_context.getService(m_ref);
+ }
+ if (ev.getType() == ServiceEvent.UNREGISTERING && m_ref == ev.getServiceReference()) {
+ m_context.ungetService(m_ref);
+ m_log = null;
+ m_ref = m_context.getServiceReference(LogService.class.getName());
+ if (m_ref != null) {
+ m_log = (LogService) m_context.getService(m_ref);
+ }
+ }
+
+ }
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/Configuration.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/Configuration.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/Configuration.java Tue Apr 17 07:31:35 2007
@@ -1,19 +1,21 @@
/*
- * $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/Configuration.java,v 1.16 2006/03/14 01:21:09 hargrave Exp $
- *
+ * $Header:
+ * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/Configuration.java,v
+ * 1.16 2006/03/14 01:21:09 hargrave Exp $
+ *
* Copyright (c) OSGi Alliance (2001, 2005). 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * Licensed 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.
+ * 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.
*/
package org.osgi.service.cm;
@@ -63,165 +65,165 @@
* @version $Revision: 1.16 $
*/
public interface Configuration {
- /**
- * Get the PID for this <code>Configuration</code> object.
- *
- * @return the PID for this <code>Configuration</code> object.
- * @throws IllegalStateException if this configuration has been deleted
- */
- public String getPid();
-
- /**
- * Return the properties of this <code>Configuration</code> object.
- *
- * The <code>Dictionary</code> 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</code>.
- *
- * <p>
- * If called just after the configuration is created and before update has
- * been called, this method returns <code>null</code>.
- *
- * @return A private copy of the properties for the caller or
- * <code>null</code>. These properties must not contain the
- * "service.bundleLocation" property. The value of this property may
- * be obtained from the <code>getBundleLocation</code> method.
- * @throws IllegalStateException if this configuration has been deleted
- */
- public Dictionary getProperties();
-
- /**
- * Update the properties of this <code>Configuration</code> object.
- *
- * Stores the properties in persistent storage after adding or overwriting
- * the following properties:
- * <ul>
- * <li>"service.pid" : is set to be the PID of this configuration.</li>
- * <li>"service.factoryPid" : if this is a factory configuration it is set
- * to the factory PID else it is not set.</li>
- * </ul>
- * These system properties are all of type <code>String</code>.
- *
- * <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 intiates an asynchronous call to all
- * <code>ConfigurationListener</code>s with a
- * <code>ConfigurationEvent.CM_UPDATED</code> event.
- *
- * @param properties the new set of properties for this configuration
- * @throws IOException if update cannot be made persistent
- * @throws IllegalArgumentException if the <code>Dictionary</code> object
- * 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 properties) throws IOException;
-
- /**
- * Delete this <code>Configuration</code> object.
- *
- * Removes this configuration object from the persistent store. Notify
- * asynchronously the corresponding Managed Service or Managed Service
- * Factory. A <code>ManagedService</code> object is notified by a call to
- * its <code>updated</code> method with a <code>null</code> properties
- * argument. A <code>ManagedServiceFactory</code> object is notified by a
- * call to its <code>deleted</code> method.
- *
- * <p>
- * Also intiates an asynchronous call to all
- * <code>ConfigurationListener</code>s with a
- * <code>ConfigurationEvent.CM_DELETED</code> event.
- *
- * @throws IOException If delete fails
- * @throws IllegalStateException if this configuration has been deleted
- */
- public void delete() throws IOException;
-
- /**
- * For a factory configuration return the PID of the corresponding Managed
- * Service Factory, else return <code>null</code>.
- *
- * @return factory PID or <code>null</code>
- * @throws IllegalStateException if this configuration has been deleted
- */
- public String getFactoryPid();
-
- /**
- * Update the <code>Configuration</code> object with the current
- * properties.
- *
- * Initiate the <code>updated</code> 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 initate a callback. For example, when that bundle detects a
- * change that requires an update of the Managed Service or Managed Service
- * Factory via its <code>ConfigurationPlugin</code> object.
- *
- * @see ConfigurationPlugin
- * @throws IOException if update cannot access the properties in persistent
- * storage
- * @throws IllegalStateException if this configuration has been deleted
- */
- public void update() throws IOException;
-
- /**
- * Bind this <code>Configuration</code> object to the specified bundle
- * location.
- *
- * If the bundleLocation parameter is <code>null</code> then the
- * <code>Configuration</code> object will not be bound to a location. It
- * will be set to the bundle's location before the first time a Managed
- * Service/Managed Service Factory receives this <code>Configuration</code>
- * object via the updated method and before any plugins are called. The
- * bundle location will be set persistently.
- *
- * @param bundleLocation a bundle location or <code>null</code>
- * @throws IllegalStateException If this configuration has been deleted.
- * @throws SecurityException If the caller does not have
- * <code>ConfigurationPermission[*,CONFIGURE]</code>.
- */
- public void setBundleLocation(String bundleLocation);
-
- /**
- * Get the bundle location.
- *
- * Returns the bundle location to which this configuration is bound, or
- * <code>null</code> if it is not yet bound to a bundle location.
- *
- * @return location to which this configuration is bound, or
- * <code>null</code>.
- * @throws IllegalStateException If this <code>Configuration</code> object
- * has been deleted.
- * @throws SecurityException If the caller does not have
- * <code>ConfigurationPermission[*,CONFIGURE]</code>.
- */
- public String getBundleLocation();
-
- /**
- * Equality is defined to have equal PIDs
- *
- * Two Configuration objects are equal when their PIDs are equal.
- *
- * @param other <code>Configuration</code> object to compare against
- * @return <code>true</code> if equal, <code>false</code> if not a
- * <code>Configuration</code> object or one with a different PID.
- */
- public boolean equals(Object other);
-
- /**
- * Hash code is based on PID.
- *
- * The hashcode for two Configuration objects must be the same when the
- * Configuration PID's are the same.
- *
- * @return hash code for this Configuration object
- */
- public int hashCode();
+ /**
+ * Get the PID for this <code>Configuration</code> object.
+ *
+ * @return the PID for this <code>Configuration</code> object.
+ * @throws IllegalStateException if this configuration has been deleted
+ */
+ public String getPid();
+
+ /**
+ * Return the properties of this <code>Configuration</code> object.
+ *
+ * The <code>Dictionary</code> 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</code>.
+ *
+ * <p>
+ * If called just after the configuration is created and before update has
+ * been called, this method returns <code>null</code>.
+ *
+ * @return A private copy of the properties for the caller or
+ * <code>null</code>. These properties must not contain the
+ * "service.bundleLocation" property. The value of this property may be
+ * obtained from the <code>getBundleLocation</code> method.
+ * @throws IllegalStateException if this configuration has been deleted
+ */
+ public Dictionary getProperties();
+
+ /**
+ * Update the properties of this <code>Configuration</code> object.
+ *
+ * Stores the properties in persistent storage after adding or overwriting
+ * the following properties:
+ * <ul>
+ * <li>"service.pid" : is set to be the PID of this configuration.</li>
+ * <li>"service.factoryPid" : if this is a factory configuration it is set
+ * to the factory PID else it is not set.</li>
+ * </ul>
+ * These system properties are all of type <code>String</code>.
+ *
+ * <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 intiates an asynchronous call to all
+ * <code>ConfigurationListener</code>s with a
+ * <code>ConfigurationEvent.CM_UPDATED</code> event.
+ *
+ * @param properties the new set of properties for this configuration
+ * @throws IOException if update cannot be made persistent
+ * @throws IllegalArgumentException if the <code>Dictionary</code> object
+ * 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 properties) throws IOException;
+
+ /**
+ * Delete this <code>Configuration</code> object.
+ *
+ * Removes this configuration object from the persistent store. Notify
+ * asynchronously the corresponding Managed Service or Managed Service
+ * Factory. A <code>ManagedService</code> object is notified by a call to
+ * its <code>updated</code> method with a <code>null</code> properties
+ * argument. A <code>ManagedServiceFactory</code> object is notified by a
+ * call to its <code>deleted</code> method.
+ *
+ * <p>
+ * Also intiates an asynchronous call to all
+ * <code>ConfigurationListener</code>s with a
+ * <code>ConfigurationEvent.CM_DELETED</code> event.
+ *
+ * @throws IOException If delete fails
+ * @throws IllegalStateException if this configuration has been deleted
+ */
+ public void delete() throws IOException;
+
+ /**
+ * For a factory configuration return the PID of the corresponding Managed
+ * Service Factory, else return <code>null</code>.
+ *
+ * @return factory PID or <code>null</code>
+ * @throws IllegalStateException if this configuration has been deleted
+ */
+ public String getFactoryPid();
+
+ /**
+ * Update the <code>Configuration</code> object with the current
+ * properties.
+ *
+ * Initiate the <code>updated</code> 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 initate a callback. For example, when that bundle detects a
+ * change that requires an update of the Managed Service or Managed Service
+ * Factory via its <code>ConfigurationPlugin</code> object.
+ *
+ * @see ConfigurationPlugin
+ * @throws IOException if update cannot access the properties in persistent
+ * storage
+ * @throws IllegalStateException if this configuration has been deleted
+ */
+ public void update() throws IOException;
+
+ /**
+ * Bind this <code>Configuration</code> object to the specified bundle
+ * location.
+ *
+ * If the bundleLocation parameter is <code>null</code> then the
+ * <code>Configuration</code> object will not be bound to a location. It
+ * will be set to the bundle's location before the first time a Managed
+ * Service/Managed Service Factory receives this <code>Configuration</code>
+ * object via the updated method and before any plugins are called. The
+ * bundle location will be set persistently.
+ *
+ * @param bundleLocation a bundle location or <code>null</code>
+ * @throws IllegalStateException If this configuration has been deleted.
+ * @throws SecurityException If the caller does not have
+ * <code>ConfigurationPermission[*,CONFIGURE]</code>.
+ */
+ public void setBundleLocation(String bundleLocation);
+
+ /**
+ * Get the bundle location.
+ *
+ * Returns the bundle location to which this configuration is bound, or
+ * <code>null</code> if it is not yet bound to a bundle location.
+ *
+ * @return location to which this configuration is bound, or
+ * <code>null</code>.
+ * @throws IllegalStateException If this <code>Configuration</code> object
+ * has been deleted.
+ * @throws SecurityException If the caller does not have
+ * <code>ConfigurationPermission[*,CONFIGURE]</code>.
+ */
+ public String getBundleLocation();
+
+ /**
+ * Equality is defined to have equal PIDs
+ *
+ * Two Configuration objects are equal when their PIDs are equal.
+ *
+ * @param other <code>Configuration</code> object to compare against
+ * @return <code>true</code> if equal, <code>false</code> if not a
+ * <code>Configuration</code> object or one with a different PID.
+ */
+ public boolean equals(Object other);
+
+ /**
+ * Hash code is based on PID.
+ *
+ * The hashcode for two Configuration objects must be the same when the
+ * Configuration PID's are the same.
+ *
+ * @return hash code for this Configuration object
+ */
+ public int hashCode();
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java Tue Apr 17 07:31:35 2007
@@ -1,19 +1,21 @@
/*
- * $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationAdmin.java,v 1.14 2006/03/14 01:21:09 hargrave Exp $
- *
+ * $Header:
+ * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationAdmin.java,v
+ * 1.14 2006/03/14 01:21:09 hargrave Exp $
+ *
* Copyright (c) OSGi Alliance (2001, 2005). 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * Licensed 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.
+ * 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.
*/
package org.osgi.service.cm;
@@ -103,154 +105,157 @@
* @version $Revision: 1.14 $
*/
public interface ConfigurationAdmin {
- /**
- * Service property naming the Factory PID in the configuration dictionary.
- * The property's value is of type <code>String</code>.
- *
- * @since 1.1
- */
- public final static String SERVICE_FACTORYPID = "service.factoryPid";
- /**
- * Service property naming the location of the bundle that is associated
- * with a a <code>Configuration</code> object. This property can be
- * searched for but must not appear in the configuration dictionary for
- * security reason. The property's value is of type <code>String</code>.
- *
- * @since 1.1
- */
- public final static String SERVICE_BUNDLELOCATION = "service.bundleLocation";
-
- /**
- * Create a new factory <code>Configuration</code> object with a new PID.
- *
- * The properties of the new <code>Configuration</code> object are
- * <code>null</code> until the first time that its
- * {@link Configuration#update(Dictionary)}method is called.
- *
- * <p>
- * It is not required that the <code>factoryPid</code> maps to a
- * registered Managed Service Factory.
- * <p>
- * The <code>Configuration</code> object is bound to the location of the
- * calling bundle.
- *
- * @param factoryPid PID of factory (not <code>null</code>).
- * @return A new <code>Configuration</code> object.
- * @throws IOException if access to persistent storage fails.
- * @throws SecurityException if caller does not have <code>ConfigurationPermission[*,CONFIGURE]</code> and <code>factoryPid</code> is bound to another bundle.
- */
- public Configuration createFactoryConfiguration(String factoryPid)
- throws IOException;
-
- /**
- * Create a new factory <code>Configuration</code> object with a new PID.
- *
- * The properties of the new <code>Configuration</code> object are
- * <code>null</code> until the first time that its
- * {@link Configuration#update(Dictionary)}method is called.
- *
- * <p>
- * It is not required that the <code>factoryPid</code> maps to a
- * registered Managed Service Factory.
- *
- * <p>
- * The <code>Configuration</code> is bound to the location specified. If
- * this location is <code>null</code> it will be bound to the location of
- * the first bundle that registers a Managed Service Factory with a
- * corresponding PID.
- *
- * @param factoryPid PID of factory (not <code>null</code>).
- * @param location A bundle location string, or <code>null</code>.
- * @return a new <code>Configuration</code> object.
- * @throws IOException if access to persistent storage fails.
- * @throws SecurityException if caller does not have <code>ConfigurationPermission[*,CONFIGURE]</code>.
- */
- public Configuration createFactoryConfiguration(String factoryPid, String location)
- throws IOException;
-
- /**
- * Get an existing <code>Configuration</code> object from the persistent
- * store, or create a new <code>Configuration</code> object.
- *
- * <p>
- * If a <code>Configuration</code> with this PID already exists in
- * Configuration Admin service return it. The location parameter is ignored
- * in this case.
- *
- * <p>
- * Else, return a new <code>Configuration</code> object. This new object
- * is bound to the location and the properties are set to <code>null</code>.
- * If the location parameter is <code>null</code>, it will be set when a
- * Managed Service with the corresponding PID is registered for the first
- * time.
- *
- * @param pid Persistent identifier.
- * @param location The bundle location string, or <code>null</code>.
- * @return An existing or new <code>Configuration</code> object.
- * @throws IOException if access to persistent storage fails.
- * @throws SecurityException if the caller does not have <code>ConfigurationPermission[*,CONFIGURE]</code>.
- */
- public Configuration getConfiguration(String pid, String location)
- throws IOException;
-
- /**
- * Get an existing or new <code>Configuration</code> object from the
- * persistent store.
- *
- * If the <code>Configuration</code> object for this PID does not exist,
- * create a new <code>Configuration</code> object for that PID, where
- * properties are <code>null</code>. Bind its location to the calling
- * bundle's location.
- *
- * <p>
- * Otherwise, if the location of the existing <code>Configuration</code> object
- * is <code>null</code>, set it to the calling bundle's location.
- *
- * @param pid persistent identifier.
- * @return an existing or new <code>Configuration</code> matching the PID.
- * @throws IOException if access to persistent storage fails.
- * @throws SecurityException if the <code>Configuration</code> object is bound to a location different from that of the calling bundle and it has no <code>ConfigurationPermission[*,CONFIGURE]</code>.
- */
- public Configuration getConfiguration(String pid) throws IOException;
-
- /**
- * List the current <code>Configuration</code> objects which match the
- * filter.
- *
- * <p>
- * Only <code>Configuration</code> objects with non- <code>null</code>
- * properties are considered current. That is,
- * <code>Configuration.getProperties()</code> is guaranteed not to return
- * <code>null</code> for each of the returned <code>Configuration</code>
- * objects.
- *
- * <p>
- * Normally only <code>Configuration</code> objects that are bound to the
- * location of the calling bundle are returned, or all if the caller has
- * <code>ConfigurationPermission[*,CONFIGURE]</code>.
- *
- * <p>
- * The syntax of the filter string is as defined in the <code>Filter</code>
- * class. The filter can test any configuration parameters including the
- * following system properties:
- * <ul>
- * <li><code>service.pid</code>-<code>String</code>- the PID under
- * which this is registered</li>
- * <li><code>service.factoryPid</code>-<code>String</code>- the
- * factory if applicable</li>
- * <li><code>service.bundleLocation</code>-<code>String</code>- the
- * bundle location</li>
- * </ul>
- * The filter can also be <code>null</code>, meaning that all
- * <code>Configuration</code> objects should be returned.
- *
- * @param filter a <code>Filter</code> object, or <code>null</code> to
- * retrieve all <code>Configuration</code> objects.
- * @return all matching <code>Configuration</code> objects, or
- * <code>null</code> if there aren't any
- * @throws IOException if access to persistent storage fails
- * @throws InvalidSyntaxException if the filter string is invalid
- */
- public Configuration[] listConfigurations(String filter) throws IOException,
- InvalidSyntaxException;
+ /**
+ * Service property naming the Factory PID in the configuration dictionary.
+ * The property's value is of type <code>String</code>.
+ *
+ * @since 1.1
+ */
+ public final static String SERVICE_FACTORYPID = "service.factoryPid";
+
+ /**
+ * Service property naming the location of the bundle that is associated
+ * with a a <code>Configuration</code> object. This property can be
+ * searched for but must not appear in the configuration dictionary for
+ * security reason. The property's value is of type <code>String</code>.
+ *
+ * @since 1.1
+ */
+ public final static String SERVICE_BUNDLELOCATION = "service.bundleLocation";
+
+ /**
+ * Create a new factory <code>Configuration</code> object with a new PID.
+ *
+ * The properties of the new <code>Configuration</code> object are
+ * <code>null</code> until the first time that its
+ * {@link Configuration#update(Dictionary)}method is called.
+ *
+ * <p>
+ * It is not required that the <code>factoryPid</code> maps to a
+ * registered Managed Service Factory.
+ * <p>
+ * The <code>Configuration</code> object is bound to the location of the
+ * calling bundle.
+ *
+ * @param factoryPid PID of factory (not <code>null</code>).
+ * @return A new <code>Configuration</code> object.
+ * @throws IOException if access to persistent storage fails.
+ * @throws SecurityException if caller does not have
+ * <code>ConfigurationPermission[*,CONFIGURE]</code> and
+ * <code>factoryPid</code> is bound to another bundle.
+ */
+ public Configuration createFactoryConfiguration(String factoryPid) throws IOException;
+
+ /**
+ * Create a new factory <code>Configuration</code> object with a new PID.
+ *
+ * The properties of the new <code>Configuration</code> object are
+ * <code>null</code> until the first time that its
+ * {@link Configuration#update(Dictionary)}method is called.
+ *
+ * <p>
+ * It is not required that the <code>factoryPid</code> maps to a
+ * registered Managed Service Factory.
+ *
+ * <p>
+ * The <code>Configuration</code> is bound to the location specified. If
+ * this location is <code>null</code> it will be bound to the location of
+ * the first bundle that registers a Managed Service Factory with a
+ * corresponding PID.
+ *
+ * @param factoryPid PID of factory (not <code>null</code>).
+ * @param location A bundle location string, or <code>null</code>.
+ * @return a new <code>Configuration</code> object.
+ * @throws IOException if access to persistent storage fails.
+ * @throws SecurityException if caller does not have
+ * <code>ConfigurationPermission[*,CONFIGURE]</code>.
+ */
+ public Configuration createFactoryConfiguration(String factoryPid, String location) throws IOException;
+
+ /**
+ * Get an existing <code>Configuration</code> object from the persistent
+ * store, or create a new <code>Configuration</code> object.
+ *
+ * <p>
+ * If a <code>Configuration</code> with this PID already exists in
+ * Configuration Admin service return it. The location parameter is ignored
+ * in this case.
+ *
+ * <p>
+ * Else, return a new <code>Configuration</code> object. This new object
+ * is bound to the location and the properties are set to <code>null</code>.
+ * If the location parameter is <code>null</code>, it will be set when a
+ * Managed Service with the corresponding PID is registered for the first
+ * time.
+ *
+ * @param pid Persistent identifier.
+ * @param location The bundle location string, or <code>null</code>.
+ * @return An existing or new <code>Configuration</code> object.
+ * @throws IOException if access to persistent storage fails.
+ * @throws SecurityException if the caller does not have
+ * <code>ConfigurationPermission[*,CONFIGURE]</code>.
+ */
+ public Configuration getConfiguration(String pid, String location) throws IOException;
+
+ /**
+ * Get an existing or new <code>Configuration</code> object from the
+ * persistent store.
+ *
+ * If the <code>Configuration</code> object for this PID does not exist,
+ * create a new <code>Configuration</code> object for that PID, where
+ * properties are <code>null</code>. Bind its location to the calling
+ * bundle's location.
+ *
+ * <p>
+ * Otherwise, if the location of the existing <code>Configuration</code>
+ * object is <code>null</code>, set it to the calling bundle's location.
+ *
+ * @param pid persistent identifier.
+ * @return an existing or new <code>Configuration</code> matching the PID.
+ * @throws IOException if access to persistent storage fails.
+ * @throws SecurityException if the <code>Configuration</code> object is
+ * bound to a location different from that of the calling bundle and it has
+ * no <code>ConfigurationPermission[*,CONFIGURE]</code>.
+ */
+ public Configuration getConfiguration(String pid) throws IOException;
+
+ /**
+ * List the current <code>Configuration</code> objects which match the
+ * filter.
+ *
+ * <p>
+ * Only <code>Configuration</code> objects with non- <code>null</code>
+ * properties are considered current. That is,
+ * <code>Configuration.getProperties()</code> is guaranteed not to return
+ * <code>null</code> for each of the returned <code>Configuration</code>
+ * objects.
+ *
+ * <p>
+ * Normally only <code>Configuration</code> objects that are bound to the
+ * location of the calling bundle are returned, or all if the caller has
+ * <code>ConfigurationPermission[*,CONFIGURE]</code>.
+ *
+ * <p>
+ * The syntax of the filter string is as defined in the <code>Filter</code>
+ * class. The filter can test any configuration parameters including the
+ * following system properties:
+ * <ul>
+ * <li><code>service.pid</code>-<code>String</code>- the PID under
+ * which this is registered</li>
+ * <li><code>service.factoryPid</code>-<code>String</code>- the
+ * factory if applicable</li>
+ * <li><code>service.bundleLocation</code>-<code>String</code>- the
+ * bundle location</li>
+ * </ul>
+ * The filter can also be <code>null</code>, meaning that all
+ * <code>Configuration</code> objects should be returned.
+ *
+ * @param filter a <code>Filter</code> object, or <code>null</code> to
+ * retrieve all <code>Configuration</code> objects.
+ * @return all matching <code>Configuration</code> objects, or
+ * <code>null</code> if there aren't any
+ * @throws IOException if access to persistent storage fails
+ * @throws InvalidSyntaxException if the filter string is invalid
+ */
+ public Configuration[] listConfigurations(String filter) throws IOException, InvalidSyntaxException;
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationEvent.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationEvent.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationEvent.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationEvent.java Tue Apr 17 07:31:35 2007
@@ -1,19 +1,21 @@
/*
- * $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationEvent.java,v 1.8 2006/03/14 01:21:09 hargrave Exp $
+ * $Header:
+ * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationEvent.java,v
+ * 1.8 2006/03/14 01:21:09 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * Licensed 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.
+ * 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.
*/
package org.osgi.service.cm;
@@ -50,118 +52,122 @@
* @since 1.2
*/
public class ConfigurationEvent {
- /**
- * A <code>Configuration</code> has been updated.
- *
- * <p>
- * This <code>ConfigurationEvent</code> type that indicates that a
- * <code>Configuration</code> object has been updated with new properties.
- *
- * An event is fired when a call to <code>Configuration.update</code>
- * successfully changes a configuration.
- *
- * <p>
- * The value of <code>CM_UPDATED</code> is 1.
- */
- public static final int CM_UPDATED = 1;
- /**
- * A <code>Configuration</code> has been deleted.
- *
- * <p>
- * This <code>ConfigurationEvent</code> type that indicates that a
- * <code>Configuration</code> object has been deleted.
- *
- * An event is fired when a call to <code>Configuration.delete</code>
- * successfully deletes a configuration.
- *
- * <p>
- * The value of <code>CM_DELETED</code> is 2.
- */
- public static final int CM_DELETED = 2;
- /**
- * Type of this event.
- *
- * @see #getType
- */
- private final int type;
- /**
- * The factory pid associated with this event.
- */
- private final String factoryPid;
- /**
- * The pid associated with this event.
- */
- private final String pid;
- /**
- * The ConfigurationAdmin service which created this event.
- */
- private final ServiceReference reference;
-
- /**
- * Constructs a <code>ConfigurationEvent</code> object from the given
- * <code>ServiceReference</code> object, event type, and pids.
- *
- * @param reference The <code>ServiceReference</code> object of the
- * Configuration Admin service that created this event.
- * @param type The event type. See {@link #getType}.
- * @param factoryPid The factory pid of the associated configuration if the
- * target of the configuration is a ManagedServiceFactory. Otherwise
- * <code>null</code> if the target of the configuration is a
- * ManagedService.
- * @param pid The pid of the associated configuration.
- */
- public ConfigurationEvent(ServiceReference reference, int type,
- String factoryPid, String pid) {
- this.reference = reference;
- this.type = type;
- this.factoryPid = factoryPid;
- this.pid = pid;
- }
-
- /**
- * Returns the factory pid of the associated configuration.
- *
- * @return Returns the factory pid of the associated configuration if the
- * target of the configuration is a ManagedServiceFactory. Otherwise
- * <code>null</code> if the target of the configuration is a
- * ManagedService.
- */
- public String getFactoryPid() {
- return factoryPid;
- }
-
- /**
- * Returns the pid of the associated configuration.
- *
- * @return Returns the pid of the associated configuration.
- */
- public String getPid() {
- return pid;
- }
-
- /**
- * Return the type of this event.
- * <p>
- * The type values are:
- * <ul>
- * <li>{@link #CM_UPDATED}
- * <li>{@link #CM_DELETED}
- * </ul>
- *
- * @return The type of this event.
- */
- public int getType() {
- return type;
- }
-
- /**
- * Return the <code>ServiceReference</code> object of the Configuration
- * Admin service that created this event.
- *
- * @return The <code>ServiceReference</code> object for the Configuration
- * Admin service that created this event.
- */
- public ServiceReference getReference() {
- return reference;
- }
+ /**
+ * A <code>Configuration</code> has been updated.
+ *
+ * <p>
+ * This <code>ConfigurationEvent</code> type that indicates that a
+ * <code>Configuration</code> object has been updated with new properties.
+ *
+ * An event is fired when a call to <code>Configuration.update</code>
+ * successfully changes a configuration.
+ *
+ * <p>
+ * The value of <code>CM_UPDATED</code> is 1.
+ */
+ public static final int CM_UPDATED = 1;
+
+ /**
+ * A <code>Configuration</code> has been deleted.
+ *
+ * <p>
+ * This <code>ConfigurationEvent</code> type that indicates that a
+ * <code>Configuration</code> object has been deleted.
+ *
+ * An event is fired when a call to <code>Configuration.delete</code>
+ * successfully deletes a configuration.
+ *
+ * <p>
+ * The value of <code>CM_DELETED</code> is 2.
+ */
+ public static final int CM_DELETED = 2;
+
+ /**
+ * Type of this event.
+ *
+ * @see #getType
+ */
+ private final int type;
+
+ /**
+ * The factory pid associated with this event.
+ */
+ private final String factoryPid;
+
+ /**
+ * The pid associated with this event.
+ */
+ private final String pid;
+
+ /**
+ * The ConfigurationAdmin service which created this event.
+ */
+ private final ServiceReference reference;
+
+ /**
+ * Constructs a <code>ConfigurationEvent</code> object from the given
+ * <code>ServiceReference</code> object, event type, and pids.
+ *
+ * @param reference The <code>ServiceReference</code> object of the
+ * Configuration Admin service that created this event.
+ * @param type The event type. See {@link #getType}.
+ * @param factoryPid The factory pid of the associated configuration if the
+ * target of the configuration is a ManagedServiceFactory. Otherwise
+ * <code>null</code> if the target of the configuration is a
+ * ManagedService.
+ * @param pid The pid of the associated configuration.
+ */
+ public ConfigurationEvent(ServiceReference reference, int type, String factoryPid, String pid) {
+ this.reference = reference;
+ this.type = type;
+ this.factoryPid = factoryPid;
+ this.pid = pid;
+ }
+
+ /**
+ * Returns the factory pid of the associated configuration.
+ *
+ * @return Returns the factory pid of the associated configuration if the
+ * target of the configuration is a ManagedServiceFactory. Otherwise
+ * <code>null</code> if the target of the configuration is a
+ * ManagedService.
+ */
+ public String getFactoryPid() {
+ return factoryPid;
+ }
+
+ /**
+ * Returns the pid of the associated configuration.
+ *
+ * @return Returns the pid of the associated configuration.
+ */
+ public String getPid() {
+ return pid;
+ }
+
+ /**
+ * Return the type of this event.
+ * <p>
+ * The type values are:
+ * <ul>
+ * <li>{@link #CM_UPDATED}
+ * <li>{@link #CM_DELETED}
+ * </ul>
+ *
+ * @return The type of this event.
+ */
+ public int getType() {
+ return type;
+ }
+
+ /**
+ * Return the <code>ServiceReference</code> object of the Configuration
+ * Admin service that created this event.
+ *
+ * @return The <code>ServiceReference</code> object for the Configuration
+ * Admin service that created this event.
+ */
+ public ServiceReference getReference() {
+ return reference;
+ }
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationException.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationException.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationException.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationException.java Tue Apr 17 07:31:35 2007
@@ -1,19 +1,21 @@
/*
- * $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationException.java,v 1.11 2006/03/14 01:21:09 hargrave Exp $
- *
+ * $Header:
+ * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationException.java,v
+ * 1.11 2006/03/14 01:21:09 hargrave Exp $
+ *
* Copyright (c) OSGi Alliance (2001, 2005). 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * Licensed 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.
+ * 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.
*/
package org.osgi.service.cm;
@@ -24,89 +26,89 @@
* @version $Revision: 1.11 $
*/
public class ConfigurationException extends Exception {
- static final long serialVersionUID = -1690090413441769377L;
+ static final long serialVersionUID = -1690090413441769377L;
+
+ private String property;
- private String property;
- private String reason;
+ private String reason;
- /**
- * Nested exception.
- */
- private Throwable cause;
-
- /**
- * Create a <code>ConfigurationException</code> object.
- *
- * @param property name of the property that caused the problem,
- * <code>null</code> if no specific property was the cause
- * @param reason reason for failure
- */
- public ConfigurationException(String property, String reason) {
- super(property + " : " + reason);
- this.property = property;
- this.reason = reason;
- this.cause = null;
- }
-
- /**
- * Create a <code>ConfigurationException</code> object.
- *
- * @param property name of the property that caused the problem,
- * <code>null</code> if no specific property was the cause
- * @param reason reason for failure
- * @param cause The cause of this exception.
- * @since 1.2
- */
- public ConfigurationException(String property, String reason,
- Throwable cause) {
- super(property + " : " + reason);
- this.property = property;
- this.reason = reason;
- this.cause = cause;
- }
-
- /**
- * Return the property name that caused the failure or null.
- *
- * @return name of property or null if no specific property caused the
- * problem
- */
- public String getProperty() {
- return property;
- }
-
- /**
- * Return the reason for this exception.
- *
- * @return reason of the failure
- */
- public String getReason() {
- return reason;
- }
-
- /**
- * Returns the cause of this exception or <code>null</code> if no cause
- * was specified when this exception was created.
- *
- * @return The cause of this exception or <code>null</code> if no cause
- * was specified.
- * @since 1.2
- */
- public Throwable getCause() {
- return cause;
- }
-
- /**
- * The cause of this exception can only be set when constructed.
- *
- * @param cause Cause of the exception.
- * @return This object.
- * @throws java.lang.IllegalStateException This method will always throw an
- * <code>IllegalStateException</code> since the cause of this
- * exception can only be set when constructed.
- * @since 1.2
- */
- public Throwable initCause(Throwable cause) {
- throw new IllegalStateException();
- }
+ /**
+ * Nested exception.
+ */
+ private Throwable cause;
+
+ /**
+ * Create a <code>ConfigurationException</code> object.
+ *
+ * @param property name of the property that caused the problem,
+ * <code>null</code> if no specific property was the cause
+ * @param reason reason for failure
+ */
+ public ConfigurationException(String property, String reason) {
+ super(property + " : " + reason);
+ this.property = property;
+ this.reason = reason;
+ this.cause = null;
+ }
+
+ /**
+ * Create a <code>ConfigurationException</code> object.
+ *
+ * @param property name of the property that caused the problem,
+ * <code>null</code> if no specific property was the cause
+ * @param reason reason for failure
+ * @param cause The cause of this exception.
+ * @since 1.2
+ */
+ public ConfigurationException(String property, String reason, Throwable cause) {
+ super(property + " : " + reason);
+ this.property = property;
+ this.reason = reason;
+ this.cause = cause;
+ }
+
+ /**
+ * Return the property name that caused the failure or null.
+ *
+ * @return name of property or null if no specific property caused the
+ * problem
+ */
+ public String getProperty() {
+ return property;
+ }
+
+ /**
+ * Return the reason for this exception.
+ *
+ * @return reason of the failure
+ */
+ public String getReason() {
+ return reason;
+ }
+
+ /**
+ * Returns the cause of this exception or <code>null</code> if no cause
+ * was specified when this exception was created.
+ *
+ * @return The cause of this exception or <code>null</code> if no cause
+ * was specified.
+ * @since 1.2
+ */
+ public Throwable getCause() {
+ return cause;
+ }
+
+ /**
+ * The cause of this exception can only be set when constructed.
+ *
+ * @param cause Cause of the exception.
+ * @return This object.
+ * @throws java.lang.IllegalStateException This method will always throw an
+ * <code>IllegalStateException</code> since the cause of this exception
+ * can only be set when constructed.
+ * @since 1.2
+ */
+ public Throwable initCause(Throwable cause) {
+ throw new IllegalStateException();
+ }
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationListener.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationListener.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationListener.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationListener.java Tue Apr 17 07:31:35 2007
@@ -1,19 +1,21 @@
/*
- * $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationListener.java,v 1.9 2006/03/14 01:21:09 hargrave Exp $
+ * $Header:
+ * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationListener.java,v
+ * 1.9 2006/03/14 01:21:09 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * Licensed 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.
+ * 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.
*/
package org.osgi.service.cm;
@@ -41,10 +43,10 @@
* @since 1.2
*/
public interface ConfigurationListener {
- /**
- * Receives notification of a Configuration that has changed.
- *
- * @param event The <code>ConfigurationEvent</code>.
- */
- public void configurationEvent(ConfigurationEvent event);
+ /**
+ * Receives notification of a Configuration that has changed.
+ *
+ * @param event The <code>ConfigurationEvent</code>.
+ */
+ public void configurationEvent(ConfigurationEvent event);
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPermission.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPermission.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPermission.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPermission.java Tue Apr 17 07:31:35 2007
@@ -1,19 +1,21 @@
/*
- * $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationPermission.java,v 1.20 2006/03/14 01:21:09 hargrave Exp $
+ * $Header:
+ * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationPermission.java,v
+ * 1.20 2006/03/14 01:21:09 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2004, 2005). 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ * Licensed 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.
+ * 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.
*/
package org.osgi.service.cm;
@@ -34,93 +36,93 @@
*/
public final class ConfigurationPermission extends BasicPermission {
- static final long serialVersionUID = 5716868734811965383L;
- /**
- * The action string <code>configure</code>.
- */
- public final static String CONFIGURE = "configure";
-
- /**
- * Create a new ConfigurationPermission.
- *
- * @param name Name must be "*".
- * @param actions <code>configure</code> (canonical order).
- */
-
- public ConfigurationPermission(String name, String actions) {
- super(name);
- if (!name.equals("*")) {
- throw new IllegalArgumentException("name must be *");
- }
- actions = actions.trim();
- if (actions.equalsIgnoreCase(CONFIGURE)||actions.equals("*"))
- return;
-
- throw new IllegalArgumentException("actions must be " + CONFIGURE);
- }
-
- /**
- * Determines if a <code>ConfigurationPermission</code> object "implies"
- * the specified permission.
- *
- * @param p The target permission to check.
- * @return <code>true</code> if the specified permission is implied by
- * this object; <code>false</code> otherwise.
- */
-
- public boolean implies(Permission p) {
- return p instanceof ConfigurationPermission;
- }
-
- /**
- * Determines the equality of two <code>ConfigurationPermission</code>
- * objects.
- * <p>
- * Two <code>ConfigurationPermission</code> objects are equal.
- *
- * @param obj The object being compared for equality with this object.
- * @return <code>true</code> if <code>obj</code> is equivalent to this
- * <code>ConfigurationPermission</code>; <code>false</code>
- * otherwise.
- */
- public boolean equals(Object obj) {
- return obj instanceof ConfigurationPermission;
- }
-
- /**
- * Returns the hash code value for this object.
- *
- * @return Hash code value for this object.
- */
-
- public int hashCode() {
- return getName().hashCode() ^ getActions().hashCode();
- }
-
- /**
- * Returns the canonical string representation of the
- * <code>ConfigurationPermission</code> actions.
- *
- * <p>
- * Always returns present <code>ConfigurationPermission</code> actions in
- * the following order: <code>CONFIGURE</code>
- *
- * @return Canonical string representation of the
- * <code>ConfigurationPermission</code> actions.
- */
- public String getActions() {
- return CONFIGURE;
- }
-
- /**
- * Returns a new <code>PermissionCollection</code> object suitable for
- * storing <code>ConfigurationPermission</code>s.
- *
- * @return A new <code>PermissionCollection</code> object.
- */
- public PermissionCollection newPermissionCollection() {
- return new ConfigurationPermissionCollection();
- }
+ static final long serialVersionUID = 5716868734811965383L;
+
+ /**
+ * The action string <code>configure</code>.
+ */
+ public final static String CONFIGURE = "configure";
+
+ /**
+ * Create a new ConfigurationPermission.
+ *
+ * @param name Name must be "*".
+ * @param actions <code>configure</code> (canonical order).
+ */
+
+ public ConfigurationPermission(String name, String actions) {
+ super(name);
+ if (!name.equals("*")) {
+ throw new IllegalArgumentException("name must be *");
+ }
+ actions = actions.trim();
+ if (actions.equalsIgnoreCase(CONFIGURE) || actions.equals("*"))
+ return;
+
+ throw new IllegalArgumentException("actions must be " + CONFIGURE);
+ }
+
+ /**
+ * Determines if a <code>ConfigurationPermission</code> object "implies"
+ * the specified permission.
+ *
+ * @param p The target permission to check.
+ * @return <code>true</code> if the specified permission is implied by
+ * this object; <code>false</code> otherwise.
+ */
+
+ public boolean implies(Permission p) {
+ return p instanceof ConfigurationPermission;
+ }
+
+ /**
+ * Determines the equality of two <code>ConfigurationPermission</code>
+ * objects.
+ * <p>
+ * Two <code>ConfigurationPermission</code> objects are equal.
+ *
+ * @param obj The object being compared for equality with this object.
+ * @return <code>true</code> if <code>obj</code> is equivalent to this
+ * <code>ConfigurationPermission</code>; <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj) {
+ return obj instanceof ConfigurationPermission;
+ }
+
+ /**
+ * Returns the hash code value for this object.
+ *
+ * @return Hash code value for this object.
+ */
+
+ public int hashCode() {
+ return getName().hashCode() ^ getActions().hashCode();
+ }
+
+ /**
+ * Returns the canonical string representation of the
+ * <code>ConfigurationPermission</code> actions.
+ *
+ * <p>
+ * Always returns present <code>ConfigurationPermission</code> actions in
+ * the following order: <code>CONFIGURE</code>
+ *
+ * @return Canonical string representation of the
+ * <code>ConfigurationPermission</code> actions.
+ */
+ public String getActions() {
+ return CONFIGURE;
+ }
+
+ /**
+ * Returns a new <code>PermissionCollection</code> object suitable for
+ * storing <code>ConfigurationPermission</code>s.
+ *
+ * @return A new <code>PermissionCollection</code> object.
+ */
+ public PermissionCollection newPermissionCollection() {
+ return new ConfigurationPermissionCollection();
+ }
}
/**
@@ -131,89 +133,86 @@
* @see java.security.PermissionCollection
*/
final class ConfigurationPermissionCollection extends PermissionCollection {
- static final long serialVersionUID = -6917638867081695839L;
- /**
- * True if collection is non-empty.
- *
- * @serial
- */
- private boolean hasElement;
-
- /**
- * Creates an empty <tt>ConfigurationPermissionCollection</tt> object.
- *
- */
- public ConfigurationPermissionCollection() {
- hasElement = false;
- }
-
- /**
- * Adds the specified permission to the
- * <tt>ConfigurationPermissionCollection</tt>. The key for the hash is
- * the interface name of the service.
- *
- * @param permission The <tt>Permission</tt> object to add.
- *
- * @exception IllegalArgumentException If the permission is not an
- * <tt>ConfigurationPermission</tt>.
- *
- * @exception SecurityException If this ConfigurationPermissionCollection
- * object has been marked read-only.
- */
-
- public void add(Permission permission) {
- if (!(permission instanceof ConfigurationPermission)) {
- throw new IllegalArgumentException("invalid permission: "
- + permission);
- }
-
- if (isReadOnly())
- throw new SecurityException("attempt to add a Permission to a "
- + "readonly PermissionCollection");
-
- hasElement = true;
- }
-
- /**
- * Determines if the specified set of permissions implies the permissions
- * expressed in the parameter <tt>permission</tt>.
- *
- * @param p The Permission object to compare.
- *
- * @return true if permission is a proper subset of a permission in the set;
- * false otherwise.
- */
-
- public boolean implies(Permission p) {
- return hasElement && (p instanceof ConfigurationPermission);
- }
-
- /**
- * Returns an enumeration of an <tt>ConfigurationPermission</tt> object.
- *
- * @return Enumeration of an <tt>ConfigurationPermission</tt> object.
- */
-
- public Enumeration elements() {
- return new Enumeration() {
- private boolean more = hasElement;
-
- public boolean hasMoreElements() {
- return more;
- }
-
- public Object nextElement() {
- if (more) {
- more = false;
-
- return new ConfigurationPermission("*",
- ConfigurationPermission.CONFIGURE);
- }
- else {
- throw new NoSuchElementException();
- }
- }
- };
- }
+ static final long serialVersionUID = -6917638867081695839L;
+
+ /**
+ * True if collection is non-empty.
+ *
+ * @serial
+ */
+ private boolean hasElement;
+
+ /**
+ * Creates an empty <tt>ConfigurationPermissionCollection</tt> object.
+ *
+ */
+ public ConfigurationPermissionCollection() {
+ hasElement = false;
+ }
+
+ /**
+ * Adds the specified permission to the
+ * <tt>ConfigurationPermissionCollection</tt>. The key for the hash is
+ * the interface name of the service.
+ *
+ * @param permission The <tt>Permission</tt> object to add.
+ *
+ * @exception IllegalArgumentException If the permission is not an
+ * <tt>ConfigurationPermission</tt>.
+ *
+ * @exception SecurityException If this ConfigurationPermissionCollection
+ * object has been marked read-only.
+ */
+
+ public void add(Permission permission) {
+ if (!(permission instanceof ConfigurationPermission)) {
+ throw new IllegalArgumentException("invalid permission: " + permission);
+ }
+
+ if (isReadOnly())
+ throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
+
+ hasElement = true;
+ }
+
+ /**
+ * Determines if the specified set of permissions implies the permissions
+ * expressed in the parameter <tt>permission</tt>.
+ *
+ * @param p The Permission object to compare.
+ *
+ * @return true if permission is a proper subset of a permission in the set;
+ * false otherwise.
+ */
+
+ public boolean implies(Permission p) {
+ return hasElement && (p instanceof ConfigurationPermission);
+ }
+
+ /**
+ * Returns an enumeration of an <tt>ConfigurationPermission</tt> object.
+ *
+ * @return Enumeration of an <tt>ConfigurationPermission</tt> object.
+ */
+
+ public Enumeration elements() {
+ return new Enumeration() {
+ private boolean more = hasElement;
+
+ public boolean hasMoreElements() {
+ return more;
+ }
+
+ public Object nextElement() {
+ if (more) {
+ more = false;
+
+ return new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE);
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+ };
+ }
}
Modified: incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java?view=diff&rev=529623&r1=529622&r2=529623
==============================================================================
--- incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java (original)
+++ incubator/felix/trunk/ipojo/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java Tue Apr 17 07:31:35 2007
@@ -1,19 +1,21 @@
/*
- * $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationPlugin.java,v 1.10 2006/03/14 01:21:09 hargrave Exp $
- *
+ * $Header:
+ * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ConfigurationPlugin.java,v
+ * 1.10 2006/03/14 01:21:09 hargrave Exp $
+ *
* Copyright (c) OSGi Alliance (2001, 2005). 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
+ * Licensed 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.
+ * 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.
*/
package org.osgi.service.cm;
@@ -79,53 +81,53 @@
* @version $Revision: 1.10 $
*/
public interface ConfigurationPlugin {
- /**
- * A service property to limit the Managed Service or Managed Service
- * Factory configuration dictionaries a Configuration Plugin service
- * receives.
- *
- * This property contains a <code>String[]</code> of PIDs. A Configuration
- * Admin service must call a Configuration Plugin service only when this
- * property is not set, or the target service's PID is listed in this
- * property.
- */
- public static final String CM_TARGET = "cm.target";
- /**
- * A service property to specify the order in which plugins are invoked.
- *
- * This property contains an <code>Integer</code> ranking of the plugin.
- * Not specifying this registration property, or setting it to something
- * other than an <code>Integer</code>, is the same as setting it to the
- * <code>Integer</code> zero. This property determines the order in which
- * plugins are invoked. Lower ranked plugins are called before higher ranked
- * ones.
- *
- * @since 1.2
- */
- public static final String CM_RANKING = "service.cmRanking";
+ /**
+ * A service property to limit the Managed Service or Managed Service
+ * Factory configuration dictionaries a Configuration Plugin service
+ * receives.
+ *
+ * This property contains a <code>String[]</code> of PIDs. A Configuration
+ * Admin service must call a Configuration Plugin service only when this
+ * property is not set, or the target service's PID is listed in this
+ * property.
+ */
+ public static final String CM_TARGET = "cm.target";
+
+ /**
+ * A service property to specify the order in which plugins are invoked.
+ *
+ * This property contains an <code>Integer</code> ranking of the plugin.
+ * Not specifying this registration property, or setting it to something
+ * other than an <code>Integer</code>, is the same as setting it to the
+ * <code>Integer</code> zero. This property determines the order in which
+ * plugins are invoked. Lower ranked plugins are called before higher ranked
+ * ones.
+ *
+ * @since 1.2
+ */
+ public static final String CM_RANKING = "service.cmRanking";
- /**
- * View and possibly modify the a set of configuration properties before
- * they are sent to the Managed Service or the Managed Service Factory. The
- * Configuration Plugin services are called in increasing order of their
- * <code>service.cmRanking</code> property. If this property is undefined
- * or is a non- <code>Integer</code> type, 0 is used.
- *
- * <p>
- * This method should not modify the properties unless the
- * <code>service.cmRanking</code> of this plugin is in the range
- * <code>0 <= service.cmRanking <= 1000</code>.
- * <p>
- * If this method throws any <code>Exception</code>, the Configuration
- * Admin service must catch it and should log it.
- *
- * @param reference reference to the Managed Service or Managed Service
- * Factory
- * @param properties The configuration properties. This argument must not
- * contain the "service.bundleLocation" property. The value of this
- * property may be obtained from the
- * <code>Configuration.getBundleLocation</code> method.
- */
- public void modifyConfiguration(ServiceReference reference,
- Dictionary properties);
+ /**
+ * View and possibly modify the a set of configuration properties before
+ * they are sent to the Managed Service or the Managed Service Factory. The
+ * Configuration Plugin services are called in increasing order of their
+ * <code>service.cmRanking</code> property. If this property is undefined
+ * or is a non- <code>Integer</code> type, 0 is used.
+ *
+ * <p>
+ * This method should not modify the properties unless the
+ * <code>service.cmRanking</code> of this plugin is in the range
+ * <code>0 <= service.cmRanking <= 1000</code>.
+ * <p>
+ * If this method throws any <code>Exception</code>, the Configuration
+ * Admin service must catch it and should log it.
+ *
+ * @param reference reference to the Managed Service or Managed Service
+ * Factory
+ * @param properties The configuration properties. This argument must not
+ * contain the "service.bundleLocation" property. The value of this property
+ * may be obtained from the <code>Configuration.getBundleLocation</code>
+ * method.
+ */
+ public void modifyConfiguration(ServiceReference reference, Dictionary properties);
}