Revision 827 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/locator/AbstractLocator.java
AbstractLocator.java | ||
---|---|---|
42 | 42 |
* |
43 | 43 |
* @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a> |
44 | 44 |
*/ |
45 |
public abstract class AbstractLocator implements Locator { |
|
45 |
public abstract class AbstractLocator implements Locator, Locator_withExists {
|
|
46 | 46 |
|
47 | 47 |
private Map instances = new HashMap(); |
48 | 48 |
private Logger logger = LoggerFactory.getLogger(AbstractLocator.class); |
... | ... | |
60 | 60 |
} catch (Exception ex) { |
61 | 61 |
throw new LocatorReferenceException(ex, name, this); |
62 | 62 |
} |
63 |
|
|
64 | 63 |
instances.put(name, instance); |
64 |
logger.info("Stored the instance of " + name + " in the singleton table."); |
|
65 | 65 |
} |
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
return instance; |
69 | 69 |
} |
70 |
|
|
71 |
public boolean exists(String name) { |
|
72 |
return instances.containsKey(name); |
|
73 |
} |
|
70 | 74 |
|
71 | 75 |
private void removeFromInstances(String name) { |
72 | 76 |
synchronized (lock) { |
73 | 77 |
if(instances.containsKey(name)) { |
74 |
logger.info("Removing the instance" + name + " from the extension points");
|
|
78 |
logger.info("Removing the instance of " + name + " from the singleton table.");
|
|
75 | 79 |
instances.remove(name); |
76 | 80 |
} |
77 | 81 |
} |
... | ... | |
95 | 99 |
ExtensionPoint ep = getExtensionPoint(); |
96 | 100 |
if (ep.get(name) == null) { |
97 | 101 |
register(name, clazz); |
98 |
removeFromInstances(name); |
|
99 | 102 |
} |
100 | 103 |
} |
101 | 104 |
|
Also available in: Unified diff