Coverage Report - org.kuali.maven.plugins.GenerateScriptMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
GenerateScriptMojo
0%
0/23
N/A
1.222
 
 1  
 package org.kuali.maven.plugins;
 2  
 
 3  
 import java.io.File;
 4  
 import java.io.IOException;
 5  
 import java.util.List;
 6  
 
 7  
 import org.apache.maven.artifact.Artifact;
 8  
 import org.apache.maven.plugin.AbstractMojo;
 9  
 import org.apache.maven.plugin.MojoExecutionException;
 10  
 import org.apache.maven.plugin.MojoFailureException;
 11  
 
 12  
 /**
 13  
  * The Oracle JDBC driver download page groups drivers by release but the filenames do not contain the version. This
 14  
  * mojo recursively inspects a directory containing Oracle JDBC drivers following the Oracle style naming convention and
 15  
  * generates a shell script following the Maven style naming convention. The shell script can then be used to upload the
 16  
  * JDBC drivers to a Maven repository.
 17  
  * 
 18  
  * @author Jeff Caddel
 19  
  * @goal genscript
 20  
  */
 21  0
 public class GenerateScriptMojo extends AbstractMojo {
 22  
     /**
 23  
      * Directory on the file system containing Oracle JDBC drivers
 24  
      * 
 25  
      * @parameter expression="${oracle.jdbcDriverDirectory}" default-value="${user.home}/.oracle"
 26  
      */
 27  
     private String jdbcDriverHome;
 28  
 
 29  
     /**
 30  
      * File where the script will be created.
 31  
      * 
 32  
      * @parameter expression="${oracle.scriptDirectory}" default-value="${project.build.directory}/deploy-jars.sh"
 33  
      */
 34  
     private String scriptFile;
 35  
 
 36  
     /**
 37  
      * Default groupId for Oracle JDBC drivers
 38  
      * 
 39  
      * @parameter expression="${oracle.groupId}" default-value="com.oracle"
 40  
      */
 41  
     private String oracleGroupId;
 42  
 
 43  
     /**
 44  
      * A comma delimited list of versions to include. If a value is provided, only jars matching one of the versions
 45  
      * will be included
 46  
      * 
 47  
      * @parameter expression="${oracle.versions}"
 48  
      */
 49  
     private String versions;
 50  
 
 51  
     @Override
 52  
     public void execute() throws MojoExecutionException, MojoFailureException {
 53  0
         DeployUtils du = new DeployUtils();
 54  
         try {
 55  0
             List<Artifact> artifacts = du.getArtifacts(new File(jdbcDriverHome), oracleGroupId, versions);
 56  0
             getLog().info("Located " + artifacts.size() + " artifacts");
 57  0
             getLog().info("Generating script to: " + scriptFile);
 58  0
             String s = du.getShellScript(artifacts);
 59  0
             du.write(scriptFile, s);
 60  0
         } catch (IOException e) {
 61  0
             throw new MojoExecutionException("Unexpected issue", e);
 62  0
         }
 63  0
     }
 64  
 
 65  
     public String getJdbcDriverHome() {
 66  0
         return jdbcDriverHome;
 67  
     }
 68  
 
 69  
     public void setJdbcDriverHome(String jdbcDriverHome) {
 70  0
         this.jdbcDriverHome = jdbcDriverHome;
 71  0
     }
 72  
 
 73  
     public String getScriptFile() {
 74  0
         return scriptFile;
 75  
     }
 76  
 
 77  
     public void setScriptFile(String scriptFile) {
 78  0
         this.scriptFile = scriptFile;
 79  0
     }
 80  
 
 81  
     public String getOracleGroupId() {
 82  0
         return oracleGroupId;
 83  
     }
 84  
 
 85  
     public void setOracleGroupId(String oracleGroupId) {
 86  0
         this.oracleGroupId = oracleGroupId;
 87  0
     }
 88  
 
 89  
     public String getVersions() {
 90  0
         return versions;
 91  
     }
 92  
 
 93  
     public void setVersions(String includeVersions) {
 94  0
         this.versions = includeVersions;
 95  0
     }
 96  
 }