KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > clipbuilder > html > web > Url > URLMap


1 package org.jahia.clipbuilder.html.web.Url;
2
3 import java.util.*;
4
5 /**
6  * Retrieve the source Url thanks to its hash (key)
7  *
8  *@author Tlili Khaled
9  */

10 public class URLMap {
11
12     private Hashtable map = new Hashtable();
13     private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(URLMap.class);
14
15
16     /**
17      * Constructor for the URLMap object
18      */

19     public URLMap() {
20     }
21
22
23     /**
24      * Gets the SourceUrl attribute of the URLMap object
25      *
26      *@param key Description of Parameter
27      *@return The SourceUrl value
28      */

29     public URLWrapper getSourceUrl(String JavaDoc key) {
30         logger.debug("get url whit key: " + key);
31         Object JavaDoc o = map.get(key);
32         if (o == null) {
33             logger.warn("[ No value found for key = " + key + " ]");
34         }
35         return (URLWrapper) map.get(key);
36     }
37
38
39     /**
40      * Adds a feature to the SourceUrl attribute of the URLMap object
41      *
42      *@param uw The feature to be added to the SourceUrl attribute
43      *@param key The feature to be added to the SourceUrl attribute
44      */

45     public void addSourceUrl(URLWrapper uw, String JavaDoc hash) {
46         logger.debug("add url wrapper " + uw.getSourceUrl() + "whit key: " + hash);
47         map.put(hash, uw);
48     }
49
50
51     /**
52      * Description of the Method
53      */

54     public void debug_EnumerateKey() {
55         logger.debug("Start-debug_EnumerateKey");
56         Enumeration enu = map.keys();
57         while (enu.hasMoreElements()) {
58             String JavaDoc key = (String JavaDoc) enu.nextElement();
59             logger.debug("find key: " + key);
60         }
61         logger.debug("End-debug_EnumerateKey");
62     }
63
64
65     /**
66      * Description of the Method
67      */

68     public void reset() {
69         map = new Hashtable();
70     }
71
72 }
73
Popular Tags