- Timestamp:
- 2012-05-22T13:01:04+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/BerryBasket.java
r24993 r25635 35 35 import org.greenstone.gsdl3.util.UserContext; 36 36 37 import java.io.Serializable; 37 38 import java.net.InetAddress; 38 39 import java.util.Properties; … … 66 67 protected static final int delay = 1800000; 67 68 68 protected Hashtable userMap = null;69 protected Hashtable timerMap = null;69 protected Hashtable<String, Hashtable<String, Hashtable<String, Item>>> userMap = null; 70 protected Hashtable<String, UserTimer> timerMap = null; 70 71 protected String username = ""; 71 72 protected String password = ""; … … 74 75 public BerryBasket() 75 76 { 76 userMap = new Hashtable ();77 timerMap = new Hashtable ();78 } 79 80 private Hashtable updateDocMap(Element request)77 userMap = new Hashtable<String, Hashtable<String, Hashtable<String, Item>>>(); 78 timerMap = new Hashtable<String, UserTimer>(); 79 } 80 81 private Hashtable<String, Hashtable<String, Item>> updateDocMap(Element request) 81 82 { 82 83 … … 87 88 if (timerMap.containsKey(id)) 88 89 { 89 UserTimer timer = (UserTimer)timerMap.get(id);90 UserTimer timer = timerMap.get(id); 90 91 timer.restart(); 91 92 } 92 return (Hashtable)userMap.get(id);93 return userMap.get(id); 93 94 } 94 95 else … … 97 98 timerMap.put(id, timer); 98 99 timer.start(); 99 Hashtable newDocs = new Hashtable();100 Hashtable<String, Hashtable<String, Item>> newDocs = new Hashtable<String, Hashtable<String, Item>>(); 100 101 userMap.put(id, newDocs); 101 102 return newDocs; … … 210 211 protected Element processAddItem(Element request) 211 212 { 212 Hashtable docsMap = updateDocMap(request);213 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 213 214 214 215 // Create a new (empty) result message … … 223 224 } 224 225 225 HashMap params = GSXML.extractParams(param_list, false);226 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 226 227 227 228 String item = (String) params.get("item"); … … 236 237 if (docsMap.containsKey(collection)) 237 238 { 238 Hashtable items = (Hashtable)docsMap.get(collection);239 Hashtable<String, Item> items = docsMap.get(collection); 239 240 if (!items.containsKey(item)) 240 241 { … … 246 247 else 247 248 { 248 Hashtable items = new Hashtable();249 Hashtable<String, Item> items = new Hashtable<String, Item>(); 249 250 Item newItem = generateItem(collection, item); 250 251 items.put(item, newItem); … … 261 262 Item item = new Item(collection, id); 262 263 String to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); 263 ArrayList tmp = new ArrayList();264 ArrayList<String> tmp = new ArrayList<String>(); 264 265 tmp.add(id); 265 266 … … 303 304 protected Element processDeleteItems(Element request) 304 305 { 305 Hashtable docsMap = updateDocMap(request);306 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 306 307 307 308 // Create a new (empty) result message … … 317 318 } 318 319 319 HashMap params = GSXML.extractParams(param_list, false);320 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 320 321 321 322 String param = (String) params.get("items"); … … 341 342 if (docsMap.containsKey(collection)) 342 343 { 343 Hashtable itemMap = (Hashtable)docsMap.get(collection);344 Hashtable itemMap = docsMap.get(collection); 344 345 if (itemMap.containsKey(item)) 345 346 { … … 359 360 protected Element processDeleteItem(Element request) 360 361 { 361 Hashtable docsMap = updateDocMap(request);362 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 362 363 363 364 // Create a new (empty) result message … … 373 374 } 374 375 375 HashMap params = GSXML.extractParams(param_list, false);376 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 376 377 377 378 String param = (String) params.get("item"); … … 393 394 if (docsMap.containsKey(collection)) 394 395 { 395 Hashtable itemMap = (Hashtable)docsMap.get(collection);396 Hashtable itemMap = docsMap.get(collection); 396 397 if (itemMap.containsKey(item)) 397 398 { … … 409 410 protected Element processItemNum(Element request) 410 411 { 411 Hashtable docsMap = updateDocMap(request);412 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 412 413 413 414 // Create a new (empty) result message … … 416 417 int size = 0; 417 418 String ids = ""; 418 Iterator keys = docsMap.keySet().iterator();419 Iterator<String> keys = docsMap.keySet().iterator(); 419 420 420 421 while (keys.hasNext()) 421 422 { 422 Hashtable items = (Hashtable) docsMap.get((String)keys.next());423 Hashtable items = docsMap.get(keys.next()); 423 424 size += items.size(); 424 425 Iterator values = items.values().iterator(); … … 437 438 } 438 439 439 private Element getDocumentMetadata(String to, UserContext userContext, Iterator ids)440 private Element getDocumentMetadata(String to, UserContext userContext, Iterator<String> ids) 440 441 { 441 442 … … 446 447 447 448 // Create a parameter list to specify the required metadata information 448 HashSet meta_names = new HashSet();449 HashSet<String> meta_names = new HashSet<String>(); 449 450 meta_names.add("Title"); // the default 450 451 meta_names.add("root_Title"); … … 454 455 455 456 Element param = null; 456 Iterator i = meta_names.iterator();457 Iterator<String> i = meta_names.iterator(); 457 458 while (i.hasNext()) 458 459 { 459 String name = (String)i.next();460 String name = i.next(); 460 461 param = this.doc.createElement(GSXML.PARAM_ELEM); 461 462 param_list.appendChild(param); … … 476 477 Element dm_doc_node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 477 478 dm_doc_list.appendChild(dm_doc_node); 478 dm_doc_node.setAttribute(GSXML.NODE_ID_ATT, (String)ids.next());479 dm_doc_node.setAttribute(GSXML.NODE_ID_ATT, ids.next()); 479 480 } 480 481 … … 485 486 protected Element processDisplayList(Element request) 486 487 { 487 Hashtable docsMap = updateDocMap(request);488 Hashtable<String, Hashtable<String, Item>> docsMap = updateDocMap(request); 488 489 489 490 // Create a new (empty) result message 490 491 Element result = this.doc.createElement(GSXML.RESPONSE_ELEM); 491 492 492 Iterator keys = docsMap.keySet().iterator();493 Iterator<String> keys = docsMap.keySet().iterator(); 493 494 494 495 while (keys.hasNext()) 495 496 { 496 String collection = (String)keys.next();497 Hashtable items = (Hashtable)docsMap.get(collection);497 String collection = keys.next(); 498 Hashtable items = docsMap.get(collection); 498 499 Iterator itemItr = items.values().iterator(); 499 500 … … 534 535 } 535 536 536 HashMap params = GSXML.extractParams(param_list, false);537 HashMap<String, Serializable> params = GSXML.extractParams(param_list, false); 537 538 538 539 String to = (String) params.get("address");
Note:
See TracChangeset
for help on using the changeset viewer.