Revision 46915
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/DatabaseWorkspaceStoresRepository.java | ||
---|---|---|
67 | 67 |
super(name, label); |
68 | 68 |
this.workspace = (DefaultDatabaseWorkspaceManager) workspace; |
69 | 69 |
this.repository = null; |
70 |
this.setServerParameters(this.workspace.getServerExplorerParameters()); |
|
70 | 71 |
} |
71 | 72 |
|
72 | 73 |
private void evaluateExpressionsInFiles(DataStoreParameters parameters) { |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/StoresRepository.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
public StoresRepository getSubrepository(String Id); |
37 | 37 |
|
38 |
public StoresRepository getSubrepository(DataServerExplorerParameters explorerParameters); |
|
39 |
|
|
40 |
public StoresRepository getSubrepository(DataServerExplorer explorer); |
|
41 |
|
|
38 | 42 |
public boolean addRepository(StoresRepository repository); |
39 | 43 |
|
40 | 44 |
public boolean removeRepository(String name); |
... | ... | |
45 | 49 |
|
46 | 50 |
public boolean contains(DataStoreParameters parameters); |
47 | 51 |
|
52 |
public boolean contains(String name); |
|
53 |
|
|
48 | 54 |
public void remove(String name); |
49 | 55 |
|
50 | 56 |
public DataStore getStore(String name); |
... | ... | |
65 | 71 |
|
66 | 72 |
public FeatureType getFeatureType(String name); |
67 | 73 |
|
74 |
public DataServerExplorerParameters getServerParameters(); |
|
75 |
|
|
68 | 76 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/AbstractStoresRepository.java | ||
---|---|---|
31 | 31 |
*/ |
32 | 32 |
@SuppressWarnings("UseSpecificCatch") |
33 | 33 |
public abstract class AbstractStoresRepository implements StoresRepository { |
34 |
|
|
34 |
|
|
35 | 35 |
protected final Logger LOGGER = LoggerFactory.getLogger(AbstractStoresRepository.class); |
36 | 36 |
|
37 | 37 |
private final String name; |
... | ... | |
41 | 41 |
private final PropertiesSupportHelper propertiesHelper; |
42 | 42 |
protected Map<String, CachedValue<FeatureType>> featureTypes; |
43 | 43 |
protected long featureTypeExpireTimeInMillis; |
44 |
private DataServerExplorerParameters serverParameters; |
|
44 | 45 |
|
45 | 46 |
public AbstractStoresRepository(String name) { |
46 | 47 |
this(name, null); |
... | ... | |
153 | 154 |
} |
154 | 155 |
|
155 | 156 |
@Override |
157 |
public boolean contains(String name) { |
|
158 |
DataStoreParameters parameters = this.getMyParameters(name); |
|
159 |
if( parameters!=null ) { |
|
160 |
return true; |
|
161 |
} |
|
162 |
for ( StoresRepository theRepository : this.subrepositories) { |
|
163 |
if( theRepository.contains(name) ) { |
|
164 |
return true; |
|
165 |
} |
|
166 |
} |
|
167 |
return false; |
|
168 |
} |
|
169 |
|
|
170 |
@Override |
|
156 | 171 |
public String getID() { |
157 | 172 |
return this.name; |
158 | 173 |
} |
... | ... | |
460 | 475 |
} |
461 | 476 |
return keys; |
462 | 477 |
} |
478 |
|
|
479 |
/** |
|
480 |
* @return the serverParameters |
|
481 |
*/ |
|
482 |
@Override |
|
483 |
public DataServerExplorerParameters getServerParameters() { |
|
484 |
return serverParameters; |
|
485 |
} |
|
486 |
|
|
487 |
/** |
|
488 |
* @param serverParameters the serverParameters to set |
|
489 |
*/ |
|
490 |
protected void setServerParameters(DataServerExplorerParameters serverParameters) { |
|
491 |
this.serverParameters = serverParameters; |
|
492 |
} |
|
493 |
|
|
494 |
|
|
495 |
protected boolean isMyServer(DataServerExplorerParameters serverParameters) { |
|
496 |
if( this.serverParameters==null || serverParameters==null ) { |
|
497 |
return false; |
|
498 |
} |
|
499 |
return this.serverParameters.isTheSameServerExplorer(serverParameters); |
|
500 |
} |
|
501 |
|
|
502 |
@Override |
|
503 |
public StoresRepository getSubrepository(DataServerExplorer server) { |
|
504 |
if( server == null ) { |
|
505 |
return null; |
|
506 |
} |
|
507 |
return this.getSubrepository(server.getParameters()); |
|
508 |
} |
|
509 |
|
|
510 |
@Override |
|
511 |
public StoresRepository getSubrepository(DataServerExplorerParameters serverParameters) { |
|
512 |
if( this.isMyServer(serverParameters) ) { |
|
513 |
return this; |
|
514 |
} |
|
515 |
for (StoresRepository repo : this.subrepositories) { |
|
516 |
if( repo!=null ) { |
|
517 |
StoresRepository r = this.getSubrepository(serverParameters); |
|
518 |
if( r!=null ) { |
|
519 |
return repo; |
|
520 |
} |
|
521 |
} |
|
522 |
} |
|
523 |
return null; |
|
524 |
} |
|
525 |
|
|
463 | 526 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/BaseStoresRepository.java | ||
---|---|---|
21 | 21 |
private final Map<String,DataStoreParameters> repository; |
22 | 22 |
|
23 | 23 |
public BaseStoresRepository(String name) { |
24 |
this(name, null); |
|
24 |
this(name, null, null);
|
|
25 | 25 |
} |
26 | 26 |
|
27 | 27 |
public BaseStoresRepository(String name, String label) { |
28 |
this(name, label, null); |
|
29 |
} |
|
30 |
|
|
31 |
public BaseStoresRepository(String name, String label, DataServerExplorerParameters serverParameters) { |
|
28 | 32 |
super(name, label); |
33 |
this.setServerParameters(serverParameters); |
|
29 | 34 |
this.repository = new HashMap<>(); |
30 | 35 |
} |
31 | 36 |
|
... | ... | |
87 | 92 |
} |
88 | 93 |
this.repository.remove(name); |
89 | 94 |
} |
90 |
|
|
95 |
|
|
91 | 96 |
} |
Also available in: Unified diff