]> git.argeo.org Git - gpl/argeo-slc.git/blob - SvnBackup.java
711f51831aa23a2aa951fe70a9b4d0d4578fb11f
[gpl/argeo-slc.git] / SvnBackup.java
1 package org.argeo.maintenance.backup.vfs;
2
3 import java.io.File;
4
5 import org.apache.commons.vfs2.FileObject;
6
7 /** Backups a Subversion repository using svnadmin. */
8 public class SvnBackup extends OsCallBackup {
9 private String svnadminLocation = "/usr/bin/svnadmin";
10
11 private String repoLocation;
12 private String repoName;
13
14 public SvnBackup() {
15 }
16
17 public SvnBackup(String repoLocation) {
18 this.repoLocation = repoLocation;
19 init();
20 }
21
22 @Override
23 public void init() {
24 // use directory as repo name
25 if (repoName == null)
26 repoName = new File(repoLocation).getName();
27
28 if (getName() == null)
29 setName(repoName + ".svndump");
30 super.init();
31 }
32
33 @Override
34 public void writeBackup(FileObject targetFo) {
35 if (getCommand() == null) {
36 setCommand(svnadminLocation + " dump " + " ${repoLocation}");
37 }
38 getVariables().put("repoLocation", repoLocation);
39
40 super.writeBackup(targetFo);
41 }
42
43 public void setRepoLocation(String repoLocation) {
44 this.repoLocation = repoLocation;
45 }
46
47 public void setRepoName(String repoName) {
48 this.repoName = repoName;
49 }
50
51 public void setSvnadminLocation(String mysqldumpLocation) {
52 this.svnadminLocation = mysqldumpLocation;
53 }
54
55 }