root / org.gvsig.educa.portableview / trunk / org.gvsig.educa.portableview / org.gvsig.educa.portableview.lib / org.gvsig.educa.portableview.lib.api / src / main / java / org / gvsig / educa / portableview / PortableViewManager.java @ 403
History | View | Annotate | Download (6.77 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (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 |
package org.gvsig.educa.portableview; |
23 |
|
24 |
import java.io.File; |
25 |
import java.io.IOException; |
26 |
import java.util.List; |
27 |
|
28 |
import org.gvsig.educa.portableview.compilation.PortableViewCompilation; |
29 |
import org.gvsig.educa.portableview.compilation.PortableViewCompiler; |
30 |
import org.gvsig.educa.portableview.map.CantLoadContextException; |
31 |
import org.gvsig.educa.portableview.map.InvalidPortableViewFormatException; |
32 |
import org.gvsig.educa.portableview.map.PortableView; |
33 |
import org.gvsig.educa.portableview.map.PortableViewInformation; |
34 |
import org.gvsig.tools.dispose.Disposable; |
35 |
|
36 |
/**
|
37 |
* Library Manager.
|
38 |
* </p>
|
39 |
* Expose main library's functionalities:
|
40 |
* <ul>
|
41 |
* <li>Set default folders configuration</li>
|
42 |
* <li>Get installed <i>Portable View</i></li>
|
43 |
* <li>Identify and get a <i>Portable View</i> from a file</li>
|
44 |
* <li>Create a new {@link PortableViewCompilation} instance</li>
|
45 |
* <li>Create a new {@link PortableViewCompiler} instance</li>
|
46 |
* </ul>
|
47 |
*
|
48 |
* @author gvSIG team
|
49 |
* @version $Id$
|
50 |
*/
|
51 |
public interface PortableViewManager extends Disposable { |
52 |
|
53 |
public static final String INSTALLER_PROVIDER_NAME = "PortableView"; |
54 |
|
55 |
/**
|
56 |
* Gets default folder to locate installed <i>Portable View</i>
|
57 |
*
|
58 |
* @return default installation folder
|
59 |
*/
|
60 |
String getInstallationMapFolder();
|
61 |
|
62 |
/**
|
63 |
* Sets default folder to locate installed <i>Portable View</i>
|
64 |
*
|
65 |
* @param folder
|
66 |
* @throws IllegalArgumentException
|
67 |
* if <code>folder</code> is a file or can't read or not exists
|
68 |
*/
|
69 |
void setInstallationMapFolder(String folder); |
70 |
|
71 |
/**
|
72 |
* Gets the folder to use to <i>open</i> any <i>Portable
|
73 |
* View</i> before access to the information contained in it.
|
74 |
*
|
75 |
* @return temporal folder
|
76 |
*/
|
77 |
String getTemporalFolder();
|
78 |
|
79 |
/**
|
80 |
* Sets the folder to use to <i>open</i> any <i>Portable View</i>
|
81 |
*
|
82 |
* @param folder
|
83 |
* @throws IllegalArgumentException
|
84 |
* if <code>folder</code> is a file or can't write
|
85 |
*/
|
86 |
void setTemporalFolder(String folder); |
87 |
|
88 |
/**
|
89 |
* Clear all data in temporal folder
|
90 |
*/
|
91 |
void cleanAllTemporalData();
|
92 |
|
93 |
/**
|
94 |
* Returns all <i>Portable View</i> installed
|
95 |
* </p>
|
96 |
* Uses installation folder to locate them
|
97 |
*
|
98 |
* @return All <i>Portable View></i> installed
|
99 |
*/
|
100 |
List<PortableView> getInstalledMaps();
|
101 |
|
102 |
/**
|
103 |
* Returns all <i>Portable View</i> installed into the specified folder
|
104 |
* </p>
|
105 |
* Uses installation folder to locate them
|
106 |
*
|
107 |
* @param folder
|
108 |
* to analyze
|
109 |
* @return All <i>Portable View></i> installed
|
110 |
* @throws IllegalArgumentException
|
111 |
* if folder is not valid (a readable folder)
|
112 |
*/
|
113 |
List<PortableView> getInstalledMaps(String folder); |
114 |
|
115 |
/**
|
116 |
* Gets a {@link PortableView} from a file
|
117 |
* </p>
|
118 |
*
|
119 |
* @param file
|
120 |
* @return the <i>Portable View</i>
|
121 |
* @throws InvalidPortableViewFormatException
|
122 |
*/
|
123 |
PortableView getMapFromFile(File file)
|
124 |
throws InvalidPortableViewFormatException;
|
125 |
|
126 |
/**
|
127 |
* Gets a {@link PortableView} from intalledMaps
|
128 |
* by its id
|
129 |
* </p>
|
130 |
*
|
131 |
* @param mapid
|
132 |
* PortableView id
|
133 |
* @return the <i>Portable View</i>
|
134 |
*/
|
135 |
PortableView getMapById(String mapId);
|
136 |
|
137 |
/**
|
138 |
* Informs if a file is a valid <i>Portable View</i> file
|
139 |
*
|
140 |
* @param file
|
141 |
* @return
|
142 |
*/
|
143 |
boolean isMap(File file); |
144 |
|
145 |
/**
|
146 |
* Informs if a folder is a valid <i>Portable View</i> installed folder
|
147 |
*
|
148 |
* @param file
|
149 |
* @return
|
150 |
*/
|
151 |
boolean isAPortableViewIntalledFolder(File folder); |
152 |
|
153 |
/**
|
154 |
* Creates a new instance of a {@link PortableViewCompilation}
|
155 |
*
|
156 |
* @return
|
157 |
*/
|
158 |
PortableViewCompilation createCompilationInstance(); |
159 |
|
160 |
/**
|
161 |
* Creates a new instance of a {@link PortableViewCompilation} based on
|
162 |
* values <code>map</code>
|
163 |
*
|
164 |
* @param map
|
165 |
* to use as template
|
166 |
* @return
|
167 |
* @throws IOException
|
168 |
* @throws CantLoadContextException
|
169 |
* @throws InvalidPortableViewFormatException
|
170 |
*/
|
171 |
PortableViewCompilation createCompilationInstanceFromMap(PortableView map) |
172 |
throws InvalidPortableViewFormatException, CantLoadContextException,
|
173 |
IOException;
|
174 |
|
175 |
/**
|
176 |
* Create a new instance of a {@link PortableViewCompiler}
|
177 |
*
|
178 |
* @return
|
179 |
*/
|
180 |
PortableViewCompiler createCompilerInstance(); |
181 |
|
182 |
/**
|
183 |
* Generates the base name for a PortableView file using its info data
|
184 |
*
|
185 |
* @param info
|
186 |
* @return
|
187 |
*/
|
188 |
String getBaseFileNameFromInfo(PortableViewInformation info);
|
189 |
|
190 |
/**
|
191 |
* Generates the base name for a PortableView file
|
192 |
*
|
193 |
* @param info
|
194 |
* @return
|
195 |
*/
|
196 |
String getBaseFileNameFromInfo(String id, String name, int version, |
197 |
int buildNumber);
|
198 |
|
199 |
/**
|
200 |
* Create a gvSIG package file (gvspkg) from a portableView
|
201 |
*
|
202 |
* @param mapId
|
203 |
* id of map to export
|
204 |
* @param targetFolder
|
205 |
* where write package file
|
206 |
* @return
|
207 |
* @throws PortableViewException
|
208 |
* @throws IOException
|
209 |
*/
|
210 |
File generatePackageFile(String mapId, File targetFolder) |
211 |
throws PortableViewException, IOException; |
212 |
|
213 |
/**
|
214 |
* Create a gvSIG package file (gvspkg) from a portableView installed folder
|
215 |
*
|
216 |
* @param portableViewIntallFolder
|
217 |
* folder of a installed PortableView
|
218 |
* @param targetFolder
|
219 |
* where write package file
|
220 |
* @return
|
221 |
* @throws PortableViewException
|
222 |
* @throws IOException
|
223 |
*/
|
224 |
File generatePackageFile(File portableViewIntallFolder, File targetFolder) |
225 |
throws PortableViewException, IOException; |
226 |
|
227 |
/**
|
228 |
* Returns the translation of a string.
|
229 |
*
|
230 |
* @param key
|
231 |
* String to translate
|
232 |
* @return a String with the translation of the string passed by parameter
|
233 |
*/
|
234 |
public String getTranslation(String key); |
235 |
} |