Remove dependency on Java 5 (Felix-312)
Format code consistently
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@550770 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
index bdd5b48..75c2c07 100644
--- a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
+++ b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
@@ -18,7 +18,6 @@
*/
package org.apache.felix.ipojo.arch;
-
import java.io.PrintStream;
import org.apache.felix.ipojo.ComponentInstance;
@@ -26,19 +25,21 @@
import org.apache.felix.ipojo.architecture.InstanceDescription;
import org.ungoverned.osgi.service.shell.Command;
-
/**
* Implementation of the arch command printing the actual architecture.
+ *
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class ArchCommandImpl implements Command {
- /**
- * List of archi service
- */
- private Architecture archiService[];
+ /**
+ * List of arch service.
+ */
+ private Architecture[] m_archs;
/**
+ * Get the command name.
+ * @return the command name (arch)
* @see org.ungoverned.osgi.service.shell.Command#getName()
*/
public String getName() {
@@ -46,6 +47,8 @@
}
/**
+ * Get help message.
+ * @return the command usage.
* @see org.ungoverned.osgi.service.shell.Command#getUsage()
*/
public String getUsage() {
@@ -53,6 +56,8 @@
}
/**
+ * Get a small description.
+ * @return get a description.
* @see org.ungoverned.osgi.service.shell.Command#getShortDescription()
*/
public String getShortDescription() {
@@ -60,32 +65,39 @@
}
/**
+ * Execute the arch command.
+ * @param line : command line
+ * @param out : the default output stream
+ * @param err : the error output stream
* @see org.ungoverned.osgi.service.shell.Command#execute(java.lang.String, java.io.PrintStream, java.io.PrintStream)
*/
public void execute(String line, PrintStream out, PrintStream err) {
- synchronized(this) {
- if(line.substring("arch".length()).trim().length() == 0) {
- for(int i=0; i < archiService.length; i++) {
- InstanceDescription instance = archiService[i].getInstanceDescription();
- if(instance.getState() == ComponentInstance.VALID) {
- out.println("Instance " + instance.getName() + " -> valid");
- }
- if(instance.getState() == ComponentInstance.INVALID) {
- out.println("Instance " + instance.getName() + " -> invalid");
- }
- if(instance.getState() == ComponentInstance.STOPPED) {
- out.println("Instance " + instance.getName() + " -> stopped");
- }
- }
- } else {
- String line2 = line.substring("arch".length()).trim();
- for(int i=0; i < archiService.length; i++) {
- InstanceDescription instance = archiService[i].getInstanceDescription();
- if(instance.getName().equalsIgnoreCase(line2)) { out.println(instance.getDescription()); return;}
- }
- err.println("Instance " + line2 + " not found");
- }
+ synchronized (this) {
+ if (line.substring("arch".length()).trim().length() == 0) {
+ for (int i = 0; i < m_archs.length; i++) {
+ InstanceDescription instance = m_archs[i].getInstanceDescription();
+ if (instance.getState() == ComponentInstance.VALID) {
+ out.println("Instance " + instance.getName() + " -> valid");
+ }
+ if (instance.getState() == ComponentInstance.INVALID) {
+ out.println("Instance " + instance.getName() + " -> invalid");
+ }
+ if (instance.getState() == ComponentInstance.STOPPED) {
+ out.println("Instance " + instance.getName() + " -> stopped");
+ }
+ }
+ } else {
+ String line2 = line.substring("arch".length()).trim();
+ for (int i = 0; i < m_archs.length; i++) {
+ InstanceDescription instance = m_archs[i].getInstanceDescription();
+ if (instance.getName().equalsIgnoreCase(line2)) {
+ out.println(instance.getDescription());
+ return;
+ }
+ }
+ err.println("Instance " + line2 + " not found");
+ }
}
-
+
}
}
diff --git a/ipojo/arch/src/main/resources/metadata.xml b/ipojo/arch/src/main/resources/metadata.xml
index 24b7954..335418a 100644
--- a/ipojo/arch/src/main/resources/metadata.xml
+++ b/ipojo/arch/src/main/resources/metadata.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<iPOJO>
<Component className="org.apache.felix.ipojo.arch.ArchCommandImpl">
- <Provides interface="org.ungoverned.osgi.service.shell.Command"/>
- <Requires field="archiService" optional="true"/>
+ <Provides/>
+ <Requires field="m_archs" optional="true"/>
</Component>
<instance component="org.apache.felix.ipojo.arch.ArchCommandImpl" name="ArchCommand"/>
</iPOJO>
\ No newline at end of file
diff --git a/ipojo/core/pom.xml b/ipojo/core/pom.xml
index 624c4d6..0dd9e15 100644
--- a/ipojo/core/pom.xml
+++ b/ipojo/core/pom.xml
@@ -21,11 +21,6 @@
<version>0.9.0-incubator-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>asm</groupId>
- <artifactId>asm</artifactId>
- <version>3.0</version>
- </dependency>
- <dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
<version>0.7.3-incubator-SNAPSHOT</version>
@@ -62,7 +57,8 @@
org.apache.felix.ipojo.handlers.dependency.nullable,
org.apache.felix.ipojo.handlers.lifecycle.callback,
org.objectweb.asm,
- org.objectweb.asm.commons
+ org.objectweb.asm.commons,
+ org.objectweb.asm.tree <!-- to remove -->
</Private-Package>
<Export-Package>
org.apache.felix.ipojo; version="0.7.3",
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
index c613466..7e510ed 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
@@ -195,7 +195,7 @@
if (field != null) {
FieldMetadata fm = manipulation.getField(field);
- if (field == null) {
+ if (fm == null) {
getInstanceManager().getFactory().getLogger().log(Logger.ERROR, "A dependency field " + field + " does not exist in the implementation class");
return false;
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java
index 3a5162f..61245eb 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java
@@ -72,9 +72,10 @@
for (int i = 0; i < m_arguments.length; i++) {
String cn = m_arguments[i];
if (cn.endsWith("[]")) {
- cn = cn.replace("[]", "$");
+ cn = cn.replace('[', '$');
+ cn = cn.substring(0, cn.length() - 1);
}
- cn = cn.replace(".", "_");
+ cn = cn.replace('.', '_');
id += cn;
}
return id;
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/Configuration.java b/ipojo/core/src/main/java/org/osgi/service/cm/Configuration.java
deleted file mode 100644
index 90a633f..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/Configuration.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * $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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-import java.io.IOException;
-import java.util.Dictionary;
-
-/**
- * The configuration information for a <code>ManagedService</code> or
- * <code>ManagedServiceFactory</code> object.
- *
- * The Configuration Admin service uses this interface to represent the
- * configuration information for a <code>ManagedService</code> or for a
- * service instance of a <code>ManagedServiceFactory</code>.
- *
- * <p>
- * A <code>Configuration</code> object contains a configuration dictionary and
- * allows the properties to be updated via this object. Bundles wishing to
- * receive configuration dictionaries do not need to use this class - they
- * register a <code>ManagedService</code> or
- * <code>ManagedServiceFactory</code>. Only administrative bundles, and
- * bundles wishing to update their own configurations need to use this class.
- *
- * <p>
- * The properties handled in this configuration have case insensitive
- * <code>String</code> objects as keys. However, case is preserved from the
- * last set key/value.
- * <p>
- * A configuration can be <i>bound </i> to a bundle location (
- * <code>Bundle.getLocation()</code>). The purpose of binding a
- * <code>Configuration</code> object to a location is to make it impossible
- * for another bundle to forge a PID that would match this configuration. When a
- * configuration is bound to a specific location, and a bundle with a different
- * location registers a corresponding <code>ManagedService</code> object or
- * <code>ManagedServiceFactory</code> object, then the configuration is not
- * passed to the updated method of that object.
- *
- * <p>
- * If a configuration's location is <code>null</code>, it is not yet bound to
- * a location. It will become bound to the location of the first bundle that
- * registers a <code>ManagedService</code> or
- * <code>ManagedServiceFactory</code> object with the corresponding PID.
- * <p>
- * The same <code>Configuration</code> object is used for configuring both a
- * Managed Service Factory and a Managed Service. When it is important to
- * differentiate between these two the term "factory configuration" is used.
- *
- * @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();
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java b/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java
deleted file mode 100644
index 0ca830c..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationAdmin.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * $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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-import java.io.IOException;
-import java.util.Dictionary;
-
-import org.osgi.framework.InvalidSyntaxException;
-
-/**
- * Service for administering configuration data.
- *
- * <p>
- * The main purpose of this interface is to store bundle configuration data
- * persistently. This information is represented in <code>Configuration</code>
- * objects. The actual configuration data is a <code>Dictionary</code> of
- * properties inside a <code>Configuration</code> object.
- *
- * <p>
- * There are two principally different ways to manage configurations. First
- * there is the concept of a Managed Service, where configuration data is
- * uniquely associated with an object registered with the service registry.
- *
- * <p>
- * Next, there is the concept of a factory where the Configuration Admin service
- * will maintain 0 or more <code>Configuration</code> objects for a Managed
- * Service Factory that is registered with the Framework.
- *
- * <p>
- * The first concept is intended for configuration data about "things/services"
- * whose existence is defined externally, e.g. a specific printer. Factories are
- * intended for "things/services" that can be created any number of times, e.g.
- * a configuration for a DHCP server for different networks.
- *
- * <p>
- * Bundles that require configuration should register a Managed Service or a
- * Managed Service Factory in the service registry. A registration property
- * named <code>service.pid</code> (persistent identifier or PID) must be used
- * to identify this Managed Service or Managed Service Factory to the
- * Configuration Admin service.
- *
- * <p>
- * When the ConfigurationAdmin detects the registration of a Managed Service, it
- * checks its persistent storage for a configuration object whose PID matches
- * the PID registration property (<code>service.pid</code>) of the Managed
- * Service. If found, it calls {@link ManagedService#updated}method with the
- * new properties. The implementation of a Configuration Admin service must run
- * these call-backs asynchronously to allow proper synchronization.
- *
- * <p>
- * When the Configuration Admin service detects a Managed Service Factory
- * registration, it checks its storage for configuration objects whose
- * <code>factoryPid</code> matches the PID of the Managed Service Factory. For
- * each such <code>Configuration</code> objects, it calls the
- * <code>ManagedServiceFactory.updated</code> method asynchronously with the
- * new properties. The calls to the <code>updated</code> method of a
- * <code>ManagedServiceFactory</code> must be executed sequentially and not
- * overlap in time.
- *
- * <p>
- * In general, bundles having permission to use the Configuration Admin service
- * can only access and modify their own configuration information. Accessing or
- * modifying the configuration of another bundle requires
- * <code>ConfigurationPermission[*,CONFIGURE]</code>.
- *
- * <p>
- * <code>Configuration</code> objects can be <i>bound </i> to a specified
- * bundle location. In this case, if a matching Managed Service or Managed
- * Service Factory is registered by a bundle with a different location, then the
- * Configuration Admin service must not do the normal callback, and it should
- * log an error. In the case where a <code>Configuration</code> object is not
- * bound, its location field is <code>null</code>, the Configuration Admin
- * service will bind it to the location of the bundle that registers the first
- * Managed Service or Managed Service Factory that has a corresponding PID
- * property. When a <code>Configuration</code> object is bound to a bundle
- * location in this manner, the Confguration Admin service must detect if the
- * bundle corresponding to the location is uninstalled. If this occurs, the
- * <code>Configuration</code> object is unbound, that is its location field is
- * set back to <code>null</code>.
- *
- * <p>
- * The method descriptions of this class refer to a concept of "the calling
- * bundle". This is a loose way of referring to the bundle which obtained the
- * Configuration Admin service from the service registry. Implementations of
- * <code>ConfigurationAdmin</code> must use a
- * {@link org.osgi.framework.ServiceFactory}to support this concept.
- *
- * @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;
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationEvent.java b/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationEvent.java
deleted file mode 100644
index 31683ac..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationEvent.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * $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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-import org.osgi.framework.ServiceReference;
-
-/**
- * A Configuration Event.
- *
- * <p>
- * <code>ConfigurationEvent</code> objects are delivered to all registered
- * <code>ConfigurationListener</code> service objects. ConfigurationEvents
- * must be asynchronously delivered in chronological order with respect to each
- * listener.
- *
- * <p>
- * A type code is used to identify the type of event. The following event types
- * are defined:
- * <ul>
- * <li>{@link #CM_UPDATED}
- * <li>{@link #CM_DELETED}
- * </ul>
- * Additional event types may be defined in the future.
- *
- * <p>
- * Security Considerations. <code>ConfigurationEvent</code> objects do not
- * provide <code>Configuration</code> objects, so no sensitive configuration
- * information is available from the event. If the listener wants to locate the
- * <code>Configuration</code> object for the specified pid, it must use
- * <code>ConfigurationAdmin</code>.
- *
- * @see ConfigurationListener
- *
- * @version $Revision: 1.8 $
- * @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;
- }
-}
\ No newline at end of file
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationException.java b/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationException.java
deleted file mode 100644
index 709d335..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationException.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * $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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-/**
- * An <code>Exception</code> class to inform the Configuration Admin service
- * of problems with configuration data.
- *
- * @version $Revision: 1.11 $
- */
-public class ConfigurationException extends Exception {
- static final long serialVersionUID = -1690090413441769377L;
-
- private String property;
-
- 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();
- }
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationListener.java b/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationListener.java
deleted file mode 100644
index 83dd364..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationListener.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * $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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-/**
- * Listener for Configuration Events. When a <code>ConfigurationEvent</code>
- * is fired, it is asynchronously delivered to a
- * <code>ConfigurationListener</code>.
- *
- * <p>
- * <code>ConfigurationListener</code> objects are registered with the
- * Framework service registry and are notified with a
- * <code>ConfigurationEvent</code> object when an event is fired.
- * <p>
- * <code>ConfigurationListener</code> objects can inspect the received
- * <code>ConfigurationEvent</code> object to determine its type, the pid of
- * the <code>Configuration</code> object with which it is associated, and the
- * Configuration Admin service that fired the event.
- *
- * <p>
- * Security Considerations. Bundles wishing to monitor configuration events will
- * require <code>ServicePermission[ConfigurationListener,REGISTER]</code> to
- * register a <code>ConfigurationListener</code> service.
- *
- * @version $Revision: 1.9 $
- * @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);
-}
\ No newline at end of file
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationPermission.java b/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationPermission.java
deleted file mode 100644
index 33f9ab2..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationPermission.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * $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
- *
- * 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.
- */
-
-package org.osgi.service.cm;
-
-import java.security.BasicPermission;
-import java.security.Permission;
-import java.security.PermissionCollection;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * Indicates a bundle's authority to configure bundles.
- *
- * This permission has only a single action: CONFIGURE.
- *
- * @version $Revision: 1.20 $
- * @since 1.2
- */
-
-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();
- }
-}
-
-/**
- * Stores a set of <code>ConfigurationPermission</code> permissions.
- *
- * @see java.security.Permission
- * @see java.security.Permissions
- * @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();
- }
- }
- };
- }
-
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java b/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java
deleted file mode 100644
index 2eee326..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ConfigurationPlugin.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * $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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-import java.util.Dictionary;
-
-import org.osgi.framework.ServiceReference;
-
-/**
- * A service interface for processing configuration dictionary before the
- * update.
- *
- * <p>
- * A bundle registers a <code>ConfigurationPlugin</code> object in order to
- * process configuration updates before they reach the Managed Service or
- * Managed Service Factory. The Configuration Admin service will detect
- * registrations of Configuration Plugin services and must call these services
- * every time before it calls the <code>ManagedService</code> or
- * <code>ManagedServiceFactory</code>
- * <code>updated</code> method. The
- * Configuration Plugin service thus has the opportunity to view and modify the
- * properties before they are passed to the ManagedS ervice or Managed Service
- * Factory.
- *
- * <p>
- * Configuration Plugin (plugin) services have full read/write access to all
- * configuration information. Therefore, bundles using this facility should be
- * trusted. Access to this facility should be limited with
- * <code>ServicePermission[ConfigurationPlugin,REGISTER]</code>.
- * Implementations of a Configuration Plugin service should assure that they
- * only act on appropriate configurations.
- *
- * <p>
- * The <code>Integer</code> <code>service.cmRanking</code> registration
- * property may be specified. 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. The
- * <code>service.cmRanking</code> property determines the order in which
- * plugins are invoked. Lower ranked plugins are called before higher ranked
- * ones. In the event of more than one plugin having the same value of
- * <code>service.cmRanking</code>, then the Configuration Admin service
- * arbitrarily chooses the order in which they are called.
- *
- * <p>
- * By convention, plugins with <code>service.cmRanking< 0</code> or
- * <code>service.cmRanking > 1000</code> should not make modifications to
- * the properties.
- *
- * <p>
- * The Configuration Admin service has the right to hide properties from
- * plugins, or to ignore some or all the changes that they make. This might be
- * done for security reasons. Any such behavior is entirely implementation
- * defined.
- *
- * <p>
- * A plugin may optionally specify a <code>cm.target</code> registration
- * property whose value is the PID of the Managed Service or Managed Service
- * Factory whose configuration updates the plugin is intended to intercept. The
- * plugin will then only be called with configuration updates that are targetted
- * at the Managed Service or Managed Service Factory with the specified PID.
- * Omitting the <code>cm.target</code> registration property means that the
- * plugin is called for all configuration updates.
- *
- * @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";
-
- /**
- * 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);
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ManagedService.java b/ipojo/core/src/main/java/org/osgi/service/cm/ManagedService.java
deleted file mode 100644
index e7582a2..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ManagedService.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * $Header:
- * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ManagedService.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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-import java.util.Dictionary;
-
-/**
- * A service that can receive configuration data from a Configuration Admin
- * service.
- *
- * <p>
- * A Managed Service is a service that needs configuration data. Such an object
- * should be registered with the Framework registry with the
- * <code>service.pid</code> property set to some unique identitifier called a
- * PID.
- *
- * <p>
- * If the Configuration Admin service has a <code>Configuration</code> object
- * corresponding to this PID, it will callback the <code>updated()</code>
- * method of the <code>ManagedService</code> object, passing the properties of
- * that <code>Configuration</code> object.
- *
- * <p>
- * If it has no such <code>Configuration</code> object, then it calls back
- * with a <code>null</code> properties argument. Registering a Managed Service
- * will always result in a callback to the <code>updated()</code> method
- * provided the Configuration Admin service is, or becomes active. This callback
- * must always be done asynchronously.
- *
- * <p>
- * Else, every time that either of the <code>updated()</code> methods is
- * called on that <code>Configuration</code> object, the
- * <code>ManagedService.updated()</code> method with the new properties is
- * called. If the <code>delete()</code> method is called on that
- * <code>Configuration</code> object, <code>ManagedService.updated()</code>
- * is called with a <code>null</code> for the properties parameter. All these
- * callbacks must be done asynchronously.
- *
- * <p>
- * The following example shows the code of a serial port that will create a port
- * depending on configuration information.
- *
- * <pre>
- *
- * class SerialPort implements ManagedService {
- *
- * ServiceRegistration registration;
- * Hashtable configuration;
- * CommPortIdentifier id;
- *
- * synchronized void open(CommPortIdentifier id,
- * BundleContext context) {
- * this.id = id;
- * registration = context.registerService(
- * ManagedService.class.getName(),
- * this,
- * getDefaults()
- * );
- * }
- *
- * Hashtable getDefaults() {
- * Hashtable defaults = new Hashtable();
- * defaults.put( "port", id.getName() );
- * defaults.put( "product", "unknown" );
- * defaults.put( "baud", "9600" );
- * defaults.put( Constants.SERVICE_PID,
- * "com.acme.serialport." + id.getName() );
- * return defaults;
- * }
- *
- * public synchronized void updated(
- * Dictionary configuration ) {
- * if ( configuration ==
- * <code>
- * null
- * </code>
- * )
- * registration.setProperties( getDefaults() );
- * else {
- * setSpeed( configuration.get("baud") );
- * registration.setProperties( configuration );
- * }
- * }
- * ...
- * }
- *
- * </pre>
- *
- * <p>
- * As a convention, it is recommended that when a Managed Service is updated, it
- * should copy all the properties it does not recognize into the service
- * registration properties. This will allow the Configuration Admin service to
- * set properties on services which can then be used by other applications.
- *
- * @version $Revision: 1.11 $
- */
-public interface ManagedService {
- /**
- * Update the configuration for a Managed Service.
- *
- * <p>
- * When the implementation of <code>updated(Dictionary)</code> detects any
- * kind of error in the configuration properties, it should create a new
- * <code>ConfigurationException</code> which describes the problem. This
- * can allow a management system to provide useful information to a human
- * administrator.
- *
- * <p>
- * If this method throws any other <code>Exception</code>, the
- * Configuration Admin service must catch it and should log it.
- * <p>
- * The Configuration Admin service must call this method asynchronously
- * which initiated the callback. This implies that implementors of Managed
- * Service can be assured that the callback will not take place during
- * registration when they execute the registration in a synchronized method.
- *
- * @param properties A copy of the Configuration properties, or
- * <code>null</code>. This argument must not contain the
- * "service.bundleLocation" property. The value of this property may be
- * obtained from the <code>Configuration.getBundleLocation</code> method.
- * @throws ConfigurationException when the update fails
- */
- public void updated(Dictionary properties) throws ConfigurationException;
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java b/ipojo/core/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java
deleted file mode 100644
index fccaa6a..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/ManagedServiceFactory.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * $Header:
- * /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/ManagedServiceFactory.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
- *
- * 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.
- */
-package org.osgi.service.cm;
-
-import java.util.Dictionary;
-
-/**
- * Manage multiple service instances.
- *
- * Bundles registering this interface are giving the Configuration Admin service
- * the ability to create and configure a number of instances of a service that
- * the implementing bundle can provide. For example, a bundle implementing a
- * DHCP server could be instantiated multiple times for different interfaces
- * using a factory.
- *
- * <p>
- * Each of these <i>service instances </i> is represented, in the persistent
- * storage of the Configuration Admin service, by a factory
- * <code>Configuration</code> object that has a PID. When such a
- * <code>Configuration</code> is updated, the Configuration Admin service
- * calls the <code>ManagedServiceFactory</code> updated method with the new
- * properties. When <code>updated</code> is called with a new PID, the Managed
- * Service Factory should create a new factory instance based on these
- * configuration properties. When called with a PID that it has seen before, it
- * should update that existing service instance with the new configuration
- * information.
- *
- * <p>
- * In general it is expected that the implementation of this interface will
- * maintain a data structure that maps PIDs to the factory instances that it has
- * created. The semantics of a factory instance are defined by the Managed
- * Service Factory. However, if the factory instance is registered as a service
- * object with the service registry, its PID should match the PID of the
- * corresponding <code>Configuration</code> object (but it should <b>not </b>
- * be registered as a Managed Service!).
- *
- * <p>
- * An example that demonstrates the use of a factory. It will create serial
- * ports under command of the Configuration Admin service.
- *
- * <pre>
- *
- * class SerialPortFactory
- * implements ManagedServiceFactory {
- * ServiceRegistration registration;
- * Hashtable ports;
- * void start(BundleContext context) {
- * Hashtable properties = new Hashtable();
- * properties.put( Constants.SERVICE_PID,
- * "com.acme.serialportfactory" );
- * registration = context.registerService(
- * ManagedServiceFactory.class.getName(),
- * this,
- * properties
- * );
- * }
- * public void updated( String pid,
- * Dictionary properties ) {
- * String portName = (String) properties.get("port");
- * SerialPortService port =
- * (SerialPort) ports.get( pid );
- * if ( port == null ) {
- * port = new SerialPortService();
- * ports.put( pid, port );
- * port.open();
- * }
- * if ( port.getPortName().equals(portName) )
- * return;
- * port.setPortName( portName );
- * }
- * public void deleted( String pid ) {
- * SerialPortService port =
- * (SerialPort) ports.get( pid );
- * port.close();
- * ports.remove( pid );
- * }
- * ...
- * }
- *
- * </pre>
- *
- * @version $Revision: 1.10 $
- */
-public interface ManagedServiceFactory {
- /**
- * Return a descriptive name of this factory.
- *
- * @return the name for the factory, which might be localized
- */
- public String getName();
-
- /**
- * Create a new instance, or update the configuration of an existing
- * instance.
- *
- * If the PID of the <code>Configuration</code> object is new for the
- * Managed Service Factory, then create a new factory instance, using the
- * configuration <code>properties</code> provided. Else, update the
- * service instance with the provided <code>properties</code>.
- *
- * <p>
- * If the factory instance is registered with the Framework, then the
- * configuration <code>properties</code> should be copied to its registry
- * properties. This is not mandatory and security sensitive properties
- * should obviously not be copied.
- *
- * <p>
- * If this method throws any <code>Exception</code>, the Configuration
- * Admin service must catch it and should log it.
- *
- * <p>
- * When the implementation of updated detects any kind of error in the
- * configuration properties, it should create a new
- * {@link ConfigurationException}which describes the problem.
- *
- * <p>
- * The Configuration Admin service must call this method asynchronously.
- * This implies that implementors of the <code>ManagedServiceFactory</code>
- * class can be assured that the callback will not take place during
- * registration when they execute the registration in a synchronized method.
- *
- * @param pid The PID for this configuration.
- * @param properties A copy of 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.
- * @throws ConfigurationException when the configuration properties are
- * invalid.
- */
- public void updated(String pid, Dictionary properties) throws ConfigurationException;
-
- /**
- * Remove a factory instance.
- *
- * Remove the factory instance associated with the PID. If the instance was
- * registered with the service registry, it should be unregistered.
- * <p>
- * If this method throws any <code>Exception</code>, the Configuration
- * Admin service must catch it and should log it.
- * <p>
- * The Configuration Admin service must call this method asynchronously.
- *
- * @param pid the PID of the service to be removed
- */
- public void deleted(String pid);
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/package.html b/ipojo/core/src/main/java/org/osgi/service/cm/package.html
deleted file mode 100644
index 3f65348..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/package.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!-- $Header: /cvshome/build/org.osgi.service.cm/src/org/osgi/service/cm/package.html,v 1.2 2004/12/01 19:01:11 hargrave Exp $ -->
-<BODY>
-<P>The OSGi Configuration Admin service Package. Specification Version 1.2
-<p>Bundles wishing to use this package must list the package
-in the Import-Package header of the bundle's manifest.
-For example:
-<pre>
-Import-Package: org.osgi.service.cm; version=1.2
-</pre>
-</BODY>
-
diff --git a/ipojo/core/src/main/java/org/osgi/service/cm/packageinfo b/ipojo/core/src/main/java/org/osgi/service/cm/packageinfo
deleted file mode 100644
index ef7df68..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/cm/packageinfo
+++ /dev/null
@@ -1 +0,0 @@
-version 1.2
diff --git a/ipojo/core/src/main/java/org/osgi/service/log/LogEntry.java b/ipojo/core/src/main/java/org/osgi/service/log/LogEntry.java
deleted file mode 100644
index c45f168..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/log/LogEntry.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * $Header:
- * /cvshome/build/org.osgi.service.log/src/org/osgi/service/log/LogEntry.java,v
- * 1.9 2006/06/16 16:31:49 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2000, 2006). 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
- *
- * 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.
- */
-package org.osgi.service.log;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
-/**
- * Provides methods to access the information contained in an individual Log
- * Service log entry.
- *
- * <p>
- * A <code>LogEntry</code> object may be acquired from the
- * <code>LogReaderService.getLog</code> method or by registering a
- * <code>LogListener</code> object.
- *
- * @version $Revision: 1.9 $
- * @see LogReaderService#getLog
- * @see LogListener
- */
-public interface LogEntry {
- /**
- * Returns the bundle that created this <code>LogEntry</code> object.
- *
- * @return The bundle that created this <code>LogEntry</code> object;
- * <code>null</code> if no bundle is associated with this
- * <code>LogEntry</code> object.
- */
- public Bundle getBundle();
-
- /**
- * Returns the <code>ServiceReference</code> object for the service
- * associated with this <code>LogEntry</code> object.
- *
- * @return <code>ServiceReference</code> object for the service associated
- * with this <code>LogEntry</code> object; <code>null</code> if no
- * <code>ServiceReference</code> object was provided.
- */
- public ServiceReference getServiceReference();
-
- /**
- * Returns the severity level of this <code>LogEntry</code> object.
- *
- * <p>
- * This is one of the severity levels defined by the <code>LogService</code>
- * interface.
- *
- * @return Severity level of this <code>LogEntry</code> object.
- *
- * @see LogService#LOG_ERROR
- * @see LogService#LOG_WARNING
- * @see LogService#LOG_INFO
- * @see LogService#LOG_DEBUG
- */
- public int getLevel();
-
- /**
- * Returns the human readable message associated with this
- * <code>LogEntry</code> object.
- *
- * @return <code>String</code> containing the message associated with this
- * <code>LogEntry</code> object.
- */
- public String getMessage();
-
- /**
- * Returns the exception object associated with this <code>LogEntry</code>
- * object.
- *
- * <p>
- * In some implementations, the returned exception may not be the original
- * exception. To avoid references to a bundle defined exception class, thus
- * preventing an uninstalled bundle from being garbage collected, the Log
- * Service may return an exception object of an implementation defined
- * Throwable subclass. The returned object will attempt to provide as much
- * information as possible from the original exception object such as the
- * message and stack trace.
- *
- * @return <code>Throwable</code> object of the exception associated with
- * this <code>LogEntry</code>;<code>null</code> if no exception is
- * associated with this <code>LogEntry</code> object.
- */
- public Throwable getException();
-
- /**
- * Returns the value of <code>currentTimeMillis()</code> at the time this
- * <code>LogEntry</code> object was created.
- *
- * @return The system time in milliseconds when this <code>LogEntry</code>
- * object was created.
- * @see "System.currentTimeMillis()"
- */
- public long getTime();
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/log/LogListener.java b/ipojo/core/src/main/java/org/osgi/service/log/LogListener.java
deleted file mode 100644
index 3f7fd4e..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/log/LogListener.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * $Header:
- * /cvshome/build/org.osgi.service.log/src/org/osgi/service/log/LogListener.java,v
- * 1.9 2006/06/16 16:31:49 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2000, 2006). 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
- *
- * 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.
- */
-package org.osgi.service.log;
-
-import java.util.EventListener;
-
-/**
- * Subscribes to <code>LogEntry</code> objects from the
- * <code>LogReaderService</code>.
- *
- * <p>
- * A <code>LogListener</code> object may be registered with the Log Reader
- * Service using the <code>LogReaderService.addLogListener</code> method.
- * After the listener is registered, the <code>logged</code> method will be
- * called for each <code>LogEntry</code> object created. The
- * <code>LogListener</code> object may be unregistered by calling the
- * <code>LogReaderService.removeLogListener</code> method.
- *
- * @version $Revision: 1.9 $
- * @see LogReaderService
- * @see LogEntry
- * @see LogReaderService#addLogListener(LogListener)
- * @see LogReaderService#removeLogListener(LogListener)
- */
-public interface LogListener extends EventListener {
- /**
- * Listener method called for each LogEntry object created.
- *
- * <p>
- * As with all event listeners, this method should return to its caller as
- * soon as possible.
- *
- * @param entry A <code>LogEntry</code> object containing log information.
- * @see LogEntry
- */
- public void logged(LogEntry entry);
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/log/LogReaderService.java b/ipojo/core/src/main/java/org/osgi/service/log/LogReaderService.java
deleted file mode 100644
index 43b6a9d..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/log/LogReaderService.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * $Header:
- * /cvshome/build/org.osgi.service.log/src/org/osgi/service/log/LogReaderService.java,v
- * 1.10 2006/06/16 16:31:49 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2000, 2006). 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
- *
- * 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.
- */
-package org.osgi.service.log;
-
-import java.util.Enumeration;
-
-/**
- * Provides methods to retrieve <code>LogEntry</code> objects from the log.
- * <p>
- * There are two ways to retrieve <code>LogEntry</code> objects:
- * <ul>
- * <li>The primary way to retrieve <code>LogEntry</code> objects is to
- * register a <code>LogListener</code> object whose
- * <code>LogListener.logged</code> method will be called for each entry added
- * to the log.
- * <li>To retrieve past <code>LogEntry</code> objects, the
- * <code>getLog</code> method can be called which will return an
- * <code>Enumeration</code> of all <code>LogEntry</code> objects in the log.
- *
- * @version $Revision: 1.10 $
- * @see LogEntry
- * @see LogListener
- * @see LogListener#logged(LogEntry)
- */
-public interface LogReaderService {
- /**
- * Subscribes to <code>LogEntry</code> objects.
- *
- * <p>
- * This method registers a <code>LogListener</code> object with the Log
- * Reader Service. The <code>LogListener.logged(LogEntry)</code> method
- * will be called for each <code>LogEntry</code> object placed into the
- * log.
- *
- * <p>
- * When a bundle which registers a <code>LogListener</code> object is
- * stopped or otherwise releases the Log Reader Service, the Log Reader
- * Service must remove all of the bundle's listeners.
- *
- * <p>
- * If this Log Reader Service's list of listeners already contains a
- * listener <code>l</code> such that <code>(l==listener)</code>, this
- * method does nothing.
- *
- * @param listener A <code>LogListener</code> object to register; the
- * <code>LogListener</code> object is used to receive
- * <code>LogEntry</code> objects.
- * @see LogListener
- * @see LogEntry
- * @see LogListener#logged(LogEntry)
- */
- public void addLogListener(LogListener listener);
-
- /**
- * Unsubscribes to <code>LogEntry</code> objects.
- *
- * <p>
- * This method unregisters a <code>LogListener</code> object from the Log
- * Reader Service.
- *
- * <p>
- * If <code>listener</code> is not contained in this Log Reader Service's
- * list of listeners, this method does nothing.
- *
- * @param listener A <code>LogListener</code> object to unregister.
- * @see LogListener
- */
- public void removeLogListener(LogListener listener);
-
- /**
- * Returns an <code>Enumeration</code> of all <code>LogEntry</code>
- * objects in the log.
- *
- * <p>
- * Each element of the enumeration is a <code>LogEntry</code> object,
- * ordered with the most recent entry first. Whether the enumeration is of
- * all <code>LogEntry</code> objects since the Log Service was started or
- * some recent past is implementation-specific. Also implementation-specific
- * is whether informational and debug <code>LogEntry</code> objects are
- * included in the enumeration.
- *
- * @return An <code>Enumeration</code> of all <code>LogEntry</code>
- * objects in the log.
- */
- public Enumeration getLog();
-}
diff --git a/ipojo/core/src/main/java/org/osgi/service/log/LogService.java b/ipojo/core/src/main/java/org/osgi/service/log/LogService.java
deleted file mode 100644
index 6271437..0000000
--- a/ipojo/core/src/main/java/org/osgi/service/log/LogService.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * $Header:
- * /cvshome/build/org.osgi.service.log/src/org/osgi/service/log/LogService.java,v
- * 1.9 2006/06/16 16:31:49 hargrave Exp $
- *
- * Copyright (c) OSGi Alliance (2000, 2006). 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
- *
- * 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.
- */
-package org.osgi.service.log;
-
-import org.osgi.framework.ServiceReference;
-
-/**
- * Provides methods for bundles to write messages to the log.
- *
- * <p>
- * <code>LogService</code> methods are provided to log messages; optionally
- * with a <code>ServiceReference</code> object or an exception.
- *
- * <p>
- * Bundles must log messages in the OSGi environment with a severity level
- * according to the following hierarchy:
- * <ol>
- * <li>{@link #LOG_ERROR}
- * <li>{@link #LOG_WARNING}
- * <li>{@link #LOG_INFO}
- * <li>{@link #LOG_DEBUG}
- * </ol>
- *
- * @version $Revision: 1.9 $
- */
-public interface LogService {
- /**
- * An error message (Value 1).
- *
- * <p>
- * This log entry indicates the bundle or service may not be functional.
- */
- public static final int LOG_ERROR = 1;
-
- /**
- * A warning message (Value 2).
- *
- * <p>
- * This log entry indicates a bundle or service is still functioning but may
- * experience problems in the future because of the warning condition.
- */
- public static final int LOG_WARNING = 2;
-
- /**
- * An informational message (Value 3).
- *
- * <p>
- * This log entry may be the result of any change in the bundle or service
- * and does not indicate a problem.
- */
- public static final int LOG_INFO = 3;
-
- /**
- * A debugging message (Value 4).
- *
- * <p>
- * This log entry is used for problem determination and may be irrelevant to
- * anyone but the bundle developer.
- */
- public static final int LOG_DEBUG = 4;
-
- /**
- * Logs a message.
- *
- * <p>
- * The <code>ServiceReference</code> field and the <code>Throwable</code>
- * field of the <code>LogEntry</code> object will be set to
- * <code>null</code>.
- *
- * @param level The severity of the message. This should be one of the
- * defined log levels but may be any integer that is interpreted in a user
- * defined way.
- * @param message Human readable string describing the condition or
- * <code>null</code>.
- * @see #LOG_ERROR
- * @see #LOG_WARNING
- * @see #LOG_INFO
- * @see #LOG_DEBUG
- */
- public void log(int level, String message);
-
- /**
- * Logs a message with an exception.
- *
- * <p>
- * The <code>ServiceReference</code> field of the <code>LogEntry</code>
- * object will be set to <code>null</code>.
- *
- * @param level The severity of the message. This should be one of the
- * defined log levels but may be any integer that is interpreted in a user
- * defined way.
- * @param message The human readable string describing the condition or
- * <code>null</code>.
- * @param exception The exception that reflects the condition or
- * <code>null</code>.
- * @see #LOG_ERROR
- * @see #LOG_WARNING
- * @see #LOG_INFO
- * @see #LOG_DEBUG
- */
- public void log(int level, String message, Throwable exception);
-
- /**
- * Logs a message associated with a specific <code>ServiceReference</code>
- * object.
- *
- * <p>
- * The <code>Throwable</code> field of the <code>LogEntry</code> will be
- * set to <code>null</code>.
- *
- * @param sr The <code>ServiceReference</code> object of the service that
- * this message is associated with or <code>null</code>.
- * @param level The severity of the message. This should be one of the
- * defined log levels but may be any integer that is interpreted in a user
- * defined way.
- * @param message Human readable string describing the condition or
- * <code>null</code>.
- * @see #LOG_ERROR
- * @see #LOG_WARNING
- * @see #LOG_INFO
- * @see #LOG_DEBUG
- */
- public void log(ServiceReference sr, int level, String message);
-
- /**
- * Logs a message with an exception associated and a
- * <code>ServiceReference</code> object.
- *
- * @param sr The <code>ServiceReference</code> object of the service that
- * this message is associated with.
- * @param level The severity of the message. This should be one of the
- * defined log levels but may be any integer that is interpreted in a user
- * defined way.
- * @param message Human readable string describing the condition or
- * <code>null</code>.
- * @param exception The exception that reflects the condition or
- * <code>null</code>.
- * @see #LOG_ERROR
- * @see #LOG_WARNING
- * @see #LOG_INFO
- * @see #LOG_DEBUG
- */
- public void log(ServiceReference sr, int level, String message, Throwable exception);
-}
diff --git a/ipojo/manipulator/pom.xml b/ipojo/manipulator/pom.xml
index c965f08..7aa38bf 100644
--- a/ipojo/manipulator/pom.xml
+++ b/ipojo/manipulator/pom.xml
@@ -1,9 +1,13 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>felix</artifactId>
+ <version>0.9.0-incubator-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.felix</groupId>
+ <packaging>bundle</packaging>
<artifactId>org.apache.felix.ipojo.manipulator</artifactId>
- <packaging>jar</packaging>
<version>0.7.3-incubator-SNAPSHOT</version>
<name>Apache Felix iPOJO Manipulator</name>
<dependencies>
@@ -13,9 +17,44 @@
<version>3.0</version>
</dependency>
<dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ <version>3.0</version>
+ </dependency>
+ <!-- to remove -->
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-tree</artifactId>
+ <version>3.0</version>
+ </dependency>
+ <dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>org.apache.felix.ipojo.metadata</artifactId>
<version>0.7.3-incubator-SNAPSHOT</version>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-Name>iPOJO Manipulator</Bundle-Name>
+ <Bundle-Vendor>Clement ESCOFFIER</Bundle-Vendor>
+ <Bundle-Description> iPOJO Manipulator </Bundle-Description>
+ <Private-Package>
+ org.apache.felix.ipojo.manipulation,
+ org.apache.felix.ipojo.manipulator,
+ org.apache.felix.ipojo.xml.parser,
+ org.objectweb.asm,
+ org.objectweb.asm.commons,
+ org.objectweb.asm.tree <!-- to remove -->
+ </Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
index 0168055..2a64910 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
@@ -33,7 +33,7 @@
/**
* Check thaht a POJO is already manipulated or not.
* Moreover it allows to get manipulation data about this class.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class ClassChecker implements ClassVisitor, Opcodes {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java
index 29ab001..a3d954b 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java
@@ -26,7 +26,7 @@
/**
* Constructor Adapter : add a component manager argument inside a constructor.
*
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class ConstructorCodeAdapter extends GeneratorAdapter implements Opcodes {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java
index cd6e278..4eb313c 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java
@@ -30,7 +30,7 @@
/**
* Create getter and setter for each fields .
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class FieldAdapter extends ClassAdapter implements Opcodes {
@@ -77,7 +77,7 @@
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) {
if ((access & ACC_STATIC) == 0) {
- ManipulationProperty.getLogger().log(Level.INFO, "Manipulate the field declaration of " + name);
+ //ManipulationProperty.getLogger().log(Level.INFO, "Manipulate the field declaration of " + name);
Type type = Type.getType(desc);
if (type.getSort() == Type.ARRAY) {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
index 5af9933..d8b6c4b 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
@@ -21,10 +21,11 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+
/**
* Store properties for the manipulation process.
*
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*
*/
public class ManipulationProperty {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
index 4063343..3d7bbab 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
@@ -37,7 +37,7 @@
/**
* iPOJO Bytecode Manipulator.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*
*/
public class Manipulator {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java
index d240be6..be9288d 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java
@@ -29,7 +29,7 @@
/**
* Insert code calling callbacks at the entry and before the exit of a method.
* Moreover it replaces all GETFIELD and SETFIELD by getter and setter invocation.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class MethodCodeAdapter extends AdviceAdapter implements Opcodes {
@@ -93,9 +93,10 @@
for (int i = 0; i < args.length; i++) {
String cn = args[i].getClassName();
if (cn.endsWith("[]")) {
- cn = cn.replace("[]", "$");
+ cn = cn.replace('[', '$');
+ cn = cn.substring(0, cn.length() - 1);
}
- cn = cn.replace(".", "_");
+ cn = cn.replace('.', '_');
name += cn;
}
@@ -126,9 +127,10 @@
for (int i = 0; i < args.length; i++) {
String cn = args[i].getClassName();
if (cn.endsWith("[]")) {
- cn = cn.replace("[]", "$");
+ cn = cn.replace('[', '$');
+ cn = cn.substring(0, cn.length() - 1);
}
- cn = cn.replace(".", "_");
+ cn = cn.replace('.', '_');
name += cn;
}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java
index 184b2f2..bd6056c 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java
@@ -24,7 +24,7 @@
/**
* Method Descriptor describe a method.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class MethodDescriptor {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
index ad427cd..863b82b 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
@@ -33,7 +33,7 @@
/**
* Manipulate a POJO class.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class PojoAdapter extends ClassAdapter implements Opcodes {
@@ -194,9 +194,10 @@
for (int i = 0; i < args.length; i++) {
String cn = args[i].getClassName();
if (cn.endsWith("[]")) {
- cn = cn.replace("[]", "$");
+ cn = cn.replace('[', '$');
+ cn = cn.substring(0, cn.length() - 1);
}
- cn = cn.replace(".", "_");
+ cn = cn.replace('.', '_');
id += cn;
}
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
index 0b34c5b..9975ee4 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
@@ -50,7 +50,7 @@
/**
* Pojoization allows creating an iPOJO bundle from a "normal" bundle.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class Pojoization {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java
index 483f088..21fc181 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java
@@ -23,7 +23,7 @@
/**
* Parse on OSGi Manifest clause.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class QuotedTokenizer {
/**
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java
index cee043d..9542658 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java
@@ -20,7 +20,7 @@
/**
* Exceptions thrown by parsers.
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class ParseException extends Exception {
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
index fa4fd1c..7560885 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
@@ -31,7 +31,7 @@
/**
* XML Metadata parser.
*
- * @author <a href="mailto:felix-dev@incubator.apache.org">Felix Project Team</a>
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class XMLMetadataParser implements ContentHandler {
@@ -307,5 +307,4 @@
}
return last;
}
-
}
diff --git a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java
index ce997b1..9ba8e6d 100644
--- a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java
+++ b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java
@@ -20,61 +20,78 @@
/**
* Attribute.
+ *
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class Attribute {
- /**
- * Name of the attribute.
- */
- private String m_name;
+ /**
+ * Name of the attribute.
+ */
+ private String m_name;
- /**
- * Value of the attribute.
- */
- private String m_value;
+ /**
+ * Value of the attribute.
+ */
+ private String m_value;
- /**
- * Namepsace of the attribute.
- */
- private String m_nameSpace;
+ /**
+ * Namepsace of the attribute.
+ */
+ private String m_nameSpace;
- /**
+ /**
* Constructor.
- * @param name : name of the attribute.
- * @param value : value of the attribute.
- */
- public Attribute(String name, String value) {
- m_name = name.toLowerCase();
- m_value = value;
- m_nameSpace = "";
- }
+ *
+ * @param name :
+ * name of the attribute.
+ * @param value :
+ * value of the attribute.
+ */
+ public Attribute(String name, String value) {
+ m_name = name.toLowerCase();
+ m_value = value;
+ m_nameSpace = "";
+ }
- /**
+ /**
* Constructor.
- * @param name : name of the attribute.
- * @param value : value of the attribute.
- * @param ns : namespace of the attribute.
- */
- public Attribute(String name, String ns, String value) {
- m_name = name.toLowerCase();
- m_value = value;
- m_nameSpace = ns;
- }
+ *
+ * @param name :
+ * name of the attribute.
+ * @param value :
+ * value of the attribute.
+ * @param ns :
+ * namespace of the attribute.
+ */
+ public Attribute(String name, String ns, String value) {
+ m_name = name.toLowerCase();
+ m_value = value;
+ m_nameSpace = ns;
+ }
- /**
- * @return the name
- */
- public String getName() { return m_name; }
+ /**
+ * Get the attribute name.
+ * @return the name
+ */
+ public String getName() {
+ return m_name;
+ }
- /**
- * @return the value
- */
- public String getValue() { return m_value; }
+ /**
+ * Get attribute value.
+ * @return the value
+ */
+ public String getValue() {
+ return m_value;
+ }
- /**
- * @return the namespace
- */
- public String getNameSpace() { return m_nameSpace; }
+ /**
+ * Get attribute namespace.
+ * @return the namespace
+ */
+ public String getNameSpace() {
+ return m_nameSpace;
+ }
}
diff --git a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
index 835a9ff..6327ad8 100644
--- a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
+++ b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
@@ -20,100 +20,123 @@
/**
* Element.
+ *
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class Element {
- /**
- * Name of the element.
- */
- private String m_name;
+ /**
+ * Name of the element.
+ */
+ private String m_name;
/**
* Name space of the element.
*/
private String m_nameSpace;
- /**
- * List of the attributes of the element.
- */
- private Attribute[] m_attributes = new Attribute[0];
+ /**
+ * List of the attributes of the element.
+ */
+ private Attribute[] m_attributes = new Attribute[0];
- /**
- * List of the subelement of the element.
- */
- private Element[] m_elements = new Element[0];
+ /**
+ * List of the subelement of the element.
+ */
+ private Element[] m_elements = new Element[0];
- /**
+ /**
* Constructor.
- * @param name : the name of the element
- * @pram ns : the namespace of the element
- */
- public Element(String name, String ns) {
+ *
+ * @param name : the name of the element
+ * @param ns : the namespace of the element
+ */
+ public Element(String name, String ns) {
m_name = name.toLowerCase();
m_nameSpace = ns;
}
- /**
- * @return the sub elements
- */
- public Element[] getElements() { return m_elements; }
-
- /**
- * @return the attributes
- */
- public Attribute[] getAttributes() { return m_attributes; }
-
- /**
- * @return the name of the element
- */
- public String getName() { return m_name; }
+ /**
+ * Get sub-elements.
+ * @return the sub elements
+ */
+ public Element[] getElements() {
+ return m_elements;
+ }
/**
+ * Get element attributes.
+ * @return the attributes
+ */
+ public Attribute[] getAttributes() {
+ return m_attributes;
+ }
+
+ /**
+ * Get element name.
+ * @return the name of the element
+ */
+ public String getName() {
+ return m_name;
+ }
+
+ /**
+ * Get element namespace.
* @return the namespace of the element
*/
- public String getNameSpace() { return m_nameSpace; }
+ public String getNameSpace() {
+ return m_nameSpace;
+ }
- /**
+ /**
* Return the value of the attribute given in parameter.
- * @param name : the name of the searched attribute
- * @return the value of the attrbitue given in parameter, null if the attribute does not exist
- */
- public String getAttribute(String name) {
- name = name.toLowerCase();
- for (int i = 0; i < m_attributes.length; i++) {
- if (m_attributes[i].getName().equals(name)) {
- return m_attributes[i].getValue();
- }
- }
- System.err.println("[Error in Metadata] The attribute " + name + " does not exist in " + m_name + " [" + m_nameSpace + "]");
- return null;
- }
+ *
+ * @param name :
+ * the name of the searched attribute
+ * @return the value of the attrbitue given in parameter, null if the attribute does not exist
+ */
+ public String getAttribute(String name) {
+ name = name.toLowerCase();
+ for (int i = 0; i < m_attributes.length; i++) {
+ if (m_attributes[i].getName().equals(name)) {
+ return m_attributes[i].getValue();
+ }
+ }
+ System.err.println("[Error in Metadata] The attribute " + name + " does not exist in " + m_name + " [" + m_nameSpace + "]");
+ return null;
+ }
- /**
- * Return the value of the attrbitue "name" of the namespace "ns".
- * @param name : name of the attribute to find
- * @param ns : namespace of the attribute to find
- * @return the String value of the attribute, or null if the attribute is not found.
- */
- public String getAttribute(String name, String ns) {
- name = name.toLowerCase();
- for (int i = 0; i < m_attributes.length; i++) {
- if (m_attributes[i].getName().equals(name) && m_attributes[i].getNameSpace().equals(ns)) {
- return m_attributes[i].getValue();
- }
- }
- System.err.println("[Error in Metadata] The attribute " + name + "[" + ns + "] does not exist in " + m_name + " [" + m_nameSpace + "]");
- return null;
- }
+ /**
+ * Return the value of the attrbitue "name" of the namespace "ns".
+ *
+ * @param name :
+ * name of the attribute to find
+ * @param ns :
+ * namespace of the attribute to find
+ * @return the String value of the attribute, or null if the attribute is not found.
+ */
+ public String getAttribute(String name, String ns) {
+ name = name.toLowerCase();
+ for (int i = 0; i < m_attributes.length; i++) {
+ if (m_attributes[i].getName().equals(name) && m_attributes[i].getNameSpace().equals(ns)) {
+ return m_attributes[i].getValue();
+ }
+ }
+ System.err.println("[Error in Metadata] The attribute " + name + "[" + ns + "] does not exist in " + m_name + " [" + m_nameSpace + "]");
+ return null;
+ }
- /**
+ /**
* Add a subelement.
- * @param elem : the element to add
- */
- public void addElement(Element elem) {
+ *
+ * @param elem :
+ * the element to add
+ */
+ public void addElement(Element elem) {
for (int i = 0; (m_elements != null) && (i < m_elements.length); i++) {
- if (m_elements[i] == elem) { return; }
+ if (m_elements[i] == elem) {
+ return;
+ }
}
if (m_elements != null) {
@@ -121,49 +144,68 @@
System.arraycopy(m_elements, 0, newElementsList, 0, m_elements.length);
newElementsList[m_elements.length] = elem;
m_elements = newElementsList;
+ } else {
+ m_elements = new Element[] { elem };
}
- else { m_elements = new Element[] {elem}; }
- }
+ }
- private static Element[] addElement(Element[] list, Element elem) {
+ /**
+ * Add an element to the given list.
+ * @param list : the input list.
+ * @param elem : the element to add.
+ * @return the returned element list.
+ */
+ private static Element[] addElement(Element[] list, Element elem) {
if (list != null) {
Element[] newElementsList = new Element[list.length + 1];
System.arraycopy(list, 0, newElementsList, 0, list.length);
newElementsList[list.length] = elem;
return newElementsList;
+ } else {
+ return new Element[] { elem };
}
- else { return new Element[] {elem}; }
- }
+ }
- /**
+ /**
* Remove a subelement.
- * @param elem : the element to remove
- */
- public void removeElement(Element elem) {
+ *
+ * @param elem :
+ * the element to remove
+ */
+ public void removeElement(Element elem) {
int idx = -1;
for (int i = 0; i < m_elements.length; i++) {
- if (m_elements[i] == elem) { idx = i; break; }
+ if (m_elements[i] == elem) {
+ idx = i;
+ break;
+ }
}
if (idx >= 0) {
- if ((m_elements.length - 1) == 0) { m_elements = new Element[0]; }
- else {
+ if ((m_elements.length - 1) == 0) {
+ m_elements = new Element[0];
+ } else {
Element[] newElementsList = new Element[m_elements.length - 1];
System.arraycopy(m_elements, 0, newElementsList, 0, idx);
if (idx < newElementsList.length) {
- System.arraycopy(m_elements, idx + 1, newElementsList, idx, newElementsList.length - idx); }
+ System.arraycopy(m_elements, idx + 1, newElementsList, idx, newElementsList.length - idx);
+ }
m_elements = newElementsList;
}
}
- }
+ }
- /**
+ /**
* Add a attribute.
- * @param att : the attribute to add
- */
- public void addAttribute(Attribute att) {
+ *
+ * @param att :
+ * the attribute to add
+ */
+ public void addAttribute(Attribute att) {
for (int i = 0; (m_attributes != null) && (i < m_attributes.length); i++) {
- if (m_attributes[i] == att) { return; }
+ if (m_attributes[i] == att) {
+ return;
+ }
}
if (m_attributes != null) {
@@ -171,57 +213,69 @@
System.arraycopy(m_attributes, 0, newAttributesList, 0, m_attributes.length);
newAttributesList[m_attributes.length] = att;
m_attributes = newAttributesList;
+ } else {
+ m_attributes = new Attribute[] { att };
}
- else { m_attributes = new Attribute[] {att}; }
- }
+ }
- /**
+ /**
* Remove an attribute.
- * @param att : the attribute to remove
- */
- public void removeAttribute(Attribute att) {
+ *
+ * @param att :
+ * the attribute to remove
+ */
+ public void removeAttribute(Attribute att) {
int idx = -1;
for (int i = 0; i < m_attributes.length; i++) {
- if (m_attributes[i] == att) { idx = i; break; }
+ if (m_attributes[i] == att) {
+ idx = i;
+ break;
+ }
}
if (idx >= 0) {
- if ((m_attributes.length - 1) == 0) { m_attributes = new Attribute[0]; }
- else {
+ if ((m_attributes.length - 1) == 0) {
+ m_attributes = new Attribute[0];
+ } else {
Attribute[] newAttributesList = new Attribute[m_attributes.length - 1];
System.arraycopy(m_attributes, 0, newAttributesList, 0, idx);
if (idx < newAttributesList.length) {
- System.arraycopy(m_attributes, idx + 1, newAttributesList, idx, newAttributesList.length - idx); }
+ System.arraycopy(m_attributes, idx + 1, newAttributesList, idx, newAttributesList.length - idx);
+ }
m_attributes = newAttributesList;
}
}
- }
+ }
- /**
- * Get the elements array of the element type given in parameter.
- * This method look for an empty namespace.
- * @param name : the type of the element to find (element name)
- * @return the resulting element array (empty if the search failed)
- */
- public Element[] getElements(String name) {
- name = name.toLowerCase();
- Element[] list = new Element[0];
- for (int i = 0; i < m_elements.length; i++) {
- if (m_elements[i].getName().equalsIgnoreCase(name) && m_elements[i].getNameSpace().equals("")) {
- list = Element.addElement(list, m_elements[i]);
- }
- }
- return list;
- }
+ /**
+ * Get the elements array of the element type given in parameter. This method look for an empty namespace.
+ *
+ * @param name :
+ * the type of the element to find (element name)
+ * @return the resulting element array (empty if the search failed)
+ */
+ public Element[] getElements(String name) {
+ name = name.toLowerCase();
+ Element[] list = new Element[0];
+ for (int i = 0; i < m_elements.length; i++) {
+ if (m_elements[i].getName().equalsIgnoreCase(name) && m_elements[i].getNameSpace().equals("")) {
+ list = Element.addElement(list, m_elements[i]);
+ }
+ }
+ return list;
+ }
/**
* Get the elements array of the element type given in parameter.
- * @param name : the type of the element to find (element name)
- * @param ns : the namespace of the element
+ *
+ * @param name :
+ * the type of the element to find (element name)
+ * @param ns :
+ * the namespace of the element
* @return the resulting element array (empty if the search failed)
*/
public Element[] getElements(String name, String ns) {
- name = name.toLowerCase();
+ name = name.toLowerCase();
Element[] list = new Element[0];
for (int i = 0; i < m_elements.length; i++) {
if (m_elements[i].getName().equals(name) && m_elements[i].getNameSpace().equals(ns)) {
@@ -231,159 +285,198 @@
return list;
}
- /**
- * Is the element contains a subelement of the type given in parameter.
- * This method does not manage the namespace
- * @param name : type of the element to check.
- * @return true if the element contains an element of the type "name"
- */
- public boolean containsElement(String name) {
- name = name.toLowerCase();
- for (int i = 0; i < m_elements.length; i++) {
- if (m_elements[i].getName().equals(name)) { return true; }
- }
- return false;
- }
-
/**
- * Is the element contains a subelement of the type given in parameter.
- * This method does not manage the namespace
- * @param name : type of the element to check.
+ * Is the element contains a subelement of the type given in parameter. This method does not manage the namespace
+ *
+ * @param name :
+ * type of the element to check.
* @return true if the element contains an element of the type "name"
*/
- public boolean containsElement(String name, String ns) {
- name = name.toLowerCase();
- ns = ns.toLowerCase();
+ public boolean containsElement(String name) {
+ name = name.toLowerCase();
for (int i = 0; i < m_elements.length; i++) {
- if (m_elements[i].getName().equals(name) && m_elements[i].getNameSpace().equals(ns)) { return true; }
+ if (m_elements[i].getName().equals(name)) {
+ return true;
+ }
}
return false;
}
- /**
- * Is the element contains an attribute of the name given in parameter.
- * @param name : name of the element
- * @return true if the element contains an attribute of the type "name"
- */
- public boolean containsAttribute(String name) {
- name = name.toLowerCase();
- for (int i = 0; i < m_attributes.length; i++) {
- if (m_attributes[i].getName().equals(name)) { return true; }
+ /**
+ * Is the element contains a subelement of the type given in parameter. This method does not manage the namespace
+ *
+ * @param name :
+ * type of the element to check.
+ * @param ns :
+ * the namespace of the element to check.
+ * @return true if the element contains an element of the type "name"
+ */
+ public boolean containsElement(String name, String ns) {
+ name = name.toLowerCase();
+ ns = ns.toLowerCase();
+ for (int i = 0; i < m_elements.length; i++) {
+ if (m_elements[i].getName().equals(name) && m_elements[i].getNameSpace().equals(ns)) {
+ return true;
+ }
}
- return false;
- }
+ return false;
+ }
- /**
- * @return the first-order namespaces list of the current element. First-order namespace are namespace of the element attribute and namespaces of its direct sub-element.
- */
- public String[] getNamespaces() {
- String[] ns = new String[0];
+ /**
+ * Is the element contains an attribute of the name given in parameter.
+ *
+ * @param name :
+ * name of the element
+ * @return true if the element contains an attribute of the type "name"
+ */
+ public boolean containsAttribute(String name) {
+ name = name.toLowerCase();
+ for (int i = 0; i < m_attributes.length; i++) {
+ if (m_attributes[i].getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
- // Look for each direct sub-element
- for (int i = 0; i < m_elements.length; i++) {
- boolean found = false;
- for (int j = 0; !found && j < ns.length; j++) {
- if (ns[j].equals(m_elements[i].getNameSpace())) { found = true; }
- }
- if (!found) {
- String[] newNSList = new String[ns.length + 1];
- System.arraycopy(ns, 0, newNSList, 0, ns.length);
- newNSList[ns.length] = m_elements[i].getNameSpace();
- ns = newNSList;
- }
- }
+ /**
+ * Get used namespace.
+ * @return the first-order namespaces list of the current element. First-order namespace are namespace of the element attribute and namespaces of its direct sub-element.
+ */
+ public String[] getNamespaces() {
+ String[] ns = new String[0];
- // Look for each attribute
- for (int i = 0; i < m_attributes.length; i++) {
- boolean found = false;
- for (int j = 0; !found && j < ns.length; j++) {
- if (ns[j].equals(m_attributes[i].getNameSpace())) { found = true; }
- }
- if (!found) {
- String[] newNSList = new String[ns.length + 1];
- System.arraycopy(ns, 0, newNSList, 0, ns.length);
- newNSList[ns.length] = m_attributes[i].getNameSpace();
- ns = newNSList;
- }
- }
+ // Look for each direct sub-element
+ for (int i = 0; i < m_elements.length; i++) {
+ boolean found = false;
+ for (int j = 0; !found && j < ns.length; j++) {
+ if (ns[j].equals(m_elements[i].getNameSpace())) {
+ found = true;
+ }
+ }
+ if (!found) {
+ String[] newNSList = new String[ns.length + 1];
+ System.arraycopy(ns, 0, newNSList, 0, ns.length);
+ newNSList[ns.length] = m_elements[i].getNameSpace();
+ ns = newNSList;
+ }
+ }
- return ns;
- }
-
- public String toXMLString() {
- return toXMLString(0);
- }
-
- private String toXMLString(int indent) {
- String xml = "";
-
- String tabs = "";
- for(int j = 0; j < indent; j++) {
- tabs += "\t";
- }
-
- if(m_nameSpace.equals("")) {
- xml = tabs + "<" + m_name;
- } else {
- xml = tabs + "<" + m_nameSpace+":"+m_name;
- }
-
- for(int i = 0; i < m_attributes.length; i++) {
- Attribute current = m_attributes[i];
- if(current.getNameSpace().equals("")) {
- xml += " " + current.getName() + "=\"" + current.getValue() + "\"";
- } else {
- xml += " " + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue()+ "\"";
- }
- }
-
- if(m_elements.length == 0) { xml += "/>"; return xml; }
- else {
- xml+=">";
- for(int i = 0; i < m_elements.length; i++) {
- xml += "\n";
- xml += m_elements[i].toXMLString(indent+1);
- }
- xml+="\n" + tabs + "</"+m_name+">";
- return xml;
- }
- }
-
- public String toString() {
- return toString(0);
- }
-
- private String toString(int indent) {
- String xml = "";
-
- String tabs = "";
- for(int j = 0; j < indent; j++) {
- tabs += "\t";
- }
-
- if(m_nameSpace.equals("")) {
- xml = tabs + m_name;
- } else {
- xml = tabs + m_nameSpace+":"+m_name;
- }
-
- for(int i = 0; i < m_attributes.length; i++) {
- Attribute current = m_attributes[i];
- if(current.getNameSpace().equals("")) {
- xml += " " + current.getName() + "=\"" + current.getValue() + "\"";
- } else {
- xml += " " + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue()+ "\"";
- }
- }
-
- if(m_elements.length == 0) { return xml; }
- else {
- for(int i = 0; i < m_elements.length; i++) {
- xml += "\n";
- xml += m_elements[i].toString(indent+1);
- }
- return xml;
- }
- }
+ // Look for each attribute
+ for (int i = 0; i < m_attributes.length; i++) {
+ boolean found = false;
+ for (int j = 0; !found && j < ns.length; j++) {
+ if (ns[j].equals(m_attributes[i].getNameSpace())) {
+ found = true;
+ }
+ }
+ if (!found) {
+ String[] newNSList = new String[ns.length + 1];
+ System.arraycopy(ns, 0, newNSList, 0, ns.length);
+ newNSList[ns.length] = m_attributes[i].getNameSpace();
+ ns = newNSList;
+ }
+ }
+
+ return ns;
+ }
+
+ /**
+ * Get the XML form of this element.
+ * @return the XML snippet representing this element.
+ */
+ public String toXMLString() {
+ return toXMLString(0);
+ }
+
+ /**
+ * Internal method to get XML form of an element.
+ * @param indent : indentation to used.
+ * @return the XML snippet representing this element.
+ */
+ private String toXMLString(int indent) {
+ String xml = "";
+
+ String tabs = "";
+ for (int j = 0; j < indent; j++) {
+ tabs += "\t";
+ }
+
+ if (m_nameSpace.equals("")) {
+ xml = tabs + "<" + m_name;
+ } else {
+ xml = tabs + "<" + m_nameSpace + ":" + m_name;
+ }
+
+ for (int i = 0; i < m_attributes.length; i++) {
+ Attribute current = m_attributes[i];
+ if (current.getNameSpace().equals("")) {
+ xml += " " + current.getName() + "=\"" + current.getValue() + "\"";
+ } else {
+ xml += " " + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue() + "\"";
+ }
+ }
+
+ if (m_elements.length == 0) {
+ xml += "/>";
+ return xml;
+ } else {
+ xml += ">";
+ for (int i = 0; i < m_elements.length; i++) {
+ xml += "\n";
+ xml += m_elements[i].toXMLString(indent + 1);
+ }
+ xml += "\n" + tabs + "</" + m_name + ">";
+ return xml;
+ }
+ }
+
+ /**
+ * To String method.
+ * @return the String form of this element.
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return toString(0);
+ }
+
+ /**
+ * Internal method to compute the toString method.
+ * @param indent : indetnation to use.
+ * @return : the String form of this element.
+ */
+ private String toString(int indent) {
+ String xml = "";
+
+ String tabs = "";
+ for (int j = 0; j < indent; j++) {
+ tabs += "\t";
+ }
+
+ if (m_nameSpace.equals("")) {
+ xml = tabs + m_name;
+ } else {
+ xml = tabs + m_nameSpace + ":" + m_name;
+ }
+
+ for (int i = 0; i < m_attributes.length; i++) {
+ Attribute current = m_attributes[i];
+ if (current.getNameSpace().equals("")) {
+ xml += " " + current.getName() + "=\"" + current.getValue() + "\"";
+ } else {
+ xml += " " + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue() + "\"";
+ }
+ }
+
+ if (m_elements.length == 0) {
+ return xml;
+ } else {
+ for (int i = 0; i < m_elements.length; i++) {
+ xml += "\n";
+ xml += m_elements[i].toString(indent + 1);
+ }
+ return xml;
+ }
+ }
}