View Javadoc
1   package com.simpligility.maven.plugins.android.configuration;
2   
3   import java.io.File;
4   
5   import com.simpligility.maven.plugins.android.common.AndroidExtension;
6   
7   /**
8    * DeployApk is the configuration pojo for the DeployApk, UndeployApk and RedeployApk mojos.
9    * 
10   * @author Manfred Moser - manfred@simpligility.com
11   */
12  public class DeployApk
13  {
14      private File filename;
15      private String packagename;
16      
17      public File getFilename() 
18      {
19          return filename;
20      }
21  
22      public void setFilename( File filename ) 
23      {
24          this.filename = filename;
25      }
26  
27      public String getPackagename() 
28      {
29          return packagename;
30      }
31  
32      public void setPackagename( String packagename ) 
33      {
34          this.packagename = packagename;
35      }
36  
37      public static ValidationResponse validFileParameter( File parsedFilename )
38      {
39          ValidationResponse result;
40          if ( parsedFilename == null )
41          {
42              result = new ValidationResponse( false, 
43                      "\n\n The parameter android.deployapk.filename is missing. \n" ) ;
44          }
45          else if ( !parsedFilename.isFile() )
46          {
47              result = new ValidationResponse( false, 
48                      "\n\n The file parameter does not point to a file: " 
49                      + parsedFilename.getAbsolutePath() + "\n" );
50          }
51          else if ( !parsedFilename.getAbsolutePath().toLowerCase().endsWith( AndroidExtension.APK ) )
52          {
53              result = new ValidationResponse( false, 
54                      "\n\n The file parameter does not point to an APK: " 
55                      + parsedFilename.getAbsolutePath() + "\n" );
56          } 
57          else 
58          {
59              result = new ValidationResponse( true,
60                      "\n\n Valid file parameter: " 
61                      + parsedFilename.getAbsolutePath() + "\n" );
62          }
63          return result;
64      }
65  }