Statistics
| Revision:

gvsig-scripting / branches / org.gvsig.scripting / org.gvsig.scripting.lib / org.gvsig.scripting.lib.api / src / main / java / org / gvsig / scripting / ScriptingLocator.java @ 199

History | View | Annotate | Download (1.49 KB)

1
package org.gvsig.scripting;
2

    
3
import org.gvsig.tools.locator.BaseLocator;
4
import org.gvsig.tools.locator.Locator;
5
import org.gvsig.tools.locator.LocatorException;
6

    
7
public class ScriptingLocator extends BaseLocator {
8

    
9
        private static final String LOCATOR_NAME = "ScriptingLocator";
10

    
11
        public static final String MANAGER_NAME = "scriptinglocator.manager";
12

    
13
        public static final String MANAGER_DESCRIPTION = "Scripting Manager";
14

    
15
        /**
16
         * Unique instance.
17
         */
18
        private static final ScriptingLocator instance = new ScriptingLocator();
19

    
20
        /**
21
         * Return the singleton instance.
22
         *
23
         * @return the singleton instance
24
         */
25
        public static ScriptingLocator getInstance() {
26
                return instance;
27
        }
28

    
29
        /**
30
         * Return the Locator's name
31
         *
32
         * @return a String with the Locator's name
33
         */
34
        public String getLocatorName() {
35
                return LOCATOR_NAME;
36
        }
37

    
38
        /**
39
         * Return a reference to PersistenceManager.
40
         *
41
         * @return a reference to PersistenceManager
42
         * @throws LocatorException
43
         *             if there is no access to the class or the class cannot be
44
         *             instantiated
45
         * @see Locator#get(String)
46
         */
47
        public static ScriptingManager getManager() throws LocatorException {
48
                return (ScriptingManager) getInstance().get(MANAGER_NAME);
49
        }
50

    
51
        /**
52
         * Registers the Class implementing the PersistenceManager interface.
53
         *
54
         * @param clazz
55
         *            implementing the PersistenceManager interface
56
         */
57
        public static void registerManager(Class clazz) {
58
                getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
59
        }
60
        
61
}