source: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentBasket.java@ 25069

Last change on this file since 25069 was 25069, checked in by sjm84, 12 years ago

Added a function to clear all the documents

  • Property svn:executable set to *
File size: 21.1 KB
Line 
1/*
2 * DocumentBasket.java
3 * Copyright (C) 2006 New Zealand Digital Library, http://www.nzdl.org
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20package org.greenstone.gsdl3.service;
21
22import java.sql.Statement;
23import java.util.Hashtable;
24import java.util.HashMap;
25import java.util.ArrayList;
26import java.util.HashSet;
27import java.util.Iterator;
28
29import org.w3c.dom.Element;
30import org.w3c.dom.NodeList;
31
32import org.greenstone.util.GlobalProperties;
33import org.greenstone.gsdl3.util.GSParams;
34import org.greenstone.gsdl3.util.GSXML;
35import org.greenstone.gsdl3.util.GSPath;
36import org.greenstone.gsdl3.util.UserContext;
37
38import java.net.InetAddress;
39import java.util.Properties;
40import java.util.Date;
41
42import javax.mail.*;
43import javax.mail.internet.*;
44
45import java.awt.event.ActionEvent;
46import java.awt.event.ActionListener;
47import javax.swing.Timer;
48
49import java.io.*;
50
51import org.apache.log4j.*;
52
53public class DocumentBasket extends ServiceRack
54{
55
56 static Logger logger = Logger.getLogger(org.greenstone.gsdl3.service.DocumentBasket.class.getName());
57
58 // the services on offer
59 // these strings must match what is found in the properties file
60 protected static final String ADD_ITEM_SERVICE = "AddDocument";
61 protected static final String DISPLAY_ITEMS_SERVICE = "DisplayDocumentList";
62 protected static final String ITEM_NUM_SERVICE = "GetDocuments";
63 protected static final String DELETE_ITEMS_SERVICE = "DeleteDocuments";
64 protected static final String DELETE_ITEM_SERVICE = "DeleteDocument";
65 protected static final String CLEAR_ITEMS_SERVICE = "ClearDocuments";
66 //added
67 protected static final String MERGE_ITEM_SERVICE = "MergeDocument";
68 protected static final String ITEM_PARAM = "item";
69 protected static final String delimiter = "|";
70 protected static final int delay = 1800000;
71
72 protected static final String BASKET_BOOK = "documentBasketBook";
73
74 protected Hashtable userMap = null;
75 protected Hashtable timerMap = null;
76 protected String username = "";
77 protected String password = "";
78
79 /** constructor */
80 public DocumentBasket()
81 {
82 userMap = new Hashtable();
83 timerMap = new Hashtable();
84 }
85
86 private Hashtable updateDocMap(Element request)
87 {
88 String id = request.getAttribute("uid");
89
90 if (userMap.containsKey(id))
91 {
92 if (timerMap.containsKey(id))
93 {
94 UserTimer timer = (UserTimer) timerMap.get(id);
95 timer.restart();
96 }
97 return (Hashtable) userMap.get(id);
98 }
99 else
100 {
101 UserTimer timer = new UserTimer(delay, id);
102 timerMap.put(id, timer);
103 timer.start();
104 Hashtable newDocs = new Hashtable();
105 userMap.put(id, newDocs);
106 return newDocs;
107 }
108 }
109
110 /** configure this service */
111 public boolean configure(Element info, Element extra_info)
112 {
113 logger.info("Configuring DocumentBasket...");
114 this.config_info = info;
115
116 // set up short_service_info_ - for now just has name and type
117 Element add_service = this.doc.createElement(GSXML.SERVICE_ELEM);
118 add_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
119 add_service.setAttribute(GSXML.NAME_ATT, ADD_ITEM_SERVICE);
120 this.short_service_info.appendChild(add_service);
121
122 // set up short_service_info_ - for now just has name and type
123 Element disp_service = this.doc.createElement(GSXML.SERVICE_ELEM);
124 disp_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
125 disp_service.setAttribute(GSXML.NAME_ATT, DISPLAY_ITEMS_SERVICE);
126 this.short_service_info.appendChild(disp_service);
127
128 // set up short_service_info_ - for now just has name and type
129 Element num_service = this.doc.createElement(GSXML.SERVICE_ELEM);
130 num_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
131 num_service.setAttribute(GSXML.NAME_ATT, ITEM_NUM_SERVICE);
132 this.short_service_info.appendChild(num_service);
133
134 // set up short_service_info_ - for now just has name and type
135 Element delete_service = this.doc.createElement(GSXML.SERVICE_ELEM);
136 delete_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
137 delete_service.setAttribute(GSXML.NAME_ATT, DELETE_ITEMS_SERVICE);
138 this.short_service_info.appendChild(delete_service);
139
140 // set up short_service_info_ - for now just has name and type
141 Element deleteone_service = this.doc.createElement(GSXML.SERVICE_ELEM);
142 deleteone_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
143 deleteone_service.setAttribute(GSXML.NAME_ATT, DELETE_ITEM_SERVICE);
144 this.short_service_info.appendChild(deleteone_service);
145
146 // set up short_service_info_ - for now just has name and type
147 Element deleteall_service = this.doc.createElement(GSXML.SERVICE_ELEM);
148 deleteall_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
149 deleteall_service.setAttribute(GSXML.NAME_ATT, CLEAR_ITEMS_SERVICE);
150 this.short_service_info.appendChild(deleteall_service);
151
152 // set up short_service_info_ - for now just has name and type
153 Element merge_service = this.doc.createElement(GSXML.SERVICE_ELEM);
154 merge_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
155 merge_service.setAttribute(GSXML.NAME_ATT, MERGE_ITEM_SERVICE);
156 this.short_service_info.appendChild(merge_service);
157
158 return true;
159 }
160
161 /** returns a specific service description */
162 protected Element getServiceDescription(String service_id, String lang, String subset)
163 {
164 if (service_id.equals(ADD_ITEM_SERVICE))
165 {
166 Element add_service = this.doc.createElement(GSXML.SERVICE_ELEM);
167 add_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
168 add_service.setAttribute(GSXML.NAME_ATT, ADD_ITEM_SERVICE);
169 return add_service;
170 }
171 if (service_id.equals(DISPLAY_ITEMS_SERVICE))
172 {
173
174 Element disp_service = this.doc.createElement(GSXML.SERVICE_ELEM);
175 disp_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
176 disp_service.setAttribute(GSXML.NAME_ATT, DISPLAY_ITEMS_SERVICE);
177 return disp_service;
178 }
179
180 if (service_id.equals(ITEM_NUM_SERVICE))
181 {
182
183 Element num_service = this.doc.createElement(GSXML.SERVICE_ELEM);
184 num_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
185 num_service.setAttribute(GSXML.NAME_ATT, ITEM_NUM_SERVICE);
186 return num_service;
187 }
188
189 if (service_id.equals(DELETE_ITEMS_SERVICE))
190 {
191
192 Element del_service = this.doc.createElement(GSXML.SERVICE_ELEM);
193 del_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
194 del_service.setAttribute(GSXML.NAME_ATT, DELETE_ITEMS_SERVICE);
195 return del_service;
196 }
197
198 if (service_id.equals(CLEAR_ITEMS_SERVICE))
199 {
200
201 Element clear_service = this.doc.createElement(GSXML.SERVICE_ELEM);
202 clear_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
203 clear_service.setAttribute(GSXML.NAME_ATT, CLEAR_ITEMS_SERVICE);
204 return clear_service;
205 }
206
207 if (service_id.equals(DELETE_ITEM_SERVICE))
208 {
209
210 Element delone_service = this.doc.createElement(GSXML.SERVICE_ELEM);
211 delone_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
212 delone_service.setAttribute(GSXML.NAME_ATT, DELETE_ITEM_SERVICE);
213 return delone_service;
214 }
215 if (service_id.equals(MERGE_ITEM_SERVICE))
216 {
217 Element merge_service = this.doc.createElement(GSXML.SERVICE_ELEM);
218 merge_service.setAttribute(GSXML.TYPE_ATT, "gather"); // what??
219 merge_service.setAttribute(GSXML.NAME_ATT, MERGE_ITEM_SERVICE);
220 return merge_service;
221 }
222 return null;
223 }
224
225 protected Element processAddDocument(Element request)
226 {
227 //System.err.println("REQUEST = " + GSXML.xmlNodeToString(request));
228 Hashtable docsMap = updateDocMap(request);
229 //System.err.println("DOCSMAP = " + docsMap);
230 // Create a new (empty) result message
231 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
232
233 // Get the parameters of the request
234 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
235 if (param_list == null)
236 {
237 logger.error("DocumentBasket Error: AddDocument request had no paramList.");
238 return result; // Return the empty result
239 }
240
241 HashMap params = GSXML.extractParams(param_list, false);
242 //System.err.println("PARAMS = " + params);
243 String item = (String) params.get("item");
244
245 int startIndex = item.startsWith(BASKET_BOOK) ? BASKET_BOOK.length() : 0;
246
247 String collection = "";
248 int pos = item.indexOf(":");
249 if (pos != -1)
250 {
251 collection = item.substring(startIndex, pos);
252 item = item.substring(pos + 1);
253 }
254 System.err.println("COLLECTION ADD IS " + collection);
255 //logger.error("COLLECTION = " + collection + " *** ITEM = " + item);
256 if (docsMap.containsKey(collection))
257 {
258 Hashtable items = (Hashtable) docsMap.get(collection);
259 if (!items.containsKey(item))
260 {
261 Item newItem = generateItem(collection, item);
262 items.put(item, newItem);
263 result.appendChild(newItem.wrapIntoElement());
264 }
265 }
266 else
267 {
268 Hashtable items = new Hashtable();
269 Item newItem = generateItem(collection, item);
270 items.put(item, newItem);
271 docsMap.put(collection, items);
272 result.appendChild(newItem.wrapIntoElement());
273 }
274
275 return result;
276 }
277
278 protected Element processMergeDocument(Element request)
279 {
280 // Get the parameters of the request
281 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
282 if (param_list == null)
283 {
284 logger.error("DocumentBasket Error: MergeDocument request had no paramList.");
285 return null; // Return the empty result
286 }
287
288 HashMap params = GSXML.extractParams(param_list, false);
289
290 String docString = (String) params.get("docs");
291 String[] docs = docString.split("-");
292
293 for (String d : docs)
294 {
295 logger.error("DOC = " + d);
296 }
297
298 /*
299 * try{ System.out.println("Concatenate Two PDF"); PdfReader reader1 =
300 * new PdfReader("3A01-01_Part_1-001.pdf"); PdfReader reader2 = new
301 * PdfReader("3A01-01_Part_1-017.pdf"); PdfCopyFields copy = new
302 * PdfCopyFields(new FileOutputStream("concatenatedPDF.pdf"));
303 * copy.addDocument(reader1); copy.addDocument(reader2); copy.close(); }
304 * catch(Exception ex) { ex.printStackTrace(); }
305 */
306 // added -->
307
308 try
309 {
310 {
311 PrintWriter pw = new PrintWriter(new FileOutputStream("G:/output1.xml"));
312 File file = new File("G:/greenstone3-svn/web/sites/localsite/collect/peij21/archives/HASH0189.dir/");
313 File[] files = file.listFiles();
314
315 for (int i = 0; i < files.length; i++)
316 {
317
318 //System.out.println(files[i].getName());
319 String fileName = files[i].getName();
320
321 if (fileName.equals("doc.xml"))
322 {
323
324 System.out.println("Processing " + files[i].getPath() + "... ");
325 BufferedReader br = new BufferedReader(new FileReader(files[i].getPath()));
326 String line = br.readLine();
327 while (line != null)
328 {
329 pw.println(line);
330 line = br.readLine();
331 }
332 br.close();
333
334 }
335
336 }
337
338 File file1 = new File("G:/greenstone3-svn/web/sites/localsite/collect/peij21/archives/HASHfdc0.dir/");
339 File[] files1 = file1.listFiles();
340
341 for (int i = 0; i < files1.length; i++)
342 {
343
344 //System.out.println(files[i].getName());
345 String fileName = files1[i].getName();
346
347 if (fileName.equals("doc.xml"))
348 {
349
350 System.out.println("Processing " + files1[i].getPath() + "... ");
351 BufferedReader br = new BufferedReader(new FileReader(files1[i].getPath()));
352 String line = br.readLine();
353 while (line != null)
354 {
355 pw.println(line);
356 line = br.readLine();
357 }
358 br.close();
359
360 }
361
362 }
363
364 pw.close();
365
366 System.out.println("All doc.xml files have been concatenated into output1.xml");
367 }
368 }
369 catch (Exception ex)
370 {
371 ex.printStackTrace();
372 }
373 return null;
374 }
375
376 //end
377 private Item generateItem(String collection, String id)
378 {
379 Item item = new Item(collection, id);
380 String to = GSPath.appendLink(collection, "DocumentMetadataRetrieve");
381 ArrayList tmp = new ArrayList();
382 tmp.add(id);
383
384 UserContext userContext = new UserContext();
385 userContext.setLanguage("en");
386 userContext.setUserID("dumy");
387
388 Element response = getDocumentMetadata(to, userContext, tmp.iterator());
389 Element doc_node = (Element) response.getElementsByTagName(GSXML.DOC_NODE_ELEM).item(0);
390
391 String node_id = doc_node.getAttribute(GSXML.NODE_ID_ATT);
392 Element metadata_list = (Element) doc_node.getElementsByTagName(GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER).item(0);
393
394 //assign title metadata if any
395 Element metadata = GSXML.getNamedElement(metadata_list, "metadata", "name", "Title");
396 if (metadata != null)
397 {
398 item.title = GSXML.getNodeText(metadata).trim();
399 }
400 //assign date metadata if any
401 metadata = GSXML.getNamedElement(metadata_list, "metadata", "name", "Date");
402 if (metadata != null)
403 {
404 item.date = GSXML.getNodeText(metadata).trim();
405 }
406
407 //assign root title metadata if any
408 metadata = GSXML.getNamedElement(metadata_list, "metadata", "name", "root_Title");
409 if (metadata != null)
410 {
411 String rootTitle = GSXML.getNodeText(metadata).trim();
412 if (!rootTitle.equals(item.title))
413 {
414 item.rootTitle = rootTitle;
415 }
416
417 }
418
419 return item;
420 }
421
422 protected Element processClearDocuments(Element request)
423 {
424 Hashtable docsMap = updateDocMap(request);
425
426 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
427
428 // Get the parameters of the request
429 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
430
431 if (param_list == null)
432 {
433 logger.error("DocumentBasket Error: DeleteDocument request had no paramList.");
434 return result; // Return the empty result
435 }
436
437 HashMap params = GSXML.extractParams(param_list, false);
438 String collection = (String) params.get(GSParams.COLLECTION);
439
440 System.err.println("COLLECTION = " + collection);
441 if (collection == null)
442 return result;
443
444 docsMap.put(collection, new Hashtable());
445
446 return result;
447 }
448
449 protected Element processDeleteDocuments(Element request)
450 {
451 Hashtable docsMap = updateDocMap(request);
452
453 // Create a new (empty) result message
454 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
455
456 // Get the parameters of the request
457 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
458
459 //GSXML.printXMLNode(param_list);
460
461 if (param_list == null)
462 {
463 logger.error("DocumentBasket Error: DeleteDocument request had no paramList.");
464 return result; // Return the empty result
465 }
466
467 HashMap params = GSXML.extractParams(param_list, false);
468
469 String param = (String) params.get("items");
470
471 if (param == null)
472 return result;
473
474 String[] items = param.split("\\|");
475
476 for (int i = 0; i < items.length; i++)
477 {
478 String item = items[i];
479 if (item.trim().length() == 0)
480 continue;
481
482 String collection = "";
483 int pos = item.indexOf(":");
484 if (pos != -1)
485 {
486 collection = item.substring(0, pos);
487 item = item.substring(pos + 1);
488 }
489
490 if (docsMap.containsKey(collection))
491 {
492 Hashtable itemMap = (Hashtable) docsMap.get(collection);
493 if (itemMap.containsKey(item))
494 {
495 itemMap.remove(item);
496 }
497 if (itemMap.size() == 0)
498 {
499 docsMap.remove(collection);
500 }
501 }
502 }
503
504 return result;
505 }
506
507 protected Element processDeleteDocument(Element request)
508 {
509 Hashtable docsMap = updateDocMap(request);
510
511 // Create a new (empty) result message
512 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
513
514 // Get the parameters of the request
515 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
516
517 //GSXML.printXMLNode(param_list);
518
519 if (param_list == null)
520 {
521 logger.error("DocumentBasket Error: DeleteDocument request had no paramList.");
522 return result; // Return the empty result
523 }
524
525 HashMap params = GSXML.extractParams(param_list, false);
526
527 String item = (String) params.get("item");
528
529 if (item == null)
530 return result;
531
532 String collection = "";
533 int pos = item.indexOf(":");
534
535 if (pos != -1)
536 {
537 collection = item.substring(0, pos);
538 item = item.substring(pos + 1);
539 }
540
541 if (docsMap.containsKey(collection))
542 {
543 Hashtable itemMap = (Hashtable) docsMap.get(collection);
544 if (itemMap.containsKey(item))
545 {
546 itemMap.remove(item);
547 }
548 if (itemMap.size() == 0)
549 {
550 docsMap.remove(collection);
551 }
552 }
553
554 return result;
555 }
556
557 protected Element processGetDocuments(Element request)
558 {
559 // GSXML.printXMLNode(request);
560 Hashtable docsMap = updateDocMap(request);
561
562 // Create a new (empty) result message
563 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
564
565 int size = 0;
566 String ids = "";
567 Iterator keys = docsMap.keySet().iterator();
568
569 while (keys.hasNext())
570 {
571 Hashtable items = (Hashtable) docsMap.get((String) keys.next());
572 size += items.size();
573 Iterator values = items.values().iterator();
574 while (values.hasNext())
575 {
576 Item item = (Item) values.next();
577 result.appendChild(item.wrapIntoElement());
578 }
579 }
580
581 Element selement = this.doc.createElement("size");
582 selement.setAttribute("value", size + "");
583 result.appendChild(selement);
584
585 return result;
586 }
587
588 private Element getDocumentMetadata(String to, UserContext userContext, Iterator ids)
589 {
590
591 // Build a request to obtain some document metadata
592 Element dm_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
593 Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext);
594 dm_message.appendChild(dm_request);
595
596 // Create a parameter list to specify the required metadata information
597 HashSet meta_names = new HashSet();
598 meta_names.add("Title"); // the default
599 meta_names.add("root_Title");
600 meta_names.add("Date");
601
602 Element param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
603
604 Element param = null;
605 Iterator i = meta_names.iterator();
606 while (i.hasNext())
607 {
608 String name = (String) i.next();
609 param = this.doc.createElement(GSXML.PARAM_ELEM);
610 param_list.appendChild(param);
611 param.setAttribute(GSXML.NAME_ATT, "metadata");
612 param.setAttribute(GSXML.VALUE_ATT, name);
613 }
614
615 dm_request.appendChild(param_list);
616
617 // create the doc node list for the metadata request
618 Element dm_doc_list = this.doc.createElement(GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER);
619 dm_request.appendChild(dm_doc_list);
620
621 while (ids.hasNext())
622 {
623 // Add the documentNode to the list
624 Element dm_doc_node = this.doc.createElement(GSXML.DOC_NODE_ELEM);
625 dm_doc_list.appendChild(dm_doc_node);
626 dm_doc_node.setAttribute(GSXML.NODE_ID_ATT, (String) ids.next());
627 }
628
629 return (Element) this.router.process(dm_message);
630 }
631
632 protected Element processDisplayDocumentList(Element request)
633 {
634 Hashtable docsMap = updateDocMap(request);
635
636 // Create a new (empty) result message
637 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM);
638
639 Iterator keys = docsMap.keySet().iterator();
640
641 while (keys.hasNext())
642 {
643 String collection = (String) keys.next();
644 Hashtable items = (Hashtable) docsMap.get(collection);
645 Iterator itemItr = items.values().iterator();
646
647 Element collectionNode = this.doc.createElement("documentList");
648 collectionNode.setAttribute("name", collection);
649 result.appendChild(collectionNode);
650
651 while (itemItr.hasNext())
652 {
653 Item item = (Item) itemItr.next();
654 Element itemElement = this.doc.createElement("item");
655
656 collectionNode.appendChild(itemElement);
657 itemElement.setAttribute("name", item.docid);
658 itemElement.setAttribute("collection", item.collection);
659 itemElement.setAttribute("title", item.title);
660 itemElement.setAttribute("date", item.date);
661 itemElement.setAttribute("root_title", item.rootTitle);
662 }
663 }
664
665 return result;
666 }
667
668 protected class Item
669 {
670 public String collection;
671 public String docid;
672 public String title = "";
673 public String query = "";
674 public String date = "";
675 public String rootTitle = "";
676
677 public Item(String coll, String id)
678 {
679 this.collection = coll;
680 this.docid = id;
681 }
682
683 public boolean equals(Object o)
684 {
685 if (!(o instanceof Item))
686 {
687 return false;
688 }
689
690 Item item = (Item) o;
691 String id = collection + ":" + docid;
692 String idin = item.collection + ":" + item.docid;
693 return id.equals(idin);
694 }
695
696 public String toString()
697 {
698 return collection + ":" + docid + ":" + "[" + ((!rootTitle.equals("")) ? (rootTitle + ":") : "") + title + "]";
699 }
700
701 public Element wrapIntoElement()
702 {
703 Element itemElement = doc.createElement("item");
704 itemElement.setAttribute("name", docid);
705 itemElement.setAttribute("collection", collection);
706 itemElement.setAttribute("title", title);
707 itemElement.setAttribute("date", date);
708 itemElement.setAttribute("root_title", rootTitle);
709 return itemElement;
710 }
711 }
712
713 private class UserTimer extends Timer implements ActionListener
714 {
715 String id = "";
716
717 public UserTimer(int delay, String id)
718 {
719 super(delay, (ActionListener) null);
720 addActionListener(this);
721 this.id = id;
722 }
723
724 public void actionPerformed(ActionEvent e)
725 {
726 userMap.remove(id);
727 timerMap.remove(id);
728 stop();
729 }
730 }
731}
Note: See TracBrowser for help on using the repository browser.