Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.googlecode.mad.mvntools.settingsutil.filestore;
  
  
- Apache License 2.0 -
Abstract Mojo to backup and restore a .x files from a project

LastChangedBy: $Author: marthaler.worb@gmail.com $
LastChangedDate: $Date: 2011-01-03 21:56:04 +0100 (Mo, 03 Jan 2011) $

Author(s):
daniel marthaler
Version:
$Revision: 27 $
Since:
24.12.2010
 
 public abstract class AbstractFilestore extends AbstractMojo {
    
    
 
     private static final String OWN_ARTIFACTID = "settingsutil";
    
 
     private static final String OWN_GROUPID = "com.googlecode.mad-mvntools";
     protected final static String FOLDER        = "XXfolder:";
     protected final static String FILE          = "XXfile:";
     protected final static String USER          = "default";
     protected final static String USER_KEY      = "user.name";
     protected final static String SEPARATOR_KEY = "file.separator";
     protected final static String TARGET        = "target";
     protected final static String EMTYSTRING    = "";
     
     protected String              fileName      = "abstractFilestore";
     
     protected XStream             xstream       = new XStream(new DomDriver());
    
    
The project dependencies. *

Parameter:
expression="${project.build.directory} "
 
     protected String              buildDir;
     
     protected String[]            files         = { ".project"".classpath" };
     
     protected String[]            folders       = { ".settings" };
    
    
The configured files

Parameter:
alias="files"
 
     private String[]              providedFiles;
    
    
The configured folders

Parameter:
alias="folders"
 
     private String[]              providedFolders;
    
    
The name of the backup-file

Parameter:
alias="backupfile" default-value="settingsutil.xml"
 
     protected String              backupFile;
    
    
The User

Parameter:
expression="${name}" default-value="default"
 
     protected String              name;
     
     // /**
     // * @parameter default-value="${project}"
     // */
     // private org.apache.maven.project.MavenProject mavenProject;
     
     protected String              delimiter;
     
     protected IFileUtil           fileUtil      = Factory.getInstance().getIFileUtil();
     
     protected IMavenVersionUtil   mvnUtil       = Factory.getInstance().getIMavenVersionUtil();
     
     public void execute() throws MojoExecutionException {
         
         this.getLog().info(this..getMavenString(this.getClass()));
         
         // overwrite the default files and folders if there are cnfigured ones
        if ((this. != null) && (this..length > 0)) {
            this. = this.;
        }
        
        if ((this. != null) && (this..length > 0)) {
            this. = this.;
        }
        // set the user
        if (this..equals(.)) {
            this. = System.getProperty(.);
        }
        // set the delimiter
        this. = System.getProperty(.);
        
        this.myExecute();
        
    }
    
    protected abstract void myExecute();
    
    protected String getRootPath() {
    }
    
New to GrepCode? Check out our FAQ X