1
2
3
4
5
6 package org.openrdf.repository.memento;
7
8 import org.openrdf.repository.RepositoryConnection;
9 import org.openrdf.repository.RepositoryException;
10
11
12
13
14
15
16
17 class OverrideNamespaceCommand implements Command {
18 private String prefix;
19
20 private String oldNS;
21
22 private String newNS;
23
24 public OverrideNamespaceCommand(String prefix, String oldNS, String newNS) {
25 super();
26 this.prefix = prefix;
27 this.oldNS = oldNS;
28 this.newNS = newNS;
29 }
30
31 public void undo(RepositoryConnection conn) throws RepositoryException {
32 if (oldNS == null) {
33 conn.removeNamespace(prefix);
34 } else {
35 conn.setNamespace(prefix, oldNS);
36 }
37 }
38
39 public void redo(RepositoryConnection conn) throws RepositoryException {
40 if (newNS == null) {
41 conn.removeNamespace(prefix);
42 } else {
43 conn.setNamespace(prefix, newNS);
44 }
45 }
46
47 }