View Javadoc

1   /**
2    * 
3    */
4   package net.sf.statsvn.util;
5   
6   import net.sf.statsvn.output.SvnConfigurationOptions;
7   
8   /**
9    * @author jpdaigle
10   *
11   * Utility class to help build svn command strings
12   */
13  public final class SvnCommandHelper {
14  	private SvnCommandHelper() {
15  	}
16  
17  	/**
18  	 * Gets the authentication / non-interactive command part to use when invoking
19  	 * the subversion binary.
20  	 * 
21  	 * @return A String with the username, password and non-interactive settings
22  	 */
23  	public static String getAuthString() {
24  		final StringBuffer strAuth = new StringBuffer(" --non-interactive");
25  		if (SvnConfigurationOptions.getSvnUsername() != null) {
26  			strAuth.append(" --username ").append(SvnConfigurationOptions.getSvnUsername()).append(" --password ").append(
27  			        SvnConfigurationOptions.getSvnPassword());
28  		}
29  
30  		return strAuth.toString();
31  	}
32  
33  }