01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2007.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.http.protocol.transaction.operations;
07:
08: import info.aduna.lang.ObjectUtil;
09:
10: import org.openrdf.repository.RepositoryConnection;
11: import org.openrdf.repository.RepositoryException;
12:
13: /**
14: * Operation that removes the namespace for a specific prefix.
15: *
16: * @author Arjohn Kampman
17: */
18: public class RemoveNamespaceOperation implements TransactionOperation {
19:
20: private String prefix;
21:
22: public RemoveNamespaceOperation() {
23: }
24:
25: public RemoveNamespaceOperation(String prefix) {
26: setPrefix(prefix);
27: }
28:
29: public String getPrefix() {
30: return prefix;
31: }
32:
33: public void setPrefix(String prefix) {
34: this .prefix = prefix;
35: }
36:
37: public void execute(RepositoryConnection con)
38: throws RepositoryException {
39: con.removeNamespace(prefix);
40: }
41:
42: @Override
43: public boolean equals(Object other) {
44: if (other instanceof RemoveNamespaceOperation) {
45: RemoveNamespaceOperation o = (RemoveNamespaceOperation) other;
46: return ObjectUtil.nullEquals(getPrefix(), o.getPrefix());
47: }
48:
49: return false;
50: }
51:
52: @Override
53: public int hashCode() {
54: return ObjectUtil.nullHashCode(getPrefix());
55: }
56: }
|