| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
package net.sf.statsvn.output; |
| 24 | |
|
| 25 | |
import java.io.File; |
| 26 | |
|
| 27 | |
import net.sf.statcvs.output.ConfigurationException; |
| 28 | |
import net.sf.statcvs.output.ConfigurationOptions; |
| 29 | |
import net.sf.statcvs.util.FileUtils; |
| 30 | |
import net.sf.statsvn.util.JavaUtilTaskLogger; |
| 31 | |
import net.sf.statsvn.util.TaskLogger; |
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
public final class SvnConfigurationOptions { |
| 44 | |
private static final int DEFAULT_THRESHOLD_MS_FOR_CONCURRENCY = 2000; |
| 45 | |
|
| 46 | |
private static final int DEFAULT_NUMBER_THREADS = 25; |
| 47 | |
|
| 48 | 12 | private static String cacheDir = ""; |
| 49 | |
|
| 50 | 12 | private static final String DEFAULT_CACHE_DIR = System.getProperty("user.home") + FileUtils.getDirSeparator() + ".statsvn" + FileUtils.getDirSeparator(); |
| 51 | |
|
| 52 | 12 | private static String svnUsername = null; |
| 53 | |
|
| 54 | 12 | private static String svnPassword = null; |
| 55 | |
|
| 56 | 12 | private static TaskLogger taskLogger = new JavaUtilTaskLogger(); |
| 57 | |
|
| 58 | 12 | private static int numberSvnDiffThreads = DEFAULT_NUMBER_THREADS; |
| 59 | |
|
| 60 | 12 | private static long thresholdInMsToUseConcurrency = DEFAULT_THRESHOLD_MS_FOR_CONCURRENCY; |
| 61 | |
|
| 62 | 12 | private static boolean dump = false; |
| 63 | |
|
| 64 | 12 | private static boolean anonymize = false; |
| 65 | |
|
| 66 | 12 | private static String tagsDirectory = "/tags/"; |
| 67 | |
|
| 68 | |
|
| 69 | 12 | private static boolean useLegacyDiff = false; |
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | 0 | private SvnConfigurationOptions() { |
| 76 | 0 | } |
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
public static String getCacheDir() { |
| 84 | 6 | return cacheDir; |
| 85 | |
} |
| 86 | |
|
| 87 | |
|
| 88 | |
|
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | |
public static void setCacheDir(String cacheDir) throws ConfigurationException { |
| 96 | 3 | if (!cacheDir.endsWith(FileUtils.getDirSeparator())) { |
| 97 | 3 | cacheDir += FileUtils.getDefaultDirSeparator(); |
| 98 | |
} |
| 99 | 3 | final File cDir = new File(cacheDir); |
| 100 | 3 | if (!cDir.exists() && !cDir.mkdirs()) { |
| 101 | 0 | throw new ConfigurationException("Can't create cache directory: " + cacheDir); |
| 102 | |
} |
| 103 | 3 | SvnConfigurationOptions.cacheDir = cacheDir; |
| 104 | 3 | } |
| 105 | |
|
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
public static void setCacheDirToDefault() throws ConfigurationException { |
| 113 | 0 | setCacheDir(DEFAULT_CACHE_DIR); |
| 114 | 0 | } |
| 115 | |
|
| 116 | |
public static File getCheckedOutDirectoryAsFile() { |
| 117 | 0 | return new File(FileUtils.getPathWithoutEndingSlash(ConfigurationOptions.getCheckedOutDirectory()) + FileUtils.getDirSeparator()); |
| 118 | |
} |
| 119 | |
|
| 120 | |
|
| 121 | |
|
| 122 | |
|
| 123 | |
public static String getSvnPassword() { |
| 124 | 0 | return svnPassword; |
| 125 | |
} |
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
|
| 131 | |
public static void setSvnPassword(final String svnPassword) { |
| 132 | 0 | SvnConfigurationOptions.svnPassword = svnPassword; |
| 133 | 0 | } |
| 134 | |
|
| 135 | |
|
| 136 | |
|
| 137 | |
|
| 138 | |
public static String getSvnUsername() { |
| 139 | 0 | return svnUsername; |
| 140 | |
} |
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
public static void setSvnUsername(final String svnUsername) { |
| 147 | 0 | SvnConfigurationOptions.svnUsername = svnUsername; |
| 148 | 0 | } |
| 149 | |
|
| 150 | |
|
| 151 | |
|
| 152 | |
|
| 153 | |
public static TaskLogger getTaskLogger() { |
| 154 | 23501 | return taskLogger; |
| 155 | |
} |
| 156 | |
|
| 157 | |
|
| 158 | |
|
| 159 | |
|
| 160 | |
|
| 161 | |
public static void setTaskLogger(final TaskLogger taskLogger) { |
| 162 | 0 | SvnConfigurationOptions.taskLogger = taskLogger; |
| 163 | 0 | } |
| 164 | |
|
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | |
public static int getNumberSvnDiffThreads() { |
| 169 | 12 | return numberSvnDiffThreads; |
| 170 | |
} |
| 171 | |
|
| 172 | |
|
| 173 | |
|
| 174 | |
|
| 175 | |
|
| 176 | |
public static void setNumberSvnDiffThreads(final int numberSvnDiffThreads) { |
| 177 | 0 | SvnConfigurationOptions.numberSvnDiffThreads = numberSvnDiffThreads; |
| 178 | 0 | } |
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
public static long getThresholdInMsToUseConcurrency() { |
| 184 | 0 | return thresholdInMsToUseConcurrency; |
| 185 | |
} |
| 186 | |
|
| 187 | |
|
| 188 | |
|
| 189 | |
|
| 190 | |
|
| 191 | |
public static void setThresholdInMsToUseConcurrency(final long thresholdToUseConcurrency) { |
| 192 | 0 | SvnConfigurationOptions.thresholdInMsToUseConcurrency = thresholdToUseConcurrency; |
| 193 | 0 | } |
| 194 | |
|
| 195 | |
public static void setDumpContent(final boolean dumpContent) { |
| 196 | 0 | dump = dumpContent; |
| 197 | 0 | } |
| 198 | |
|
| 199 | |
public static boolean isDumpContent() { |
| 200 | 3 | return dump; |
| 201 | |
} |
| 202 | |
|
| 203 | |
public static void setAnonymize(final boolean bAnon) { |
| 204 | 0 | anonymize = bAnon; |
| 205 | 0 | } |
| 206 | |
|
| 207 | |
public static boolean isAnonymize() { |
| 208 | 16653 | return anonymize; |
| 209 | |
} |
| 210 | |
|
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
public static void setTagsDirectory(final String tagsDir) { |
| 215 | 0 | if (tagsDir != null) { |
| 216 | 0 | tagsDirectory = tagsDir.replace('\\', '/'); |
| 217 | 0 | if (!tagsDirectory.endsWith("/")) { |
| 218 | 0 | tagsDirectory = tagsDir + "/"; |
| 219 | |
} |
| 220 | |
} |
| 221 | 0 | } |
| 222 | |
|
| 223 | |
|
| 224 | |
|
| 225 | |
|
| 226 | |
public static String getTagsDirectory() { |
| 227 | 16254 | return tagsDirectory; |
| 228 | |
} |
| 229 | |
|
| 230 | |
|
| 231 | |
|
| 232 | |
|
| 233 | |
|
| 234 | |
|
| 235 | |
public static boolean isLegacyDiff() { |
| 236 | 6 | return useLegacyDiff; |
| 237 | |
} |
| 238 | |
|
| 239 | |
|
| 240 | |
|
| 241 | |
|
| 242 | |
|
| 243 | |
|
| 244 | |
public static void setLegacyDiff(final boolean isLegacy) { |
| 245 | 0 | useLegacyDiff = isLegacy; |
| 246 | 0 | } |
| 247 | |
|
| 248 | |
} |