01: // /xml.bookmarks/tags/get.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: //
08: // last major change: 27.12.2005
09: // this file is contributed by Alexander Schier
10: //
11: // This program is free software; you can redistribute it and/or modify
12: // it under the terms of the GNU General Public License as published by
13: // the Free Software Foundation; either version 2 of the License, or
14: // (at your option) any later version.
15: //
16: // This program is distributed in the hope that it will be useful,
17: // but WITHOUT ANY WARRANTY; without even the implied warranty of
18: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: // GNU General Public License for more details.
20: //
21: // You should have received a copy of the GNU General Public License
22: // along with this program; if not, write to the Free Software
23: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24: //
25: // Using this software in any meaning (reading, learning, copying, compiling,
26: // running) means that you agree that the Author(s) is (are) not responsible
27: // for cost, loss of data or any harm that may be caused directly or indirectly
28: // by usage of this softare or this documentation. The usage of this software
29: // is on your own risk. The installation and usage (starting/running) of this
30: // software may allow other people or application to access your computer and
31: // any attached devices and is highly dependent on the configuration of the
32: // software which must be done by the user of the software; the author(s) is
33: // (are) also not responsible for proper configuration and usage of the
34: // software, even if provoked by documentation provided together with
35: // the software.
36: //
37: // Any changes to this file according to the GPL as documented in the file
38: // gpl.txt aside this file in the shipment you received can be done to the
39: // lines that follows this copyright notice here, but changes must not be
40: // done inside the copyright notive above. A re-distribution must contain
41: // the intact and unchanged copyright notice.
42: // Contributions and changes to the program code must be marked as such.
43:
44: // You must compile this file with
45: // javac -classpath .:../classes IndexCreate_p.java
46: // if the shell's current path is HTROOT
47:
48: //package xml.bookmarks.tags;
49: package xml.bookmarks.tags;
50:
51: import java.util.Iterator;
52:
53: import de.anomic.data.bookmarksDB;
54: import de.anomic.http.httpHeader;
55: import de.anomic.plasma.plasmaSwitchboard;
56: import de.anomic.server.serverObjects;
57: import de.anomic.server.serverSwitch;
58:
59: public class get {
60: public static serverObjects respond(httpHeader header,
61: serverObjects post, serverSwitch env) {
62: // return variable that accumulates replacements
63: plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
64: boolean isAdmin = switchboard
65: .verifyAuthentication(header, true);
66: serverObjects prop = new serverObjects();
67:
68: Iterator<bookmarksDB.Tag> it = switchboard.bookmarksDB
69: .getTagIterator(isAdmin);
70: int count = 0;
71: bookmarksDB.Tag tag;
72: while (it.hasNext()) {
73: tag = it.next();
74: if (!tag.getTagName().startsWith("/")) { // ignore folder tags
75: prop.put("tags_" + count + "_name", tag.getTagName());
76: prop.put("tags_" + count + "_count", tag.size());
77: count++;
78: }
79: }
80: prop.put("tags", count);
81:
82: // return rewrite properties
83: return prop;
84: }
85:
86: }
|