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 @ 43983
History | View | Annotate | Download (3.8 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 | 40435 | jjdelcerro | |
43 | 43925 | jjdelcerro | public static final String SERVICE_MANAGER_NAME = "Export.serviceManager"; |
44 | public static final String SERVICE_MANAGER_DESCRIPTION = "Export Service Manager"; |
||
45 | 40435 | jjdelcerro | |
46 | 43925 | jjdelcerro | private static final String LOCATOR_NAME = "Export.locator"; |
47 | 40435 | jjdelcerro | |
48 | /**
|
||
49 | * Unique instance.
|
||
50 | */
|
||
51 | 43925 | jjdelcerro | private static final ExportLocator INSTANCE = new ExportLocator(); |
52 | 40435 | jjdelcerro | |
53 | /**
|
||
54 | * Return the singleton instance.
|
||
55 | *
|
||
56 | * @return the singleton instance
|
||
57 | */
|
||
58 | 43925 | jjdelcerro | public static ExportLocator getInstance() { |
59 | 40435 | jjdelcerro | return INSTANCE;
|
60 | } |
||
61 | |||
62 | /**
|
||
63 | * Return the Locator's name.
|
||
64 | *
|
||
65 | * @return a String with the Locator's name
|
||
66 | */
|
||
67 | 43925 | jjdelcerro | @Override
|
68 | 40435 | jjdelcerro | public final String getLocatorName() { |
69 | return LOCATOR_NAME;
|
||
70 | } |
||
71 | |||
72 | /**
|
||
73 | 43925 | jjdelcerro | * Return a reference to the ExportManager.
|
74 | 40435 | jjdelcerro | *
|
75 | 43925 | jjdelcerro | * @return a reference to the ExportManager
|
76 | 40435 | jjdelcerro | * @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 | 43925 | jjdelcerro | public static ExportManager getManager() throws LocatorException { |
82 | return (ExportManager) getInstance().get(MANAGER_NAME);
|
||
83 | 40435 | jjdelcerro | } |
84 | |||
85 | /**
|
||
86 | 43925 | jjdelcerro | * Registers the Class implementing the ExportManager interface.
|
87 | 40435 | jjdelcerro | *
|
88 | * @param clazz
|
||
89 | 43925 | jjdelcerro | * implementing the ExportManager interface
|
90 | 40435 | jjdelcerro | */
|
91 | 43925 | jjdelcerro | public static void registerManager(Class<? extends ExportManager> clazz) { |
92 | 40435 | jjdelcerro | getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz); |
93 | } |
||
94 | |||
95 | 43925 | jjdelcerro | /**
|
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 | 40435 | jjdelcerro | } |