Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.raster / org.gvsig.raster.lib / org.gvsig.raster.lib.buffer.api / src / main / java / org / gvsig / raster / lib / buffer / api / BufferLocator.java @ 44831

History | View | Annotate | Download (2.23 KB)

1
package org.gvsig.raster.lib.buffer.api;
2

    
3
import org.gvsig.tools.locator.AbstractLocator;
4
import org.gvsig.tools.locator.LocatorException;
5

    
6

    
7
/**
8
 * This {@link Locator} provides the entry point for the gvSIG raster
9
 * {@link BufferManager}.
10
 *
11
 * @author fdiaz
12
 *
13
 */
14
public class BufferLocator extends AbstractLocator {
15

    
16
    private static final String LOCATOR_NAME = "BufferLocator";
17

    
18
    /**
19
     * GeometryManager name used by the locator to access the instance
20
     */
21
    public static final String BUFFER_MANAGER_NAME = "BufferManager";
22

    
23
    private static final String BUFFER_MANAGER_DESCRIPTION = "Buffer manager of gvSIG raster";
24

    
25
    /**
26
     * Unique instance.
27
     */
28
    private static final BufferLocator instance = new BufferLocator();
29

    
30
    /**
31
     * Return the singleton instance.
32
     *
33
     * @return the singleton instance
34
     */
35
    public static BufferLocator getInstance() {
36
        return instance;
37
    }
38

    
39
    @Override
40
    public String getLocatorName() {
41
        return LOCATOR_NAME;
42
    }
43

    
44
    /**
45
     * Return a reference to {@link BufferManager}.
46
     *
47
     * @return a reference to BufferManager
48
     * @throws LocatorException
49
     *             if there is no access to the class or the class cannot be
50
     *             instantiated
51
     * @see Locator#get(String)
52
     */
53
    public static BufferManager getBufferManager() throws LocatorException {
54
        return (BufferManager) getInstance().get(BUFFER_MANAGER_NAME);
55
    }
56

    
57
    /**
58
     * Return a reference to {@link OperationManager}.
59
     *
60
     * @return a reference to OperationListManager
61
     * @throws LocatorException
62
     *             if there is no access to the class or the class cannot be
63
     *             instantiated
64
     * @see Locator#get(String)
65
     */
66
    public static OperationManager getOperationManager() throws LocatorException {
67
        return (OperationManager) getInstance().get(BUFFER_MANAGER_NAME);
68
    }
69

    
70
    /**
71
     * Registers the Class implementing the {@link BufferManager} interface.
72
     *
73
     * @param clazz
74
     *            implementing the BufferManager interface
75
     */
76
    public static void registerBufferManager(Class clazz) {
77
        getInstance().register(BUFFER_MANAGER_NAME, BUFFER_MANAGER_DESCRIPTION,
78
                clazz);
79
    }
80

    
81

    
82
}