01: // /xml.bookmarks/tags/rename_p.java
02: // -------------------------------
03: // part of the AnomicHTTPD caching proxy
04: // (C) by Michael Peter Christen; mc@anomic.de
05: // first published on http://www.anomic.de
06: // Frankfurt, Germany, 2004, 2005
07: // last major change: 28.12.2005
08: // this file is contributed by Alexander Schier
09: //
10: // This program is free software; you can redistribute it and/or modify
11: // it under the terms of the GNU General Public License as published by
12: // the Free Software Foundation; either version 2 of the License, or
13: // (at your option) any later version.
14: //
15: // This program is distributed in the hope that it will be useful,
16: // but WITHOUT ANY WARRANTY; without even the implied warranty of
17: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: // GNU General Public License for more details.
19: //
20: // You should have received a copy of the GNU General Public License
21: // along with this program; if not, write to the Free Software
22: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: //
24: // Using this software in any meaning (reading, learning, copying, compiling,
25: // running) means that you agree that the Author(s) is (are) not responsible
26: // for cost, loss of data or any harm that may be caused directly or indirectly
27: // by usage of this softare or this documentation. The usage of this software
28: // is on your own risk. The installation and usage (starting/running) of this
29: // software may allow other people or application to access your computer and
30: // any attached devices and is highly dependent on the configuration of the
31: // software which must be done by the user of the software; the author(s) is
32: // (are) also not responsible for proper configuration and usage of the
33: // software, even if provoked by documentation provided together with
34: // the software.
35: //
36: // Any changes to this file according to the GPL as documented in the file
37: // gpl.txt aside this file in the shipment you received can be done to the
38: // lines that follows this copyright notice here, but changes must not be
39: // done inside the copyright notive above. A re-distribution must contain
40: // the intact and unchanged copyright notice.
41: // Contributions and changes to the program code must be marked as such.
42:
43: // You must compile this file with
44: // javac -classpath .:../classes IndexCreate_p.java
45: // if the shell's current path is HTROOT
46:
47: //package xml.bookmarks.tags;
48: package xml.bookmarks.tags;
49:
50: import de.anomic.http.httpHeader;
51: import de.anomic.plasma.plasmaSwitchboard;
52: import de.anomic.server.serverObjects;
53: import de.anomic.server.serverSwitch;
54:
55: public class rename_p {
56: public static serverObjects respond(httpHeader header,
57: serverObjects post, serverSwitch env) {
58: // return variable that accumulates replacements
59: plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
60: serverObjects prop = new serverObjects();
61: prop.put("result", "0");//error
62: //rename tags
63: if (post != null && post.containsKey("old")
64: && post.containsKey("new")) {
65: if (switchboard.bookmarksDB.renameTag((String) post
66: .get("old"), (String) post.get("new")))
67: prop.put("result", "1");//success
68: }
69: // return rewrite properties
70: return prop;
71: }
72:
73: }
|