Coverage Report - com.aurea.maven.plugins.sonic.topology.TopoPackageMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
TopoPackageMojo
0%
0/11
N/A
3
 
 1  
 package com.aurea.maven.plugins.sonic.topology;
 2  
 
 3  
 import java.io.File;
 4  
 
 5  
 import org.apache.maven.plugin.MojoExecutionException;
 6  
 import org.apache.maven.plugin.MojoFailureException;
 7  
 import org.codehaus.plexus.archiver.Archiver;
 8  
 import org.codehaus.plexus.archiver.manager.ArchiverManager;
 9  
 
 10  
 /**
 11  
  * This Mojo is responsible for packaging the generated SDM Model.
 12  
  * 
 13  
  * @goal topo-package
 14  
  */
 15  
 
 16  
 // TODO: Implement a SDM SDO ????
 17  0
 public class TopoPackageMojo extends AbstractTopoMojo {
 18  
   
 19  
           /**
 20  
            * To look up Archiver/UnArchiver implementations.
 21  
            * 
 22  
            * @component
 23  
            * @required
 24  
            */
 25  
           protected ArchiverManager         archiverManager;
 26  
   
 27  
   /**
 28  
    * This method is called from the framework to actually perform the work.
 29  
    * 
 30  
    * @throws MojoExecutionException
 31  
    *           MojoExecutionException
 32  
    * @throws MojoFailureException
 33  
    *           MojoFailureException
 34  
    */
 35  
   protected void doExecute() throws MojoExecutionException, MojoFailureException {
 36  
 
 37  
     try {
 38  
       
 39  
       // package everything up in one archive. That archive is THE maven artifact that will be deployed, installed etc.
 40  0
       File sdmFile = new File(getOutputDirectory(), getFinalAssemblyFileName());
 41  0
       Archiver archiver = archiverManager.getArchiver("zip");
 42  0
       archiver.setDestFile(sdmFile);
 43  0
       archiver.addDirectory(getTargetTopologyDir());
 44  0
       archiver.createArchive();
 45  0
       project.getArtifact().setFile(sdmFile);
 46  0
     } catch (Exception e) {
 47  0
       throw new MojoExecutionException("Error creating Topology project - " + e.getMessage(), e);
 48  0
     }
 49  0
   }
 50  
   
 51  
 }
 52