Apply Felix coding style

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@615139 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java
index 689cf3f..e8d4bee 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.util.ArrayList;

 import java.util.List;

 

@@ -25,11 +26,13 @@
 import org.w3c.dom.Element;

 import org.w3c.dom.Node;

 

+

 /**

  * This class describe and store capability node.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class Capability {

+public class Capability

+{

 

     /**

      * m_name: name of the capability.

@@ -41,65 +44,78 @@
      */

     private List m_p = new ArrayList();

 

+

     /**

      * get the name attribute.

      * 

      * @return name attribute

      */

-    public String getName() {

+    public String getName()

+    {

         return m_name;

     }

 

+

     /**

      * set the name attribute.

      * 

      * @param name new name value

      *            

      */

-    public void setName(String name) {

+    public void setName( String name )

+    {

         this.m_name = name;

     }

 

+

     /**

      * return the capabilities.

      * 

      * @return List of PElement

      */

-    public List getP() {

+    public List getP()

+    {

         return m_p;

     }

 

+

     /**

      * set the capabilities.

      * 

      * @param mp List of PElement

      *            

      */

-    public void setP(List mp) {

+    public void setP( List mp )

+    {

         this.m_p = mp;

     }

 

+

     /**

      * add one element in List.

      * 

      * @param pelement PElement

      *            

      */

-    public void addP(PElement pelement) {

-        m_p.add(pelement);

+    public void addP( PElement pelement )

+    {

+        m_p.add( pelement );

     }

 

+

     /**

      * transform this object to Node.

      * 

      * @param father father document for create Node

      * @return node

      */

-    public Node getNode(Document father) {

-        Element capability = father.createElement("capability");

-        capability.setAttribute("name", this.getName());

-        for (int i = 0; i < this.getP().size(); i++) {

-            capability.appendChild(((PElement) (this.getP().get(i))).getNode(father));

+    public Node getNode( Document father )

+    {

+        Element capability = father.createElement( "capability" );

+        capability.setAttribute( "name", this.getName() );

+        for ( int i = 0; i < this.getP().size(); i++ )

+        {

+            capability.appendChild( ( ( PElement ) ( this.getP().get( i ) ) ).getNode( father ) );

         }

         return capability;

     }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java
index 8b48f1b..990256b 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java
@@ -18,47 +18,56 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import org.w3c.dom.Document;

 import org.w3c.dom.Element;

 import org.w3c.dom.Node;

 

+

 /**

  * describe and store category node.

  * 

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

 

-public class Category {

+public class Category

+{

     /**

      * id of the category.

      */

     private String m_id;

 

+

     /**

      * get the id attribute.

      * 

      * @return id

      */

-    public String getId() {

+    public String getId()

+    {

         return m_id;

     }

 

+

     /**

      * set the id attribute.

      * @param id new id value

      */

-    public void setId(String id) {

+    public void setId( String id )

+    {

         this.m_id = id;

     }

 

+

     /**

      * transform this object to node.

      * @param father father document for create Node

      * @return node

      */

-    public Node getNode(Document father) {

-        Element category = father.createElement("category");

-        category.setAttribute("id", this.getId());

+    public Node getNode( Document father )

+    {

+        Element category = father.createElement( "category" );

+        category.setAttribute( "id", this.getId() );

         return category;

     }

 }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java
index 434a864..16cbe92 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java
@@ -18,12 +18,14 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 /**

  * this class is used to store some user information about configuration of the plugin.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  *

  */

-public class Config {

+public class Config

+{

 

     /**

      * use relative path or not.

@@ -35,45 +37,55 @@
      */

     private boolean m_fileRemote; // deploy file on remote server

 

+

     /**

      * constructor: set default configuration: use relative path and don't upload file.

      *

      */

-    public Config() {

+    public Config()

+    {

         // default configuration

         m_pathRelative = true;

         m_fileRemote = false;

     }

 

+

     /**

      * set relativePath attribute.

      * @param value new value of attribute

      */

-    public void setPathRelative(boolean value) {

+    public void setPathRelative( boolean value )

+    {

         m_pathRelative = value;

     }

 

+

     /**

      * set fileRemote attribute.

      * @param value new value of attribute

      */

-    public void setRemotely(boolean value) {

+    public void setRemotely( boolean value )

+    {

         m_fileRemote = value;

     }

 

+

     /**

      * get use path relative.

      * @return true if plugin use relative path, else false

      */

-    public boolean isPathRelative() {

+    public boolean isPathRelative()

+    {

         return m_pathRelative;

     }

 

+

     /**

      * get if use upload file.

      * @return true if the file will be uploaded, else false

      */

-    public boolean isRemotely() {

+    public boolean isRemotely()

+    {

         return m_fileRemote;

     }

 }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
index ff8c734..b416e32 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.File;

 import java.net.MalformedURLException;

 import java.net.URI;

@@ -35,218 +36,285 @@
 import org.osgi.impl.bundle.obr.resource.ResourceImpl;

 import org.osgi.impl.bundle.obr.resource.VersionRange;

 

+

 /**

  * this class is used to configure bindex and get information built by bindex about targeted bundle.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class ExtractBindexInfo {

+public class ExtractBindexInfo

+{

 

     /**

      * attribute get from bindex which describe targeted resource.

      */

     private ResourceImpl m_resource;

 

+

     /**

      * configure bindex and build information.

      * @param repoFilename URI on OBR descriptor file

      * @param outFile path on targeted jar-file

      * @throws MojoExecutionException occurs if bindex configuration failed

      */

-    public ExtractBindexInfo(URI repoFilename, String outFile) throws MojoExecutionException {

+    public ExtractBindexInfo( URI repoFilename, String outFile ) throws MojoExecutionException

+    {

 

         this.m_resource = null;

         RepositoryImpl repository = null;

-        try {

-            repository = new RepositoryImpl(new File(repoFilename).getAbsoluteFile().toURL());

-        } catch (MalformedURLException e) {

+        try

+        {

+            repository = new RepositoryImpl( new File( repoFilename ).getAbsoluteFile().toURL() );

+        }

+        catch ( MalformedURLException e )

+        {

             e.printStackTrace();

-            throw new MojoExecutionException("MalformedURLException");

+            throw new MojoExecutionException( "MalformedURLException" );

         }

         BundleInfo info = null;

-        try {

-            info = new BundleInfo(repository, new File(outFile));

-        } catch (Exception e) {

+        try

+        {

+            info = new BundleInfo( repository, new File( outFile ) );

+        }

+        catch ( Exception e )

+        {

             e.printStackTrace();

-            throw new MojoExecutionException("Exception");

+            throw new MojoExecutionException( "Exception" );

         }

 

-        try {

+        try

+        {

             m_resource = info.build();

-        } catch (Exception e) {

+        }

+        catch ( Exception e )

+        {

             e.printStackTrace();

-            throw new MojoExecutionException("Exception");

+            throw new MojoExecutionException( "Exception" );

         }

     }

 

+

     /**

      * transform logical operator in xml syntax.

      * @param filter string which contains logical operator

      * @return string in correct xml syntax

      */

-    private String parseFilter(String filter) {

-        filter.replaceAll("&", "&amp");

-        filter.replaceAll(">=", "&gt");

+    private String parseFilter( String filter )

+    {

+        filter.replaceAll( "&", "&amp" );

+        filter.replaceAll( ">=", "&gt" );

 

         return filter;

     }

 

+

     /**

      * extract capabilities from bindex information.

      * @return bundle capabilities List

      */

-    public List getCapabilities() {

+    public List getCapabilities()

+    {

         List list = new ArrayList();

         Collection res = m_resource.getCapabilityList();

         Iterator it = res.iterator();

-        while (it.hasNext()) {

+        while ( it.hasNext() )

+        {

             Capability capability = new Capability();

-            CapabilityImpl ci = (CapabilityImpl) it.next();

-            capability.setName(ci.getName());

+            CapabilityImpl ci = ( CapabilityImpl ) it.next();

+            capability.setName( ci.getName() );

             // System.out.println(ci.getName()) ;

-            if (!(ci.getName().compareTo("bundle") == 0)) {

+            if ( !( ci.getName().compareTo( "bundle" ) == 0 ) )

+            {

                 Map properties = ci.getProperties();

-                for (Iterator k = properties.keySet().iterator(); k.hasNext();) {

+                for ( Iterator k = properties.keySet().iterator(); k.hasNext(); )

+                {

                     PElement p = new PElement();

-                    String key = (String) k.next();

-                    List values = (List) properties.get(key);

-                    for (Iterator v = values.iterator(); v.hasNext();) {

+                    String key = ( String ) k.next();

+                    List values = ( List ) properties.get( key );

+                    for ( Iterator v = values.iterator(); v.hasNext(); )

+                    {

                         Object value = v.next();

-                        p.setN(key);

-                        if (value != null) {

-                            p.setV(value.toString());

-                        } else {

-                            System.out.println("Missing value " + key);

+                        p.setN( key );

+                        if ( value != null )

+                        {

+                            p.setV( value.toString() );

+                        }

+                        else

+                        {

+                            System.out.println( "Missing value " + key );

                         }

                         String type = null;

-                        if (value instanceof Number) {

+                        if ( value instanceof Number )

+                        {

                             type = "number";

-                        } else { 

-                            if (value.getClass() == VersionRange.class) { type = "version"; }

                         }

-                        if (type != null) {

-                            p.setT(type);

+                        else

+                        {

+                            if ( value.getClass() == VersionRange.class )

+                            {

+                                type = "version";

+                            }

+                        }

+                        if ( type != null )

+                        {

+                            p.setT( type );

                         }

                     }

-                    capability.addP(p);

+                    capability.addP( p );

                 }

 

-                list.add(capability);

+                list.add( capability );

             }

         }

         return list;

     }

 

+

     /**

      * extract requirement from bindex information.

      * @return bundle requirement List

      */

-    public List getRequirement() {

+    public List getRequirement()

+    {

         List list = new ArrayList();

         Collection res = m_resource.getRequirementList();

         Iterator it = res.iterator();

-        while (it.hasNext()) {

-            RequirementImpl ci = (RequirementImpl) it.next();

+        while ( it.hasNext() )

+        {

+            RequirementImpl ci = ( RequirementImpl ) it.next();

             Require require = new Require();

 

-            require.setExtend(String.valueOf(ci.isExtend()));

-            require.setMultiple(String.valueOf(ci.isMultiple()));

-            require.setOptional(String.valueOf(ci.isOptional()));

-            require.setName(ci.getName());

-            require.setFilter(this.parseFilter(ci.getFilter()));

-            require.setValue(ci.getComment());

-            list.add(require);

+            require.setExtend( String.valueOf( ci.isExtend() ) );

+            require.setMultiple( String.valueOf( ci.isMultiple() ) );

+            require.setOptional( String.valueOf( ci.isOptional() ) );

+            require.setName( ci.getName() );

+            require.setFilter( this.parseFilter( ci.getFilter() ) );

+            require.setValue( ci.getComment() );

+            list.add( require );

         }

         return list;

     }

 

+

     /**

      * extract symbolic name from bindex information.

      * @return bundle symbolic name

      */

-    public String getSymbolicName() {

+    public String getSymbolicName()

+    {

         return m_resource.getSymbolicName();

     }

 

+

     /**

      * extract version from bindex information.

      * @return bundle version

      */

-    public String getVersion() {

-        if (m_resource.getVersion() != null) {

+    public String getVersion()

+    {

+        if ( m_resource.getVersion() != null )

+        {

             return m_resource.getVersion().toString();

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

 

+

     /**

      * extract presentation name from bindex information.

      * @return bundle presentation name

      */

-    public String getPresentationName() {

+    public String getPresentationName()

+    {

         return m_resource.getPresentationName();

     }

 

+

     /**

      * extract copyright from bindex information.

      * @return bundle copyright

      */

-    public String getCopyright() {

+    public String getCopyright()

+    {

         return m_resource.getCopyright();

     }

 

+

     /**

      * extract description from bindex information.

      * @return bundle description

      */

-    public String getDescription() {

+    public String getDescription()

+    {

         return m_resource.getDescription();

     }

 

+

     /**

      * extract documentation from bindex information.

      * @return bundle documentation

      */

-    public String getDocumentation() {

-        if (m_resource.getDocumentation() != null) {

+    public String getDocumentation()

+    {

+        if ( m_resource.getDocumentation() != null )

+        {

             return m_resource.getDocumentation().toString();

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

 

+

     /**

      * extract license from bindex information.

      * @return bundle license

      */

-    public String getLicense() {

-        if (m_resource.getLicense() != null) {

+    public String getLicense()

+    {

+        if ( m_resource.getLicense() != null )

+        {

             return m_resource.getLicense().toString();

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

 

+

     /**

      * extract source from bindex information.

      * @return bundle source

      */

-    public String getSource() {

-        if (m_resource.getSource() != null) {

+    public String getSource()

+    {

+        if ( m_resource.getSource() != null )

+        {

             return m_resource.getSource().toString();

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

-    

+

+

     /**

      * extract source from bindex information.

      * @return bundle source

      */

-    public String getId() {

-        if (m_resource.getId() != null) {

+    public String getId()

+    {

+        if ( m_resource.getId() != null )

+        {

             return m_resource.getId();

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
index 567e374..d61a839 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.File;

 import java.io.FileNotFoundException;

 import java.io.FileOutputStream;

@@ -50,6 +51,7 @@
 import org.w3c.dom.NodeList;

 import org.xml.sax.SAXException;

 

+

 /**

  * Clean an OBR repository by finding and removing missing resources. 

  * @goal clean

@@ -57,7 +59,8 @@
  * @requiresDependencyResolution compile

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class ObrCleanRepo extends AbstractMojo {

+public class ObrCleanRepo extends AbstractMojo

+{

 

     /**

      * OBR Repository.

@@ -75,97 +78,121 @@
      */

     private ArtifactRepository localRepository;

 

-    public void execute() throws MojoExecutionException {

+

+    public void execute() throws MojoExecutionException

+    {

         // If no OBR repository, return

-        if ("NONE".equalsIgnoreCase(obrRepository)) {

+        if ( "NONE".equalsIgnoreCase( obrRepository ) )

+        {

             return;

         }

 

-        try {

+        try

+        {

             // Compute local repository location

             String localRepoPath = localRepository.getBasedir();

-            PathFile repositoryXml = normalizeRepositoryPath(obrRepository, localRepoPath);

+            PathFile repositoryXml = normalizeRepositoryPath( obrRepository, localRepoPath );

 

             // Check if the file exist

-            if (!repositoryXml.isExists()) {

-                getLog().error("The repository file " + repositoryXml.getAbsoluteFilename() + " does not exist");

+            if ( !repositoryXml.isExists() )

+            {

+                getLog().error( "The repository file " + repositoryXml.getAbsoluteFilename() + " does not exist" );

                 return;

             }

 

-            Document doc = parseFile(repositoryXml.getFile(), initConstructor());

-            Node finalDocument = cleanDocument(doc.getDocumentElement()); //Analyze existing repository.

+            Document doc = parseFile( repositoryXml.getFile(), initConstructor() );

+            Node finalDocument = cleanDocument( doc.getDocumentElement() ); //Analyze existing repository.

 

-            if (finalDocument == null) {

-                getLog().info("Nothing to clean in " + repositoryXml.getAbsoluteFilename());

-            } else {

-                getLog().info("Cleaning...");

-                writeToFile(repositoryXml.getUri(), finalDocument);  // Write the new file

-                getLog().info("Repository " + repositoryXml.getAbsoluteFilename() + " updated");

+            if ( finalDocument == null )

+            {

+                getLog().info( "Nothing to clean in " + repositoryXml.getAbsoluteFilename() );

             }

-        } catch (Exception e) {

-            getLog().error("Exception while cleaning the OBR repository file : " + e.getLocalizedMessage(), e);

+            else

+            {

+                getLog().info( "Cleaning..." );

+                writeToFile( repositoryXml.getUri(), finalDocument ); // Write the new file

+                getLog().info( "Repository " + repositoryXml.getAbsoluteFilename() + " updated" );

+            }

+        }

+        catch ( Exception e )

+        {

+            getLog().error( "Exception while cleaning the OBR repository file : " + e.getLocalizedMessage(), e );

         }

     }

 

+

     /**

      * Analyze the given XML tree (DOM of the repository file) and remove missing resources.

      * @param elem : the input XML tree

      * @return the cleaned XML tree

      */

-    private Element cleanDocument(Element elem) {

-        NodeList nodes = elem.getElementsByTagName("resource");

+    private Element cleanDocument( Element elem )

+    {

+        NodeList nodes = elem.getElementsByTagName( "resource" );

         List toRemove = new ArrayList();

-        

+

         // First, look for missing resources

-        for (int i = 0; i < nodes.getLength(); i++) {

-            Element n = (Element) nodes.item(i);

-            String value = n.getAttribute("uri");

+        for ( int i = 0; i < nodes.getLength(); i++ )

+        {

+            Element n = ( Element ) nodes.item( i );

+            String value = n.getAttribute( "uri" );

 

             String localRepoPath = localRepository.getBasedir();

-            File file = new File(localRepoPath, value);

+            File file = new File( localRepoPath, value );

 

-            if (!file.exists()) {

+            if ( !file.exists() )

+            {

                 getLog().info(

-                        "The bundle " + n.getAttribute("presentationname") + " - " + n.getAttribute("version")

-                                + " will be removed");

-                toRemove.add(n);

+                    "The bundle " + n.getAttribute( "presentationname" ) + " - " + n.getAttribute( "version" )

+                        + " will be removed" );

+                toRemove.add( n );

             }

         }

 

-        if (toRemove.size() > 0) {

+        if ( toRemove.size() > 0 )

+        {

             // Then remove missing resources.

-            for (int i = 0; i < toRemove.size(); i++) {

-                elem.removeChild((Node) toRemove.get(i));

+            for ( int i = 0; i < toRemove.size(); i++ )

+            {

+                elem.removeChild( ( Node ) toRemove.get( i ) );

             }

-            

+

             // If we have to remove resources, we need to update  'lastmodified' attribute

-            SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss.SSS");

+            SimpleDateFormat format = new SimpleDateFormat( "yyyyMMddHHmmss.SSS" );

             Date d = new Date();

-            d.setTime(System.currentTimeMillis());

-            elem.setAttribute("lastmodified", format.format(d));

+            d.setTime( System.currentTimeMillis() );

+            elem.setAttribute( "lastmodified", format.format( d ) );

             return elem;

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

 

+

     /**

      * Initialize the document builder from Xerces.

      * @return DocumentBuilder ready to create new document

      * @throws MojoExecutionException : occurs when the instantiation of the document builder fails

      */

-    private DocumentBuilder initConstructor() throws MojoExecutionException {

+    private DocumentBuilder initConstructor() throws MojoExecutionException

+    {

         DocumentBuilder constructor = null;

         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

-        try {

+        try

+        {

             constructor = factory.newDocumentBuilder();

-        } catch (ParserConfigurationException e) {

-            getLog().error("Unable to create a new xml document");

-            throw new MojoExecutionException("Cannot create the Document Builder : " + e.getMessage());

+        }

+        catch ( ParserConfigurationException e )

+        {

+            getLog().error( "Unable to create a new xml document" );

+            throw new MojoExecutionException( "Cannot create the Document Builder : " + e.getMessage() );

         }

         return constructor;

     }

 

+

     /**

      * Open an XML file.

      * @param filename : XML file path

@@ -173,99 +200,132 @@
      * @return Document which describes this file

      * @throws MojoExecutionException occurs when the given file cannot be opened or is a valid XML file.

      */

-    private Document parseFile(File file, DocumentBuilder constructor) throws MojoExecutionException {

-        if (constructor == null) {

+    private Document parseFile( File file, DocumentBuilder constructor ) throws MojoExecutionException

+    {

+        if ( constructor == null )

+        {

             return null;

         }

         // The document is the root of the DOM tree.

-        getLog().info("Parsing " + file.getAbsolutePath());

+        getLog().info( "Parsing " + file.getAbsolutePath() );

         Document doc = null;

-        try {

-            doc = constructor.parse(file);

-        } catch (SAXException e) {

-            getLog().error("Cannot parse " + file.getAbsolutePath() + " : " + e.getMessage());

-            throw new MojoExecutionException("Cannot parse " + file.getAbsolutePath() + " : " + e.getMessage());

-        } catch (IOException e) {

-            getLog().error("Cannot open " + file.getAbsolutePath() + " : " + e.getMessage());

-            throw new MojoExecutionException("Cannot open " + file.getAbsolutePath() + " : " + e.getMessage());

+        try

+        {

+            doc = constructor.parse( file );

+        }

+        catch ( SAXException e )

+        {

+            getLog().error( "Cannot parse " + file.getAbsolutePath() + " : " + e.getMessage() );

+            throw new MojoExecutionException( "Cannot parse " + file.getAbsolutePath() + " : " + e.getMessage() );

+        }

+        catch ( IOException e )

+        {

+            getLog().error( "Cannot open " + file.getAbsolutePath() + " : " + e.getMessage() );

+            throw new MojoExecutionException( "Cannot open " + file.getAbsolutePath() + " : " + e.getMessage() );

         }

         return doc;

     }

 

+

     /**

      * write a Node in a xml file.

      * @param outputFilename URI to the output file

      * @param treeToBeWrite Node root of the tree to be write in file

      * @throws MojoExecutionException if the plugin failed

      */

-    private void writeToFile(URI outputFilename, Node treeToBeWrite) throws MojoExecutionException {

+    private void writeToFile( URI outputFilename, Node treeToBeWrite ) throws MojoExecutionException

+    {

         // init the transformer

         Transformer transformer = null;

         TransformerFactory tfabrique = TransformerFactory.newInstance();

-        try {

+        try

+        {

             transformer = tfabrique.newTransformer();

-        } catch (TransformerConfigurationException e) {

-            getLog().error("Unable to write to file: " + outputFilename.toString());

-            throw new MojoExecutionException("Unable to write to file: " + outputFilename.toString() + " : " + e.getMessage());

+        }

+        catch ( TransformerConfigurationException e )

+        {

+            getLog().error( "Unable to write to file: " + outputFilename.toString() );

+            throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "

+                + e.getMessage() );

         }

         Properties proprietes = new Properties();

-        proprietes.put("method", "xml");

-        proprietes.put("version", "1.0");

-        proprietes.put("encoding", "ISO-8859-1");

-        proprietes.put("standalone", "yes");

-        proprietes.put("indent", "yes");

-        proprietes.put("omit-xml-declaration", "no");

-        transformer.setOutputProperties(proprietes);

+        proprietes.put( "method", "xml" );

+        proprietes.put( "version", "1.0" );

+        proprietes.put( "encoding", "ISO-8859-1" );

+        proprietes.put( "standalone", "yes" );

+        proprietes.put( "indent", "yes" );

+        proprietes.put( "omit-xml-declaration", "no" );

+        transformer.setOutputProperties( proprietes );

 

-        DOMSource input = new DOMSource(treeToBeWrite);

+        DOMSource input = new DOMSource( treeToBeWrite );

 

-        File fichier = new File(outputFilename);

+        File fichier = new File( outputFilename );

         FileOutputStream flux = null;

-        try {

-            flux = new FileOutputStream(fichier);

-        } catch (FileNotFoundException e) {

-            getLog().error("Unable to write to file: " + fichier.getName());

-            throw new MojoExecutionException("Unable to write to file: " + fichier.getName() + " : " + e.getMessage());

+        try

+        {

+            flux = new FileOutputStream( fichier );

         }

-        Result output = new StreamResult(flux);

-        try {

-            transformer.transform(input, output);

-        } catch (TransformerException e) {

-            throw new MojoExecutionException("Unable to write to file: " + outputFilename.toString() + " : " + e.getMessage());

+        catch ( FileNotFoundException e )

+        {

+            getLog().error( "Unable to write to file: " + fichier.getName() );

+            throw new MojoExecutionException( "Unable to write to file: " + fichier.getName() + " : " + e.getMessage() );

+        }

+        Result output = new StreamResult( flux );

+        try

+        {

+            transformer.transform( input, output );

+        }

+        catch ( TransformerException e )

+        {

+            throw new MojoExecutionException( "Unable to write to file: " + outputFilename.toString() + " : "

+                + e.getMessage() );

         }

 

-        try {

+        try

+        {

             flux.flush();

             flux.close();

-        } catch (IOException e) {

-            throw new MojoExecutionException("IOException when closing file : " + e.getMessage());

+        }

+        catch ( IOException e )

+        {

+            throw new MojoExecutionException( "IOException when closing file : " + e.getMessage() );

         }

 

     }

 

-    private static PathFile normalizeRepositoryPath(String obrPath, String mavenPath) {

-        if (null == obrPath || obrPath.length() == 0) {

+

+    private static PathFile normalizeRepositoryPath( String obrPath, String mavenPath )

+    {

+        if ( null == obrPath || obrPath.length() == 0 )

+        {

             obrPath = mavenPath + File.separatorChar + "repository.xml";

-        } else if (!obrPath.endsWith(".xml")) {

+        }

+        else if ( !obrPath.endsWith( ".xml" ) )

+        {

             obrPath = obrPath + File.separatorChar + "repository.xml";

         }

 

         URI uri;

-        try {

-            uri = new URI(obrPath);

-        } catch (URISyntaxException e) {

+        try

+        {

+            uri = new URI( obrPath );

+        }

+        catch ( URISyntaxException e )

+        {

             uri = null;

         }

 

-        if (null == uri || !uri.isAbsolute()) {

-            File file = new File(obrPath);

-            if (!file.isAbsolute()) {

-                file = new File(mavenPath, obrPath);

+        if ( null == uri || !uri.isAbsolute() )

+        {

+            File file = new File( obrPath );

+            if ( !file.isAbsolute() )

+            {

+                file = new File( mavenPath, obrPath );

             }

 

             uri = file.toURI();

         }

 

-        return new PathFile(uri.toASCIIString());

+        return new PathFile( uri.toASCIIString() );

     }

 }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
index b0896e2..5eea1a3 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.BufferedWriter;

 import java.io.File;

 import java.io.FileWriter;

@@ -37,6 +38,7 @@
 import org.apache.maven.wagon.TransferFailedException;

 import org.apache.maven.wagon.authorization.AuthorizationException;

 

+

 /**

  * deploy the bundle to a remote site.

  * this goal is used when you compile a project with a pom file

@@ -46,7 +48,8 @@
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

 

-public class ObrDeploy extends AbstractMojo {

+public class ObrDeploy extends AbstractMojo

+{

 

     /**

      * setting of maven.

@@ -103,199 +106,266 @@
      * @description If true evrything the goal do nothing, the goal just skip over 

      * @parameter expression="${maven.obr.installToRemoteOBR}" default-value="false"

      */

-    private boolean installToRemoteOBR;    

+    private boolean installToRemoteOBR;

 

-    

+

     /**

      * main method for this goal.

      * @implements org.apache.maven.plugin.Mojo.execute 

      * @throws MojoExecutionException if the plugin failed

      * @throws MojoFailureException if the plugin failed

      */

-    public void execute() throws MojoExecutionException, MojoFailureException {

-        getLog().info("Obr-deploy start:");

-        if(!installToRemoteOBR)

+    public void execute() throws MojoExecutionException, MojoFailureException

+    {

+        getLog().info( "Obr-deploy start:" );

+        if ( !installToRemoteOBR )

         {

-        	getLog().info("maven-obr-plugin:deploy goal is disable due to one of the following reason:");

-        	getLog().info(" - 'installToRemoteOBR' configuration set to false");

-        	getLog().info(" - JVM property maven.obr.installToRemoteOBR set to false");

-        	return;

+            getLog().info( "maven-obr-plugin:deploy goal is disable due to one of the following reason:" );

+            getLog().info( " - 'installToRemoteOBR' configuration set to false" );

+            getLog().info( " - JVM property maven.obr.installToRemoteOBR set to false" );

+            return;

         }

         ArtifactRepository ar = m_project.getDistributionManagementArtifactRepository();

 

         // locate the obr.xml file

         String obrXmlFile = null;

         List l = m_project.getResources();

-        for (int i = 0; i < l.size(); i++) {

-            File f = new File(((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml");

-            if (f.exists()) {

-                obrXmlFile = ((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml";

+        for ( int i = 0; i < l.size(); i++ )

+        {

+            File f = new File( ( ( Resource ) l.get( i ) ).getDirectory() + File.separator + "obr.xml" );

+            if ( f.exists() )

+            {

+                obrXmlFile = ( ( Resource ) l.get( i ) ).getDirectory() + File.separator + "obr.xml";

                 break;

             }

         }

 

         // the obr.xml file is not present

-        if (obrXmlFile == null) {

-            getLog().warn("obr.xml is not present, use default");

+        if ( obrXmlFile == null )

+        {

+            getLog().warn( "obr.xml is not present, use default" );

         }

 

         File repoDescriptorFile = null;

 

         // init the wagon connection

-        RemoteFileManager remoteFile = new RemoteFileManager(ar, m_wagonManager, m_settings, getLog());

+        RemoteFileManager remoteFile = new RemoteFileManager( ar, m_wagonManager, m_settings, getLog() );

         remoteFile.connect();

 

         // create a non-empty file used to lock the repository descriptor file

         File lockFile = null;

         Writer output = null;

-        try {

-            lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);

-            output = new BufferedWriter(new FileWriter(lockFile));

-            output.write("locked");

+        try

+        {

+            lockFile = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );

+            output = new BufferedWriter( new FileWriter( lockFile ) );

+            output.write( "locked" );

             output.close();

-        } catch (IOException e) {

-            getLog().error("Unable to create temporary file");

-            throw new MojoFailureException("IOException");

+        }

+        catch ( IOException e )

+        {

+            getLog().error( "Unable to create temporary file" );

+            throw new MojoFailureException( "IOException" );

         }

 

-        if (m_ignoreLock) {

-            try {

-                remoteFile.put(lockFile, m_repositoryName + ".lock");

-            } catch (TransferFailedException e) {

-                getLog().error("Transfer failed");

+        if ( m_ignoreLock )

+        {

+            try

+            {

+                remoteFile.put( lockFile, m_repositoryName + ".lock" );

+            }

+            catch ( TransferFailedException e )

+            {

+                getLog().error( "Transfer failed" );

                 e.printStackTrace();

-                throw new MojoFailureException("TransferFailedException");

+                throw new MojoFailureException( "TransferFailedException" );

 

-            } catch (ResourceDoesNotExistException e) {

-                throw new MojoFailureException("ResourceDoesNotExistException");

-            } catch (AuthorizationException e) {

-                getLog().error("Authorization failed");

+            }

+            catch ( ResourceDoesNotExistException e )

+            {

+                throw new MojoFailureException( "ResourceDoesNotExistException" );

+            }

+            catch ( AuthorizationException e )

+            {

+                getLog().error( "Authorization failed" );

                 e.printStackTrace();

-                throw new MojoFailureException("AuthorizationException");

+                throw new MojoFailureException( "AuthorizationException" );

             }

 

-        } else {

+        }

+        else

+        {

             int countError = 0;

-            while (remoteFile.isLockedFile(remoteFile, m_repositoryName) && countError < 2) {

+            while ( remoteFile.isLockedFile( remoteFile, m_repositoryName ) && countError < 2 )

+            {

                 countError++;

-                getLog().warn("File is locked, retry in 10s");

-                try {

-                    Thread.sleep(10000);

-                } catch (InterruptedException e) {

-                    getLog().warn("Sleep interupted");

+                getLog().warn( "File is locked, retry in 10s" );

+                try

+                {

+                    Thread.sleep( 10000 );

+                }

+                catch ( InterruptedException e )

+                {

+                    getLog().warn( "Sleep interupted" );

                 }

             }

 

-            if (countError == 2) {

-                getLog().error("File: " + m_repositoryName + " is locked. Try -Dignore-lock=true if you want force uploading");

-                throw new MojoFailureException("fileLocked");

+            if ( countError == 2 )

+            {

+                getLog().error(

+                    "File: " + m_repositoryName + " is locked. Try -Dignore-lock=true if you want force uploading" );

+                throw new MojoFailureException( "fileLocked" );

             }

         }

 

         // file is not locked, so we lock it now

-        try {

-            remoteFile.put(lockFile, m_repositoryName + ".lock");

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        try

+        {

+            remoteFile.put( lockFile, m_repositoryName + ".lock" );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

+            throw new MojoFailureException( "TransferFailedException" );

 

-        } catch (ResourceDoesNotExistException e) {

-            throw new MojoFailureException("ResourceDoesNotExistException");

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

+            throw new MojoFailureException( "ResourceDoesNotExistException" );

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

+            throw new MojoFailureException( "AuthorizationException" );

         }

 

-        try {

-            repoDescriptorFile = remoteFile.get(m_repositoryName);

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        try

+        {

+            repoDescriptorFile = remoteFile.get( m_repositoryName );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

+            throw new MojoFailureException( "TransferFailedException" );

 

-        } catch (ResourceDoesNotExistException e) {

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

             // file doesn't exist! create a new one

-            getLog().warn("file specified does not exist: " + m_repositoryName);

-            getLog().warn("Create a new repository descriptor file " + m_repositoryName);

-            try {

-                File f = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);

-                repoDescriptorFile = new File(f.getParent() + File.separator + String.valueOf(System.currentTimeMillis()) + ".xml");

-            } catch (IOException e1) {

-                getLog().error("canno't create temporary file");

+            getLog().warn( "file specified does not exist: " + m_repositoryName );

+            getLog().warn( "Create a new repository descriptor file " + m_repositoryName );

+            try

+            {

+                File f = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );

+                repoDescriptorFile = new File( f.getParent() + File.separator

+                    + String.valueOf( System.currentTimeMillis() ) + ".xml" );

+            }

+            catch ( IOException e1 )

+            {

+                getLog().error( "canno't create temporary file" );

                 e1.printStackTrace();

                 return;

             }

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

-        } catch (IOException e) {

+            throw new MojoFailureException( "AuthorizationException" );

+        }

+        catch ( IOException e )

+        {

             e.printStackTrace();

-            throw new MojoFailureException("IOException");

+            throw new MojoFailureException( "IOException" );

         }

 

         Config userConfig = new Config();

-        userConfig.setPathRelative(true);

-        userConfig.setRemotely(true);

+        userConfig.setPathRelative( true );

+        userConfig.setRemotely( true );

 

         PathFile file = null;

 

         // get the path to local maven repository

-        file = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + PathFile.uniformSeparator(m_localRepo.pathOf(m_project.getArtifact())));

-        if (file.isExists()) {

+        file = new PathFile( PathFile.uniformSeparator( m_settings.getLocalRepository() ) + File.separator

+            + PathFile.uniformSeparator( m_localRepo.pathOf( m_project.getArtifact() ) ) );

+        if ( file.isExists() )

+        {

             m_fileInLocalRepo = file.getOnlyAbsoluteFilename();

-        } else {

-            getLog().error("file not found in local repository: " + m_settings.getLocalRepository() + File.separator + m_localRepo.pathOf(m_project.getArtifact()));

+        }

+        else

+        {

+            getLog().error(

+                "file not found in local repository: " + m_settings.getLocalRepository() + File.separator

+                    + m_localRepo.pathOf( m_project.getArtifact() ) );

             return;

         }

 

-        file = new PathFile("file:/" + repoDescriptorFile.getAbsolutePath());

+        file = new PathFile( "file:/" + repoDescriptorFile.getAbsolutePath() );

 

-        ObrUpdate obrUpdate = new ObrUpdate(file, obrXmlFile, m_project, m_fileInLocalRepo, PathFile.uniformSeparator(m_settings.getLocalRepository()), userConfig, getLog());

+        ObrUpdate obrUpdate = new ObrUpdate( file, obrXmlFile, m_project, m_fileInLocalRepo, PathFile

+            .uniformSeparator( m_settings.getLocalRepository() ), userConfig, getLog() );

 

         obrUpdate.updateRepository();

 

         // the reposiroty descriptor file is modified, we upload it on the remote repository

-        try {

-            remoteFile.put(repoDescriptorFile, m_repositoryName);

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        try

+        {

+            remoteFile.put( repoDescriptorFile, m_repositoryName );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

-        } catch (ResourceDoesNotExistException e) {

-            getLog().error("Resource does not exist:" + repoDescriptorFile.getName());

+            throw new MojoFailureException( "TransferFailedException" );

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

+            getLog().error( "Resource does not exist:" + repoDescriptorFile.getName() );

             e.printStackTrace();

-            throw new MojoFailureException("ResourceDoesNotExistException");

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+            throw new MojoFailureException( "ResourceDoesNotExistException" );

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

+            throw new MojoFailureException( "AuthorizationException" );

         }

         repoDescriptorFile.delete();

 

         // we remove lockFile activation

         lockFile = null;

-        try {

-            lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);

-        } catch (IOException e) {

-            e.printStackTrace();

-            throw new MojoFailureException("IOException");

+        try

+        {

+            lockFile = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );

         }

-        try {

-            remoteFile.put(lockFile, m_repositoryName + ".lock");

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        catch ( IOException e )

+        {

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

-        } catch (ResourceDoesNotExistException e) {

+            throw new MojoFailureException( "IOException" );

+        }

+        try

+        {

+            remoteFile.put( lockFile, m_repositoryName + ".lock" );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("ResourceDoesNotExistException");

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+            throw new MojoFailureException( "TransferFailedException" );

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

+            throw new MojoFailureException( "ResourceDoesNotExistException" );

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

+            e.printStackTrace();

+            throw new MojoFailureException( "AuthorizationException" );

         }

 

         remoteFile.disconnect();

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java
index 1bf521c..4eb126e 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.BufferedWriter;

 import java.io.File;

 import java.io.FileWriter;

@@ -35,6 +36,7 @@
 import org.apache.maven.wagon.TransferFailedException;

 import org.apache.maven.wagon.authorization.AuthorizationException;

 

+

 /**

  * deploy the bundle to a ftp site.

  * this goal is used when you upload a jar file (in command line)

@@ -42,7 +44,8 @@
  * @phase deploy

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class ObrDeployFile extends AbstractMojo {

+public class ObrDeployFile extends AbstractMojo

+{

 

     /**

      * setting of maven.

@@ -103,180 +106,246 @@
      */

     private String m_fileInLocalRepo;

 

+

     /**

      * main method for this goal.

      * @implements org.apache.maven.plugin.Mojo.execute 

      * @throws MojoExecutionException if the plugin failed

      * @throws MojoFailureException if the plugin failed

      */

-    public void execute() throws MojoExecutionException, MojoFailureException {

-        getLog().info("Obr-deploy-file start:");

+    public void execute() throws MojoExecutionException, MojoFailureException

+    {

+        getLog().info( "Obr-deploy-file start:" );

 

         ArtifactRepository ar = m_project.getDistributionManagementArtifactRepository();

 

         // locate the obr.xml file

-        PathFile fileObrXml = new PathFile(m_obrFile);

-        if (!fileObrXml.isExists()) {

-            getLog().warn("obr.xml file not found, use default");

+        PathFile fileObrXml = new PathFile( m_obrFile );

+        if ( !fileObrXml.isExists() )

+        {

+            getLog().warn( "obr.xml file not found, use default" );

         }

 

         File repoDescriptorFile = null;

 

-        RemoteFileManager remoteFile = new RemoteFileManager(ar, m_wagonManager, m_settings, getLog());

+        RemoteFileManager remoteFile = new RemoteFileManager( ar, m_wagonManager, m_settings, getLog() );

 

         remoteFile.connect();

 

         // create a non-empty file used to lock the repository descriptor file

         File lockFile = null;

         Writer output = null;

-        try {

-            lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);

-            output = new BufferedWriter(new FileWriter(lockFile));

-            output.write("locked");

+        try

+        {

+            lockFile = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );

+            output = new BufferedWriter( new FileWriter( lockFile ) );

+            output.write( "locked" );

             output.close();

-        } catch (IOException e) {

-            getLog().error("Unable to create temporary file");

-            throw new MojoFailureException("IOException");

+        }

+        catch ( IOException e )

+        {

+            getLog().error( "Unable to create temporary file" );

+            throw new MojoFailureException( "IOException" );

         }

 

-        if (m_ignoreLock) {

-            try {

-                remoteFile.put(lockFile, m_repositoryName + ".lock");

-            } catch (TransferFailedException e) {

-                getLog().error("Transfer failed");

+        if ( m_ignoreLock )

+        {

+            try

+            {

+                remoteFile.put( lockFile, m_repositoryName + ".lock" );

+            }

+            catch ( TransferFailedException e )

+            {

+                getLog().error( "Transfer failed" );

                 e.printStackTrace();

-                throw new MojoFailureException("TransferFailedException");

+                throw new MojoFailureException( "TransferFailedException" );

 

-            } catch (ResourceDoesNotExistException e) {

-                throw new MojoFailureException("ResourceDoesNotExistException");

-            } catch (AuthorizationException e) {

-                getLog().error("Authorization failed");

+            }

+            catch ( ResourceDoesNotExistException e )

+            {

+                throw new MojoFailureException( "ResourceDoesNotExistException" );

+            }

+            catch ( AuthorizationException e )

+            {

+                getLog().error( "Authorization failed" );

                 e.printStackTrace();

-                throw new MojoFailureException("AuthorizationException");

+                throw new MojoFailureException( "AuthorizationException" );

             }

 

-        } else {

+        }

+        else

+        {

             int countError = 0;

-            while (remoteFile.isLockedFile(remoteFile, m_repositoryName) && countError < 2) {

+            while ( remoteFile.isLockedFile( remoteFile, m_repositoryName ) && countError < 2 )

+            {

                 countError++;

-                getLog().warn("File is locked, retry in 10s");

-                try {

-                    Thread.sleep(10000);

-                } catch (InterruptedException e) {

-                    getLog().warn("Sleep Interupted");

+                getLog().warn( "File is locked, retry in 10s" );

+                try

+                {

+                    Thread.sleep( 10000 );

+                }

+                catch ( InterruptedException e )

+                {

+                    getLog().warn( "Sleep Interupted" );

                 }

             }

 

-            if (countError == 2) {

-                getLog().error("File: " + m_repositoryName + " is locked. Try -Dignore-lock=true if you want to force uploading");

-                throw new MojoFailureException("fileLocked");

+            if ( countError == 2 )

+            {

+                getLog().error(

+                    "File: " + m_repositoryName + " is locked. Try -Dignore-lock=true if you want to force uploading" );

+                throw new MojoFailureException( "fileLocked" );

             }

         }

 

         // file is not locked, so we lock it now

-        try {

-            remoteFile.put(lockFile, m_repositoryName + ".lock");

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        try

+        {

+            remoteFile.put( lockFile, m_repositoryName + ".lock" );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

+            throw new MojoFailureException( "TransferFailedException" );

 

-        } catch (ResourceDoesNotExistException e) {

-            throw new MojoFailureException("ResourceDoesNotExistException");

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

+            throw new MojoFailureException( "ResourceDoesNotExistException" );

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

+            throw new MojoFailureException( "AuthorizationException" );

         }

 

-        try {

-            repoDescriptorFile = remoteFile.get(m_repositoryName);

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        try

+        {

+            repoDescriptorFile = remoteFile.get( m_repositoryName );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

+            throw new MojoFailureException( "TransferFailedException" );

 

-        } catch (ResourceDoesNotExistException e) {

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

             // file doesn't exist! create a new one

-            getLog().warn("file specified does not exist: " + m_repositoryName);

-            getLog().warn("Create a new repository descriptor file " + m_repositoryName);

-            try {

-                File f = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);

-                repoDescriptorFile = new File(f.getParent() + File.separator + String.valueOf(System.currentTimeMillis()) + ".xml");

-            } catch (IOException e1) {

-                getLog().error("canno't create temporary file");

+            getLog().warn( "file specified does not exist: " + m_repositoryName );

+            getLog().warn( "Create a new repository descriptor file " + m_repositoryName );

+            try

+            {

+                File f = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );

+                repoDescriptorFile = new File( f.getParent() + File.separator

+                    + String.valueOf( System.currentTimeMillis() ) + ".xml" );

+            }

+            catch ( IOException e1 )

+            {

+                getLog().error( "canno't create temporary file" );

                 e1.printStackTrace();

                 return;

             }

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

-        } catch (IOException e) {

+            throw new MojoFailureException( "AuthorizationException" );

+        }

+        catch ( IOException e )

+        {

             e.printStackTrace();

-            throw new MojoFailureException("IOException");

+            throw new MojoFailureException( "IOException" );

         }

 

         Config userConfig = new Config();

-        userConfig.setPathRelative(true);

-        userConfig.setRemotely(true);

+        userConfig.setPathRelative( true );

+        userConfig.setRemotely( true );

 

         PathFile file = null;

 

         // get the path to local maven repository

-        file = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + PathFile.uniformSeparator(m_localRepo.pathOf(m_project.getArtifact())));

-        if (file.isExists()) {

+        file = new PathFile( PathFile.uniformSeparator( m_settings.getLocalRepository() ) + File.separator

+            + PathFile.uniformSeparator( m_localRepo.pathOf( m_project.getArtifact() ) ) );

+        if ( file.isExists() )

+        {

             m_fileInLocalRepo = file.getOnlyAbsoluteFilename();

-        } else {

-            getLog().error("file not found in local repository: " + m_settings.getLocalRepository() + File.separator + m_localRepo.pathOf(m_project.getArtifact()));

+        }

+        else

+        {

+            getLog().error(

+                "file not found in local repository: " + m_settings.getLocalRepository() + File.separator

+                    + m_localRepo.pathOf( m_project.getArtifact() ) );

             return;

         }

 

-        file = new PathFile("file:/" + repoDescriptorFile.getAbsolutePath());

+        file = new PathFile( "file:/" + repoDescriptorFile.getAbsolutePath() );

 

-        ObrUpdate obrUpdate = new ObrUpdate(file, fileObrXml.getOnlyAbsoluteFilename(), m_project, m_fileInLocalRepo, PathFile.uniformSeparator(m_settings.getLocalRepository()), userConfig, getLog());

+        ObrUpdate obrUpdate = new ObrUpdate( file, fileObrXml.getOnlyAbsoluteFilename(), m_project, m_fileInLocalRepo,

+            PathFile.uniformSeparator( m_settings.getLocalRepository() ), userConfig, getLog() );

 

         obrUpdate.updateRepository();

 

         // the reposiroty descriptor file is modified, we upload it on the remote repository

-        try {

-            remoteFile.put(repoDescriptorFile, m_repositoryName);

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        try

+        {

+            remoteFile.put( repoDescriptorFile, m_repositoryName );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

-        } catch (ResourceDoesNotExistException e) {

-            getLog().error("Resource does not exist:" + repoDescriptorFile.getName());

+            throw new MojoFailureException( "TransferFailedException" );

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

+            getLog().error( "Resource does not exist:" + repoDescriptorFile.getName() );

             e.printStackTrace();

-            throw new MojoFailureException("ResourceDoesNotExistException");

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+            throw new MojoFailureException( "ResourceDoesNotExistException" );

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

+            throw new MojoFailureException( "AuthorizationException" );

         }

         repoDescriptorFile.delete();

 

         // we remove lockFile activation

         lockFile = null;

-        try {

-            lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);

-        } catch (IOException e) {

-            e.printStackTrace();

-            throw new MojoFailureException("IOException");

+        try

+        {

+            lockFile = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );

         }

-        try {

-            remoteFile.put(lockFile, m_repositoryName + ".lock");

-        } catch (TransferFailedException e) {

-            getLog().error("Transfer failed");

+        catch ( IOException e )

+        {

             e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

-        } catch (ResourceDoesNotExistException e) {

+            throw new MojoFailureException( "IOException" );

+        }

+        try

+        {

+            remoteFile.put( lockFile, m_repositoryName + ".lock" );

+        }

+        catch ( TransferFailedException e )

+        {

+            getLog().error( "Transfer failed" );

             e.printStackTrace();

-            throw new MojoFailureException("ResourceDoesNotExistException");

-        } catch (AuthorizationException e) {

-            getLog().error("Authorization failed");

+            throw new MojoFailureException( "TransferFailedException" );

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

             e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

+            throw new MojoFailureException( "ResourceDoesNotExistException" );

+        }

+        catch ( AuthorizationException e )

+        {

+            getLog().error( "Authorization failed" );

+            e.printStackTrace();

+            throw new MojoFailureException( "AuthorizationException" );

         }

         remoteFile.disconnect();

     }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
index c813305..bce9414 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
@@ -18,6 +18,7 @@
  */
 package org.apache.felix.obr.plugin;
 
+
 import java.io.File;
 import java.util.List;
 
@@ -28,6 +29,7 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
 
+
 /**
  * construct the repository.xml with a project Maven compiled
  *
@@ -36,7 +38,8 @@
  * @requiresDependencyResolution compile
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class ObrInstall extends AbstractMojo {
+public class ObrInstall extends AbstractMojo
+{
     /**
      * The local Maven repository.
      * 
@@ -70,93 +73,118 @@
      */
 
     private Settings m_settings;
-    
+
     /**
      * Enable/Disable this goal
      * @description If true evrything the goal do nothing, the goal just skip over 
      * @parameter expression="${maven.obr.installToLocalOBR}" default-value="true"
      */
-    private boolean installToLocalOBR;    
-    
+    private boolean installToLocalOBR;
 
     /**
      * path to file in the maven local repository.
      */
     private String m_fileInLocalRepo;
 
+
     /**
      * main method for this goal.
      * @implements org.apache.maven.plugin.Mojo.execute 
      * @throws MojoExecutionException if the plugin failed
      */
-    public void execute() throws MojoExecutionException {
-        getLog().info("Obr Plugin starts:");
-        if(!installToLocalOBR)
+    public void execute() throws MojoExecutionException
+    {
+        getLog().info( "Obr Plugin starts:" );
+        if ( !installToLocalOBR )
         {
-        	getLog().info("maven-obr-plugin:repository goal is disable due to one of the following reason:");
-        	getLog().info(" - 'installToLocalOBR' configuration set to false");
-        	getLog().info(" - JVM property maven.obr.installToLocalOBR set to false");
-        	return;
-        }
-        
-        if (m_repositoryPath == null) {
-            m_repositoryPath = "file:/" + m_localRepo.getBasedir() + File.separator + "repository.xml";
-            getLog().warn("-DpathRepo is not define, use default repository: " + m_repositoryPath);
+            getLog().info( "maven-obr-plugin:repository goal is disable due to one of the following reason:" );
+            getLog().info( " - 'installToLocalOBR' configuration set to false" );
+            getLog().info( " - JVM property maven.obr.installToLocalOBR set to false" );
+            return;
         }
 
-        PathFile file = new PathFile(m_repositoryPath);
-        if (file.isExists()) {
-            if (!m_repositoryPath.startsWith("file:/")) { m_repositoryPath = "file:/" + m_repositoryPath; }
+        if ( m_repositoryPath == null )
+        {
+            m_repositoryPath = "file:/" + m_localRepo.getBasedir() + File.separator + "repository.xml";
+            getLog().warn( "-DpathRepo is not define, use default repository: " + m_repositoryPath );
+        }
+
+        PathFile file = new PathFile( m_repositoryPath );
+        if ( file.isExists() )
+        {
+            if ( !m_repositoryPath.startsWith( "file:/" ) )
+            {
+                m_repositoryPath = "file:/" + m_repositoryPath;
+            }
         }
 
         // locate the obr.xml file
         String obrXmlFile = null;
         List l = m_project.getResources();
-        for (int i = 0; i < l.size(); i++) {
-            File f = new File(((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml");
-            if (f.exists()) {
-                obrXmlFile = ((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml";
+        for ( int i = 0; i < l.size(); i++ )
+        {
+            File f = new File( ( ( Resource ) l.get( i ) ).getDirectory() + File.separator + "obr.xml" );
+            if ( f.exists() )
+            {
+                obrXmlFile = ( ( Resource ) l.get( i ) ).getDirectory() + File.separator + "obr.xml";
                 break;
             }
         }
         // the obr.xml file is not present
-        if (obrXmlFile == null) {
-            getLog().warn("obr.xml is not present, use default");
+        if ( obrXmlFile == null )
+        {
+            getLog().warn( "obr.xml is not present, use default" );
         }
 
         // get the path to local maven repository
-        file = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + 
-        		File.separator + PathFile.uniformSeparator(m_localRepo.pathOf(m_project.getArtifact())));
-	
-        if (file.isExists()) {
-            m_fileInLocalRepo = file.	getOnlyAbsoluteFilename();
-        } else {
-            getLog().error("file not found in local repository: " + m_settings.getLocalRepository() + File.separator + m_localRepo.pathOf(m_project.getArtifact()));
-		getLog().error("file not found in local repository: " 
-				+ m_localRepo.getBasedir() + File.separator + m_localRepo.pathOf(m_project.getArtifact()));
+        file = new PathFile( PathFile.uniformSeparator( m_settings.getLocalRepository() ) + File.separator
+            + PathFile.uniformSeparator( m_localRepo.pathOf( m_project.getArtifact() ) ) );
+
+        if ( file.isExists() )
+        {
+            m_fileInLocalRepo = file.getOnlyAbsoluteFilename();
+        }
+        else
+        {
+            getLog().error(
+                "file not found in local repository: " + m_settings.getLocalRepository() + File.separator
+                    + m_localRepo.pathOf( m_project.getArtifact() ) );
+            getLog().error(
+                "file not found in local repository: " + m_localRepo.getBasedir() + File.separator
+                    + m_localRepo.pathOf( m_project.getArtifact() ) );
             return;
         }
 
         // verify the repository.xml
-        PathFile fileRepo = new PathFile(m_repositoryPath);
-        if (fileRepo.isRelative()) { fileRepo.setBaseDir(m_settings.getLocalRepository()); }
+        PathFile fileRepo = new PathFile( m_repositoryPath );
+        if ( fileRepo.isRelative() )
+        {
+            fileRepo.setBaseDir( m_settings.getLocalRepository() );
+        }
 
         // create the folder to the repository
-        PathFile repoExist = new PathFile(fileRepo.getAbsolutePath());
-        if (!repoExist.isExists()) { fileRepo.createPath(); }
+        PathFile repoExist = new PathFile( fileRepo.getAbsolutePath() );
+        if ( !repoExist.isExists() )
+        {
+            fileRepo.createPath();
+        }
 
         // build the user configuration (use default)
         Config user = new Config();
 
-    	getLog().debug("Maven2 Local File repository = "+fileRepo.getAbsoluteFilename());
-    	getLog().debug("OBR repository = "+obrXmlFile);
-	
-        ObrUpdate obrUpdate = new ObrUpdate(fileRepo, obrXmlFile, m_project, m_fileInLocalRepo, PathFile.uniformSeparator(m_settings.getLocalRepository()), user, getLog());
-        try {
+        getLog().debug( "Maven2 Local File repository = " + fileRepo.getAbsoluteFilename() );
+        getLog().debug( "OBR repository = " + obrXmlFile );
+
+        ObrUpdate obrUpdate = new ObrUpdate( fileRepo, obrXmlFile, m_project, m_fileInLocalRepo, PathFile
+            .uniformSeparator( m_settings.getLocalRepository() ), user, getLog() );
+        try
+        {
             obrUpdate.updateRepository();
-        } catch (MojoExecutionException e) {
+        }
+        catch ( MojoExecutionException e )
+        {
             e.printStackTrace();
-            throw new MojoExecutionException("MojoFailureException");
+            throw new MojoExecutionException( "MojoFailureException" );
         }
     }
 
diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java
index 4bb8bb7..03b9e8b 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.File;

 

 import org.apache.maven.artifact.repository.ArtifactRepository;

@@ -27,6 +28,7 @@
 import org.apache.maven.project.MavenProject;

 import org.apache.maven.settings.Settings;

 

+

 /**

  * construct the repository.xml from a compiled bundle.

  * @description construct the repository.xml from a compiled bundle.

@@ -35,7 +37,8 @@
  * @phase install

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class ObrInstallFile extends AbstractMojo {

+public class ObrInstallFile extends AbstractMojo

+{

     /**

      * The local Maven repository.

      * 

@@ -100,79 +103,94 @@
      */

     private MavenProject m_project;

 

+

     /**

      * main method for this goal.

      * @implements org.apache.maven.plugin.Mojo.execute 

      * @throws MojoExecutionException if the plugin failed

      * @throws MojoFailureException if the plugin failed

      */

-    public void execute() throws MojoExecutionException, MojoFailureException {

-        getLog().info("Install-File Obr starts:");

+    public void execute() throws MojoExecutionException, MojoFailureException

+    {

+        getLog().info( "Install-File Obr starts:" );

 

         m_project = new MavenProject();

-        m_project.setArtifactId(m_artifactId);

-        m_project.setGroupId(m_groupId);

-        m_project.setVersion(m_version);

-        m_project.setPackaging(m_packaging);

+        m_project.setArtifactId( m_artifactId );

+        m_project.setGroupId( m_groupId );

+        m_project.setVersion( m_version );

+        m_project.setPackaging( m_packaging );

 

         PathFile fileOut;

 

-        if (m_groupId == null) {

-            getLog().error("-DgroupId=VALUE is required");

+        if ( m_groupId == null )

+        {

+            getLog().error( "-DgroupId=VALUE is required" );

             return;

         }

-        if (m_artifactId == null) {

-            getLog().error("-Dartifactid=VALUE is required");

+        if ( m_artifactId == null )

+        {

+            getLog().error( "-Dartifactid=VALUE is required" );

             return;

         }

-        if (m_version == null) {

-            getLog().error("-Dversion=VALUE is required");

+        if ( m_version == null )

+        {

+            getLog().error( "-Dversion=VALUE is required" );

             return;

         }

-        if (m_packaging == null) {

-            getLog().error("-Dpackaging=VALUE is required");

+        if ( m_packaging == null )

+        {

+            getLog().error( "-Dpackaging=VALUE is required" );

             return;

         }

 

         // copy the file to the local repository

-        PathFile repoLocal = new PathFile(m_localRepo.getBasedir());

+        PathFile repoLocal = new PathFile( m_localRepo.getBasedir() );

 

         // get the target file in mvn repo

-        fileOut = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + m_groupId.replace('.', File.separatorChar) + File.separator + m_artifactId + File.separator + m_version + File.separator + m_artifactId

-                + "-" + m_version + "." + m_packaging);

+        fileOut = new PathFile( PathFile.uniformSeparator( m_settings.getLocalRepository() ) + File.separator

+            + m_groupId.replace( '.', File.separatorChar ) + File.separator + m_artifactId + File.separator + m_version

+            + File.separator + m_artifactId + "-" + m_version + "." + m_packaging );

 

-        if (!fileOut.isExists()) {

-            getLog().error("file doesn't exist: " + fileOut.getAbsoluteFilename());

+        if ( !fileOut.isExists() )

+        {

+            getLog().error( "file doesn't exist: " + fileOut.getAbsoluteFilename() );

             return;

-        } else {

-            getLog().info("Target file: " + fileOut.getAbsoluteFilename());

+        }

+        else

+        {

+            getLog().info( "Target file: " + fileOut.getAbsoluteFilename() );

         }

 

-        if (m_repositoryPath == null) {

+        if ( m_repositoryPath == null )

+        {

             m_repositoryPath = "file:" + repoLocal.getOnlyAbsoluteFilename() + "repository.xml";

-            getLog().warn("-DpathRepo is not define, use default repository: " + m_repositoryPath);

+            getLog().warn( "-DpathRepo is not define, use default repository: " + m_repositoryPath );

         }

 

-        PathFile fileRepo = new PathFile(m_repositoryPath);

-        if (fileRepo.isRelative()) {

-            fileRepo.setBaseDir(m_settings.getLocalRepository());

+        PathFile fileRepo = new PathFile( m_repositoryPath );

+        if ( fileRepo.isRelative() )

+        {

+            fileRepo.setBaseDir( m_settings.getLocalRepository() );

         }

 

         // create the folder to the repository

-        PathFile repoExist = new PathFile(fileRepo.getAbsolutePath());

-        if (!repoExist.isExists()) {

+        PathFile repoExist = new PathFile( fileRepo.getAbsolutePath() );

+        if ( !repoExist.isExists() )

+        {

             fileRepo.createPath();

         }

 

-        PathFile fileObrXml = new PathFile(m_obrFile);

-        if (!fileObrXml.isExists()) {

-            getLog().warn("obr.xml file not found, use default");

+        PathFile fileObrXml = new PathFile( m_obrFile );

+        if ( !fileObrXml.isExists() )

+        {

+            getLog().warn( "obr.xml file not found, use default" );

         }

 

         // build the user config

         Config userConfig = new Config();

 

-        ObrUpdate obrUpdate = new ObrUpdate(fileRepo, fileObrXml.getOnlyAbsoluteFilename(), m_project, fileOut.getOnlyAbsoluteFilename(), m_localRepo.getBasedir(), userConfig, getLog());

+        ObrUpdate obrUpdate = new ObrUpdate( fileRepo, fileObrXml.getOnlyAbsoluteFilename(), m_project, fileOut

+            .getOnlyAbsoluteFilename(), m_localRepo.getBasedir(), userConfig, getLog() );

         obrUpdate.updateRepository();

 

     }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
index e5249fb..75d307b 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.File;

 import java.io.FileNotFoundException;

 import java.io.FileOutputStream;

@@ -48,16 +49,18 @@
 import org.w3c.dom.NodeList;

 import org.xml.sax.SAXException;

 

+

 /**

  * this class parse the old repository.xml file build the bundle resource description and update the repository.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

 

-public class ObrUpdate {

+public class ObrUpdate

+{

     /**

      * generate the date format to insert it in repository descriptor file.

      */

-    static SimpleDateFormat m_format = new SimpleDateFormat("yyyyMMddHHmmss.SSS");

+    static SimpleDateFormat m_format = new SimpleDateFormat( "yyyyMMddHHmmss.SSS" );

 

     /**

      * logger for this plugin.

@@ -119,6 +122,7 @@
      */

     private PathFile m_repo;

 

+

     /**

      * initialize information.

      * @param repoFilename path to the repository descriptor file

@@ -129,7 +133,9 @@
      * @param userConfig user information

      * @param log plugin logger

      */

-    public ObrUpdate(PathFile repoFilename, String obrXml, MavenProject project, String outputFile, String localRepo, Config userConfig, Log log) {

+    public ObrUpdate( PathFile repoFilename, String obrXml, MavenProject project, String outputFile, String localRepo,

+        Config userConfig, Log log )

+    {

         // this.m_localRepo = localRepo;

         this.m_outputFile = outputFile;

         this.m_repoFilename = repoFilename.getUri();

@@ -139,118 +145,152 @@
 

         this.m_userConfig = userConfig;

 

-        m_resourceBundle = new ResourcesBundle(log);

+        m_resourceBundle = new ResourcesBundle( log );

 

-        if (userConfig.isRemotely()) {

-            this.m_repo = new PathFile(localRepo);

-        } else {

+        if ( userConfig.isRemotely() )

+        {

+            this.m_repo = new PathFile( localRepo );

+        }

+        else

+        {

             this.m_repo = repoFilename;

         }

     }

 

+

     /**

      * update the repository descriptor file. parse the old repository descriptor file, get the old reference of the bundle or determine the id for a new bundle, extract information from bindex set the new information in descriptor file and save it.

      * @throws MojoExecutionException if the plugin failed

      */

-    public void updateRepository() throws MojoExecutionException {

-    	

-    	m_logger.debug(" (f) m_obrXml = " + m_obrXml);

-    	m_logger.debug(" (f) m_outputFile = " + m_outputFile);

-    	m_logger.debug(" (f) m_repoFilename = " + m_repoFilename);

+    public void updateRepository() throws MojoExecutionException

+    {

+

+        m_logger.debug( " (f) m_obrXml = " + m_obrXml );

+        m_logger.debug( " (f) m_outputFile = " + m_outputFile );

+        m_logger.debug( " (f) m_repoFilename = " + m_repoFilename );

 

         m_constructor = initConstructor();

 

-        if (m_constructor == null)  {

+        if ( m_constructor == null )

+        {

             return;

         }

 

         // get the file size

-        PathFile pf = new PathFile(m_outputFile);

+        PathFile pf = new PathFile( m_outputFile );

         File fout = pf.getFile();

-        pf.setBaseDir(m_repo.getOnlyAbsolutePath());

-        if (fout.exists()) {

-            m_resourceBundle.setSize(String.valueOf(fout.length()));

-            if (m_userConfig.isPathRelative()) {

-                m_resourceBundle.setUri(pf.getOnlyRelativeFilename().replace('\\', '/'));

-            } else {

-                m_resourceBundle.setUri("file:" + m_outputFile);

+        pf.setBaseDir( m_repo.getOnlyAbsolutePath() );

+        if ( fout.exists() )

+        {

+            m_resourceBundle.setSize( String.valueOf( fout.length() ) );

+            if ( m_userConfig.isPathRelative() )

+            {

+                m_resourceBundle.setUri( pf.getOnlyRelativeFilename().replace( '\\', '/' ) );

             }

-        } else {

-            m_logger.error("file doesn't exist: " + m_outputFile);

+            else

+            {

+                m_resourceBundle.setUri( "file:" + m_outputFile );

+            }

+        }

+        else

+        {

+            m_logger.error( "file doesn't exist: " + m_outputFile );

             return;

         }

 

         // parse repository

-        if (parseRepositoryXml() == -1) { return; }

+        if ( parseRepositoryXml() == -1 )

+        {

+            return;

+        }

 

         // parse the obr.xml file

-        if (m_obrXml != null) {

+        if ( m_obrXml != null )

+        {

             // URL url = getClass().getResource("/SchemaObr.xsd");

             // TODO validate obr.xml file

 

-            Document obrXmlDoc = parseFile(m_obrXml, m_constructor);

-            if (obrXmlDoc == null) { return; }

-            Node obrXmlRoot = (Element) obrXmlDoc.getDocumentElement();

+            Document obrXmlDoc = parseFile( m_obrXml, m_constructor );

+            if ( obrXmlDoc == null )

+            {

+                return;

+            }

+            Node obrXmlRoot = ( Element ) obrXmlDoc.getDocumentElement();

             // sort the obr file

-            sortObrXml(obrXmlRoot);

+            sortObrXml( obrXmlRoot );

         }

 

         // use bindex to extract bundle information

-        try {

-            m_ebi = new ExtractBindexInfo(m_repoFilename, m_outputFile);

-        } catch (MojoExecutionException e) {

-            m_logger.error("unable to build Bindex informations");

+        try

+        {

+            m_ebi = new ExtractBindexInfo( m_repoFilename, m_outputFile );

+        }

+        catch ( MojoExecutionException e )

+        {

+            m_logger.error( "unable to build Bindex informations" );

             e.printStackTrace();

-            throw new MojoExecutionException("MojoFailureException");

+            throw new MojoExecutionException( "MojoFailureException" );

         }

 

-        m_resourceBundle.construct(m_project, m_ebi);

+        m_resourceBundle.construct( m_project, m_ebi );

 

-        if (!walkOnTree(m_root)) {

+        if ( !walkOnTree( m_root ) )

+        {

             // the correct resource node was not found, we must create it

             // we compute the new id

             String id = m_resourceBundle.getId();

-            searchRepository(m_root, id);

+            searchRepository( m_root, id );

         }

 

         // the repository.xml file have been modified, so we save it

-        m_logger.info("Writing OBR metadata");

-        writeToFile(m_repoFilename, m_root);

+        m_logger.info( "Writing OBR metadata" );

+        writeToFile( m_repoFilename, m_root );

     }

 

+

     /**

      * init the document builder from xerces.

      * @return DocumentBuilder ready to create new document

      */

-    private DocumentBuilder initConstructor() {

+    private DocumentBuilder initConstructor()

+    {

         DocumentBuilder constructor = null;

         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

-        try {

+        try

+        {

             constructor = factory.newDocumentBuilder();

-        } catch (ParserConfigurationException e) {

-            m_logger.error("unable to create a new xml document");

+        }

+        catch ( ParserConfigurationException e )

+        {

+            m_logger.error( "unable to create a new xml document" );

             e.printStackTrace();

         }

         return constructor;

 

     }

 

+

     /**

      * Parse the repository descriptor file.

      * 

      * @return 0 if the bundle is already in the descriptor, else -1

      * @throws MojoExecutionException if the plugin failed

      */

-    private int parseRepositoryXml() throws MojoExecutionException {

+    private int parseRepositoryXml() throws MojoExecutionException

+    {

 

-        File fout = new File(m_repoFilename);

-        if (!fout.exists()) {

+        File fout = new File( m_repoFilename );

+        if ( !fout.exists() )

+        {

             // create the repository.xml

-            try {

-            	fout.createNewFile();

-                m_logger.info("Created "+fout.getAbsolutePath());

-            } catch (IOException e) {

-                m_logger.error("Cannot create file " + fout.getAbsolutePath());

+            try

+            {

+                fout.createNewFile();

+                m_logger.info( "Created " + fout.getAbsolutePath() );

+            }

+            catch ( IOException e )

+            {

+                m_logger.error( "Cannot create file " + fout.getAbsolutePath() );

                 e.printStackTrace();

                 return -1;

             }

@@ -258,184 +298,250 @@
             Document doc = m_constructor.newDocument();

             // create xml tree

             Date d = new Date();

-            d.setTime(System.currentTimeMillis());

-            Element root = doc.createElement("repository");

-            root.setAttribute("lastmodified", m_format.format(d));

-            root.setAttribute("name", "MyRepository");

-            try {

-                writeToFile(m_repoFilename, root);

-            } catch (MojoExecutionException e) {

+            d.setTime( System.currentTimeMillis() );

+            Element root = doc.createElement( "repository" );

+            root.setAttribute( "lastmodified", m_format.format( d ) );

+            root.setAttribute( "name", "MyRepository" );

+            try

+            {

+                writeToFile( m_repoFilename, root );

+            }

+            catch ( MojoExecutionException e )

+            {

                 e.printStackTrace();

-                throw new MojoExecutionException("MojoExecutionException");

+                throw new MojoExecutionException( "MojoExecutionException" );

             }

         }

 

         // now we parse the repository.xml file

-        m_repoDoc = parseFile(fout.getAbsolutePath(), m_constructor);

-        if (m_repoDoc == null) { return -1; }

+        m_repoDoc = parseFile( fout.getAbsolutePath(), m_constructor );

+        if ( m_repoDoc == null )

+        {

+            return -1;

+        }

 

-        m_root = (Element) m_repoDoc.getDocumentElement();

+        m_root = ( Element ) m_repoDoc.getDocumentElement();

         return 0;

     }

 

+

     /**

      * transform a xml file to a xerces Document.

      * @param filename path to the xml file

      * @param constructor DocumentBuilder get from xerces

      * @return Document which describe this file

      */

-    private Document parseFile(String filename, DocumentBuilder constructor) {

-        if (constructor == null) { return null; }

+    private Document parseFile( String filename, DocumentBuilder constructor )

+    {

+        if ( constructor == null )

+        {

+            return null;

+        }

         // The document is the root of the DOM tree.

-        m_logger.info("Parsing " + filename);

+        m_logger.info( "Parsing " + filename );

         Document doc = null;

-        try {

-            doc = constructor.parse(new File(filename));

-        } catch (SAXException e) {

+        try

+        {

+            doc = constructor.parse( new File( filename ) );

+        }

+        catch ( SAXException e )

+        {

             e.printStackTrace();

             return null;

-        } catch (IOException e) {

-            m_logger.error("cannot open file: " + filename);

+        }

+        catch ( IOException e )

+        {

+            m_logger.error( "cannot open file: " + filename );

             e.printStackTrace();

             return null;

         }

         return doc;

     }

 

+

     /**

      * put the information from obr.xml into ressourceBundle object.

      * @param node Node to the OBR.xml file

      */

-    private void sortObrXml(Node node) {

-        if (node.getNodeName().compareTo("require") == 0) {

+    private void sortObrXml( Node node )

+    {

+        if ( node.getNodeName().compareTo( "require" ) == 0 )

+        {

             Require newRequireNode = new Require();

             NamedNodeMap list = node.getAttributes();

-            try {

-                newRequireNode.setExtend(list.getNamedItem("extend").getNodeValue());

-                newRequireNode.setMultiple(list.getNamedItem("multiple").getNodeValue());

-                newRequireNode.setOptional(list.getNamedItem("optional").getNodeValue());

-                newRequireNode.setFilter(list.getNamedItem("filter").getNodeValue());

-                newRequireNode.setName(list.getNamedItem("name").getNodeValue());

-            } catch (NullPointerException e) {

-                m_logger.error("the obr.xml file seems to be invalid in a \"require\" tag (one or more attributes are missing)");

+            try

+            {

+                newRequireNode.setExtend( list.getNamedItem( "extend" ).getNodeValue() );

+                newRequireNode.setMultiple( list.getNamedItem( "multiple" ).getNodeValue() );

+                newRequireNode.setOptional( list.getNamedItem( "optional" ).getNodeValue() );

+                newRequireNode.setFilter( list.getNamedItem( "filter" ).getNodeValue() );

+                newRequireNode.setName( list.getNamedItem( "name" ).getNodeValue() );

+            }

+            catch ( NullPointerException e )

+            {

+                m_logger

+                    .error( "the obr.xml file seems to be invalid in a \"require\" tag (one or more attributes are missing)" );

                 // e.printStackTrace();

             }

-            newRequireNode.setValue(XmlHelper.getTextContent(node));

-            m_resourceBundle.addRequire(newRequireNode);

-        } else if (node.getNodeName().compareTo("capability") == 0) {

+            newRequireNode.setValue( XmlHelper.getTextContent( node ) );

+            m_resourceBundle.addRequire( newRequireNode );

+        }

+        else if ( node.getNodeName().compareTo( "capability" ) == 0 )

+        {

             Capability newCapability = new Capability();

-            try {

-                newCapability.setName(node.getAttributes().getNamedItem("name").getNodeValue());

-            } catch (NullPointerException e) {

-                m_logger.error("attribute \"name\" is missing in obr.xml in a \"capability\" tag");

+            try

+            {

+                newCapability.setName( node.getAttributes().getNamedItem( "name" ).getNodeValue() );

+            }

+            catch ( NullPointerException e )

+            {

+                m_logger.error( "attribute \"name\" is missing in obr.xml in a \"capability\" tag" );

                 e.printStackTrace();

             }

             NodeList list = node.getChildNodes();

-            for (int i = 0; i < list.getLength(); i++) {

+            for ( int i = 0; i < list.getLength(); i++ )

+            {

                 PElement p = new PElement();

-                Node n = list.item(i);

+                Node n = list.item( i );

                 Node item = null;

                 // System.err.println(n.getNodeName());

-                if (n.getNodeName().compareTo("p") == 0) {

+                if ( n.getNodeName().compareTo( "p" ) == 0 )

+                {

 

-                    p.setN(n.getAttributes().getNamedItem("n").getNodeValue());

-                    item = n.getAttributes().getNamedItem("t");

-                    if (item != null) { p.setT(item.getNodeValue()); }

-                    item = n.getAttributes().getNamedItem("v");

-                    if (item != null) { p.setV(item.getNodeValue()); }

+                    p.setN( n.getAttributes().getNamedItem( "n" ).getNodeValue() );

+                    item = n.getAttributes().getNamedItem( "t" );

+                    if ( item != null )

+                    {

+                        p.setT( item.getNodeValue() );

+                    }

+                    item = n.getAttributes().getNamedItem( "v" );

+                    if ( item != null )

+                    {

+                        p.setV( item.getNodeValue() );

+                    }

 

-                    newCapability.addP(p);

+                    newCapability.addP( p );

                 }

             }

-            m_resourceBundle.addCapability(newCapability);

-        } else if (node.getNodeName().compareTo("category") == 0) {

+            m_resourceBundle.addCapability( newCapability );

+        }

+        else if ( node.getNodeName().compareTo( "category" ) == 0 )

+        {

             Category newCategory = new Category();

-            newCategory.setId(node.getAttributes().getNamedItem("id").getNodeValue());

-            m_resourceBundle.addCategory(newCategory);

-        } else {

+            newCategory.setId( node.getAttributes().getNamedItem( "id" ).getNodeValue() );

+            m_resourceBundle.addCategory( newCategory );

+        }

+        else

+        {

             NodeList list = node.getChildNodes();

-            for (int i = 0; i < list.getLength(); i++) {

-                sortObrXml(list.item(i));

+            for ( int i = 0; i < list.getLength(); i++ )

+            {

+                sortObrXml( list.item( i ) );

             }

         }

     }

 

+

     /**

      * write a Node in a xml file.

      * @param outputFilename URI to the output file

      * @param treeToBeWrite Node root of the tree to be write in file

      * @throws MojoExecutionException if the plugin failed

      */

-    private void writeToFile(URI outputFilename, Node treeToBeWrite) throws MojoExecutionException {

+    private void writeToFile( URI outputFilename, Node treeToBeWrite ) throws MojoExecutionException

+    {

         // init the transformer

         Transformer transformer = null;

         TransformerFactory tfabrique = TransformerFactory.newInstance();

-        try {

+        try

+        {

             transformer = tfabrique.newTransformer();

-        } catch (TransformerConfigurationException e) {

-            m_logger.error("Unable to write to file: " + outputFilename.toString());

+        }

+        catch ( TransformerConfigurationException e )

+        {

+            m_logger.error( "Unable to write to file: " + outputFilename.toString() );

             e.printStackTrace();

-            throw new MojoExecutionException("TransformerConfigurationException");

+            throw new MojoExecutionException( "TransformerConfigurationException" );

         }

         Properties proprietes = new Properties();

-        proprietes.put("method", "xml");

-        proprietes.put("version", "1.0");

-        proprietes.put("encoding", "ISO-8859-1");

-        proprietes.put("standalone", "yes");

-        proprietes.put("indent", "yes");

-        proprietes.put("omit-xml-declaration", "no");

-        transformer.setOutputProperties(proprietes);

+        proprietes.put( "method", "xml" );

+        proprietes.put( "version", "1.0" );

+        proprietes.put( "encoding", "ISO-8859-1" );

+        proprietes.put( "standalone", "yes" );

+        proprietes.put( "indent", "yes" );

+        proprietes.put( "omit-xml-declaration", "no" );

+        transformer.setOutputProperties( proprietes );

 

-        DOMSource input = new DOMSource(treeToBeWrite);

+        DOMSource input = new DOMSource( treeToBeWrite );

 

-        File fichier = new File(outputFilename);

+        File fichier = new File( outputFilename );

         FileOutputStream flux = null;

-        try {

-            flux = new FileOutputStream(fichier);

-        } catch (FileNotFoundException e) {

-            m_logger.error("Unable to write to file: " + fichier.getName());

-            e.printStackTrace();

-            throw new MojoExecutionException("FileNotFoundException");

+        try

+        {

+            flux = new FileOutputStream( fichier );

         }

-        Result output = new StreamResult(flux);

-        try {

-            transformer.transform(input, output);

-        } catch (TransformerException e) {

+        catch ( FileNotFoundException e )

+        {

+            m_logger.error( "Unable to write to file: " + fichier.getName() );

             e.printStackTrace();

-            throw new MojoExecutionException("TransformerException");

+            throw new MojoExecutionException( "FileNotFoundException" );

+        }

+        Result output = new StreamResult( flux );

+        try

+        {

+            transformer.transform( input, output );

+        }

+        catch ( TransformerException e )

+        {

+            e.printStackTrace();

+            throw new MojoExecutionException( "TransformerException" );

         }

 

-        try {

+        try

+        {

             flux.flush();

             flux.close();

-        } catch (IOException e) {

+        }

+        catch ( IOException e )

+        {

             e.printStackTrace();

-            throw new MojoExecutionException("IOException");

+            throw new MojoExecutionException( "IOException" );

         }

 

     }

 

+

     /**

      * walk on the tree until the targeted node was found.

      * @param node targeted node

      * @return true if the requiered node was found else false.

      */

-    private boolean walkOnTree(Node node) {

+    private boolean walkOnTree( Node node )

+    {

 

-        if (node.getNodeName().compareTo("resource") == 0) {

-            return resource(node);

-        } else { // look at the repository node (first in the file)

-            if (node.getNodeName().compareTo("repository") == 0) {

+        if ( node.getNodeName().compareTo( "resource" ) == 0 )

+        {

+            return resource( node );

+        }

+        else

+        { // look at the repository node (first in the file)

+            if ( node.getNodeName().compareTo( "repository" ) == 0 )

+            {

                 Date d = new Date();

-                d.setTime(System.currentTimeMillis());

+                d.setTime( System.currentTimeMillis() );

                 NamedNodeMap nList = node.getAttributes();

-                Node n = nList.getNamedItem("lastmodified");

-                n.setNodeValue(m_format.format(d));

+                Node n = nList.getNamedItem( "lastmodified" );

+                n.setNodeValue( m_format.format( d ) );

             }

             NodeList list = node.getChildNodes();

-            if (list.getLength() > 0) {

-                for (int i = 0; i < list.getLength(); i++) {

-                    if (walkOnTree(list.item(i))) { return true; }

+            if ( list.getLength() > 0 )

+            {

+                for ( int i = 0; i < list.getLength(); i++ )

+                {

+                    if ( walkOnTree( list.item( i ) ) )

+                    {

+                        return true;

+                    }

                 }

             }

             return false;

@@ -443,41 +549,52 @@
 

     }

 

+

     /**

      * put the resource bundle in the tree.

      * @param node Node on the xml file

      * @param id id of the bundle ressource

      */

-    private void searchRepository(Node node, String id) {

-        if (node.getNodeName().compareTo("repository") == 0) {

-            node.appendChild(m_resourceBundle.getNode(m_repoDoc));

+    private void searchRepository( Node node, String id )

+    {

+        if ( node.getNodeName().compareTo( "repository" ) == 0 )

+        {

+            node.appendChild( m_resourceBundle.getNode( m_repoDoc ) );

             return;

-        } else {

-            System.out.println("Second branch...");

+        }

+        else

+        {

+            System.out.println( "Second branch..." );

             NodeList list = node.getChildNodes();

-            if (list.getLength() > 0) {

-                for (int i = 0; i < list.getLength(); i++) {

-                    searchRepository(list.item(i), id);

+            if ( list.getLength() > 0 )

+            {

+                for ( int i = 0; i < list.getLength(); i++ )

+                {

+                    searchRepository( list.item( i ), id );

                 }

             }

         }

 

     }

 

+

     /**

      * compare two node and update the array which compute the smallest free id.

      * @param node : node

      * @return true if the node is the same bundle than the ressourceBundle, else false.

      */

-    private boolean resource(Node node) {

+    private boolean resource( Node node )

+    {

 

         // this part save all the id free if we need to add resource

-        String id = node.getAttributes().getNamedItem("id").getNodeValue();

+        String id = node.getAttributes().getNamedItem( "id" ).getNodeValue();

         NamedNodeMap map = node.getAttributes();

 

-        if (m_resourceBundle.isSameBundleResource(map.getNamedItem("symbolicname").getNodeValue(), map.getNamedItem("version").getNodeValue())) {

-            m_resourceBundle.setId(String.valueOf(id));

-            node.getParentNode().replaceChild(m_resourceBundle.getNode(m_repoDoc), node);

+        if ( m_resourceBundle.isSameBundleResource( map.getNamedItem( "symbolicname" ).getNodeValue(), map

+            .getNamedItem( "version" ).getNodeValue() ) )

+        {

+            m_resourceBundle.setId( String.valueOf( id ) );

+            node.getParentNode().replaceChild( m_resourceBundle.getNode( m_repoDoc ), node );

             return true;

         }

         return false;

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java
index 75b1e37..8a51bd8 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java
@@ -18,16 +18,19 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import org.w3c.dom.Document;

 import org.w3c.dom.Element;

 import org.w3c.dom.Node;

 

+

 /**

  * this class describe the p element in a capability tag.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  * 

  */

-public class PElement {

+public class PElement

+{

     /**

      * store the v tag (value).

      */

@@ -43,65 +46,85 @@
      */

     private String m_n;

 

+

     /**

      * get the n tag.

      * @return attribute n

      */

-    public String getN() {

+    public String getN()

+    {

         return m_n;

     }

 

+

     /**

      * set the n tage.

      * @param n new value

      */

-    public void setN(String n) {

+    public void setN( String n )

+    {

         this.m_n = n;

     }

 

+

     /**

      * get the t tag.

      * @return attribute t

      */

-    public String getT() {

+    public String getT()

+    {

         return m_t;

     }

 

+

     /**

      * set the t tag.

      * @param t new value

      */

-    public void setT(String t) {

+    public void setT( String t )

+    {

         this.m_t = t;

     }

 

+

     /**

      * get the v tag.

      * @return attribute v

      */

-    public String getV() {

+    public String getV()

+    {

         return m_v;

     }

 

+

     /**

      * set the v tag.

      * @param v new value

      */

-    public void setV(String v) {

+    public void setV( String v )

+    {

         this.m_v = v;

     }

 

+

     /**

      * transform this object to node.

      * @param father father document for create Node

      * @return node

      */

-    public Node getNode(Document father) {

-        Element p = father.createElement("p");

-        p.setAttribute("n", this.getN());

-        if (this.getT() != null) { p.setAttribute("t", this.getT()); }

+    public Node getNode( Document father )

+    {

+        Element p = father.createElement( "p" );

+        p.setAttribute( "n", this.getN() );

+        if ( this.getT() != null )

+        {

+            p.setAttribute( "t", this.getT() );

+        }

 

-        if (this.getV() != null) { p.setAttribute("v", this.getV()); }

+        if ( this.getV() != null )

+        {

+            p.setAttribute( "v", this.getV() );

+        }

 

         return p;

     }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PathFile.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PathFile.java
index 7cb4bf5..bd9e693 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PathFile.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PathFile.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.File;

 import java.io.FileInputStream;

 import java.io.FileOutputStream;

@@ -26,11 +27,13 @@
 import java.net.URISyntaxException;

 import java.nio.channels.FileChannel;

 

+

 /**

  * this class provide some functions to simplify file manipulation.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class PathFile {

+public class PathFile

+{

 

     /**

      * full filename.

@@ -82,43 +85,55 @@
      */

     private boolean m_valid;

 

+

     /**

      * build all the attribute information.

      * @param filename path to the file

      */

-    public PathFile(String filename) {

+    public PathFile( String filename )

+    {

 

         this.m_fullFilename = filename;

-        if (filename == null) {

+        if ( filename == null )

+        {

             this.m_valid = false;

             return;

         }

         this.m_valid = true;

-        m_protocol = extractProtocol(filename);

-        m_pathFile = extractPathFile(filename);

-        if (m_pathFile.startsWith("//")) {

+        m_protocol = extractProtocol( filename );

+        m_pathFile = extractPathFile( filename );

+        if ( m_pathFile.startsWith( "//" ) )

+        {

             // avoid problems on Unix like system

-            m_pathFile = m_pathFile.substring(1);

+            m_pathFile = m_pathFile.substring( 1 );

         }

-        m_fileName = extractFileName(filename);

+        m_fileName = extractFileName( filename );

         m_relative = extractRelative();

-        if (!m_relative && (getProtocol().compareTo("file") == 0 || getProtocol().compareTo("") == 0)) {

-            File f = new File(getOnlyAbsoluteFilename());

+        if ( !m_relative && ( getProtocol().compareTo( "file" ) == 0 || getProtocol().compareTo( "" ) == 0 ) )

+        {

+            File f = new File( getOnlyAbsoluteFilename() );

             m_file = f.isFile();

             m_folder = f.isDirectory();

             m_exist = f.exists();

-            if (m_folder) {

+            if ( m_folder )

+            {

                 m_pathFile = m_pathFile + m_fileName + File.separator;

                 m_fileName = "";

             }

         }

-        if (m_exist) {

+        if ( m_exist )

+        {

             m_protocol = "file";

-        } else {

-            if (m_fileName.compareTo("") == 0) {

+        }

+        else

+        {

+            if ( m_fileName.compareTo( "" ) == 0 )

+            {

                 m_folder = true;

                 m_file = false;

-            } else {

+            }

+            else

+            {

                 m_folder = false;

                 m_file = true;

             }

@@ -126,17 +141,23 @@
         }

 

         // add the '/' before the complete path if it is absolute path

-        if (!this.isRelative() && !m_pathFile.startsWith("/")) { m_pathFile = "/".concat(m_pathFile); }

+        if ( !this.isRelative() && !m_pathFile.startsWith( "/" ) )

+        {

+            m_pathFile = "/".concat( m_pathFile );

+        }

 

     }

 

+

     /**

      * get if the filename is relative or absolute.

      * @return true if the path is relative, else false

      */

-    private boolean extractRelative() {

-        if (m_pathFile.startsWith("." + File.separator, 1) || m_pathFile.startsWith(".." + File.separator, 1)) {

-            m_pathFile = m_pathFile.substring(1);

+    private boolean extractRelative()

+    {

+        if ( m_pathFile.startsWith( "." + File.separator, 1 ) || m_pathFile.startsWith( ".." + File.separator, 1 ) )

+        {

+            m_pathFile = m_pathFile.substring( 1 );

             m_valid = false;

             return true;

         }

@@ -144,325 +165,466 @@
         return false;

     }

 

+

     /**

      * get only the name from the filename.

      * @param fullFilename full filename

      * @return the name of the file or folder

      */

-    private String extractFileName(String fullFilename) {

-        int index = fullFilename.lastIndexOf('/'); // Given path 

-        return fullFilename.substring(index + 1, fullFilename.length());

+    private String extractFileName( String fullFilename )

+    {

+        int index = fullFilename.lastIndexOf( '/' ); // Given path 

+        return fullFilename.substring( index + 1, fullFilename.length() );

     }

 

+

     /**

      * get the path from the filename.

      * @param fullFilename full filename

      * @return the path of the file

      */

-    private String extractPathFile(String fullFilename) {

+    private String extractPathFile( String fullFilename )

+    {

         String substring;

-        if (extractFileName(fullFilename).compareTo("") == 0) {

+        if ( extractFileName( fullFilename ).compareTo( "" ) == 0 )

+        {

             // it is a folder

             substring = fullFilename;

-        } else {

-            substring = fullFilename.substring(0, fullFilename.indexOf(extractFileName(fullFilename)));

+        }

+        else

+        {

+            substring = fullFilename.substring( 0, fullFilename.indexOf( extractFileName( fullFilename ) ) );

         }

 

-        if (getProtocol().compareTo("") != 0) {

-            substring = substring.substring(5);

+        if ( getProtocol().compareTo( "" ) != 0 )

+        {

+            substring = substring.substring( 5 );

         }

 

         return substring;

     }

 

+

     /**

      * determine which protocol is used.

      * @param filename the full fileneme

      * @return "file" or "http" or ""

      */

-    private String extractProtocol(String filename) {

-        if (filename.startsWith("file:")) { return "file"; }

-        if (filename.startsWith("http:")) { return "http"; }

+    private String extractProtocol( String filename )

+    {

+        if ( filename.startsWith( "file:" ) )

+        {

+            return "file";

+        }

+        if ( filename.startsWith( "http:" ) )

+        {

+            return "http";

+        }

         return "";

     }

 

+

     /**

      * set the base directory.

      * @param baseDir new value for the base directory

      */

-    public void setBaseDir(String baseDir) {

+    public void setBaseDir( String baseDir )

+    {

         this.m_baseDir = baseDir;

-        if (isRelative() && this.m_fullFilename != null) {

+        if ( isRelative() && this.m_fullFilename != null )

+        {

             this.m_valid = true;

-            if (getProtocol().compareTo("file") == 0 || getProtocol().compareTo("") == 0) {

-                File f = new File(getOnlyAbsoluteFilename());

+            if ( getProtocol().compareTo( "file" ) == 0 || getProtocol().compareTo( "" ) == 0 )

+            {

+                File f = new File( getOnlyAbsoluteFilename() );

                 m_file = f.isFile();

                 m_folder = f.isDirectory();

                 m_exist = f.exists();

             }

-            if (m_exist) {

+            if ( m_exist )

+            {

                 m_protocol = "file";

             }

         }

 

     }

 

+

     /**

      * get the base directory.

      * @return base directory

      */

-    public String getBaseDir() {

+    public String getBaseDir()

+    {

         return this.m_baseDir;

     }

 

-    public boolean isValid() {

+

+    public boolean isValid()

+    {

         return m_valid;

     }

 

-    public boolean isRelative() {

+

+    public boolean isRelative()

+    {

         return m_relative;

     }

 

-    public boolean isExists() {

+

+    public boolean isExists()

+    {

         return m_exist;

     }

 

-    public boolean isFile() {

+

+    public boolean isFile()

+    {

         return m_file;

     }

 

-    public boolean isFolder() {

+

+    public boolean isFolder()

+    {

         return m_folder;

     }

 

+

     /**

      * get a File which points on the same file.

      * @return a File object

      */

-    public File getFile() {

-        if (!this.isValid()) { return null; }

-        String path = PathFile.uniformSeparator(this.getOnlyAbsoluteFilename());

-        if (File.separatorChar == '\\') { path = path.replace('\\', '/'); }

-        File f = new File(path);

+    public File getFile()

+    {

+        if ( !this.isValid() )

+        {

+            return null;

+        }

+        String path = PathFile.uniformSeparator( this.getOnlyAbsoluteFilename() );

+        if ( File.separatorChar == '\\' )

+        {

+            path = path.replace( '\\', '/' );

+        }

+        File f = new File( path );

         return f;

     }

 

+

     /**

      * get an URI which points on the same file.

      * @return an URI object

      */

-    public URI getUri() {

-        if (!this.isValid()) { return null; }

-        String path = PathFile.uniformSeparator(getAbsoluteFilename());

-        if (File.separatorChar == '\\') { 

-        	path = path.replace('\\', '/');

+    public URI getUri()

+    {

+        if ( !this.isValid() )

+        {

+            return null;

+        }

+        String path = PathFile.uniformSeparator( getAbsoluteFilename() );

+        if ( File.separatorChar == '\\' )

+        {

+            path = path.replace( '\\', '/' );

         }

 

-        path = path.replaceAll(" ", "%20");

+        path = path.replaceAll( " ", "%20" );

 

         URI uri = null;

-        try {

-            uri = new URI(path);

-        } catch (URISyntaxException e) {        	

-            System.err.println("Malformed URI: " + path);

-            System.err.println(e.getMessage());

+        try

+        {

+            uri = new URI( path );

+        }

+        catch ( URISyntaxException e )

+        {

+            System.err.println( "Malformed URI: " + path );

+            System.err.println( e.getMessage() );

             return null;

         }

         return uri;

     }

 

+

     /**

      * get protocol + relative path of this file.

      * @return the relative path or null if it is not valid

      */

-    public String getRelativePath() {

-        if (!this.isValid()) { return null; }

+    public String getRelativePath()

+    {

+        if ( !this.isValid() )

+        {

+            return null;

+        }

 

         return getProtocol() + ":/" + getOnlyRelativePath();

     }

 

+

     /**

      * get only (without protocol) relative path of this file.

      * @return the relative path or null if it is not valid

      */

-    public String getOnlyRelativePath() {

-        if (!this.isValid()) { return null; }

-        if (this.isRelative()) {

+    public String getOnlyRelativePath()

+    {

+        if ( !this.isValid() )

+        {

+            return null;

+        }

+        if ( this.isRelative() )

+        {

             return m_pathFile;

 

-        } else {

-            if (m_baseDir != null) {

+        }

+        else

+        {

+            if ( m_baseDir != null )

+            {

                 // System.err.println(m_pathFile);

                 // System.err.println(m_baseDir);

-                if (m_pathFile.startsWith(m_baseDir)) {

+                if ( m_pathFile.startsWith( m_baseDir ) )

+                {

                     /*

                      * String ch1 = m_pathFile; String ch2 = m_baseDir; System.err.println(ch1); System.err.println(ch2); System.err.println("."+File.separator+ch1.substring(ch2.length()));

                      */

-                    return "." + File.separator + m_pathFile.substring(m_baseDir.length());

+                    return "." + File.separator + m_pathFile.substring( m_baseDir.length() );

                 }

             }

             return m_pathFile;

         }

     }

 

+

     /**

      * calcul absolute path from relative path.

      * @param baseDir base directory

      * @param path path to convert

      * @return the absolute path or null

      */

-    private String calculAbsolutePath(String baseDir, String path) {

-        if (path.startsWith(".." + File.separatorChar)) {

+    private String calculAbsolutePath( String baseDir, String path )

+    {

+        if ( path.startsWith( ".." + File.separatorChar ) )

+        {

             String base = baseDir;

             int lastIndex;

-            lastIndex = base.lastIndexOf(File.separator);

-            if (lastIndex == base.length()) {

-                base = base.substring(0, base.length() - 1);

-                lastIndex = base.lastIndexOf(File.separator);

+            lastIndex = base.lastIndexOf( File.separator );

+            if ( lastIndex == base.length() )

+            {

+                base = base.substring( 0, base.length() - 1 );

+                lastIndex = base.lastIndexOf( File.separator );

             }

-            if (lastIndex < base.length()) {

-                return calculAbsolutePath(base.substring(0, lastIndex + 1), path.substring(3));

-            } else {

+            if ( lastIndex < base.length() )

+            {

+                return calculAbsolutePath( base.substring( 0, lastIndex + 1 ), path.substring( 3 ) );

+            }

+            else

+            {

                 return null;

             }

-        } else if (path.startsWith("." + File.separatorChar)) {

+        }

+        else if ( path.startsWith( "." + File.separatorChar ) )

+        {

             String res;

-            if (File.separatorChar == '\\') {

-                res = path.replaceFirst(".", baseDir.replace('\\', '/'));

-            } else {

-                res = path.replaceFirst(".", baseDir);

+            if ( File.separatorChar == '\\' )

+            {

+                res = path.replaceFirst( ".", baseDir.replace( '\\', '/' ) );

+            }

+            else

+            {

+                res = path.replaceFirst( ".", baseDir );

             }

 

-            return PathFile.uniformSeparator(res);

-        } else {

-            return PathFile.uniformSeparator(baseDir + path);

+            return PathFile.uniformSeparator( res );

+        }

+        else

+        {

+            return PathFile.uniformSeparator( baseDir + path );

         }

     }

 

+

     /**

      * get only (without protocol) absolute path (without filename).

      * @return absolute path

      */

-    public String getOnlyAbsolutePath() {

-        if (!this.isValid()) { return null; }

-        if (isRelative()) {

-            return calculAbsolutePath(m_baseDir, m_pathFile);

-        } else {

+    public String getOnlyAbsolutePath()

+    {

+        if ( !this.isValid() )

+        {

+            return null;

+        }

+        if ( isRelative() )

+        {

+            return calculAbsolutePath( m_baseDir, m_pathFile );

+        }

+        else

+        {

             return m_pathFile;

         }

     }

 

+

     /**

      * get protocol + absolute path (without filename).

      * @return absolute path

      */

-    public String getAbsolutePath() {

+    public String getAbsolutePath()

+    {

 

-        if (isRelative()) {

-            return getProtocol() + ":/" + calculAbsolutePath(m_baseDir, m_pathFile);

-        } else {

-            if (getProtocol().compareTo("") == 0 || m_pathFile == null) {

+        if ( isRelative() )

+        {

+            return getProtocol() + ":/" + calculAbsolutePath( m_baseDir, m_pathFile );

+        }

+        else

+        {

+            if ( getProtocol().compareTo( "" ) == 0 || m_pathFile == null )

+            {

                 return m_pathFile;

-            } else {

+            }

+            else

+            {

                 return getProtocol() + ":" + m_pathFile;

             }

         }

     }

 

+

     /**

      * get only (without protocol) absolute path + filename.

      * @return absolute filename

      */

-    public String getOnlyAbsoluteFilename() {

-        if (getOnlyAbsolutePath() != null && getFilename() != null) {

+    public String getOnlyAbsoluteFilename()

+    {

+        if ( getOnlyAbsolutePath() != null && getFilename() != null )

+        {

             return getOnlyAbsolutePath() + getFilename();

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

 

+

     /**

      * get protocol + absolute path + filename.

      * @return absolute filenama

      */

-    public String getAbsoluteFilename() {

-        if (getAbsolutePath() != null && getFilename() != null) {

+    public String getAbsoluteFilename()

+    {

+        if ( getAbsolutePath() != null && getFilename() != null )

+        {

             return getAbsolutePath() + getFilename();

-        } else {

+        }

+        else

+        {

             return null;

         }

     }

 

+

     /**

      * get only (without protocol) relative path + filename.

      * @return relative filename

      */

-    public String getOnlyRelativeFilename() {

-        if (!this.isValid()) { return ""; }

+    public String getOnlyRelativeFilename()

+    {

+        if ( !this.isValid() )

+        {

+            return "";

+        }

 

         return getOnlyRelativePath() + getFilename();

 

     }

 

+

     /**

      * get protocol + relative path + filename.

      * @return relative filename

      */

-    public String getRelativeFilename() {

-        if (!this.isValid()) { return ""; }

+    public String getRelativeFilename()

+    {

+        if ( !this.isValid() )

+        {

+            return "";

+        }

 

-        if (this.isRelative()) {

+        if ( this.isRelative() )

+        {

             return getRelativePath() + getFilename();

-        } else {

+        }

+        else

+        {

             return getAbsoluteFilename();

         }

     }

 

-    public String getFilename() {

+

+    public String getFilename()

+    {

         return m_fileName;

     }

 

-    public String getProtocol() {

+

+    public String getProtocol()

+    {

         return m_protocol;

     }

 

+

     /**

      * create all the directories not also present in the current path.

      * @return true if all directories was created, else false

      */

-    public boolean createPath() {

-        File path = new File(this.getOnlyAbsolutePath());

-        if (path.exists()) { return true; }

+    public boolean createPath()

+    {

+        File path = new File( this.getOnlyAbsolutePath() );

+        if ( path.exists() )

+        {

+            return true;

+        }

         return path.mkdirs();

     }

 

+

     /**

      * create all the directories not also present in the current path and the file.

      * @return true it was created, else false

      */

-    public boolean createFile() {

-        File path = new File(this.getOnlyAbsolutePath());

-        if (!path.exists()) {

-            if (!this.createPath()) { return false; }

+    public boolean createFile()

+    {

+        File path = new File( this.getOnlyAbsolutePath() );

+        if ( !path.exists() )

+        {

+            if ( !this.createPath() )

+            {

+                return false;

+            }

         }

-        path = new File(this.getOnlyAbsoluteFilename());

-        try {

+        path = new File( this.getOnlyAbsoluteFilename() );

+        try

+        {

             return path.createNewFile();

-        } catch (IOException e) {

+        }

+        catch ( IOException e )

+        {

             return false;

         }

 

     }

 

+

     /**

      * delete the current file.

      * @return true if it was deleted, else false

      */

-    public boolean delete() {

-        File path = new File(this.getAbsoluteFilename());

-        if (path.exists()) {

+    public boolean delete()

+    {

+        File path = new File( this.getAbsoluteFilename() );

+        if ( path.exists() )

+        {

             return path.delete();

-        } else {

+        }

+        else

+        {

             return true;

         }

 

@@ -470,73 +632,103 @@
 

     private static final String REGEXP_BACKSLASH = "\\\\";

 

+

     /**

      * replace all '\' by '\\' in the given string.

      * @param path string where replace the search pattern

      * @return string replaced

      */

-    public static String doubleSeparator(String path) {

+    public static String doubleSeparator( String path )

+    {

         // double the '\' in the path

-        if (path != null && File.separatorChar == '\\') {

-            return path.replaceAll(REGEXP_BACKSLASH, REGEXP_BACKSLASH + REGEXP_BACKSLASH);

-        } else {

+        if ( path != null && File.separatorChar == '\\' )

+        {

+            return path.replaceAll( REGEXP_BACKSLASH, REGEXP_BACKSLASH + REGEXP_BACKSLASH );

+        }

+        else

+        {

             return null;

         }

     }

 

+

     /**

      * file separator('\' or '/') by the one of the current system.

      * @param path string where replace the search pattern

      * @return string replaced

      */

-    public static String uniformSeparator(String path) {

-        if (File.separatorChar == '\\') {

-            if (path.startsWith("/")) {

-                return path.substring(1).replace('/', File.separatorChar);

-            } else {

-                return path.replace('/', File.separatorChar);

+    public static String uniformSeparator( String path )

+    {

+        if ( File.separatorChar == '\\' )

+        {

+            if ( path.startsWith( "/" ) )

+            {

+                return path.substring( 1 ).replace( '/', File.separatorChar );

             }

-        } else {

-            return path.replace('\\', File.separatorChar);

+            else

+            {

+                return path.replace( '/', File.separatorChar );

+            }

+        }

+        else

+        {

+            return path.replace( '\\', File.separatorChar );

         }

     }

 

+

     /**

      * copy file from src to dest.

      * @param src source file

      * @param dest destination file

      * @return true if the file was correctly copied, else false

      */

-    public static boolean copyFile(PathFile src, PathFile dest) {

+    public static boolean copyFile( PathFile src, PathFile dest )

+    {

         FileChannel in = null;

         FileChannel out = null;

 

-        if (!src.isExists()) {

-            System.err.println("src file must exist: " + src.getAbsoluteFilename());

+        if ( !src.isExists() )

+        {

+            System.err.println( "src file must exist: " + src.getAbsoluteFilename() );

             return false;

         }

-        if (!dest.isExists()) {

+        if ( !dest.isExists() )

+        {

             dest.createFile();

         }

-        try {

-            in = new FileInputStream(src.getOnlyAbsoluteFilename()).getChannel();

-            out = new FileOutputStream(dest.getOnlyAbsoluteFilename()).getChannel();

+        try

+        {

+            in = new FileInputStream( src.getOnlyAbsoluteFilename() ).getChannel();

+            out = new FileOutputStream( dest.getOnlyAbsoluteFilename() ).getChannel();

 

-            in.transferTo(0, in.size(), out);

-        } catch (Exception e) {

+            in.transferTo( 0, in.size(), out );

+        }

+        catch ( Exception e )

+        {

             e.printStackTrace();

-        } finally {

-            if (in != null) {

-                try {

+        }

+        finally

+        {

+            if ( in != null )

+            {

+                try

+                {

                     in.close();

-                } catch (IOException e) {

+                }

+                catch ( IOException e )

+                {

                     return false;

                 }

             }

-            if (out != null) {

-                try {

+            if ( out != null )

+            {

+                try

+                {

                     out.close();

-                } catch (IOException e) {

+                }

+                catch ( IOException e )

+                {

                     return false;

                 }

             }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
index 1c934cc..8c503c1 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.io.File;

 import java.io.IOException;

 

@@ -40,11 +41,13 @@
 import org.apache.maven.wagon.proxy.ProxyInfo;

 import org.apache.maven.wagon.repository.Repository;

 

+

 /**

  * this class is used to manage all connections by wagon.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class RemoteFileManager {

+public class RemoteFileManager

+{

 

     /**

      * save the connection.

@@ -71,6 +74,7 @@
      */

     private Log m_log;

 

+

     /**

      * initialize main information.

      * @param ar ArtifactRepository provides by maven

@@ -78,7 +82,8 @@
      * @param settings settings of the current project provides by maven

      * @param log logger

      */

-    public RemoteFileManager(ArtifactRepository ar, WagonManager wm, Settings settings, Log log) {

+    public RemoteFileManager( ArtifactRepository ar, WagonManager wm, Settings settings, Log log )

+    {

         m_artifactRepository = ar;

         m_wagonManager = wm;

         m_settings = settings;

@@ -86,59 +91,81 @@
         m_wagon = null;

     }

 

+

     /**

      * disconnect the current object.

      *

      */

-    public void disconnect() {

-        if (m_wagon == null) {

-            m_log.error("must be connected first!");

+    public void disconnect()

+    {

+        if ( m_wagon == null )

+        {

+            m_log.error( "must be connected first!" );

             return;

         }

-        try {

+        try

+        {

             m_wagon.disconnect();

-        } catch (ConnectionException e) {

-            m_log.error("Error disconnecting wagon - ignored", e);

+        }

+        catch ( ConnectionException e )

+        {

+            m_log.error( "Error disconnecting wagon - ignored", e );

         }

     }

 

+

     /**

      * connect the current object to artifact repository given in constructor.

      * @throws MojoExecutionException if connection failed

      */

-    public void connect() throws MojoExecutionException {

+    public void connect() throws MojoExecutionException

+    {

         String url = m_artifactRepository.getUrl();

         String id = m_artifactRepository.getId();

 

-        Repository repository = new Repository(id, url);

+        Repository repository = new Repository( id, url );

 

-        try {

-            m_wagon = m_wagonManager.getWagon(repository);

+        try

+        {

+            m_wagon = m_wagonManager.getWagon( repository );

             //configureWagon(m_wagon, repository.getId());

-        } catch (UnsupportedProtocolException e) {

-            throw new MojoExecutionException("Unsupported protocol: '" + repository.getProtocol() + "'", e);

-        } catch (WagonConfigurationException e) {

-            throw new MojoExecutionException("Unable to configure Wagon: '" + repository.getProtocol() + "'", e);

+        }

+        catch ( UnsupportedProtocolException e )

+        {

+            throw new MojoExecutionException( "Unsupported protocol: '" + repository.getProtocol() + "'", e );

+        }

+        catch ( WagonConfigurationException e )

+        {

+            throw new MojoExecutionException( "Unable to configure Wagon: '" + repository.getProtocol() + "'", e );

         }

 

-        try {

+        try

+        {

             Debug debug = new Debug();

-            m_wagon.addTransferListener(debug);

+            m_wagon.addTransferListener( debug );

 

-            ProxyInfo proxyInfo = getProxyInfo(m_settings);

-            if (proxyInfo != null) {

-                m_wagon.connect(repository, m_wagonManager.getAuthenticationInfo(id), proxyInfo);

-            } else {

-                m_wagon.connect(repository, m_wagonManager.getAuthenticationInfo(id));

+            ProxyInfo proxyInfo = getProxyInfo( m_settings );

+            if ( proxyInfo != null )

+            {

+                m_wagon.connect( repository, m_wagonManager.getAuthenticationInfo( id ), proxyInfo );

+            }

+            else

+            {

+                m_wagon.connect( repository, m_wagonManager.getAuthenticationInfo( id ) );

             }

 

-        } catch (ConnectionException e) {

-            throw new MojoExecutionException("Error uploading file", e);

-        } catch (AuthenticationException e) {

-            throw new MojoExecutionException("Error uploading file", e);

+        }

+        catch ( ConnectionException e )

+        {

+            throw new MojoExecutionException( "Error uploading file", e );

+        }

+        catch ( AuthenticationException e )

+        {

+            throw new MojoExecutionException( "Error uploading file", e );

         }

     }

 

+

     /**

      * get a file from the current repository connected.

      * @param url url to the targeted file

@@ -148,18 +175,22 @@
      * @throws ResourceDoesNotExistException if the targeted resource doesn't exist

      * @throws AuthorizationException if the connection authorization failed

      */

-    public File get(String url) throws IOException, TransferFailedException, ResourceDoesNotExistException, AuthorizationException {

+    public File get( String url ) throws IOException, TransferFailedException, ResourceDoesNotExistException,

+        AuthorizationException

+    {

 

-        if (m_wagon == null) {

-            m_log.error("must be connected first!");

+        if ( m_wagon == null )

+        {

+            m_log.error( "must be connected first!" );

             return null;

         }

 

-        File file = File.createTempFile(String.valueOf(System.currentTimeMillis()), "tmp");

-        m_wagon.get(url, file);

+        File file = File.createTempFile( String.valueOf( System.currentTimeMillis() ), "tmp" );

+        m_wagon.get( url, file );

         return file;

     }

 

+

     /**

      * put a file on the current repository connected.

      * @param file file to upload

@@ -168,36 +199,43 @@
      * @throws ResourceDoesNotExistException if the targeted resource doesn't exist

      * @throws AuthorizationException if the connection authorization failed

      */

-    public void put(File file, String url) throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException {

-        if (m_wagon == null) {

-            m_log.error("must be connected first!");

+    public void put( File file, String url ) throws TransferFailedException, ResourceDoesNotExistException,

+        AuthorizationException

+    {

+        if ( m_wagon == null )

+        {

+            m_log.error( "must be connected first!" );

             return;

         }

-        m_wagon.put(file, url);

+        m_wagon.put( file, url );

     }

 

+

     /**

      * Convenience method to map a Proxy object from the user system settings to a ProxyInfo object.

      * @param settings project settings given by maven

      * @return a proxyInfo object instancied or null if no active proxy is define in the settings.xml

      */

-    public static ProxyInfo getProxyInfo(Settings settings) {

+    public static ProxyInfo getProxyInfo( Settings settings )

+    {

         ProxyInfo proxyInfo = null;

-        if (settings != null && settings.getActiveProxy() != null) {

+        if ( settings != null && settings.getActiveProxy() != null )

+        {

             Proxy settingsProxy = settings.getActiveProxy();

 

             proxyInfo = new ProxyInfo();

-            proxyInfo.setHost(settingsProxy.getHost());

-            proxyInfo.setType(settingsProxy.getProtocol());

-            proxyInfo.setPort(settingsProxy.getPort());

-            proxyInfo.setNonProxyHosts(settingsProxy.getNonProxyHosts());

-            proxyInfo.setUserName(settingsProxy.getUsername());

-            proxyInfo.setPassword(settingsProxy.getPassword());

+            proxyInfo.setHost( settingsProxy.getHost() );

+            proxyInfo.setType( settingsProxy.getProtocol() );

+            proxyInfo.setPort( settingsProxy.getPort() );

+            proxyInfo.setNonProxyHosts( settingsProxy.getNonProxyHosts() );

+            proxyInfo.setUserName( settingsProxy.getUsername() );

+            proxyInfo.setPassword( settingsProxy.getPassword() );

         }

 

         return proxyInfo;

     }

 

+

     /**

      * this method indicates if the targeted file is locked or not.

      * @param remote connection manager

@@ -205,24 +243,37 @@
      * @return  true if thr reuiered file is locked, else false

      * @throws MojoFailureException if the plugin failed

      */

-    public boolean isLockedFile(RemoteFileManager remote, String fileName) throws MojoFailureException {

+    public boolean isLockedFile( RemoteFileManager remote, String fileName ) throws MojoFailureException

+    {

         File file = null;

-        try {

-            file = remote.get(fileName + ".lock");

-        } catch (TransferFailedException e) {

-            e.printStackTrace();

-            throw new MojoFailureException("TransferFailedException");

-

-        } catch (ResourceDoesNotExistException e) {

-            return false;

-        } catch (AuthorizationException e) {

-            e.printStackTrace();

-            throw new MojoFailureException("AuthorizationException");

-        } catch (IOException e) {

-            e.printStackTrace();

-            throw new MojoFailureException("IOException");

+        try

+        {

+            file = remote.get( fileName + ".lock" );

         }

-        if (file != null && file.length() == 0) { return false; }

+        catch ( TransferFailedException e )

+        {

+            e.printStackTrace();

+            throw new MojoFailureException( "TransferFailedException" );

+

+        }

+        catch ( ResourceDoesNotExistException e )

+        {

+            return false;

+        }

+        catch ( AuthorizationException e )

+        {

+            e.printStackTrace();

+            throw new MojoFailureException( "AuthorizationException" );

+        }

+        catch ( IOException e )

+        {

+            e.printStackTrace();

+            throw new MojoFailureException( "IOException" );

+        }

+        if ( file != null && file.length() == 0 )

+        {

+            return false;

+        }

         return true;

     }

 

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Require.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Require.java
index da9b26e..76162fc 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Require.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Require.java
@@ -18,15 +18,18 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import org.w3c.dom.Document;

 import org.w3c.dom.Element;

 import org.w3c.dom.Node;

 

+

 /**

  * this class store a Require tag.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class Require {

+public class Require

+{

 

     /**

      * store the extend attribute.

@@ -58,116 +61,142 @@
      */

     private String m_value;

 

+

     /**

      * get the extend attribute.

      * @return a string which contains the value of the boolean

      */

-    public String getExtend() {

+    public String getExtend()

+    {

         return m_extend;

     }

 

+

     /**

      * set the extend attribute.

      * @param extend new value for the extend attribute

      */

-    public void setExtend(String extend) {

+    public void setExtend( String extend )

+    {

         this.m_extend = extend;

     }

 

+

     /**

      * get the filter attribute.

      * @return m_filter value

      */

-    public String getFilter() {

+    public String getFilter()

+    {

         return m_filter;

     }

 

+

     /**

      * set the filter attribute.

      * @param filter new value for filter

      */

-    public void setFilter(String filter) {

+    public void setFilter( String filter )

+    {

         this.m_filter = filter;

     }

 

+

     /**

      * get multiple attribute.

      * @return m_multiple value

      */

-    public String getMultiple() {

+    public String getMultiple()

+    {

         return m_multiple;

     }

 

+

     /**

      * set multiple attribute.

      * @param multiple new value for m_multiple

      */

-    public void setMultiple(String multiple) {

+    public void setMultiple( String multiple )

+    {

         this.m_multiple = multiple;

     }

 

+

     /**

      * get name attribute.

      * @return m_name value

      */

-    public String getName() {

+    public String getName()

+    {

         return m_name;

     }

 

+

     /**

      * set name attribute.

      * @param name new value for m_name

      */

-    public void setName(String name) {

+    public void setName( String name )

+    {

         this.m_name = name;

     }

 

+

     /**

      * get the optional attribute.

      * @return m_optional value

      */

-    public String getOptional() {

+    public String getOptional()

+    {

         return m_optional;

     }

 

+

     /**

      * set the optional attribute.

      * @param optionnal new value for m_optional

      */

-    public void setOptional(String optionnal) {

+    public void setOptional( String optionnal )

+    {

         this.m_optional = optionnal;

     }

 

+

     /**

      * get value of the tag.

      * @return value of this tag

      */

-    public String getValue() {

+    public String getValue()

+    {

         return m_value;

     }

 

+

     /**

      * set the value of the tag.

      * @param value new value for this tag

      */

-    public void setValue(String value) {

+    public void setValue( String value )

+    {

         this.m_value = value;

     }

 

+

     /**

      * transform this object to Node.

      * 

      * @param father father document for create Node

      * @return node

      */

-    public Node getNode(Document father) {

-        Element require = father.createElement("require");

-        require.setAttribute("name", this.getName());

-        require.setAttribute("filter", this.getFilter());

-        require.setAttribute("extend", this.getExtend());

-        require.setAttribute("multiple", this.getMultiple());

-        require.setAttribute("optional", this.getOptional());

-        XmlHelper.setTextContent(require,this.getValue());

+    public Node getNode( Document father )

+    {

+        Element require = father.createElement( "require" );

+        require.setAttribute( "name", this.getName() );

+        require.setAttribute( "filter", this.getFilter() );

+        require.setAttribute( "extend", this.getExtend() );

+        require.setAttribute( "multiple", this.getMultiple() );

+        require.setAttribute( "optional", this.getOptional() );

+        XmlHelper.setTextContent( require, this.getValue() );

 

         return require;

     }

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
index a69e359..0c3fb45 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
@@ -18,6 +18,7 @@
  */

 package org.apache.felix.obr.plugin;

 

+

 import java.util.ArrayList;

 import java.util.Iterator;

 import java.util.List;

@@ -28,11 +29,13 @@
 import org.w3c.dom.Element;

 import org.w3c.dom.Node;

 

+

 /**

  * this class describe all information by bundle.

  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>

  */

-public class ResourcesBundle {

+public class ResourcesBundle

+{

     /**

      * store the bundle symbolic name.

      */

@@ -103,342 +106,461 @@
      */

     private Log m_logger;

 

+

     /**

      * initialize logger.

      * @param log log use by plugin

      */

-    public ResourcesBundle(Log log) {

+    public ResourcesBundle( Log log )

+    {

         m_logger = log;

     }

 

-    public List getCapability() {

+

+    public List getCapability()

+    {

         return m_capability;

     }

 

-    public void setCapability(List capability) {

+

+    public void setCapability( List capability )

+    {

         this.m_capability = capability;

     }

 

-    public List getCategory() {

+

+    public List getCategory()

+    {

         return m_category;

     }

 

-    public void setCategory(List category) {

+

+    public void setCategory( List category )

+    {

         this.m_category = category;

     }

 

-    public String getLicense() {

+

+    public String getLicense()

+    {

         return m_license;

     }

 

-    public void setLicense(String license) {

+

+    public void setLicense( String license )

+    {

         this.m_license = license;

     }

 

-    public String getDescription() {

+

+    public String getDescription()

+    {

         return m_description;

     }

 

-    public void setDescription(String description) {

+

+    public void setDescription( String description )

+    {

         this.m_description = description;

     }

 

-    public String getDocumentation() {

+

+    public String getDocumentation()

+    {

         return m_documentation;

     }

 

-    public void setDocumentation(String documentation) {

+

+    public void setDocumentation( String documentation )

+    {

         this.m_documentation = documentation;

     }

 

-    public String getPresentationName() {

+

+    public String getPresentationName()

+    {

         return m_presentationName;

     }

 

-    public void setPresentationName(String name) {

+

+    public void setPresentationName( String name )

+    {

         m_presentationName = name;

     }

 

-    public String getSize() {

+

+    public String getSize()

+    {

         return m_size;

     }

 

-    public void setSize(String size) {

+

+    public void setSize( String size )

+    {

         this.m_size = size;

     }

 

-    public String getSymbolicName() {

+

+    public String getSymbolicName()

+    {

         return m_symbolicName;

     }

 

-    public void setSymbolicName(String name) {

+

+    public void setSymbolicName( String name )

+    {

         m_symbolicName = name;

     }

 

-    public String getUri() {

+

+    public String getUri()

+    {

         return m_uri;

     }

 

-    public void setUri(String url) {

+

+    public void setUri( String url )

+    {

         this.m_uri = url;

     }

 

-    public String getVersion() {

+

+    public String getVersion()

+    {

         return m_version;

     }

 

-    public void setVersion(String version) {

+

+    public void setVersion( String version )

+    {

         this.m_version = version;

     }

 

-    public List getRequire() {

+

+    public List getRequire()

+    {

         return m_require;

     }

 

-    public void setRequire(List require) {

+

+    public void setRequire( List require )

+    {

         this.m_require = require;

     }

 

-    public String getSource() {

+

+    public String getSource()

+    {

         return m_source;

     }

 

-    public void setSource(String source) {

+

+    public void setSource( String source )

+    {

         this.m_source = source;

     }

 

-    public String getId() {

+

+    public String getId()

+    {

         return m_id;

     }

 

-    public void setId(String id) {

+

+    public void setId( String id )

+    {

         this.m_id = id;

     }

 

+

     /**

      * add a new capability for this bundle description.

      * @param capability the Capability to add

      */

-    public void addCapability(Capability capability) {

-        m_capability.add(capability);

+    public void addCapability( Capability capability )

+    {

+        m_capability.add( capability );

     }

 

+

     /**

      * add a new requirement for this bundle description.

      * @param require th Require to add

      */

-    public void addRequire(Require require) {

-        m_require.add(require);

+    public void addRequire( Require require )

+    {

+        m_require.add( require );

     }

 

+

     /**

      * add a new category for this bundle decription.

      * @param category the Category to add

      */

-    public void addCategory(Category category) {

-        m_category.add(category);

+    public void addCategory( Category category )

+    {

+        m_category.add( category );

     }

 

+

     /**

      * transform this object to Node.

      * tranform all sub-object to node also

      * @param father father document for create Node

      * @return node

      */

-    public Node getNode(Document father) {

+    public Node getNode( Document father )

+    {

         // return the complete resource tree

-        if (!this.isValid() || this.getId() == null) {

-            m_logger.error("those properties was not defined:" + this.getInvalidProperties());

+        if ( !this.isValid() || this.getId() == null )

+        {

+            m_logger.error( "those properties was not defined:" + this.getInvalidProperties() );

             return null;

         }

 

-        Element resource = father.createElement("resource");

-        Element description = father.createElement("description");

-        Element size = father.createElement("size");

-        Element documentation = father.createElement("documentation");

-        Element source = father.createElement("source");

-        Element license = father.createElement("license");

+        Element resource = father.createElement( "resource" );

+        Element description = father.createElement( "description" );

+        Element size = father.createElement( "size" );

+        Element documentation = father.createElement( "documentation" );

+        Element source = father.createElement( "source" );

+        Element license = father.createElement( "license" );

 

-        resource.setAttribute("id", this.getId());

-        resource.setAttribute("symbolicname", this.getSymbolicName());

-        resource.setAttribute("presentationname", this.getPresentationName());

-        resource.setAttribute("uri", this.getUri());

-        resource.setAttribute("version", this.getVersion());

+        resource.setAttribute( "id", this.getId() );

+        resource.setAttribute( "symbolicname", this.getSymbolicName() );

+        resource.setAttribute( "presentationname", this.getPresentationName() );

+        resource.setAttribute( "uri", this.getUri() );

+        resource.setAttribute( "version", this.getVersion() );

 

-        XmlHelper.setTextContent(description,this.getDescription());

-        resource.appendChild(description);

+        XmlHelper.setTextContent( description, this.getDescription() );

+        resource.appendChild( description );

 

-        XmlHelper.setTextContent(size,this.getSize());

-        resource.appendChild(size);

+        XmlHelper.setTextContent( size, this.getSize() );

+        resource.appendChild( size );

 

-        if (this.getDocumentation() != null) {

-            XmlHelper.setTextContent(documentation,this.getDocumentation());

-            resource.appendChild(documentation);

+        if ( this.getDocumentation() != null )

+        {

+            XmlHelper.setTextContent( documentation, this.getDocumentation() );

+            resource.appendChild( documentation );

         }

 

-        if (this.getSource() != null) {

-            XmlHelper.setTextContent(source,this.getSource());

-            resource.appendChild(source);

+        if ( this.getSource() != null )

+        {

+            XmlHelper.setTextContent( source, this.getSource() );

+            resource.appendChild( source );

         }

 

-        if (this.getLicense() != null) {

-            XmlHelper.setTextContent(license, this.getLicense());

-            resource.appendChild(license);

+        if ( this.getLicense() != null )

+        {

+            XmlHelper.setTextContent( license, this.getLicense() );

+            resource.appendChild( license );

         }

 

-        List list = (ArrayList) this.getNodeCategories(father);

-        for (int i = 0; i < list.size(); i++) {

-            resource.appendChild((Node) list.get(i));

+        List list = ( ArrayList ) this.getNodeCategories( father );

+        for ( int i = 0; i < list.size(); i++ )

+        {

+            resource.appendChild( ( Node ) list.get( i ) );

         }

 

-        list = (ArrayList) this.getNodeCapabilities(father);

-        for (int i = 0; i < list.size(); i++) {

-            resource.appendChild((Node) list.get(i));

+        list = ( ArrayList ) this.getNodeCapabilities( father );

+        for ( int i = 0; i < list.size(); i++ )

+        {

+            resource.appendChild( ( Node ) list.get( i ) );

         }

 

-        list = (ArrayList) this.getNodeRequirement(father);

-        for (int i = 0; i < list.size(); i++) {

-            resource.appendChild((Node) list.get(i));

+        list = ( ArrayList ) this.getNodeRequirement( father );

+        for ( int i = 0; i < list.size(); i++ )

+        {

+            resource.appendChild( ( Node ) list.get( i ) );

         }

 

         return resource;

     }

 

+

     /**

      * this method gets information form pom.xml to complete missing data from those given by user.

      * @param project project information given by maven

      * @param ebi bundle information extracted from bindex

      * @return true

      */

-    public boolean construct(MavenProject project, ExtractBindexInfo ebi) {

+    public boolean construct( MavenProject project, ExtractBindexInfo ebi )

+    {

 

-        if (ebi.getPresentationName() != null) {

-            this.setPresentationName(ebi.getPresentationName());

-            if (project.getName() != null) { m_logger.debug("pom property override:<presentationname> " + project.getName()); }

-        } else {

-            this.setPresentationName(project.getName());

+        if ( ebi.getPresentationName() != null )

+        {

+            this.setPresentationName( ebi.getPresentationName() );

+            if ( project.getName() != null )

+            {

+                m_logger.debug( "pom property override:<presentationname> " + project.getName() );

+            }

+        }

+        else

+        {

+            this.setPresentationName( project.getName() );

         }

 

-        if (ebi.getSymbolicName() != null) {

-            this.setSymbolicName(ebi.getSymbolicName());

-            if (project.getArtifactId() != null) { m_logger.debug("pom property override:<symbolicname> " + project.getArtifactId()); }

-        } else {

-            this.setSymbolicName(project.getArtifactId());

+        if ( ebi.getSymbolicName() != null )

+        {

+            this.setSymbolicName( ebi.getSymbolicName() );

+            if ( project.getArtifactId() != null )

+            {

+                m_logger.debug( "pom property override:<symbolicname> " + project.getArtifactId() );

+            }

+        }

+        else

+        {

+            this.setSymbolicName( project.getArtifactId() );

         }

 

-        if (ebi.getVersion() != null) {

-            this.setVersion(ebi.getVersion());

-            if (project.getVersion() != null) { m_logger.debug("pom property override:<version> " + project.getVersion()); }

-        } else {

-            this.setVersion(project.getVersion());

+        if ( ebi.getVersion() != null )

+        {

+            this.setVersion( ebi.getVersion() );

+            if ( project.getVersion() != null )

+            {

+                m_logger.debug( "pom property override:<version> " + project.getVersion() );

+            }

         }

-        

-        if (ebi.getId() != null) {

-            this.setId(ebi.getId());

+        else

+        {

+            this.setVersion( project.getVersion() );

         }

 

-        if (ebi.getDescription() != null) {

-            this.setDescription(ebi.getDescription());

-            if (project.getDescription() != null) { m_logger.debug("pom property override:<description> " + project.getDescription()); }

-        } else {

-            this.setDescription(project.getDescription());

+        if ( ebi.getId() != null )

+        {

+            this.setId( ebi.getId() );

         }

 

-        if (ebi.getDocumentation() != null) {

-            this.setDocumentation(ebi.getDocumentation());

-            if (project.getUrl() != null) { m_logger.debug("pom property override:<documentation> " + project.getUrl()); }

-        } else {

-            this.setDocumentation(project.getUrl());

+        if ( ebi.getDescription() != null )

+        {

+            this.setDescription( ebi.getDescription() );

+            if ( project.getDescription() != null )

+            {

+                m_logger.debug( "pom property override:<description> " + project.getDescription() );

+            }

+        }

+        else

+        {

+            this.setDescription( project.getDescription() );

         }

 

-        if (ebi.getSource() != null) {

-            this.setSource(ebi.getSource());

-            if (project.getScm() != null) { m_logger.debug("pom property override:<source> " + project.getScm()); }

-        } else {

+        if ( ebi.getDocumentation() != null )

+        {

+            this.setDocumentation( ebi.getDocumentation() );

+            if ( project.getUrl() != null )

+            {

+                m_logger.debug( "pom property override:<documentation> " + project.getUrl() );

+            }

+        }

+        else

+        {

+            this.setDocumentation( project.getUrl() );

+        }

+

+        if ( ebi.getSource() != null )

+        {

+            this.setSource( ebi.getSource() );

+            if ( project.getScm() != null )

+            {

+                m_logger.debug( "pom property override:<source> " + project.getScm() );

+            }

+        }

+        else

+        {

             String src = null;

-            if (project.getScm() != null) { src = project.getScm().getUrl(); }

-            this.setSource(src);

+            if ( project.getScm() != null )

+            {

+                src = project.getScm().getUrl();

+            }

+            this.setSource( src );

         }

 

-        if (ebi.getLicense() != null) {

-            this.setLicense(ebi.getLicense());

+        if ( ebi.getLicense() != null )

+        {

+            this.setLicense( ebi.getLicense() );

             String lic = null;

             List l = project.getLicenses();

             Iterator it = l.iterator();

-            while (it.hasNext()) {

-                if (it.next() != null) {

-                    m_logger.debug("pom property override:<license> " + lic);

+            while ( it.hasNext() )

+            {

+                if ( it.next() != null )

+                {

+                    m_logger.debug( "pom property override:<license> " + lic );

                     break;

                 }

             }

-        } else {

+        }

+        else

+        {

             String lic = null;

             List l = project.getLicenses();

             Iterator it = l.iterator();

-            while (it.hasNext()) {

+            while ( it.hasNext() )

+            {

                 lic = it.next() + ";";

             }

 

-            this.setLicense(lic);

+            this.setLicense( lic );

         }

 

         // create the first capability (ie : bundle)

         Capability capability = new Capability();

-        capability.setName("bundle");

+        capability.setName( "bundle" );

         PElement p = new PElement();

-        p.setN("manifestversion");

-        p.setV("2");

-        capability.addP(p);

+        p.setN( "manifestversion" );

+        p.setV( "2" );

+        capability.addP( p );

 

         p = new PElement();

-        p.setN("presentationname");

-        p.setV(this.getPresentationName());

-        capability.addP(p);

+        p.setN( "presentationname" );

+        p.setV( this.getPresentationName() );

+        capability.addP( p );

 

         p = new PElement();

-        p.setN("symbolicname");

-        p.setV(this.getSymbolicName());

-        capability.addP(p);

+        p.setN( "symbolicname" );

+        p.setV( this.getSymbolicName() );

+        capability.addP( p );

 

         p = new PElement();

-        p.setN("version");

-        p.setT("version");

-        p.setV(this.getVersion());

-        capability.addP(p);

+        p.setN( "version" );

+        p.setT( "version" );

+        p.setV( this.getVersion() );

+        capability.addP( p );

 

-        this.addCapability(capability);

+        this.addCapability( capability );

 

-        List capabilities = (ArrayList) ebi.getCapabilities();

-        for (int i = 0; i < capabilities.size(); i++) {

-            this.addCapability((Capability) capabilities.get(i));

+        List capabilities = ( ArrayList ) ebi.getCapabilities();

+        for ( int i = 0; i < capabilities.size(); i++ )

+        {

+            this.addCapability( ( Capability ) capabilities.get( i ) );

         }

 

-        List requirement = (ArrayList) ebi.getRequirement();

-        for (int i = 0; i < requirement.size(); i++) {

-            this.addRequire((Require) requirement.get(i));

+        List requirement = ( ArrayList ) ebi.getRequirement();

+        for ( int i = 0; i < requirement.size(); i++ )

+        {

+            this.addRequire( ( Require ) requirement.get( i ) );

         }

 

         // we also add the goupId

         Category category = new Category();

-        category.setId(project.getGroupId());

-        this.addCategory(category);

+        category.setId( project.getGroupId() );

+        this.addCategory( category );

 

         return true;

     }

 

+

     /**

      * return if the bundle resource is complete.

      * @return false if an information is missing, else true

      */

-    public boolean isValid() {

+    public boolean isValid()

+    {

         // we must verify required properties are present

-        return this.getPresentationName() != null 

-            && this.getSymbolicName() != null

-            && this.getVersion() != null 

-            && this.getUri() != null 

-            && this.getSize() != null;

+        return this.getPresentationName() != null && this.getSymbolicName() != null && this.getVersion() != null

+            && this.getUri() != null && this.getSize() != null;

     }

 

+

     /**

      * test if this bundle has the same symbolicname, and version number.

      * @param symbolicName symbolicName to compare with current bundle

@@ -446,75 +568,110 @@
      * @param version version to compare with current bundle

      * @return true if the information are the same, else false

      */

-    public boolean isSameBundleResource(String symbolicName, String version) {

-        if (this.isValid()) {

-            return (symbolicName.compareTo(this.getSymbolicName()) == 0) && (version.compareTo(this.getVersion()) == 0);

-        } else {

+    public boolean isSameBundleResource( String symbolicName, String version )

+    {

+        if ( this.isValid() )

+        {

+            return ( symbolicName.compareTo( this.getSymbolicName() ) == 0 )

+                && ( version.compareTo( this.getVersion() ) == 0 );

+        }

+        else

+        {

             return false;

         }

 

     }

 

+

     /**

      * return a list of categories transformed to node.

      * @param father father document to create node from same document

      * @return List of Node

      */

-    private List getNodeCategories(Document father) {

+    private List getNodeCategories( Document father )

+    {

         List listNode = new ArrayList();

-        List listCategory = (ArrayList) this.getCategory();

-        for (int i = 0; i < listCategory.size(); i++) {

-            listNode.add(((Category) listCategory.get(i)).getNode(father));

+        List listCategory = ( ArrayList ) this.getCategory();

+        for ( int i = 0; i < listCategory.size(); i++ )

+        {

+            listNode.add( ( ( Category ) listCategory.get( i ) ).getNode( father ) );

         }

         return listNode;

     }

 

+

     /**

      * return a list of capabilities transformed to node.

      * @param father father document to create node from same document

      * @return List of Node

      */

-    private List getNodeCapabilities(Document father) {

+    private List getNodeCapabilities( Document father )

+    {

         List listNode = new ArrayList();

-        List listCapability = (ArrayList) this.getCapability();

-        for (int i = 0; i < listCapability.size(); i++) {

-            listNode.add(((Capability) listCapability.get(i)).getNode(father));

+        List listCapability = ( ArrayList ) this.getCapability();

+        for ( int i = 0; i < listCapability.size(); i++ )

+        {

+            listNode.add( ( ( Capability ) listCapability.get( i ) ).getNode( father ) );

         }

         return listNode;

     }

 

+

     /**

      * return a list of requirement transformed to node.

      * @param father father document to create node from same document

      * @return List of Node.

      */

-    private List getNodeRequirement(Document father) {

+    private List getNodeRequirement( Document father )

+    {

         List listNode = new ArrayList();

-        List listRequirement = (ArrayList) this.getRequire();

-        for (int i = 0; i < listRequirement.size(); i++) {

-            listNode.add(((Require) listRequirement.get(i)).getNode(father));

+        List listRequirement = ( ArrayList ) this.getRequire();

+        for ( int i = 0; i < listRequirement.size(); i++ )

+        {

+            listNode.add( ( ( Require ) listRequirement.get( i ) ).getNode( father ) );

         }

         return listNode;

     }

 

+

     /**

      * return the list of properties not define in this bundle resource.

      * @return list of properties not define

      */

-    private String getInvalidProperties() {

-        if (this.isValid()) {

-            if (this.getId() == null) {

+    private String getInvalidProperties()

+    {

+        if ( this.isValid() )

+        {

+            if ( this.getId() == null )

+            {

                 return "id";

-            } else {

+            }

+            else

+            {

                 return "";

             }

         }

         String result = "";

-        if (this.getPresentationName() == null) { result = result + "presentationName;"; }

-        if (this.getSymbolicName() == null) { result = result + "symbolicName;"; }

-        if (this.getVersion() == null) { result = result + "version;"; }

-        if (this.getUri() == null) { result = result + "Uri;"; }

-        if (this.getSize() == null) { result = result + "Size"; }

+        if ( this.getPresentationName() == null )

+        {

+            result = result + "presentationName;";

+        }

+        if ( this.getSymbolicName() == null )

+        {

+            result = result + "symbolicName;";

+        }

+        if ( this.getVersion() == null )

+        {

+            result = result + "version;";

+        }

+        if ( this.getUri() == null )

+        {

+            result = result + "Uri;";

+        }

+        if ( this.getSize() == null )

+        {

+            result = result + "Size";

+        }

         return result;

     }

 

diff --git a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/XmlHelper.java b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/XmlHelper.java
index 2dd7fd1..5ad06fb 100644
--- a/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/XmlHelper.java
+++ b/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/XmlHelper.java
@@ -18,9 +18,11 @@
  */
 package org.apache.felix.obr.plugin;
 
+
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+
 /**
  * Provide XML helper methods to support pre-Java5 runtimes
  * 
@@ -33,26 +35,28 @@
      */
     public static String getTextContent( Node node )
     {
-        switch( node.getNodeType() ) {
-        case Node.ELEMENT_NODE:
-        case Node.ATTRIBUTE_NODE:
-        case Node.ENTITY_NODE:
-        case Node.ENTITY_REFERENCE_NODE:
-        case Node.DOCUMENT_FRAGMENT_NODE:
-            return mergeTextContent( node.getChildNodes() );
-        case Node.TEXT_NODE:
-        case Node.CDATA_SECTION_NODE:
-        case Node.COMMENT_NODE:
-        case Node.PROCESSING_INSTRUCTION_NODE:
-            return node.getNodeValue();
-        case Node.DOCUMENT_NODE:
-        case Node.DOCUMENT_TYPE_NODE:
-        case Node.NOTATION_NODE:
-        default:
-            return null;
+        switch ( node.getNodeType() )
+        {
+            case Node.ELEMENT_NODE:
+            case Node.ATTRIBUTE_NODE:
+            case Node.ENTITY_NODE:
+            case Node.ENTITY_REFERENCE_NODE:
+            case Node.DOCUMENT_FRAGMENT_NODE:
+                return mergeTextContent( node.getChildNodes() );
+            case Node.TEXT_NODE:
+            case Node.CDATA_SECTION_NODE:
+            case Node.COMMENT_NODE:
+            case Node.PROCESSING_INSTRUCTION_NODE:
+                return node.getNodeValue();
+            case Node.DOCUMENT_NODE:
+            case Node.DOCUMENT_TYPE_NODE:
+            case Node.NOTATION_NODE:
+            default:
+                return null;
         }
     }
 
+
     /**
      * based on the following quote from public Java5 javadoc of org.w3c.dom.Node.getTextContent method:
      * 
@@ -62,22 +66,23 @@
     private static String mergeTextContent( NodeList nodes )
     {
         StringBuffer buf = new StringBuffer();
-        for( int i = 0; i < nodes.getLength(); i++ )
+        for ( int i = 0; i < nodes.getLength(); i++ )
         {
             Node n = nodes.item( i );
             final String text;
 
-            switch( n.getNodeType() ) {
-            case Node.COMMENT_NODE:
-            case Node.PROCESSING_INSTRUCTION_NODE:
-                text = null;
-                break;
-            default:
-                text = getTextContent( n );
-                break;
+            switch ( n.getNodeType() )
+            {
+                case Node.COMMENT_NODE:
+                case Node.PROCESSING_INSTRUCTION_NODE:
+                    text = null;
+                    break;
+                default:
+                    text = getTextContent( n );
+                    break;
             }
 
-            if( text != null )
+            if ( text != null )
             {
                 buf.append( text );
             }
@@ -85,17 +90,18 @@
         return buf.toString();
     }
 
+
     /**
      * based on public Java5 javadoc of org.w3c.dom.Node.setTextContent method
      */
     public static void setTextContent( Node node, final String text )
     {
-        while( node.hasChildNodes() )
+        while ( node.hasChildNodes() )
         {
             node.removeChild( node.getFirstChild() );
         }
 
-        if( text != null && text.length() > 0 )
+        if ( text != null && text.length() > 0 )
         {
             Node textNode = node.getOwnerDocument().createTextNode( text );
             node.appendChild( textNode );