1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.argeo.maintenance.backup.vfs;
17
18 import org.apache.commons.vfs2.FileObject;
19 import org.argeo.maintenance.MaintenanceException;
20
21
22 public class OpenLdapBackup extends OsCallBackup {
23 private String slapcatLocation = "/usr/sbin/slapcat";
24 private String slapdConfLocation = "/etc/openldap/slapd.conf";
25 private String baseDn;
26
27 public OpenLdapBackup() {
28 super();
29 }
30
31 public OpenLdapBackup(String baseDn) {
32 super();
33 this.baseDn = baseDn;
34 }
35
36 @Override
37 public void writeBackup(FileObject targetFo) {
38 if (baseDn == null)
39 throw new MaintenanceException("Base DN must be set");
40
41 if (getCommand() == null)
42 setCommand(slapcatLocation
43 + " -f ${slapdConfLocation} -b '${baseDn}'");
44 getVariables().put("slapdConfLocation", slapdConfLocation);
45 getVariables().put("baseDn", baseDn);
46
47 super.writeBackup(targetFo);
48 }
49
50 public void setSlapcatLocation(String slapcatLocation) {
51 this.slapcatLocation = slapcatLocation;
52 }
53
54 public void setSlapdConfLocation(String slapdConfLocation) {
55 this.slapdConfLocation = slapdConfLocation;
56 }
57
58 public void setBaseDn(String baseDn) {
59 this.baseDn = baseDn;
60 }
61
62 }