You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2007/06/26 12:49:55 UTC

svn commit: r550770 - in /felix/trunk/ipojo: arch/src/main/java/org/apache/felix/ipojo/arch/ arch/src/main/resources/ core/ core/src/main/java/org/apache/felix/ipojo/handlers/dependency/ core/src/main/java/org/apache/felix/ipojo/parser/ core/src/main/j...

Author: clement
Date: Tue Jun 26 03:49:53 2007
New Revision: 550770

URL: http://svn.apache.org/viewvc?view=rev&rev=550770
Log:
Remove dependency on Java 5 (Felix-312)
Format code consistently

Removed:
    felix/trunk/ipojo/core/src/main/java/org/osgi/
Modified:
    felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
    felix/trunk/ipojo/arch/src/main/resources/metadata.xml
    felix/trunk/ipojo/core/pom.xml
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
    felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java
    felix/trunk/ipojo/manipulator/pom.xml
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java
    felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
    felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java
    felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java

Modified: felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java (original)
+++ felix/trunk/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java Tue Jun 26 03:49:53 2007
@@ -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");
+            }
         }
-        
+
     }
 }

Modified: felix/trunk/ipojo/arch/src/main/resources/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/arch/src/main/resources/metadata.xml?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/arch/src/main/resources/metadata.xml (original)
+++ felix/trunk/ipojo/arch/src/main/resources/metadata.xml Tue Jun 26 03:49:53 2007
@@ -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>

Modified: felix/trunk/ipojo/core/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/pom.xml?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/core/pom.xml (original)
+++ felix/trunk/ipojo/core/pom.xml Tue Jun 26 03:49:53 2007
@@ -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", 

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java Tue Jun 26 03:49:53 2007
@@ -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;
             }

Modified: felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java (original)
+++ felix/trunk/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java Tue Jun 26 03:49:53 2007
@@ -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;

Modified: felix/trunk/ipojo/manipulator/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/pom.xml?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/pom.xml (original)
+++ felix/trunk/ipojo/manipulator/pom.xml Tue Jun 26 03:49:53 2007
@@ -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>

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java Tue Jun 26 03:49:53 2007
@@ -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 {
 

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java Tue Jun 26 03:49:53 2007
@@ -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 {
 

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/FieldAdapter.java Tue Jun 26 03:49:53 2007
@@ -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) {

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java Tue Jun 26 03:49:53 2007
@@ -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 {

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java Tue Jun 26 03:49:53 2007
@@ -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 {

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java Tue Jun 26 03:49:53 2007
@@ -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;
         }
 

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java Tue Jun 26 03:49:53 2007
@@ -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 {
 

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java Tue Jun 26 03:49:53 2007
@@ -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;
             }
 

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java Tue Jun 26 03:49:53 2007
@@ -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 {
 

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java Tue Jun 26 03:49:53 2007
@@ -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 {
     /**

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java Tue Jun 26 03:49:53 2007
@@ -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 {
 

Modified: felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java (original)
+++ felix/trunk/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java Tue Jun 26 03:49:53 2007
@@ -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;
     }
-
 }

Modified: felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java (original)
+++ felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java Tue Jun 26 03:49:53 2007
@@ -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;
-
-	/**
-	 * Value of the attribute.
-	 */
-	private String m_value;
-
-	/**
-	 * Namepsace of the attribute.
-	 */
-	private String m_nameSpace;
+    /**
+     * Name of the attribute.
+     */
+    private String m_name;
+
+    /**
+     * Value of the attribute.
+     */
+    private String m_value;
+
+    /**
+     * 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;
-	}
-
-	/**
-	 * @return the name
-	 */
-	public String getName() { return m_name; }
-
-	/**
-	 * @return the value
-	 */
-	public String getValue() { return m_value; }
-
-	/**
-	 * @return the namespace
-	 */
-	public String getNameSpace() { return m_nameSpace; }
+     * 
+     * @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;
+    }
+
+    /**
+     * Get the attribute name.
+     * @return the name
+     */
+    public String getName() {
+        return m_name;
+    }
+
+    /**
+     * Get attribute value.
+     * @return the value
+     */
+    public String getValue() {
+        return m_value;
+    }
+
+    /**
+     * Get attribute namespace.
+     * @return the namespace
+     */
+    public String getNameSpace() {
+        return m_nameSpace;
+    }
 
 }

Modified: felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java?view=diff&rev=550770&r1=550769&r2=550770
==============================================================================
--- felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java (original)
+++ felix/trunk/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java Tue Jun 26 03:49:53 2007
@@ -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 subelement of the element.
-	 */
-	private Element[] m_elements = new Element[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];
+
+    /**
      * 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;
-	}
-
-	/**
-	 * 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;
-	}
+     * 
+     * @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;
+    }
 
-	/**
+    /**
      * 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) {
+        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.
+     * @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();
+        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; }
+            if (m_elements[i].getName().equals(name) && m_elements[i].getNameSpace().equals(ns)) {
+                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; }
-        }
-		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];
-
-		// 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;
-			}
-		}
-
-		// 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;
-	}
-	
-	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;
-		}
-	}
+     * 
+     * @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;
+    }
+
+    /**
+     * 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 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;
+            }
+        }
+
+        // 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;
+        }
+    }
 
 }