Revision 8718 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
VCSGisManagerImpl.java | ||
---|---|---|
446 | 446 |
|
447 | 447 |
@Override |
448 | 448 |
public void registerWorkspace(VCSGisWorkspace workspace) { |
449 |
this.deregisterWorkspace(workspace.getCode()); |
|
450 |
VCSGisWorkspaceDescriptorImpl descriptor = new VCSGisWorkspaceDescriptorImpl(workspace); |
|
451 |
this.workspaces.put(descriptor.getCode(), descriptor); |
|
449 |
VCSGisWorkspaceDescriptor descriptor = this.workspaces.get(workspace.getCode()); |
|
450 |
if( descriptor == null ) { |
|
451 |
descriptor = new VCSGisWorkspaceDescriptorImpl(workspace); |
|
452 |
this.workspaces.put(workspace.getCode(), descriptor); |
|
453 |
} else { |
|
454 |
((VCSGisWorkspaceDescriptorImpl)descriptor).setWorkspace(workspace); |
|
455 |
} |
|
452 | 456 |
} |
453 | 457 |
|
454 | 458 |
@Override |
... | ... | |
539 | 543 |
} |
540 | 544 |
String entity_name = ((JDBCStoreParameters) params).getTable(); |
541 | 545 |
|
542 |
if (INTERNAL_WORKSPACE_TABLES.contains(entity_name)) { |
|
546 |
if (INTERNAL_WORKSPACE_TABLES.contains(entity_name) || |
|
547 |
INTERNAL_REPOSITORY_TABLES.contains(entity_name) ) { |
|
543 | 548 |
StoreProperties.setNotVCSMode(store); |
544 | 549 |
return null; |
545 | 550 |
} |
546 | 551 |
|
547 | 552 |
String storeUrl = ((JDBCStoreParameters)params).getUrl(); |
548 |
for (VCSGisWorkspaceDescriptor value : this.workspaces.values()) { |
|
549 |
if( value == null || |
|
550 |
value.getExplorerParameters() == null || |
|
551 |
value.getWorkspace() == null ) { |
|
553 |
List<VCSGisWorkspaceDescriptor> descriptors = new ArrayList<>(this.workspaces.values()); |
|
554 |
for (VCSGisWorkspaceDescriptor value : descriptors) { |
|
555 |
if( value == null ) { |
|
552 | 556 |
continue; |
553 | 557 |
} |
554 |
if (StringUtils.equals(storeUrl, value.getExplorerParameters().getUrl())) { |
|
555 |
workspace = (VCSGisWorkspaceImpl) value.getWorkspace(); |
|
556 |
EntityRow entity = (EntityRow) workspace.getWorkspaceEntityByName(entity_name); |
|
557 |
if (entity == null) { |
|
558 |
StoreProperties.setNotVCSMode(store); |
|
559 |
DisposeUtils.dispose(workspace); |
|
560 |
return null; |
|
561 |
} |
|
562 |
StoreProperties.set(store, workspace, entity_name); |
|
563 |
if( workspace.isCorrupt(entity,store,0) ) { |
|
558 |
JDBCServerExplorerParameters explorerParams = value.getExplorerParameters(); |
|
559 |
if( explorerParams == null ) { |
|
560 |
continue; |
|
561 |
} |
|
562 |
if (!StringUtils.equals(storeUrl, explorerParams.getUrl())) { |
|
563 |
continue; |
|
564 |
} |
|
565 |
workspace = (VCSGisWorkspaceImpl) value.getWorkspace(); |
|
566 |
if( workspace == null ) { |
|
567 |
continue; |
|
568 |
} |
|
569 |
EntityRow entity = (EntityRow) workspace.getWorkspaceEntityByName(entity_name); |
|
570 |
if (entity == null) { |
|
571 |
StoreProperties.setNotVCSMode(store); |
|
572 |
DisposeUtils.dispose(workspace); |
|
573 |
return null; |
|
574 |
} |
|
575 |
StoreProperties.set(store, workspace, entity_name); |
|
576 |
if( workspace.isCorrupt(entity,store,0) ) { |
|
564 | 577 |
// return null; |
565 |
}
|
|
578 |
} |
|
566 | 579 |
// LOGGER.debug("===: GET WORKSPACE "+ hexId(workspace)+ " from registry (code='"+workspace.getCode()+"', label='"+workspace.getLabel()+"') for store '"+store.getName()+"'"); |
567 |
return workspace; |
|
568 |
} |
|
569 |
|
|
580 |
return workspace; |
|
570 | 581 |
} |
571 | 582 |
|
572 | 583 |
JDBCServerExplorer explorer = null; |
Also available in: Unified diff