Revision 43409
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.spi/src/main/java/org/gvsig/fmap/dal/resource/spi/AbstractResource.java | ||
---|---|---|
104 | 104 |
delegateObservable = new DelegateWeakReferencingObservable(this); |
105 | 105 |
lock = new Object(); |
106 | 106 |
multiResourcelock = new Object(); |
107 |
try { |
|
108 |
this.parameters = (ResourceParameters) parameters.getCopy(); |
|
109 |
} catch (CopyParametersException e) { |
|
110 |
throw new InitializeException(e); |
|
111 |
} |
|
112 |
|
|
107 |
this.parameters = null; |
|
108 |
if( parameters != null ) { |
|
109 |
try { |
|
110 |
this.parameters = (ResourceParameters) parameters.getCopy(); |
|
111 |
} catch (CopyParametersException e) { |
|
112 |
throw new InitializeException(e); |
|
113 |
} |
|
114 |
} |
|
113 | 115 |
} |
114 | 116 |
|
115 | 117 |
protected final void updateLastTimeUsed() { |
... | ... | |
145 | 147 |
} |
146 | 148 |
|
147 | 149 |
public void prepare() throws PrepareResourceException { |
148 |
if (preparedParameters == null) { |
|
150 |
if (preparedParameters == null && this.parameters!=null ) {
|
|
149 | 151 |
try { |
150 | 152 |
ResourceParameters params = |
151 | 153 |
(ResourceParameters) parameters.getCopy(); |
... | ... | |
169 | 171 |
try { |
170 | 172 |
throw new IllegalStateException(); |
171 | 173 |
} catch(IllegalStateException ex) { |
172 |
this. |
|
173 |
logger.warn("notify close in a resource already closed ("+this.parameters.toString()+").", ex); |
|
174 |
logger.warn("notify close in a resource already closed ("+this.parameters==null? "null": this.parameters.toString()+").", ex); |
|
174 | 175 |
} |
175 | 176 |
this.notifyObserver(ResourceNotification.CLOSE); |
176 | 177 |
} else { |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.jdbc/src/main/java/org/gvsig/fmap/dal/store/jdbc2/spi/JDBCStoreProviderBase.java | ||
---|---|---|
1 | 1 |
package org.gvsig.fmap.dal.store.jdbc2.spi; |
2 | 2 |
|
3 |
import java.text.MessageFormat; |
|
3 | 4 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCStoreProvider; |
4 | 5 |
import java.util.Arrays; |
5 | 6 |
import java.util.Collections; |
6 | 7 |
import java.util.Iterator; |
7 | 8 |
import java.util.List; |
9 |
import java.util.logging.Level; |
|
8 | 10 |
import org.apache.commons.lang3.BooleanUtils; |
9 | 11 |
import org.apache.commons.lang3.StringUtils; |
10 | 12 |
import org.cresques.cts.IProjection; |
... | ... | |
28 | 30 |
import org.gvsig.fmap.dal.feature.spi.FeatureProvider; |
29 | 31 |
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices; |
30 | 32 |
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider; |
33 |
import org.gvsig.fmap.dal.resource.ResourceParameters; |
|
34 |
import org.gvsig.fmap.dal.resource.exception.AccessResourceException; |
|
35 |
import org.gvsig.fmap.dal.resource.exception.ResourceException; |
|
36 |
import org.gvsig.fmap.dal.resource.spi.AbstractResource; |
|
31 | 37 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
32 | 38 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
33 | 39 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
... | ... | |
382 | 388 |
return this.getHelper().getSourceId(this.getParameters()); |
383 | 389 |
} |
384 | 390 |
|
391 |
private static class DummyResource extends AbstractResource { |
|
392 |
|
|
393 |
private final String name; |
|
394 |
|
|
395 |
DummyResource(String name) throws InitializeException { |
|
396 |
super((ResourceParameters)null); |
|
397 |
this.name = name; |
|
398 |
} |
|
399 |
|
|
400 |
@Override |
|
401 |
public String getName() throws AccessResourceException { |
|
402 |
return MessageFormat.format("DummyResource({0})", |
|
403 |
new Object[] { this.name }); |
|
404 |
} |
|
405 |
|
|
406 |
@Override |
|
407 |
public Object get() throws AccessResourceException { |
|
408 |
return null; |
|
409 |
} |
|
410 |
|
|
411 |
@Override |
|
412 |
public boolean isThis(ResourceParameters parameters) throws ResourceException { |
|
413 |
return true; |
|
414 |
} |
|
415 |
|
|
416 |
} |
|
417 |
|
|
385 | 418 |
@Override |
386 | 419 |
public ResourceProvider getResource() { |
387 |
return getHelper().getResource(); |
|
420 |
ResourceProvider r = getHelper().getResource(); |
|
421 |
if( r == null ) { |
|
422 |
try { |
|
423 |
r = new DummyResource(this.getName()); |
|
424 |
} catch (InitializeException ex) { |
|
425 |
logger.warn("Can't create DummyResource",ex); |
|
426 |
// Do nothing |
|
427 |
} |
|
428 |
} |
|
429 |
return r; |
|
388 | 430 |
} |
389 | 431 |
|
390 | 432 |
@Override |
Also available in: Unified diff