Revision 24064 branches/v2_0_0_prep/libraries/libTools/src/org/gvsig/tools/locator/AbstractLocator.java
AbstractLocator.java | ||
---|---|---|
2 | 2 |
* |
3 | 3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
4 | 4 |
* of the Valencian Gobernment (CIT) |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* This program is free software; you can redistribute it and/or |
7 | 7 |
* modify it under the terms of the GNU General Public License |
8 | 8 |
* as published by the Free Software Foundation; either version 2 |
9 | 9 |
* of the License, or (at your option) any later version. |
10 |
*
|
|
10 |
* |
|
11 | 11 |
* This program is distributed in the hope that it will be useful, |
12 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | 14 |
* GNU General Public License for more details. |
15 |
*
|
|
15 |
* |
|
16 | 16 |
* You should have received a copy of the GNU General Public License |
17 | 17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 | 19 |
* MA 02110-1301, USA. |
20 |
*
|
|
20 |
* |
|
21 | 21 |
*/ |
22 | 22 |
|
23 | 23 |
/* |
... | ... | |
36 | 36 |
|
37 | 37 |
/** |
38 | 38 |
* Locator implementation based on the use of the ExtensionPoints. |
39 |
*
|
|
39 |
* |
|
40 | 40 |
* @author <a href="mailto:cordin@disid.com">C?sar Ordi?ana</a> |
41 | 41 |
*/ |
42 | 42 |
public abstract class AbstractLocator implements Locator { |
... | ... | |
77 | 77 |
.add(getLocatorName(), name, clazz); |
78 | 78 |
} |
79 | 79 |
|
80 |
public void registerDefault(String name, Class clazz) { |
|
81 |
ExtensionPoint ep = getExtensionPoint(); |
|
82 |
if (ep.get(name) == null) { |
|
83 |
register(name, clazz); |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
80 | 87 |
public void register(String name, String description, Class clazz) { |
81 | 88 |
ExtensionPointsSingleton.getInstance().add(getLocatorName(), name, |
82 | 89 |
description, clazz); |
83 | 90 |
} |
84 | 91 |
|
92 |
public void registerDefault(String name, String description, Class clazz) { |
|
93 |
ExtensionPoint ep = getExtensionPoint(); |
|
94 |
if( ep.get(name) == null ) { |
|
95 |
register(name,description, clazz); |
|
96 |
} |
|
97 |
} |
|
98 |
|
|
85 | 99 |
public void register(String name, LocatorObjectFactory factory) { |
86 | 100 |
ExtensionPointsSingleton.getInstance().add(getLocatorName(), name, |
87 | 101 |
factory); |
... | ... | |
92 | 106 |
ExtensionPointsSingleton.getInstance().add(getLocatorName(), name, |
93 | 107 |
description, factory); |
94 | 108 |
} |
95 |
|
|
109 |
|
|
96 | 110 |
public String toString() { |
97 | 111 |
return getLocatorName(); |
98 | 112 |
} |
Also available in: Unified diff