felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r615139 [1/3] - /felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/
Date Fri, 25 Jan 2008 08:08:18 GMT
Author: mcculls
Date: Fri Jan 25 00:08:15 2008
New Revision: 615139

URL: http://svn.apache.org/viewvc?rev=615139&view=rev
Log:
Apply Felix coding style

Modified:
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PathFile.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Require.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
    felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/XmlHelper.java

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java Fri Jan 25 00:08:15 2008
@@ -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;
     }

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java Fri Jan 25 00:08:15 2008
@@ -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;
     }
 }

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java Fri Jan 25 00:08:15 2008
@@ -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;
     }
 }

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java Fri Jan 25 00:08:15 2008
@@ -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;
         }
     }

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrCleanRepo.java Fri Jan 25 00:08:15 2008
@@ -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());
-        }
-        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
+        {
+            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() );
+        }
+        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() );
     }
 }

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java Fri Jan 25 00:08:15 2008
@@ -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)
-        {
-        	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;
+    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;
         }
         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");
-            e.printStackTrace();
-            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");
+        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() );
+            e.printStackTrace();
+            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) {
+        try
+        {
+            lockFile = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );
+        }
+        catch ( IOException e )
+        {
             e.printStackTrace();
-            throw new MojoFailureException("IOException");
+            throw new MojoFailureException( "IOException" );
         }
-        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");
-        } catch (ResourceDoesNotExistException e) {
+            throw new MojoFailureException( "TransferFailedException" );
+        }
+        catch ( ResourceDoesNotExistException e )
+        {
             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" );
         }
 
         remoteFile.disconnect();

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java Fri Jan 25 00:08:15 2008
@@ -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");
-            e.printStackTrace();
-            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");
+        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() );
             e.printStackTrace();
-            throw new MojoFailureException("AuthorizationException");
+            throw new MojoFailureException( "ResourceDoesNotExistException" );
+        }
+        catch ( AuthorizationException e )
+        {
+            getLog().error( "Authorization failed" );
+            e.printStackTrace();
+            throw new MojoFailureException( "AuthorizationException" );
         }
         repoDescriptorFile.delete();
 
         // we remove lockFile activation
         lockFile = null;
-        try {
-            lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
-        } catch (IOException e) {
+        try
+        {
+            lockFile = File.createTempFile( String.valueOf( System.currentTimeMillis() ), null );
+        }
+        catch ( IOException e )
+        {
             e.printStackTrace();
-            throw new MojoFailureException("IOException");
+            throw new MojoFailureException( "IOException" );
         }
-        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");
-        } catch (ResourceDoesNotExistException e) {
+            throw new MojoFailureException( "TransferFailedException" );
+        }
+        catch ( ResourceDoesNotExistException e )
+        {
             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" );
         }
         remoteFile.disconnect();
     }

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java Fri Jan 25 00:08:15 2008
@@ -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)
-        {
-        	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;
+    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) {
+
+        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().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; }
+        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" );
         }
     }
 

Modified: felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java
URL: http://svn.apache.org/viewvc/felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java?rev=615139&r1=615138&r2=615139&view=diff
==============================================================================
--- felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java (original)
+++ felix/trunk/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java Fri Jan 25 00:08:15 2008
@@ -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);
-
-        if (!fileOut.isExists()) {
-            getLog().error("file doesn't exist: " + fileOut.getAbsoluteFilename());
+        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() );
             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();
 
     }



Mime
View raw message