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 | 40559 | jjdelcerro | /**
|
---|---|---|---|
2 | * gvSIG. Desktop Geographic Information System.
|
||
3 | 40435 | jjdelcerro | *
|
4 | 40559 | jjdelcerro | * Copyright (C) 2007-2013 gvSIG Association.
|
5 | 40435 | jjdelcerro | *
|
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 | 40559 | jjdelcerro | * as published by the Free Software Foundation; either version 3
|
9 | 40435 | jjdelcerro | * 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 | 40559 | jjdelcerro | * For any additional information, do not hesitate to contact us
|
22 | * at info AT gvsig.com, or visit our website www.gvsig.com.
|
||
23 | 40435 | jjdelcerro | */
|
24 | 43925 | jjdelcerro | package org.gvsig.export; |
25 | 40435 | jjdelcerro | |
26 | 43925 | jjdelcerro | import org.gvsig.export.spi.ExportServiceManager; |
27 | 40435 | jjdelcerro | 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 | 43925 | jjdelcerro | * access to all Exportto services through the {@link ExportManager} .
|
34 | 40435 | jjdelcerro | *
|
35 | * @author gvSIG team
|
||
36 | * @version $Id$
|
||
37 | */
|
||
38 | 43925 | jjdelcerro | public class ExportLocator extends BaseLocator { |
39 | 40435 | jjdelcerro | |
40 | 43925 | jjdelcerro | public static final String MANAGER_NAME = "Export.manager"; |
41 | public static final String MANAGER_DESCRIPTION = "Export Manager"; |
||
42 | 44386 | omartinez | |
43 | public static final String ENTRIES_MANAGER_NAME = "Export.entriesManager"; |
||
44 | public static final String ENTRIES_MANAGER_DESCRIPTION = "Export Entries Manager"; |
||
45 | |||
46 | 43925 | jjdelcerro | public static final String SERVICE_MANAGER_NAME = "Export.serviceManager"; |
47 | public static final String SERVICE_MANAGER_DESCRIPTION = "Export Service Manager"; |
||
48 | 40435 | jjdelcerro | |
49 | 43925 | jjdelcerro | private static final String LOCATOR_NAME = "Export.locator"; |
50 | 40435 | jjdelcerro | |
51 | /**
|
||
52 | * Unique instance.
|
||
53 | */
|
||
54 | 43925 | jjdelcerro | private static final ExportLocator INSTANCE = new ExportLocator(); |
55 | 40435 | jjdelcerro | |
56 | /**
|
||
57 | * Return the singleton instance.
|
||
58 | *
|
||
59 | * @return the singleton instance
|
||
60 | */
|
||
61 | 43925 | jjdelcerro | public static ExportLocator getInstance() { |
62 | 40435 | jjdelcerro | return INSTANCE;
|
63 | } |
||
64 | |||
65 | /**
|
||
66 | * Return the Locator's name.
|
||
67 | *
|
||
68 | * @return a String with the Locator's name
|
||
69 | */
|
||
70 | 43925 | jjdelcerro | @Override
|
71 | 40435 | jjdelcerro | public final String getLocatorName() { |
72 | return LOCATOR_NAME;
|
||
73 | } |
||
74 | |||
75 | /**
|
||
76 | 43925 | jjdelcerro | * Return a reference to the ExportManager.
|
77 | 40435 | jjdelcerro | *
|
78 | 43925 | jjdelcerro | * @return a reference to the ExportManager
|
79 | 40435 | jjdelcerro | * @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 | 43925 | jjdelcerro | public static ExportManager getManager() throws LocatorException { |
85 | return (ExportManager) getInstance().get(MANAGER_NAME);
|
||
86 | 40435 | jjdelcerro | } |
87 | |||
88 | /**
|
||
89 | 43925 | jjdelcerro | * Registers the Class implementing the ExportManager interface.
|
90 | 40435 | jjdelcerro | *
|
91 | * @param clazz
|
||
92 | 43925 | jjdelcerro | * implementing the ExportManager interface
|
93 | 40435 | jjdelcerro | */
|
94 | 43925 | jjdelcerro | public static void registerManager(Class<? extends ExportManager> clazz) { |
95 | 40435 | jjdelcerro | getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
96 | } |
||
97 | |||
98 | 43925 | jjdelcerro | /**
|
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 | 44386 | omartinez | |
121 | 40435 | jjdelcerro | } |