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 @ 44386
History | View | Annotate | Download (3.98 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 ENTRIES_MANAGER_NAME = "Export.entriesManager"; |
44 |
public static final String ENTRIES_MANAGER_DESCRIPTION = "Export Entries Manager"; |
45 |
|
46 |
public static final String SERVICE_MANAGER_NAME = "Export.serviceManager"; |
47 |
public static final String SERVICE_MANAGER_DESCRIPTION = "Export Service Manager"; |
48 |
|
49 |
private static final String LOCATOR_NAME = "Export.locator"; |
50 |
|
51 |
/**
|
52 |
* Unique instance.
|
53 |
*/
|
54 |
private static final ExportLocator INSTANCE = new ExportLocator(); |
55 |
|
56 |
/**
|
57 |
* Return the singleton instance.
|
58 |
*
|
59 |
* @return the singleton instance
|
60 |
*/
|
61 |
public static ExportLocator getInstance() { |
62 |
return INSTANCE;
|
63 |
} |
64 |
|
65 |
/**
|
66 |
* Return the Locator's name.
|
67 |
*
|
68 |
* @return a String with the Locator's name
|
69 |
*/
|
70 |
@Override
|
71 |
public final String getLocatorName() { |
72 |
return LOCATOR_NAME;
|
73 |
} |
74 |
|
75 |
/**
|
76 |
* Return a reference to the ExportManager.
|
77 |
*
|
78 |
* @return a reference to the ExportManager
|
79 |
* @throws LocatorException
|
80 |
* if there is no access to the class or the class cannot be
|
81 |
* instantiated
|
82 |
* @see Locator#get(String)
|
83 |
*/
|
84 |
public static ExportManager getManager() throws LocatorException { |
85 |
return (ExportManager) getInstance().get(MANAGER_NAME);
|
86 |
} |
87 |
|
88 |
/**
|
89 |
* Registers the Class implementing the ExportManager interface.
|
90 |
*
|
91 |
* @param clazz
|
92 |
* implementing the ExportManager interface
|
93 |
*/
|
94 |
public static void registerManager(Class<? extends ExportManager> clazz) { |
95 |
getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
96 |
} |
97 |
|
98 |
/**
|
99 |
* Return a reference to the ExportServiceMnager.
|
100 |
*
|
101 |
* @return a reference to the ExportServiceMnager
|
102 |
* @throws LocatorException
|
103 |
* if there is no access to the class or the class cannot be
|
104 |
* instantiated
|
105 |
* @see Locator#get(String)
|
106 |
*/
|
107 |
public static ExportServiceManager getServiceManager() throws LocatorException { |
108 |
return (ExportServiceManager) getInstance().get(SERVICE_MANAGER_NAME);
|
109 |
} |
110 |
|
111 |
/**
|
112 |
* Registers the Class implementing the ExportServiceManager interface.
|
113 |
*
|
114 |
* @param clazz
|
115 |
* implementing the ExportServiceManager interface
|
116 |
*/
|
117 |
public static void registerServiceManager(Class<? extends ExportServiceManager> clazz) { |
118 |
getInstance().register(SERVICE_MANAGER_NAME, SERVICE_MANAGER_DESCRIPTION, clazz); |
119 |
} |
120 |
|
121 |
} |