Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.metadata.basic / org.gvsig.metadata.basic.swing / org.gvsig.metadata.swing.basic.api / src / main / java / org / gvsig / metadata / swing / basic / api / MetadataSwingLocator.java @ 40608

History | View | Annotate | Download (3.03 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2010 Infrastructures and Transports Department
4
 * of the Valencian Gobernment (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 Institute of New Imaging Technologies (INIT): 
26
 *   http://www.init.uji.es
27
 * Geographic Information research group: 
28
 *   http://www.geoinfo.uji.es
29
 * Universitat Jaume I UJI, Spain
30
 */
31

    
32
package org.gvsig.metadata.swing.basic.api;
33

    
34
import org.gvsig.tools.locator.BaseLocator;
35
import org.gvsig.tools.locator.Locator;
36
import org.gvsig.tools.locator.LocatorException;
37

    
38
/**
39
 * Locator for the Metadata Library main object instances.
40
 * 
41
 * Replaces the MetadataManager by its own services, by adding as many constants
42
 * and methods as needed, taking the MetadataManager as a guide.
43
 * 
44
 * @author gvSIG Team
45
 * @author <a href="mailto:reinhold@uji.es">cmartin</a>
46
 * @version $Id$
47
 * 
48
 */
49
public class MetadataSwingLocator extends BaseLocator {
50

    
51
        /**
52
         * Unique instance.
53
         */
54
        private static final MetadataSwingLocator instance = new MetadataSwingLocator();
55

    
56
        private static final String METADATA_MANAGER_DESCRIPTION = "Metadata API Library Manager";
57

    
58
        public static final String METADATA_MANAGER_NAME = "org.gvsig.metadata.swing.basic.api.manager";
59

    
60
        /**
61
         * Returns the Metadata singleton instance.
62
         * 
63
         * @return the Metadata singleton instance
64
         */
65
        public static MetadataSwingLocator getInstance() {
66
                return instance;
67
        }
68

    
69
        /**
70
         * Returns a reference to the MetadataManager.
71
         * 
72
         * @return a reference to MetadataManager
73
         * @throws LocatorException
74
         *             if there is no access to the class or the class cannot be
75
         *             instantiated
76
         * @see Locator#get(String)
77
         */
78
        public static MetadataSwingManager getMetadataSwingManager()
79
                        throws LocatorException {
80
                return (MetadataSwingManager) getInstance().get(METADATA_MANAGER_NAME);
81
        }
82

    
83
        public static void registerDefaultMetadataSwingManager(Class clazz) {
84
                getInstance().registerDefault(METADATA_MANAGER_NAME,
85
                                METADATA_MANAGER_DESCRIPTION, clazz);
86
        }
87

    
88
        /**
89
         * Registers the Class implementing the MetadataManager interface.
90
         * 
91
         * @param clazz
92
         *            implementing the MetadataManager interface
93
         */
94
        public static void registerMetadataSwingManager(Class clazz) {
95
                getInstance().register(METADATA_MANAGER_NAME,
96
                                METADATA_MANAGER_DESCRIPTION, clazz);
97
        }
98
}