X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=server%2Fruntime%2Forg.argeo.server.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fserver%2Fbackup%2FSvnBackup.java;fp=server%2Fruntime%2Forg.argeo.server.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fserver%2Fbackup%2FSvnBackup.java;h=f1e45c30553b698484a1d77c838a77ad3f741851;hb=6696d5e2d21eb342b4bb096e059f0c77940fedc9;hp=0000000000000000000000000000000000000000;hpb=e13785786edb6cb45fd5598916e64b72cbb1bfc1;p=lgpl%2Fargeo-commons.git diff --git a/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/backup/SvnBackup.java b/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/backup/SvnBackup.java new file mode 100644 index 000000000..f1e45c305 --- /dev/null +++ b/server/runtime/org.argeo.server.core/src/main/java/org/argeo/server/backup/SvnBackup.java @@ -0,0 +1,55 @@ +package org.argeo.server.backup; + +import java.io.File; + +import org.apache.commons.vfs.FileObject; + +/** Backups a Subversion repository using svnadmin. */ +public class SvnBackup extends OsCallBackup { + private String svnadminLocation = "/usr/bin/svnadmin"; + + private String repoLocation; + private String repoName; + + public SvnBackup() { + } + + public SvnBackup(String repoLocation) { + this.repoLocation = repoLocation; + init(); + } + + @Override + public void init() { + // use directory as repo name + if (repoName == null) + repoName = new File(repoLocation).getName(); + + if (getName() == null) + setName(repoName + ".svndump"); + super.init(); + } + + @Override + public void writeBackup(FileObject targetFo) { + if (getCommand() == null) { + setCommand(svnadminLocation + " dump " + " ${repoLocation}"); + } + getVariables().put("repoLocation", repoLocation); + + super.writeBackup(targetFo); + } + + public void setRepoLocation(String repoLocation) { + this.repoLocation = repoLocation; + } + + public void setRepoName(String repoName) { + this.repoName = repoName; + } + + public void setSvnadminLocation(String mysqldumpLocation) { + this.svnadminLocation = mysqldumpLocation; + } + +}