directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r607527 - /directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/
Date Sun, 30 Dec 2007 08:57:39 GMT
Author: felixk
Date: Sun Dec 30 00:57:37 2007
New Revision: 607527

URL: http://svn.apache.org/viewvc?rev=607527&view=rev
Log:
Formatting using directory formatting template (http://cwiki.apache.org/DIRxDEV/coding-standards.data/formatting.xml)

Modified:
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java
    directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java Sun Dec 30 00:57:37 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Iterator;
@@ -43,13 +44,15 @@
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
 
+
 /**
  * The abstract studio mojo
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id: AbstractStudioMojo.java 350 2007-10-28 12:01:17Z felix $
  */
-public abstract class AbstractStudioMojo extends AbstractMojo {
+public abstract class AbstractStudioMojo extends AbstractMojo
+{
 
     /**
      * To look up Archiver/UnArchiver implementations
@@ -158,6 +161,7 @@
      */
     protected boolean outputAbsoluteArtifactFilename;
 
+
     /**
      * Unpack a file to a location
      * 
@@ -166,23 +170,30 @@
      * @param file
      *            The file to unpack
      */
-    protected void unpackToLocation(final File location, final File file) throws Exception {
-        try {
-            getLog().info("Unpacking " + file + " to\n                 " + location);
+    protected void unpackToLocation( final File location, final File file ) throws Exception
+    {
+        try
+        {
+            getLog().info( "Unpacking " + file + " to\n                 " + location );
             location.mkdirs();
-            UnArchiver unArchiver = archiverManager.getUnArchiver(file);
-            unArchiver.setSourceFile(file);
-            unArchiver.setDestDirectory(location);
+            UnArchiver unArchiver = archiverManager.getUnArchiver( file );
+            unArchiver.setSourceFile( file );
+            unArchiver.setDestDirectory( location );
             unArchiver.extract();
-        } catch (NoSuchArchiverException e) {
-            throw new MojoExecutionException("Unknown archiver type", e);
-        } catch (ArchiverException e) {
+        }
+        catch ( NoSuchArchiverException e )
+        {
+            throw new MojoExecutionException( "Unknown archiver type", e );
+        }
+        catch ( ArchiverException e )
+        {
             e.printStackTrace();
-            throw new MojoExecutionException("Error unpacking file: " + file + " to: " + location + "\r\n"
-                    + e.toString(), e);
+            throw new MojoExecutionException( "Error unpacking file: " + file + " to: " + location + "\r\n"
+                + e.toString(), e );
         }
     }
 
+
     /**
      * Pack a given location into a file
      * 
@@ -193,25 +204,34 @@
      * @throws Exception
      *             If an error occurs
      */
-    protected void packFromLocation(final File location, final File file) throws MojoExecutionException {
-        try {
-            getLog().info("Packing " + location + " to\n               " + file);
-            Archiver archiver = archiverManager.getArchiver(file);
-            archiver.setDestFile(file);
-            archiver.setIncludeEmptyDirs(true);
-            archiver.addDirectory(location);
+    protected void packFromLocation( final File location, final File file ) throws MojoExecutionException
+    {
+        try
+        {
+            getLog().info( "Packing " + location + " to\n               " + file );
+            Archiver archiver = archiverManager.getArchiver( file );
+            archiver.setDestFile( file );
+            archiver.setIncludeEmptyDirs( true );
+            archiver.addDirectory( location );
             archiver.createArchive();
-        } catch (NoSuchArchiverException e) {
-            throw new MojoExecutionException("Unknown archiver type", e);
-        } catch (IOException e) {
-            throw new MojoExecutionException("Error creating archive", e);
-        } catch (ArchiverException e) {
+        }
+        catch ( NoSuchArchiverException e )
+        {
+            throw new MojoExecutionException( "Unknown archiver type", e );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error creating archive", e );
+        }
+        catch ( ArchiverException e )
+        {
             e.printStackTrace();
-            throw new MojoExecutionException(
-                    "Error packing file: " + file + " to: " + location + "\r\n" + e.toString(), e);
+            throw new MojoExecutionException( "Error packing file: " + file + " to: " + location + "\r\n"
+                + e.toString(), e );
         }
     }
 
+
     /**
      * Resolves the Artifact from the remote repository if nessessary. If no
      * version is specified, it will be retrieved from the dependency list or
@@ -226,36 +246,49 @@
      *             with a message if the version can't be found in
      *             DependencyManagement.
      */
-    protected Artifact getArtifact(ArtifactItem artifactItem) throws MojoExecutionException {
+    protected Artifact getArtifact( ArtifactItem artifactItem ) throws MojoExecutionException
+    {
         Artifact artifact;
 
         VersionRange vr;
-        try {
-            vr = VersionRange.createFromVersionSpec(artifactItem.getVersion());
-        } catch (InvalidVersionSpecificationException e1) {
+        try
+        {
+            vr = VersionRange.createFromVersionSpec( artifactItem.getVersion() );
+        }
+        catch ( InvalidVersionSpecificationException e1 )
+        {
             e1.printStackTrace();
-            vr = VersionRange.createFromVersion(artifactItem.getVersion());
+            vr = VersionRange.createFromVersion( artifactItem.getVersion() );
         }
 
-        if (StringUtils.isEmpty(artifactItem.getClassifier())) {
-            artifact = factory.createDependencyArtifact(artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
-                    artifactItem.getType(), null, Artifact.SCOPE_COMPILE);
-        } else {
-            artifact = factory.createDependencyArtifact(artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
-                    artifactItem.getType(), artifactItem.getClassifier(), Artifact.SCOPE_COMPILE);
-        }
-
-        try {
-            resolver.resolve(artifact, remoteRepos, local);
-        } catch (ArtifactResolutionException e) {
-            throw new MojoExecutionException("Unable to resolve artifact.", e);
-        } catch (ArtifactNotFoundException e) {
-            throw new MojoExecutionException("Unable to find artifact.", e);
+        if ( StringUtils.isEmpty( artifactItem.getClassifier() ) )
+        {
+            artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
+                artifactItem.getType(), null, Artifact.SCOPE_COMPILE );
+        }
+        else
+        {
+            artifact = factory.createDependencyArtifact( artifactItem.getGroupId(), artifactItem.getArtifactId(), vr,
+                artifactItem.getType(), artifactItem.getClassifier(), Artifact.SCOPE_COMPILE );
+        }
+
+        try
+        {
+            resolver.resolve( artifact, remoteRepos, local );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MojoExecutionException( "Unable to resolve artifact.", e );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new MojoExecutionException( "Unable to find artifact.", e );
         }
 
         return artifact;
     }
 
+
     /**
      * Tries to find missing version from dependancy list and dependency
      * management. If found, the artifact is updated with the correct version.
@@ -268,18 +301,21 @@
      *            representing configured file.
      * @throws MojoExecutionException
      */
-    protected void fillMissingArtifactVersion(ArtifactItem artifact) throws MojoExecutionException {
-        if (!findDependencyVersion(artifact, project.getDependencies(), false)
-                && (project.getDependencyManagement() == null || !findDependencyVersion(artifact, project
-                        .getDependencyManagement().getDependencies(), false))
-                && !findDependencyVersion(artifact, project.getDependencies(), true)
-                && (project.getDependencyManagement() == null || !findDependencyVersion(artifact, project
-                        .getDependencyManagement().getDependencies(), true))) {
-            throw new MojoExecutionException("Unable to find artifact version of " + artifact.getGroupId() + ":"
-                    + artifact.getArtifactId() + " in either dependency list or in project's dependency management.");
+    protected void fillMissingArtifactVersion( ArtifactItem artifact ) throws MojoExecutionException
+    {
+        if ( !findDependencyVersion( artifact, project.getDependencies(), false )
+            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, project
+                .getDependencyManagement().getDependencies(), false ) )
+            && !findDependencyVersion( artifact, project.getDependencies(), true )
+            && ( project.getDependencyManagement() == null || !findDependencyVersion( artifact, project
+                .getDependencyManagement().getDependencies(), true ) ) )
+        {
+            throw new MojoExecutionException( "Unable to find artifact version of " + artifact.getGroupId() + ":"
+                + artifact.getArtifactId() + " in either dependency list or in project's dependency management." );
         }
     }
 
+
     /**
      * Tries to find missing version from a list of dependencies. If found, the
      * artifact is updated with the correct version.
@@ -292,17 +328,20 @@
      *            only look at artifactId and groupId
      * @return the found dependency
      */
-    protected boolean findDependencyVersion(ArtifactItem artifact, List<Dependency> list, boolean looseMatch) {
+    protected boolean findDependencyVersion( ArtifactItem artifact, List<Dependency> list, boolean looseMatch )
+    {
         boolean result = false;
 
-        for (int i = 0; i < list.size(); i++) {
-            Dependency dependency = list.get(i);
-            if (StringUtils.equals(dependency.getArtifactId(), artifact.getArtifactId())
-                    && StringUtils.equals(dependency.getGroupId(), artifact.getGroupId())
-                    && (looseMatch || StringUtils.equals(dependency.getClassifier(), artifact.getClassifier()))
-                    && (looseMatch || StringUtils.equals(dependency.getType(), artifact.getType()))) {
+        for ( int i = 0; i < list.size(); i++ )
+        {
+            Dependency dependency = list.get( i );
+            if ( StringUtils.equals( dependency.getArtifactId(), artifact.getArtifactId() )
+                && StringUtils.equals( dependency.getGroupId(), artifact.getGroupId() )
+                && ( looseMatch || StringUtils.equals( dependency.getClassifier(), artifact.getClassifier() ) )
+                && ( looseMatch || StringUtils.equals( dependency.getType(), artifact.getType() ) ) )
+            {
 
-                artifact.setVersion(dependency.getVersion());
+                artifact.setVersion( dependency.getVersion() );
                 result = true;
                 break;
             }
@@ -310,149 +349,191 @@
         return result;
     }
 
+
     /**
      * Complete the artifacts in the artifactItems list (e.g. complete with
      * version number)
      * 
      * @throws MojoExecutionException
      */
-    protected void completeArtifactItems(List<ArtifactItem> artifactItems) throws MojoExecutionException {
-        try {
+    protected void completeArtifactItems( List<ArtifactItem> artifactItems ) throws MojoExecutionException
+    {
+        try
+        {
             // Get and complete artifacts
-            for (Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext();) {
+            for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+            {
                 ArtifactItem item = artifactItem.next();
                 // make sure we have a version.
-                if (StringUtils.isEmpty(item.getVersion())) {
-                    fillMissingArtifactVersion(item);
+                if ( StringUtils.isEmpty( item.getVersion() ) )
+                {
+                    fillMissingArtifactVersion( item );
                 }
-                item.setArtifact(this.getArtifact(item));
+                item.setArtifact( this.getArtifact( item ) );
             }
-        } catch (Exception e) {
-            throw new MojoExecutionException("", e);
+        }
+        catch ( Exception e )
+        {
+            throw new MojoExecutionException( "", e );
         }
     }
 
+
     /**
      * Delete a directory
      * 
      * @param path
      * @return
      */
-    protected static boolean deleteDirectory(File path) {
-        if (path.exists()) {
-            for (File file : path.listFiles()) {
-                if (file.isDirectory()) {
-                    deleteDirectory(file);
-                } else {
+    protected static boolean deleteDirectory( File path )
+    {
+        if ( path.exists() )
+        {
+            for ( File file : path.listFiles() )
+            {
+                if ( file.isDirectory() )
+                {
+                    deleteDirectory( file );
+                }
+                else
+                {
                     file.delete();
                 }
             }
         }
-        return (path.delete());
+        return ( path.delete() );
     }
 
+
     /**
      * @return Returns the factory.
      */
-    public org.apache.maven.artifact.factory.ArtifactFactory getFactory() {
+    public org.apache.maven.artifact.factory.ArtifactFactory getFactory()
+    {
         return this.factory;
     }
 
+
     /**
      * @param factory
      *            The factory to set.
      */
-    public void setFactory(org.apache.maven.artifact.factory.ArtifactFactory factory) {
+    public void setFactory( org.apache.maven.artifact.factory.ArtifactFactory factory )
+    {
         this.factory = factory;
     }
 
+
     /**
      * @return Returns the project.
      */
-    public MavenProject getProject() {
+    public MavenProject getProject()
+    {
         return this.project;
     }
 
+
     /**
      * @return Returns the local.
      */
-    public org.apache.maven.artifact.repository.ArtifactRepository getLocal() {
+    public org.apache.maven.artifact.repository.ArtifactRepository getLocal()
+    {
         return this.local;
     }
 
+
     /**
      * @param local
      *            The local to set.
      */
-    public void setLocal(org.apache.maven.artifact.repository.ArtifactRepository local) {
+    public void setLocal( org.apache.maven.artifact.repository.ArtifactRepository local )
+    {
         this.local = local;
     }
 
+
     /**
      * @return Returns the remoteRepos.
      */
-    public List<ArtifactRepository> getRemoteRepos() {
+    public List<ArtifactRepository> getRemoteRepos()
+    {
         return this.remoteRepos;
     }
 
+
     /**
      * @param remoteRepos
      *            The remoteRepos to set.
      */
-    public void setRemoteRepos(List<ArtifactRepository> remoteRepos) {
+    public void setRemoteRepos( List<ArtifactRepository> remoteRepos )
+    {
         this.remoteRepos = remoteRepos;
     }
 
+
     /**
      * @return Returns the resolver.
      */
-    public org.apache.maven.artifact.resolver.ArtifactResolver getResolver() {
+    public org.apache.maven.artifact.resolver.ArtifactResolver getResolver()
+    {
         return this.resolver;
     }
 
+
     /**
      * @param resolver
      *            The resolver to set.
      */
-    public void setResolver(org.apache.maven.artifact.resolver.ArtifactResolver resolver) {
+    public void setResolver( org.apache.maven.artifact.resolver.ArtifactResolver resolver )
+    {
         this.resolver = resolver;
     }
 
+
     /**
      * @return Returns the artifactCollector.
      */
-    public ArtifactCollector getArtifactCollector() {
+    public ArtifactCollector getArtifactCollector()
+    {
         return this.artifactCollector;
     }
 
+
     /**
      * @param theArtifactCollector
      *            The artifactCollector to set.
      */
-    public void setArtifactCollector(ArtifactCollector theArtifactCollector) {
+    public void setArtifactCollector( ArtifactCollector theArtifactCollector )
+    {
         this.artifactCollector = theArtifactCollector;
     }
 
+
     /**
      * @return Returns the artifactMetadataSource.
      */
-    public ArtifactMetadataSource getArtifactMetadataSource() {
+    public ArtifactMetadataSource getArtifactMetadataSource()
+    {
         return this.artifactMetadataSource;
     }
 
+
     /**
      * @param theArtifactMetadataSource
      *            The artifactMetadataSource to set.
      */
-    public void setArtifactMetadataSource(ArtifactMetadataSource theArtifactMetadataSource) {
+    public void setArtifactMetadataSource( ArtifactMetadataSource theArtifactMetadataSource )
+    {
         this.artifactMetadataSource = theArtifactMetadataSource;
     }
 
+
     /**
      * @param libraryPath
      *            the libraryPath to set
      */
-    public void setLibraryPath(String pLibraryPath) {
+    public void setLibraryPath( String pLibraryPath )
+    {
         this.libraryPath = pLibraryPath;
     }
 }

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/ArtifactItem.java Sun Dec 30 00:57:37 2007
@@ -19,9 +19,11 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import org.apache.commons.lang.StringUtils;
 import org.apache.maven.artifact.Artifact;
 
+
 /**
  * ArtifactItem represents information specified in the plugin configuration
  * section for each artifact.
@@ -29,7 +31,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id: ArtifactItem.java 349 2007-10-28 11:51:21Z felix $
  */
-public class ArtifactItem {
+public class ArtifactItem
+{
     /**
      * Group Id of Artifact
      * 
@@ -73,123 +76,161 @@
      */
     private Artifact artifact;
 
-    public ArtifactItem() {
+
+    public ArtifactItem()
+    {
         // default constructor
     }
 
-    public ArtifactItem(Artifact artifact) {
-        this.setArtifact(artifact);
-        this.setArtifactId(artifact.getArtifactId());
-        this.setClassifier(artifact.getClassifier());
-        this.setGroupId(artifact.getGroupId());
-        this.setType(artifact.getType());
-        this.setVersion(artifact.getVersion());
+
+    public ArtifactItem( Artifact artifact )
+    {
+        this.setArtifact( artifact );
+        this.setArtifactId( artifact.getArtifactId() );
+        this.setClassifier( artifact.getClassifier() );
+        this.setGroupId( artifact.getGroupId() );
+        this.setType( artifact.getType() );
+        this.setVersion( artifact.getVersion() );
     }
 
-    private String filterEmptyString(String in) {
-        if (in == null || in.equals("")) {
+
+    private String filterEmptyString( String in )
+    {
+        if ( in == null || in.equals( "" ) )
+        {
             return null;
-        } else {
+        }
+        else
+        {
             return in;
         }
     }
 
+
     /**
      * @return Returns the artifactId.
      */
-    public String getArtifactId() {
+    public String getArtifactId()
+    {
         return artifactId;
     }
 
+
     /**
      * @param artifactId
      *            The artifactId to set.
      */
-    public void setArtifactId(String artifact) {
-        this.artifactId = filterEmptyString(artifact);
+    public void setArtifactId( String artifact )
+    {
+        this.artifactId = filterEmptyString( artifact );
     }
 
+
     /**
      * @return Returns the groupId.
      */
-    public String getGroupId() {
+    public String getGroupId()
+    {
         return groupId;
     }
 
+
     /**
      * @param groupId
      *            The groupId to set.
      */
-    public void setGroupId(String groupId) {
-        this.groupId = filterEmptyString(groupId);
+    public void setGroupId( String groupId )
+    {
+        this.groupId = filterEmptyString( groupId );
     }
 
+
     /**
      * @return Returns the type.
      */
-    public String getType() {
+    public String getType()
+    {
         return type;
     }
 
+
     /**
      * @param type
      *            The type to set.
      */
-    public void setType(String type) {
-        this.type = filterEmptyString(type);
+    public void setType( String type )
+    {
+        this.type = filterEmptyString( type );
     }
 
+
     /**
      * @return Returns the version.
      */
-    public String getVersion() {
+    public String getVersion()
+    {
         return version;
     }
 
+
     /**
      * @param version
      *            The version to set.
      */
-    public void setVersion(String version) {
-        this.version = filterEmptyString(version);
+    public void setVersion( String version )
+    {
+        this.version = filterEmptyString( version );
     }
 
+
     /**
      * @return Classifier.
      */
-    public String getClassifier() {
+    public String getClassifier()
+    {
         return classifier;
     }
 
+
     /**
      * @param classifier
      *            Classifier.
      */
-    public void setClassifier(String classifier) {
-        this.classifier = filterEmptyString(classifier);
+    public void setClassifier( String classifier )
+    {
+        this.classifier = filterEmptyString( classifier );
     }
 
-    public String toString() {
-        if (this.classifier == null) {
-            return groupId + ":" + artifactId + ":" + StringUtils.defaultString(version, "?") + ":" + type;
-        } else {
-            return groupId + ":" + artifactId + ":" + classifier + ":" + StringUtils.defaultString(version, "?") + ":"
-                    + type;
+
+    public String toString()
+    {
+        if ( this.classifier == null )
+        {
+            return groupId + ":" + artifactId + ":" + StringUtils.defaultString( version, "?" ) + ":" + type;
+        }
+        else
+        {
+            return groupId + ":" + artifactId + ":" + classifier + ":" + StringUtils.defaultString( version, "?" )
+                + ":" + type;
         }
     }
 
+
     /**
      * @return Returns the artifact.
      */
-    public Artifact getArtifact() {
+    public Artifact getArtifact()
+    {
         return this.artifact;
     }
 
+
     /**
      * @param artifact
      *            The artifact to set.
      */
-    public void setArtifact(Artifact artifact) {
+    public void setArtifact( Artifact artifact )
+    {
         this.artifact = artifact;
     }
 

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCleanMojo.java Sun Dec 30 00:57:37 2007
@@ -19,11 +19,13 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import java.io.File;
 
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 
+
 /**
  * Clean stuff generated by studio:eclipse
  * 
@@ -35,7 +37,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id: StudioReplaceFileInJarMojo.java 350 2007-10-28 12:01:17Z felix $
  */
-public class StudioCleanMojo extends AbstractStudioMojo {
+public class StudioCleanMojo extends AbstractStudioMojo
+{
 
     private final String MAVEN_ECLIPSE_XML = "maven-eclipse.xml";
     private final String EXTERNAL_TOOL_BUILDERS_DIR = ".externalToolBuilders";
@@ -48,19 +51,24 @@
      */
     protected MavenProject project;
 
-    public void execute() throws MojoExecutionException {
-        try {
-            File file = new File(project.getBasedir(), MAVEN_ECLIPSE_XML);
-            getLog().info("Deleting " + file);
+
+    public void execute() throws MojoExecutionException
+    {
+        try
+        {
+            File file = new File( project.getBasedir(), MAVEN_ECLIPSE_XML );
+            getLog().info( "Deleting " + file );
             file.delete();
-            file = new File(project.getBasedir(), EXTERNAL_TOOL_BUILDERS_DIR);
-            getLog().info("Deleting " + file);
-            deleteDirectory(file);
-            file = new File(project.getBasedir(), libraryPath);
-            getLog().info("Deleting " + file);
-            deleteDirectory(file);
-        } catch (Exception e) {
-            getLog().error(e);
+            file = new File( project.getBasedir(), EXTERNAL_TOOL_BUILDERS_DIR );
+            getLog().info( "Deleting " + file );
+            deleteDirectory( file );
+            file = new File( project.getBasedir(), libraryPath );
+            getLog().info( "Deleting " + file );
+            deleteDirectory( file );
+        }
+        catch ( Exception e )
+        {
+            getLog().error( e );
         }
     }
 }

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioCopyEclipseDependencyMojo.java Sun Dec 30 00:57:37 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -28,6 +29,7 @@
 import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
 import org.apache.maven.shared.osgi.Maven2OsgiConverter;
 
+
 /**
  * Copy a set of artifacts to a configured output directory by replacing the
  * separator between artifactId and version by an underscore instead of a dash.
@@ -42,7 +44,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id: StudioReplaceFileInJarMojo.java 350 2007-10-28 12:01:17Z felix $
  */
-public class StudioCopyEclipseDependencyMojo extends AbstractStudioMojo {
+public class StudioCopyEclipseDependencyMojo extends AbstractStudioMojo
+{
 
     /**
      * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
@@ -62,44 +65,56 @@
      */
     private File destinationDirectory;
 
+
     /**
      * @param destinationDirectory
      *            the destinationDirectory to set
      */
-    public void setDestinationDirectory(File destinationDirectory) {
+    public void setDestinationDirectory( File destinationDirectory )
+    {
         this.destinationDirectory = destinationDirectory;
     }
 
-    public void execute() throws MojoExecutionException {
+
+    public void execute() throws MojoExecutionException
+    {
         final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-        
-        completeArtifactItems(artifactItems);
 
-        for (Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext();) {
+        completeArtifactItems( artifactItems );
+
+        for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+        {
             ArtifactItem item = artifactItem.next();
-            try {
+            try
+            {
 
-                final File destFile = new File(destinationDirectory.getAbsoluteFile() + File.separator
-                        + maven2OsgiConverter.getBundleFileName(item.getArtifact()));
+                final File destFile = new File( destinationDirectory.getAbsoluteFile() + File.separator
+                    + maven2OsgiConverter.getBundleFileName( item.getArtifact() ) );
 
-                getLog().info("Copying artifact " + item.getArtifactId() + " to\n               " + destFile.getAbsolutePath());
+                getLog().info(
+                    "Copying artifact " + item.getArtifactId() + " to\n               " + destFile.getAbsolutePath() );
 
-                if (!destinationDirectory.exists()) {
+                if ( !destinationDirectory.exists() )
+                {
                     destinationDirectory.mkdirs();
                 }
-                FileUtils.copyFile(item.getArtifact().getFile(), destFile);
+                FileUtils.copyFile( item.getArtifact().getFile(), destFile );
 
-            } catch (Exception e) {
-                throw new MojoExecutionException("", e);
+            }
+            catch ( Exception e )
+            {
+                throw new MojoExecutionException( "", e );
             }
         }
     }
 
+
     /**
      * @param artifactItems
      *            the artifactItems to set
      */
-    public void setArtifactItems(ArrayList<ArtifactItem> artifactItems) {
+    public void setArtifactItems( ArrayList<ArtifactItem> artifactItems )
+    {
         this.artifactItems = artifactItems;
     }
 }

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioEclipseMojo.java Sun Dec 30 00:57:37 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
@@ -45,10 +46,16 @@
 import org.codehaus.plexus.util.xml.Xpp3DomWriter;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
+
 /**
- * Prepares for eclipse: Copy artifacts nonscoped "provided" to ${basedir}/lib
- * Add artifacts nonscoped "provided" to Bundle-ClassPath ind MANIFEST.MF Adapt
- * ${basedir}/.classpath for artifacts nonscoped "provided"
+ * Prepares for eclipse: 
+ * <p>
+ * <ul>
+ * <li>Copy artifacts nonscoped "provided" to ${basedir}/lib</li>
+ * <li>Add artifacts nonscoped "provided" to Bundle-ClassPath ind MANIFEST.MF</li>
+ * <li>Adapt ${basedir}/.classpath for artifacts nonscoped "provided"</li>
+ * </ul>
+ * </p>
  * 
  * @goal eclipse
  * @execute phase="generate-resources"
@@ -62,7 +69,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id: StudioReplaceFileInJarMojo.java 350 2007-10-28 12:01:17Z felix $
  */
-public class StudioEclipseMojo extends AbstractStudioMojo {
+public class StudioEclipseMojo extends AbstractStudioMojo
+{
 
     /**
      * POM
@@ -88,76 +96,87 @@
      */
     public final static String ENTRY_BUNDLE_SYMBOLICNAME = "Bundle-SymbolicName:";
 
-    public void execute() throws MojoExecutionException {
-        if (!skip) {
-            try {
+
+    public void execute() throws MojoExecutionException
+    {
+        if ( !skip )
+        {
+            try
+            {
                 // Create list of used artifacts
                 final List<Artifact> artifactList = createArtifactList();
 
                 // copy Artifacts
-                copyArtifacts(artifactList);
+                copyArtifacts( artifactList );
 
                 // Update Bundle-Classpath in MANIFEST.MF
-                updateManifest(artifactList);
+                updateManifest( artifactList );
 
                 // Update .classpath
-                updateDotClasspath(artifactList);
+                updateDotClasspath( artifactList );
 
                 updateDotProject();
                 removeMavenEclipseXml();
                 removeDotExternalToolBuilders();
 
-            } catch (Exception e) {
-                getLog().error(e);
+            }
+            catch ( Exception e )
+            {
+                getLog().error( e );
             }
         }
     }
 
+
     /**
      * Return a list of artifacts nonscoped "provided"
      * 
      * @return
      */
-    private List<Artifact> createArtifactList() {
+    private List<Artifact> createArtifactList()
+    {
         List<Artifact> list = new ArrayList<Artifact>();
-        for (Iterator<Artifact> artifactItem = project.getArtifacts()
-                .iterator(); artifactItem.hasNext();) {
-            Artifact artifact = (Artifact) artifactItem.next();
-            if (!artifact.getScope().equalsIgnoreCase("provided")) {
-                list.add(artifact);
+        for ( Iterator<Artifact> artifactItem = project.getArtifacts().iterator(); artifactItem.hasNext(); )
+        {
+            Artifact artifact = ( Artifact ) artifactItem.next();
+            if ( !artifact.getScope().equalsIgnoreCase( "provided" ) )
+            {
+                list.add( artifact );
             }
         }
         return list;
     }
 
+
     /**
      * Copy artifacts to ${basedir}/lib
      * 
      * @param list
      * @throws IOException
      */
-    private void copyArtifacts(final List<Artifact> list) throws IOException {
+    private void copyArtifacts( final List<Artifact> list ) throws IOException
+    {
         // Only proceed when we have artifacts to process
-        if (!list.isEmpty()) {
-            final File copyDir = new File(project.getBasedir(), libraryPath);
+        if ( !list.isEmpty() )
+        {
+            final File copyDir = new File( project.getBasedir(), libraryPath );
 
-            if (!copyDir.exists())
+            if ( !copyDir.exists() )
                 copyDir.mkdirs();
 
-            for (Artifact artifact : list) {
-                if (!artifact.getScope().equalsIgnoreCase("test")) {
-                    final File destFile = new File(copyDir, artifact.getFile()
-                            .getName());
-                    FileUtils.copyFile(artifact.getFile(), destFile);
-                    getLog()
-                            .info(
-                                    "Copying " + artifact.getFile() + " to "
-                                            + destFile);
+            for ( Artifact artifact : list )
+            {
+                if ( !artifact.getScope().equalsIgnoreCase( "test" ) )
+                {
+                    final File destFile = new File( copyDir, artifact.getFile().getName() );
+                    FileUtils.copyFile( artifact.getFile(), destFile );
+                    getLog().info( "Copying " + artifact.getFile() + " to " + destFile );
                 }
             }
         }
     }
 
+
     /**
      * Updates the Bundle-ClassPath entry in the manifest file
      * 
@@ -165,20 +184,20 @@
      * @throws FileNotFoundException
      * @throws IOException
      */
-    private void updateManifest(final List<Artifact> list)
-            throws FileNotFoundException, IOException {
+    private void updateManifest( final List<Artifact> list ) throws FileNotFoundException, IOException
+    {
         final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-        final File manifestFile = new File(project.getBasedir(),
-                "META-INF/MANIFEST.MF");
-        getLog().info("Update Bundle-Classpath in " + manifestFile);
+        final File manifestFile = new File( project.getBasedir(), "META-INF/MANIFEST.MF" );
+        getLog().info( "Update Bundle-Classpath in " + manifestFile );
 
         // Build Bundle-ClassPath entry
-        final StringBuilder bundleClasspath = new StringBuilder(" .");
-        for (Artifact artifact : list) {
-            if (!artifact.getScope().equalsIgnoreCase("test")) {
-                bundleClasspath.append(",").append(NEWLINE).append(" ").append(
-                        libraryPath).append(File.separator).append(
-                        artifact.getFile().getName());
+        final StringBuilder bundleClasspath = new StringBuilder( " ." );
+        for ( Artifact artifact : list )
+        {
+            if ( !artifact.getScope().equalsIgnoreCase( "test" ) )
+            {
+                bundleClasspath.append( "," ).append( NEWLINE ).append( " " ).append( libraryPath ).append(
+                    File.separator ).append( artifact.getFile().getName() );
             }
         }
 
@@ -187,153 +206,170 @@
         // Read existing MANIFEST.MF and add existing entries
         // to StringBuilder exept Bundle-ClassPath entry
         StringBuilder manifestSb = new StringBuilder();
-        BufferedReader in = new BufferedReader(new InputStreamReader(
-                new FileInputStream(manifestFile), "UTF-8"));
+        BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( manifestFile ), "UTF-8" ) );
         String line;
-        while ((line = in.readLine()) != null) {
-            if (inBundleClasspathEntry && line.indexOf(":") > -1) {
+        while ( ( line = in.readLine() ) != null )
+        {
+            if ( inBundleClasspathEntry && line.indexOf( ":" ) > -1 )
+            {
                 inBundleClasspathEntry = false;
-            } else if (inBundleClasspathEntry) {
+            }
+            else if ( inBundleClasspathEntry )
+            {
                 continue;
             }
 
-            String name = line.substring(0, line.indexOf(":") + 1);
+            String name = line.substring( 0, line.indexOf( ":" ) + 1 );
 
-            if (!name.equalsIgnoreCase(ENTRY_BUNDLE_CLASSPATH)) {
-                if (name.equalsIgnoreCase(ENTRY_BUNDLE_SYMBOLICNAME)) {
+            if ( !name.equalsIgnoreCase( ENTRY_BUNDLE_CLASSPATH ) )
+            {
+                if ( name.equalsIgnoreCase( ENTRY_BUNDLE_SYMBOLICNAME ) )
+                {
                     // get OSGI Bundle Name
-                    manifestSb.append(ENTRY_BUNDLE_SYMBOLICNAME);
-                    manifestSb.append(" ");
-                    manifestSb.append(maven2OsgiConverter
-                            .getBundleSymbolicName(project.getArtifact()));
-                    manifestSb.append(";singleton:=true");
-                    manifestSb.append(NEWLINE);
-                } else {
-                    manifestSb.append(line).append(NEWLINE);
+                    manifestSb.append( ENTRY_BUNDLE_SYMBOLICNAME );
+                    manifestSb.append( " " );
+                    manifestSb.append( maven2OsgiConverter.getBundleSymbolicName( project.getArtifact() ) );
+                    manifestSb.append( ";singleton:=true" );
+                    manifestSb.append( NEWLINE );
                 }
-            } else {
+                else
+                {
+                    manifestSb.append( line ).append( NEWLINE );
+                }
+            }
+            else
+            {
                 inBundleClasspathEntry = true;
             }
         }
 
         // Add Bundle-ClassPath entry
-        manifestSb.append(ENTRY_BUNDLE_CLASSPATH).append(bundleClasspath)
-                .append(NEWLINE);
+        manifestSb.append( ENTRY_BUNDLE_CLASSPATH ).append( bundleClasspath ).append( NEWLINE );
 
         // Write MANIFEST.MF
-        Writer out = new OutputStreamWriter(new FileOutputStream(manifestFile),
-                "UTF-8");
-        out.write(manifestSb.toString());
+        Writer out = new OutputStreamWriter( new FileOutputStream( manifestFile ), "UTF-8" );
+        out.write( manifestSb.toString() );
         out.flush();
         out.close();
     }
 
+
     /**
      * Adapt the ${basedir}/.classpath
      * 
      * @param list
      */
-    private void updateDotClasspath(List<Artifact> list) throws IOException,
-            XmlPullParserException {
-        getLog().info("Update .classpath in " + project.getBasedir());
-        final InputStream is = new FileInputStream(new File(project
-                .getBasedir(), ".classpath"));
-        Xpp3Dom dom = Xpp3DomBuilder.build(is, "UTF-8");
+    private void updateDotClasspath( List<Artifact> list ) throws IOException, XmlPullParserException
+    {
+        getLog().info( "Update .classpath in " + project.getBasedir() );
+        final InputStream is = new FileInputStream( new File( project.getBasedir(), ".classpath" ) );
+        Xpp3Dom dom = Xpp3DomBuilder.build( is, "UTF-8" );
         int cnt = 0;
-        for (Xpp3Dom cpEntry : dom.getChildren("classpathentry")) {
-            if (cpEntry.getAttribute("kind").equals("lib")) {
-                dom.removeChild(cnt);
+        for ( Xpp3Dom cpEntry : dom.getChildren( "classpathentry" ) )
+        {
+            if ( cpEntry.getAttribute( "kind" ).equals( "lib" ) )
+            {
+                dom.removeChild( cnt );
                 cnt--;
             }
             cnt++;
         }
 
         Xpp3Dom entry;
-        for (Artifact artifact : list) {
-            if (artifact.getScope().equalsIgnoreCase("test")) {
-                entry = new Xpp3Dom("classpathentry");
-                entry.setAttribute("kind", "lib");
-                entry.setAttribute("path", (new StringBuilder()).append(
-                        libraryPath).append(File.separator).append(
-                        artifact.getFile().getName()).toString());
-            } else {
-                entry = new Xpp3Dom("classpathentry");
-                entry.setAttribute("exported", "true");
-                entry.setAttribute("kind", "lib");
-                entry.setAttribute("path", (new StringBuilder()).append(
-                        libraryPath).append(File.separator).append(
-                        artifact.getFile().getName()).toString());
+        for ( Artifact artifact : list )
+        {
+            if ( artifact.getScope().equalsIgnoreCase( "test" ) )
+            {
+                entry = new Xpp3Dom( "classpathentry" );
+                entry.setAttribute( "kind", "lib" );
+                entry.setAttribute( "path", ( new StringBuilder() ).append( libraryPath ).append( File.separator )
+                    .append( artifact.getFile().getName() ).toString() );
+            }
+            else
+            {
+                entry = new Xpp3Dom( "classpathentry" );
+                entry.setAttribute( "exported", "true" );
+                entry.setAttribute( "kind", "lib" );
+                entry.setAttribute( "path", ( new StringBuilder() ).append( libraryPath ).append( File.separator )
+                    .append( artifact.getFile().getName() ).toString() );
             }
-            dom.addChild(entry);
+            dom.addChild( entry );
         }
 
         is.close();
-        Writer w = new OutputStreamWriter(new FileOutputStream(new File(project
-                .getBasedir(), ".classpath")), "UTF-8");
-        org.codehaus.plexus.util.xml.XMLWriter writer = new PrettyPrintXMLWriter(
-                w);
-        Xpp3DomWriter.write(writer, dom);
+        Writer w = new OutputStreamWriter( new FileOutputStream( new File( project.getBasedir(), ".classpath" ) ),
+            "UTF-8" );
+        org.codehaus.plexus.util.xml.XMLWriter writer = new PrettyPrintXMLWriter( w );
+        Xpp3DomWriter.write( writer, dom );
         w.flush();
         w.close();
     }
 
+
     /**
      * Adapt the ${basedir}/.project
      * 
      * @param list
      */
-    private void updateDotProject() throws IOException, XmlPullParserException {
-        getLog().info("Update .project in " + project.getBasedir());
-        InputStream is = new FileInputStream(new File(project.getBasedir(),
-                ".project"));
-        Xpp3Dom dom = Xpp3DomBuilder.build(is, "UTF-8");
+    private void updateDotProject() throws IOException, XmlPullParserException
+    {
+        getLog().info( "Update .project in " + project.getBasedir() );
+        InputStream is = new FileInputStream( new File( project.getBasedir(), ".project" ) );
+        Xpp3Dom dom = Xpp3DomBuilder.build( is, "UTF-8" );
         int cnt = 0;
-        for (Xpp3Dom cpEntry : dom.getChild("buildSpec").getChildren(
-                "buildCommand")) {
-            if (cpEntry.getChild("name").getValue().equals(
-                    "org.eclipse.ui.externaltools.ExternalToolBuilder")) {
-                dom.getChild("buildSpec").removeChild(cnt);
+        for ( Xpp3Dom cpEntry : dom.getChild( "buildSpec" ).getChildren( "buildCommand" ) )
+        {
+            if ( cpEntry.getChild( "name" ).getValue().equals( "org.eclipse.ui.externaltools.ExternalToolBuilder" ) )
+            {
+                dom.getChild( "buildSpec" ).removeChild( cnt );
                 cnt--;
             }
             cnt++;
         }
 
-        removeChildFromDom(dom, "linkedResources");
-        removeChildFromDom(dom, "projects");
+        removeChildFromDom( dom, "linkedResources" );
+        removeChildFromDom( dom, "projects" );
 
         is.close();
-        Writer w = new OutputStreamWriter(new FileOutputStream(new File(project
-                .getBasedir(), ".project")), "UTF-8");
-        org.codehaus.plexus.util.xml.XMLWriter writer = new PrettyPrintXMLWriter(
-                w);
-        Xpp3DomWriter.write(writer, dom);
+        Writer w = new OutputStreamWriter( new FileOutputStream( new File( project.getBasedir(), ".project" ) ),
+            "UTF-8" );
+        org.codehaus.plexus.util.xml.XMLWriter writer = new PrettyPrintXMLWriter( w );
+        Xpp3DomWriter.write( writer, dom );
         w.flush();
         w.close();
     }
 
+
     /**
      * remove ${basedir}/maven-eclipse.xml
      */
-    void removeMavenEclipseXml() {
-        File file = new File(project.getBasedir(), "maven-eclipse.xml");
-        if (file.exists())
+    void removeMavenEclipseXml()
+    {
+        File file = new File( project.getBasedir(), "maven-eclipse.xml" );
+        if ( file.exists() )
             file.delete();
     }
 
+
     /**
      * Adapt the ${basedir}/.externalToolBuilders
      */
-    void removeDotExternalToolBuilders() {
-        File file = new File(project.getBasedir(), ".externalToolBuilders");
-        if (file.exists())
-            deleteDirectory(file);
+    void removeDotExternalToolBuilders()
+    {
+        File file = new File( project.getBasedir(), ".externalToolBuilders" );
+        if ( file.exists() )
+            deleteDirectory( file );
     }
 
-    private void removeChildFromDom(Xpp3Dom dom, String childName) {
+
+    private void removeChildFromDom( Xpp3Dom dom, String childName )
+    {
         int cnt = 0;
-        for (Xpp3Dom child : dom.getChildren()) {
-            if (child.getName().equals(childName)) {
-                dom.removeChild(cnt);
+        for ( Xpp3Dom child : dom.getChildren() )
+        {
+            if ( child.getName().equals( childName ) )
+            {
+                dom.removeChild( cnt );
                 cnt -= 1;
             }
             cnt += 1;

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioPrepareJarPackageMojo.java Sun Dec 30 00:57:37 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
@@ -30,6 +31,7 @@
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
 
+
 /**
  * Prepares for jar: Copy artifacts nonscoped "provided" to
  * ${project.build.outputDirectory}/libraryPath
@@ -45,7 +47,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id$
  */
-public class StudioPrepareJarPackageMojo extends AbstractStudioMojo {
+public class StudioPrepareJarPackageMojo extends AbstractStudioMojo
+{
 
     /**
      * POM
@@ -65,53 +68,66 @@
      */
     private File classesOutDir;
 
-    public void execute() throws MojoExecutionException {
-        try {
+
+    public void execute() throws MojoExecutionException
+    {
+        try
+        {
             // Create list of used artifacts
             final List<Artifact> artifactList = createArtifactList();
 
             // copy Artifacts
-            copyArtifacts(artifactList);
+            copyArtifacts( artifactList );
 
-        } catch (Exception e) {
-            getLog().error(e);
+        }
+        catch ( Exception e )
+        {
+            getLog().error( e );
         }
     }
 
+
     /**
      * Return a list of artifacts nonscoped "provided"
      * 
      * @return
      */
-    private List<Artifact> createArtifactList() {
+    private List<Artifact> createArtifactList()
+    {
         List<Artifact> list = new ArrayList<Artifact>();
-        for (Iterator<Artifact> artifactItem = project.getArtifacts().iterator(); artifactItem.hasNext();) {
-            Artifact artifact = (Artifact) artifactItem.next();
-            if (!artifact.getScope().equalsIgnoreCase("provided")) {
-                list.add(artifact);
+        for ( Iterator<Artifact> artifactItem = project.getArtifacts().iterator(); artifactItem.hasNext(); )
+        {
+            Artifact artifact = ( Artifact ) artifactItem.next();
+            if ( !artifact.getScope().equalsIgnoreCase( "provided" ) )
+            {
+                list.add( artifact );
             }
         }
         return list;
     }
 
+
     /**
      * Copy artifacts to ${basedir}/lib
      * 
      * @param list
      * @throws IOException
      */
-    private void copyArtifacts(final List<Artifact> list) throws IOException {
+    private void copyArtifacts( final List<Artifact> list ) throws IOException
+    {
         // Only proceed when we have artifacts to process
-        if (!list.isEmpty()) {
-            final File copyDir = new File(classesOutDir, libraryPath);
+        if ( !list.isEmpty() )
+        {
+            final File copyDir = new File( classesOutDir, libraryPath );
 
-            if (!copyDir.exists())
+            if ( !copyDir.exists() )
                 copyDir.mkdirs();
 
-            for (Artifact artifact : list) {
-                final File destFile = new File(copyDir, artifact.getFile().getName());
-                FileUtils.copyFile(artifact.getFile(), destFile);
-                getLog().info("Copying " + artifact.getFile() + " to\n               " + destFile);
+            for ( Artifact artifact : list )
+            {
+                final File destFile = new File( copyDir, artifact.getFile().getName() );
+                FileUtils.copyFile( artifact.getFile(), destFile );
+                getLog().info( "Copying " + artifact.getFile() + " to\n               " + destFile );
             }
         }
     }

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioReplaceFileInJarMojo.java Sun Dec 30 00:57:37 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -28,6 +29,7 @@
 import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
 import org.apache.maven.shared.osgi.Maven2OsgiConverter;
 
+
 /**
  * Add ro replace file in existing, distributed artifact
  * 
@@ -40,7 +42,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id: StudioReplaceFileInJarMojo.java 368 2007-11-02 06:52:32Z felix $
  */
-public class StudioReplaceFileInJarMojo extends AbstractStudioMojo {
+public class StudioReplaceFileInJarMojo extends AbstractStudioMojo
+{
 
     /**
      * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
@@ -77,50 +80,62 @@
      */
     private String pluginWorkDir;
 
+
     /**
      * @param destinationDirectory
      *            the destinationDirectory to set
      */
-    public void setDestinationDirectory(File destinationDirectory) {
+    public void setDestinationDirectory( File destinationDirectory )
+    {
         this.destinationDirectory = destinationDirectory;
     }
 
+
     /**
      * @param inputFile
      *            the inputFile to set
      */
-    public void setInputFile(File inputFile) {
+    public void setInputFile( File inputFile )
+    {
         this.inputFile = inputFile;
     }
 
-    public void execute() throws MojoExecutionException {
+
+    public void execute() throws MojoExecutionException
+    {
         final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-        
-        completeArtifactItems(artifactItems);
+
+        completeArtifactItems( artifactItems );
 
         // Add file to packed file
-        for (Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext();) {
+        for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+        {
             ArtifactItem item = artifactItem.next();
-            try {
-                final File zipFile = new File(destinationDirectory.getAbsoluteFile() + File.separator
-                        + maven2OsgiConverter.getBundleFileName(item.getArtifact()));
-                final File tmpDir = new File(pluginWorkDir + item.getArtifact().getArtifactId());
-                unpackToLocation(tmpDir, zipFile);
-                getLog().info("Adding " + inputFile + " to\n              " + zipFile);
-                FileUtils.copyFileToDirectory(inputFile, tmpDir);
-                packFromLocation(tmpDir, zipFile);
+            try
+            {
+                final File zipFile = new File( destinationDirectory.getAbsoluteFile() + File.separator
+                    + maven2OsgiConverter.getBundleFileName( item.getArtifact() ) );
+                final File tmpDir = new File( pluginWorkDir + item.getArtifact().getArtifactId() );
+                unpackToLocation( tmpDir, zipFile );
+                getLog().info( "Adding " + inputFile + " to\n              " + zipFile );
+                FileUtils.copyFileToDirectory( inputFile, tmpDir );
+                packFromLocation( tmpDir, zipFile );
 
-            } catch (Exception e) {
-                throw new MojoExecutionException("", e);
+            }
+            catch ( Exception e )
+            {
+                throw new MojoExecutionException( "", e );
             }
         }
     }
 
+
     /**
      * @param artifactItems
      *            the artifactItems to set
      */
-    public void setArtifactItems(ArrayList<ArtifactItem> artifactItems) {
+    public void setArtifactItems( ArrayList<ArtifactItem> artifactItems )
+    {
         this.artifactItems = artifactItems;
     }
 }

Modified: directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java
URL: http://svn.apache.org/viewvc/directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java?rev=607527&r1=607526&r2=607527&view=diff
==============================================================================
--- directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java (original)
+++ directory/sandbox/felixk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/StudioUnpackPrefixedMojo.java Sun Dec 30 00:57:37 2007
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.studio.maven.plugins;
 
+
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -27,6 +28,7 @@
 import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
 import org.apache.maven.shared.osgi.Maven2OsgiConverter;
 
+
 /**
  * Prefixes the unpack of an artifact into a given directory with a directory
  * named based on the artifacts final name
@@ -40,7 +42,8 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Id: StreamGenerator.java 448473 2006-09-21 06:22:51Z crossley $
  */
-public class StudioUnpackPrefixedMojo extends AbstractStudioMojo {
+public class StudioUnpackPrefixedMojo extends AbstractStudioMojo
+{
 
     /**
      * Collection of ArtifactItems to work on. (ArtifactItem contains groupId,
@@ -60,34 +63,45 @@
      */
     private File outputDirectory;
 
+
     /**
      * @param outputDirectory
      *            the outputDirectory to set
      */
-    public void setOutputDirectory(File outputDirectory) {
+    public void setOutputDirectory( File outputDirectory )
+    {
         this.outputDirectory = outputDirectory;
     }
 
-    public void execute() throws MojoExecutionException {
+
+    public void execute() throws MojoExecutionException
+    {
         final Maven2OsgiConverter maven2OsgiConverter = new DefaultMaven2OsgiConverter();
-        completeArtifactItems(artifactItems);
-        for (Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext();) {
+        completeArtifactItems( artifactItems );
+        for ( Iterator<ArtifactItem> artifactItem = artifactItems.iterator(); artifactItem.hasNext(); )
+        {
             ArtifactItem item = artifactItem.next();
-            try {
-                final File tmpDir = new File(outputDirectory.getAbsoluteFile() + File.separator + maven2OsgiConverter.getBundleSymbolicName(item.getArtifact())
-                        + "_" + maven2OsgiConverter.getVersion(item.getArtifact()));
-                unpackToLocation(tmpDir, item.getArtifact().getFile());
-            } catch (Exception e) {
-                throw new MojoExecutionException("", e);
+            try
+            {
+                final File tmpDir = new File( outputDirectory.getAbsoluteFile() + File.separator
+                    + maven2OsgiConverter.getBundleSymbolicName( item.getArtifact() ) + "_"
+                    + maven2OsgiConverter.getVersion( item.getArtifact() ) );
+                unpackToLocation( tmpDir, item.getArtifact().getFile() );
+            }
+            catch ( Exception e )
+            {
+                throw new MojoExecutionException( "", e );
             }
         }
     }
 
+
     /**
      * @param artifactItems
      *            the artifactItems to set
      */
-    public void setArtifactItems(ArrayList<ArtifactItem> artifactItems) {
+    public void setArtifactItems( ArrayList<ArtifactItem> artifactItems )
+    {
         this.artifactItems = artifactItems;
     }
 



Mime
View raw message