svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.exportto / org.gvsig.exportto.lib / org.gvsig.exportto.lib.api / src / main / java / org / gvsig / export / ExportLocator.java @ 43925
History | View | Annotate | Download (3.8 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
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 3
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.export; |
25 |
|
26 |
import org.gvsig.export.spi.ExportServiceManager; |
27 |
import org.gvsig.tools.locator.BaseLocator; |
28 |
import org.gvsig.tools.locator.Locator; |
29 |
import org.gvsig.tools.locator.LocatorException; |
30 |
|
31 |
/**
|
32 |
* This locator is the entry point for the Exportto library, providing
|
33 |
* access to all Exportto services through the {@link ExportManager} .
|
34 |
*
|
35 |
* @author gvSIG team
|
36 |
* @version $Id$
|
37 |
*/
|
38 |
public class ExportLocator extends BaseLocator { |
39 |
|
40 |
public static final String MANAGER_NAME = "Export.manager"; |
41 |
public static final String MANAGER_DESCRIPTION = "Export Manager"; |
42 |
|
43 |
public static final String SERVICE_MANAGER_NAME = "Export.serviceManager"; |
44 |
public static final String SERVICE_MANAGER_DESCRIPTION = "Export Service Manager"; |
45 |
|
46 |
private static final String LOCATOR_NAME = "Export.locator"; |
47 |
|
48 |
/**
|
49 |
* Unique instance.
|
50 |
*/
|
51 |
private static final ExportLocator INSTANCE = new ExportLocator(); |
52 |
|
53 |
/**
|
54 |
* Return the singleton instance.
|
55 |
*
|
56 |
* @return the singleton instance
|
57 |
*/
|
58 |
public static ExportLocator getInstance() { |
59 |
return INSTANCE;
|
60 |
} |
61 |
|
62 |
/**
|
63 |
* Return the Locator's name.
|
64 |
*
|
65 |
* @return a String with the Locator's name
|
66 |
*/
|
67 |
@Override
|
68 |
public final String getLocatorName() { |
69 |
return LOCATOR_NAME;
|
70 |
} |
71 |
|
72 |
/**
|
73 |
* Return a reference to the ExportManager.
|
74 |
*
|
75 |
* @return a reference to the ExportManager
|
76 |
* @throws LocatorException
|
77 |
* if there is no access to the class or the class cannot be
|
78 |
* instantiated
|
79 |
* @see Locator#get(String)
|
80 |
*/
|
81 |
public static ExportManager getManager() throws LocatorException { |
82 |
return (ExportManager) getInstance().get(MANAGER_NAME);
|
83 |
} |
84 |
|
85 |
/**
|
86 |
* Registers the Class implementing the ExportManager interface.
|
87 |
*
|
88 |
* @param clazz
|
89 |
* implementing the ExportManager interface
|
90 |
*/
|
91 |
public static void registerManager(Class<? extends ExportManager> clazz) { |
92 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
93 |
} |
94 |
|
95 |
/**
|
96 |
* Return a reference to the ExportServiceMnager.
|
97 |
*
|
98 |
* @return a reference to the ExportServiceMnager
|
99 |
* @throws LocatorException
|
100 |
* if there is no access to the class or the class cannot be
|
101 |
* instantiated
|
102 |
* @see Locator#get(String)
|
103 |
*/
|
104 |
public static ExportServiceManager getServiceManager() throws LocatorException { |
105 |
return (ExportServiceManager) getInstance().get(SERVICE_MANAGER_NAME);
|
106 |
} |
107 |
|
108 |
/**
|
109 |
* Registers the Class implementing the ExportServiceManager interface.
|
110 |
*
|
111 |
* @param clazz
|
112 |
* implementing the ExportServiceManager interface
|
113 |
*/
|
114 |
public static void registerServiceManager(Class<? extends ExportServiceManager> clazz) { |
115 |
getInstance().register(SERVICE_MANAGER_NAME, SERVICE_MANAGER_DESCRIPTION, clazz); |
116 |
} |
117 |
|
118 |
} |