gvsig-projects-pool / org.gvsig.vcsgis / trunk / org.gvsig.vcsgis / org.gvsig.vcsgis.lib / org.gvsig.vcsgis.lib.impl / src / main / java / org / gvsig / vcsgis / lib / VCSGisManagerImpl.java @ 3630
History | View | Annotate | Download (21.2 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright (c) 2007-2015 gvSIG Association
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.vcsgis.lib; |
24 |
|
25 |
import java.io.File; |
26 |
import java.net.URL; |
27 |
import java.util.Collections; |
28 |
import java.util.HashMap; |
29 |
import java.util.List; |
30 |
import java.util.Map; |
31 |
import org.apache.commons.lang3.StringUtils; |
32 |
import org.gvsig.fmap.dal.DALLocator; |
33 |
import org.gvsig.fmap.dal.DataManager; |
34 |
import org.gvsig.fmap.dal.DataServerExplorer; |
35 |
import org.gvsig.fmap.dal.DataStore; |
36 |
import org.gvsig.fmap.dal.DataStoreParameters; |
37 |
import org.gvsig.fmap.dal.DatabaseWorkspaceManager; |
38 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.CONFIG_NAME_STORESREPOSITORYID; |
39 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_CONFIGURATION; |
40 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_CONFIGURATION_NAME; |
41 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_REPOSITORY; |
42 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_RESOURCES; |
43 |
import static org.gvsig.fmap.dal.DatabaseWorkspaceManager.TABLE_RESOURCES_NAME; |
44 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
45 |
import org.gvsig.fmap.dal.feature.FeatureType; |
46 |
import org.gvsig.fmap.dal.store.jdbc.JDBCNewStoreParameters; |
47 |
import org.gvsig.fmap.dal.store.jdbc.JDBCServerExplorerParameters; |
48 |
import org.gvsig.fmap.dal.store.jdbc.JDBCStoreParameters; |
49 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCServerExplorer; |
50 |
import org.gvsig.tools.ToolsLocator; |
51 |
import org.gvsig.tools.dispose.DisposeUtils; |
52 |
import org.gvsig.tools.task.SimpleTaskStatus; |
53 |
import org.gvsig.tools.util.HasAFile; |
54 |
import org.gvsig.tools.util.ListBuilder; |
55 |
import org.gvsig.vcsgis.lib.repository.VCSGisRepository; |
56 |
import org.gvsig.vcsgis.lib.repository.localdb.VCSGisRepositoryLocaldb; |
57 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.DataRepoTable; |
58 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.EntitiesRepoTable; |
59 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.HooksRepoTable; |
60 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.RevisionsRepoTable; |
61 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.ConfigRepoTable; |
62 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.TopologyplanRepoTable; |
63 |
import org.gvsig.vcsgis.lib.repository.localdb.tables.UsersRepoTable; |
64 |
import org.gvsig.vcsgis.lib.repository.remoteclient.VCSGisRepositoryClient; |
65 |
import org.gvsig.vcsgis.lib.server.VCSGisServerController; |
66 |
import org.gvsig.vcsgis.lib.server.VCSGisServerControllerImpl; |
67 |
import org.gvsig.vcsgis.lib.workspace.StoreProperties; |
68 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspace; |
69 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceDescriptor; |
70 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceDescriptorImpl; |
71 |
import org.gvsig.vcsgis.lib.workspace.VCSGisWorkspaceImpl; |
72 |
import org.gvsig.vcsgis.lib.workspace.tables.EntitiesTable; |
73 |
import org.gvsig.vcsgis.lib.workspace.tables.EntitiesTable.EntityRow; |
74 |
import org.gvsig.vcsgis.lib.workspace.tables.LocalRevisionsTable; |
75 |
import org.gvsig.vcsgis.lib.workspace.tables.RemoteChangesTable; |
76 |
import org.gvsig.vcsgis.lib.workspace.tables.TopologyplanTable; |
77 |
import org.gvsig.vcsgis.lib.workspace.tables.UsersTable; |
78 |
import org.gvsig.vcsgis.lib.workspace.tables.VarsTable; |
79 |
import org.gvsig.vcsgis.lib.workspace.tables.WorkspaceChangesTable; |
80 |
import org.slf4j.Logger; |
81 |
import org.slf4j.LoggerFactory; |
82 |
|
83 |
|
84 |
/**
|
85 |
* @author gvSIG Team
|
86 |
*
|
87 |
*/
|
88 |
@SuppressWarnings("UseSpecificCatch") |
89 |
public class VCSGisManagerImpl implements VCSGisManager { |
90 |
private static final Logger LOGGER = LoggerFactory.getLogger(VCSGisManagerImpl.class); |
91 |
|
92 |
|
93 |
|
94 |
public static final List<String> INTERNAL_WORKSPACE_TABLES = ListBuilder.create( |
95 |
EntitiesTable.TABLE_NAME, |
96 |
LocalRevisionsTable.TABLE_NAME, |
97 |
RemoteChangesTable.TABLE_NAME, |
98 |
VarsTable.TABLE_NAME, |
99 |
WorkspaceChangesTable.TABLE_NAME, |
100 |
UsersTable.TABLE_NAME, |
101 |
TopologyplanTable.TABLE_NAME, |
102 |
TABLE_RESOURCES_NAME, |
103 |
TABLE_CONFIGURATION_NAME |
104 |
); |
105 |
|
106 |
public static final List<String> INTERNAL_REPOSITORY_TABLES = ListBuilder.create(DataRepoTable.TABLE_NAME, |
107 |
EntitiesRepoTable.TABLE_NAME, |
108 |
HooksRepoTable.TABLE_NAME, |
109 |
RevisionsRepoTable.TABLE_NAME, |
110 |
ConfigRepoTable.TABLE_NAME, |
111 |
TopologyplanRepoTable.TABLE_NAME, |
112 |
UsersRepoTable.TABLE_NAME, |
113 |
|
114 |
TABLE_RESOURCES_NAME, |
115 |
TABLE_CONFIGURATION_NAME |
116 |
); |
117 |
|
118 |
|
119 |
private Map<String,VCSGisWorkspaceDescriptor> workspaces; |
120 |
private VCSGisCodeGenerator codeGenerator;
|
121 |
private VCSGisUserIdentificationRequester userIdentificationRequester;
|
122 |
|
123 |
public VCSGisManagerImpl() {
|
124 |
this.workspaces = new HashMap<>(); |
125 |
this.codeGenerator = new RandomCodeGenerator(); |
126 |
this.userIdentificationRequester = null; |
127 |
} |
128 |
|
129 |
@Override
|
130 |
public Map<String, VCSGisWorkspaceDescriptor> getWorkspaces() { |
131 |
return Collections.unmodifiableMap(this.workspaces); |
132 |
} |
133 |
|
134 |
@Override
|
135 |
public void restoreWorkspaces(Map<String, VCSGisWorkspaceDescriptor> descriptors) { |
136 |
this.workspaces = new HashMap<>(); |
137 |
if( descriptors != null ) { |
138 |
this.workspaces.putAll(descriptors);
|
139 |
} |
140 |
} |
141 |
|
142 |
@Override
|
143 |
public int initWorkspace(File wsfile, VCSGisRepository repo, String label, SimpleTaskStatus status) { |
144 |
int err = ERR_NO_ERROR;
|
145 |
if (wsfile == null) { |
146 |
return ERR_DBFILE_IS_NULL;
|
147 |
} |
148 |
if (status == null) { |
149 |
status = ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus("vcsgis init_workspace");
|
150 |
status.add(); |
151 |
} |
152 |
status.push(); |
153 |
DataManager dataManager = DALLocator.getDataManager(); |
154 |
try {
|
155 |
wsfile = removeH2FileExtension(wsfile); |
156 |
if (StringUtils.isBlank(label)) {
|
157 |
label = wsfile.getName(); |
158 |
} |
159 |
err = ERR_CANT_OPEN_WORKSPACE_SERVEREXPLORER; |
160 |
JDBCServerExplorerParameters explorerParams = (JDBCServerExplorerParameters) dataManager.createServerExplorerParameters(DataStore.H2SPATIAL_PROVIDER_NAME); |
161 |
((HasAFile) explorerParams).setFile(wsfile); |
162 |
JDBCServerExplorer explorer = (JDBCServerExplorer) dataManager.openServerExplorer( |
163 |
explorerParams.getProviderName(), |
164 |
explorerParams |
165 |
); |
166 |
return this.initWorkspace(explorer, repo, label, status); |
167 |
} catch (Exception ex) { |
168 |
status.abort(); |
169 |
LOGGER.warn("Can't init workspace in '" + wsfile.getAbsolutePath() + "'.", ex); |
170 |
status.message(ex.getMessage()); |
171 |
return err;
|
172 |
} finally {
|
173 |
status.pop(); |
174 |
} |
175 |
} |
176 |
|
177 |
@Override
|
178 |
public int initWorkspace(JDBCServerExplorer wsexplorer, VCSGisRepository repository, String label, SimpleTaskStatus status) { |
179 |
int err = ERR_NO_ERROR;
|
180 |
if (wsexplorer == null) { |
181 |
return ERR_WSEXPLORER_IS_NULL;
|
182 |
} |
183 |
if (StringUtils.isBlank(label)) {
|
184 |
return ERR_LABEL_IS_NULL;
|
185 |
} |
186 |
if (status == null) { |
187 |
status = ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus("vcsgis init_workspace");
|
188 |
status.add(); |
189 |
} |
190 |
status.push(); |
191 |
DataManager dataManager = DALLocator.getDataManager(); |
192 |
try {
|
193 |
status.setTitle("vcsgis init_workspace");
|
194 |
|
195 |
DatabaseWorkspaceManager databaseWorkspaceManager = dataManager.createDatabaseWorkspaceManager(wsexplorer.getParameters()); |
196 |
|
197 |
if(!databaseWorkspaceManager.existsTable(TABLE_CONFIGURATION)){
|
198 |
databaseWorkspaceManager.createTable(TABLE_CONFIGURATION); |
199 |
} |
200 |
if(!databaseWorkspaceManager.existsTable(TABLE_RESOURCES)){
|
201 |
databaseWorkspaceManager.createTable(TABLE_RESOURCES); |
202 |
} |
203 |
if(!databaseWorkspaceManager.existsTable(TABLE_REPOSITORY)){
|
204 |
databaseWorkspaceManager.createTable(TABLE_REPOSITORY); |
205 |
databaseWorkspaceManager.set(CONFIG_NAME_STORESREPOSITORYID, "VCSGIS");
|
206 |
} |
207 |
databaseWorkspaceManager.connect(); |
208 |
|
209 |
|
210 |
FeatureType[] tables = new FeatureType[]{ |
211 |
VarsTable.featureType(), |
212 |
EntitiesTable.featureType(), |
213 |
WorkspaceChangesTable.featureType(), |
214 |
RemoteChangesTable.featureType(), |
215 |
LocalRevisionsTable.featureType(), |
216 |
UsersTable.featureType(), |
217 |
TopologyplanTable.featureType() |
218 |
}; |
219 |
status.setRangeOfValues(0, tables.length);
|
220 |
int step = 1; |
221 |
for (FeatureType table : tables) {
|
222 |
status.message(table.getLabel()); |
223 |
status.setCurValue(step++); |
224 |
err = ERR_CANT_CREATE_TABLE + step; |
225 |
JDBCNewStoreParameters table_params = wsexplorer.getAddParameters(); |
226 |
table_params.setDefaultFeatureType(table.getEditable()); |
227 |
String tableName = table.getTags().getString("ID"); |
228 |
table_params.setTable(tableName); |
229 |
wsexplorer.add(wsexplorer.getProviderName(), table_params, false);
|
230 |
|
231 |
JDBCStoreParameters openParams = wsexplorer.get(tableName); |
232 |
databaseWorkspaceManager.writeStoresRepositoryEntry(tableName, openParams); |
233 |
|
234 |
} |
235 |
try {
|
236 |
wsexplorer.execute(VCSGisUtils.getSqlTemplate(wsexplorer.getProviderName(), "createWorkspaceIndex1"));
|
237 |
wsexplorer.execute(VCSGisUtils.getSqlTemplate(wsexplorer.getProviderName(), "createWorkspaceIndex2"));
|
238 |
wsexplorer.execute(VCSGisUtils.getSqlTemplate(wsexplorer.getProviderName(), "createWorkspaceIndex3"));
|
239 |
|
240 |
} catch (Exception ex) { |
241 |
LOGGER.warn("Can't create index in workspace", ex);
|
242 |
} |
243 |
|
244 |
status.setTitle("vcsgis retrieving entities");
|
245 |
VCSGisWorkspaceImpl workspace = new VCSGisWorkspaceImpl(wsexplorer, this.codeGenerator, repository, label); |
246 |
workspace.initialize(); |
247 |
|
248 |
this.registerWorkspace(workspace);
|
249 |
status.terminate(); |
250 |
return ERR_NO_ERROR;
|
251 |
} catch (Exception ex) { |
252 |
status.abort(); |
253 |
LOGGER.warn("Can't init workspace in '" + getMessageLabel(wsexplorer) + "'.", ex); |
254 |
status.message(ex.getMessage()); |
255 |
return err;
|
256 |
} finally {
|
257 |
status.pop(); |
258 |
} |
259 |
} |
260 |
|
261 |
private String getMessageLabel(JDBCServerExplorer explorer) { |
262 |
return explorer.getParameters().getUrl();
|
263 |
} |
264 |
|
265 |
@Override
|
266 |
public VCSGisWorkspace openWorkspace(File wsfile) { |
267 |
if (wsfile == null) { |
268 |
return null; |
269 |
} |
270 |
try {
|
271 |
DataManager dataManager = DALLocator.getDataManager(); |
272 |
JDBCServerExplorerParameters explorerParams = (JDBCServerExplorerParameters) dataManager.createServerExplorerParameters(DataStore.H2SPATIAL_PROVIDER_NAME); |
273 |
((HasAFile) explorerParams).setFile(wsfile); |
274 |
JDBCServerExplorer explorer = (JDBCServerExplorer) dataManager.openServerExplorer( |
275 |
explorerParams.getProviderName(), |
276 |
explorerParams |
277 |
); |
278 |
VCSGisWorkspace workspace = openWorkspace(explorer); |
279 |
return workspace;
|
280 |
} catch (Exception ex) { |
281 |
return null; |
282 |
} |
283 |
} |
284 |
|
285 |
@Override
|
286 |
public VCSGisWorkspace openWorkspace(JDBCServerExplorer wsexplorer) {
|
287 |
if (wsexplorer == null) { |
288 |
return null; |
289 |
} |
290 |
try {
|
291 |
VCSGisWorkspace workspace; |
292 |
|
293 |
JDBCServerExplorerParameters params = wsexplorer.getParameters(); |
294 |
String url = params.getUrl();
|
295 |
for (VCSGisWorkspaceDescriptor value : this.workspaces.values()) { |
296 |
if (value.isWorkspaceInitialized() && StringUtils.equals(url, value.getExplorerParameters().getUrl())) {
|
297 |
workspace = value.getWorkspace();//FIXME: lo siguiente solo si es null
|
298 |
if(workspace.getUserIdentificationRequester() == null){ |
299 |
workspace.setUserIdentificationRequester(this.userIdentificationRequester);
|
300 |
} |
301 |
// LOGGER.debug("===: OPEN WORKSPACE "+ hexId(workspace)+ " from registry (code='"+workspace.getCode()+"', label='"+workspace.getLabel()+"')");
|
302 |
return workspace;
|
303 |
} |
304 |
} |
305 |
|
306 |
workspace = new VCSGisWorkspaceImpl(wsexplorer, this.codeGenerator); |
307 |
workspace.setUserIdentificationRequester(this.userIdentificationRequester);
|
308 |
this.registerWorkspace(workspace);
|
309 |
return workspace;
|
310 |
} catch (Exception ex) { |
311 |
return null; |
312 |
} |
313 |
} |
314 |
|
315 |
@Override
|
316 |
public void registerWorkspace(VCSGisWorkspace workspace) { |
317 |
VCSGisWorkspaceDescriptorImpl descriptor = new VCSGisWorkspaceDescriptorImpl(workspace);
|
318 |
this.workspaces.put(descriptor.getCode(), descriptor);
|
319 |
} |
320 |
|
321 |
@Override
|
322 |
public void deregisterWorkspace(VCSGisWorkspace workspace) { |
323 |
this.deregisterWorkspace(workspace.getCode());
|
324 |
} |
325 |
|
326 |
@Override
|
327 |
public void deregisterWorkspace(String workspaceCode) { |
328 |
DisposeUtils.disposeQuietly(this.workspaces.get(workspaceCode));
|
329 |
this.workspaces.remove(workspaceCode);
|
330 |
} |
331 |
|
332 |
@Override
|
333 |
public VCSGisWorkspace getWorkspace(FeatureStore store) {
|
334 |
try {
|
335 |
VCSGisWorkspace workspace; |
336 |
switch(StoreProperties.getVCSMode(store)) {
|
337 |
case StoreProperties.MODE_NOT_VCS:
|
338 |
return null; |
339 |
|
340 |
case StoreProperties.MODE_VCS:
|
341 |
String workspace_code = StoreProperties.getWorkspaceCode(store);
|
342 |
VCSGisWorkspaceDescriptor workspaceDescriptor = this.workspaces.get(workspace_code);
|
343 |
if( workspaceDescriptor!=null ) { |
344 |
workspace = workspaceDescriptor.getWorkspace(); |
345 |
if (workspace != null) { |
346 |
String entity_name = StoreProperties.getEntityName(store);
|
347 |
EntityRow entity = (EntityRow) workspace.getWorkspaceEntityByName(entity_name); |
348 |
if (entity == null) { |
349 |
StoreProperties.setNotVCSMode(store); |
350 |
return null; |
351 |
} |
352 |
// LOGGER.debug("===: GET WORKSPACE "+ hexId(workspace)+ " from property (code='"+workspace.getCode()+"', label='"+workspace.getLabel()+"') for store '"+store.getName()+"'");
|
353 |
return workspace;
|
354 |
} |
355 |
} |
356 |
// break;
|
357 |
|
358 |
case StoreProperties.MODE_UNKNOWN:
|
359 |
default:
|
360 |
DataStoreParameters params = store.getParameters(); |
361 |
if(!(params instanceof JDBCStoreParameters)) { |
362 |
StoreProperties.setNotVCSMode(store); |
363 |
return null; |
364 |
} |
365 |
String entity_name = ((JDBCStoreParameters) params).getTable();
|
366 |
|
367 |
if (INTERNAL_WORKSPACE_TABLES.contains(entity_name)) {
|
368 |
StoreProperties.setNotVCSMode(store); |
369 |
return null; |
370 |
} |
371 |
|
372 |
String storeUrl = ((JDBCStoreParameters)params).getUrl();
|
373 |
for (VCSGisWorkspaceDescriptor value : this.workspaces.values()) { |
374 |
if (StringUtils.equals(storeUrl, value.getExplorerParameters().getUrl())) {
|
375 |
workspace = value.getWorkspace(); |
376 |
EntityRow entity = (EntityRow) workspace.getWorkspaceEntityByName(entity_name); |
377 |
if (entity == null) { |
378 |
StoreProperties.setNotVCSMode(store); |
379 |
return null; |
380 |
} |
381 |
StoreProperties.set(store, workspace, entity_name); |
382 |
// LOGGER.debug("===: GET WORKSPACE "+ hexId(workspace)+ " from registry (code='"+workspace.getCode()+"', label='"+workspace.getLabel()+"') for store '"+store.getName()+"'");
|
383 |
return workspace;
|
384 |
} |
385 |
|
386 |
} |
387 |
|
388 |
try {
|
389 |
workspace = openWorkspace((JDBCServerExplorer)store.getExplorer()); |
390 |
} catch (Exception e) { |
391 |
workspace = null;
|
392 |
} |
393 |
if (workspace == null) { |
394 |
StoreProperties.setNotVCSMode(store); |
395 |
return null; |
396 |
} |
397 |
this.registerWorkspace(workspace);
|
398 |
|
399 |
EntityRow entity = (EntityRow) workspace.getWorkspaceEntityByName(entity_name); |
400 |
if (entity == null) { |
401 |
StoreProperties.setNotVCSMode(store); |
402 |
return null; |
403 |
} |
404 |
StoreProperties.set(store, workspace, entity_name); |
405 |
return workspace;
|
406 |
} |
407 |
} catch (Exception ex) { |
408 |
LOGGER.warn("Can't get '" +store.getName()+ "'store's workspace ", ex); |
409 |
StoreProperties.setNotVCSMode(store); |
410 |
return null; |
411 |
} |
412 |
} |
413 |
|
414 |
@Override
|
415 |
public boolean isWorkspace(JDBCServerExplorerParameters params) { |
416 |
try {
|
417 |
DataManager dataManager = DALLocator.getDataManager(); |
418 |
DataServerExplorer explorer = dataManager.openServerExplorer(params.getProviderName(), params); |
419 |
DataStoreParameters x = explorer.get(VarsTable.TABLE_NAME); |
420 |
if(x==null) { |
421 |
return false; |
422 |
} |
423 |
return explorer.exists(x);
|
424 |
} catch (Exception ex) { |
425 |
return false; |
426 |
} |
427 |
} |
428 |
|
429 |
@Override
|
430 |
public boolean isWorkspace(File dbfile) { |
431 |
try {
|
432 |
DataManager dataManager = DALLocator.getDataManager(); |
433 |
JDBCServerExplorerParameters params = (JDBCServerExplorerParameters) dataManager.createServerExplorerParameters(DataStore.H2SPATIAL_PROVIDER_NAME); |
434 |
((HasAFile)params).setFile(dbfile); |
435 |
return isWorkspace(params);
|
436 |
} catch (Exception ex) { |
437 |
return false; |
438 |
} |
439 |
} |
440 |
|
441 |
private File removeH2FileExtension(File f) { |
442 |
if (f == null) { |
443 |
return null; |
444 |
} |
445 |
String pathname = f.getAbsolutePath();
|
446 |
String lpathname = pathname.toLowerCase();
|
447 |
for (String ext : new String[]{".mv.db", ".mv", ".trace.db", ".trace"}) { |
448 |
if (lpathname.endsWith(ext)) {
|
449 |
pathname = pathname.substring(0, pathname.length() - ext.length());
|
450 |
return new File(pathname); |
451 |
} |
452 |
} |
453 |
return f;
|
454 |
} |
455 |
|
456 |
public static String hexId(Object obj) { |
457 |
if( obj==null ) { |
458 |
return "NULL"; |
459 |
} |
460 |
return Integer.toHexString(obj.hashCode()).toUpperCase(); |
461 |
} |
462 |
|
463 |
@Override
|
464 |
public VCSGisWorkspaceDescriptor getWorkspaceDescriptor(String code) { |
465 |
VCSGisWorkspaceDescriptor descriptor = this.workspaces.get(code);
|
466 |
DisposeUtils.bind(descriptor); |
467 |
return descriptor;
|
468 |
} |
469 |
|
470 |
@Override
|
471 |
public int initRepository(JDBCServerExplorerParameters repositoryParameters, SimpleTaskStatus status) { |
472 |
return VCSGisRepositoryLocaldb.create(repositoryParameters, this.codeGenerator, status); |
473 |
} |
474 |
|
475 |
@Override
|
476 |
public VCSGisRepository openRepository(JDBCServerExplorerParameters repositoryParameters) {
|
477 |
return new VCSGisRepositoryLocaldb(repositoryParameters, codeGenerator); |
478 |
} |
479 |
|
480 |
@Override
|
481 |
public VCSGisRepository openRepository(URL repository) { |
482 |
return new VCSGisRepositoryClient(repository); |
483 |
} |
484 |
|
485 |
@Override
|
486 |
public VCSGisServerController createServerController(VCSGisRepository repository) {
|
487 |
return new VCSGisServerControllerImpl(repository); |
488 |
} |
489 |
|
490 |
@Override
|
491 |
public void setCodeGenerator(VCSGisCodeGenerator generator) { |
492 |
this.codeGenerator = generator;
|
493 |
} |
494 |
|
495 |
@Override
|
496 |
public VCSGisCodeGenerator getCodeGenerator() {
|
497 |
return this.codeGenerator; |
498 |
} |
499 |
|
500 |
@Override
|
501 |
public String getErrorMessage(int errcode) { |
502 |
return VCSGisUtils.getErrorMessage(errcode);
|
503 |
} |
504 |
|
505 |
@Override
|
506 |
public void setUserIdentificationRequester(VCSGisUserIdentificationRequester userIdentificationRequester) { |
507 |
this.userIdentificationRequester = userIdentificationRequester;
|
508 |
} |
509 |
|
510 |
} |