Author: shawkins
Date: 2010-10-25 14:30:04 -0400 (Mon, 25 Oct 2010)
New Revision: 2680
Modified:
branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties
Log:
TEIID-1321 separating out the exception cases when getting a particular vdb version.
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java
===================================================================
--- branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-10-25
16:56:38 UTC (rev 2679)
+++ branches/7.1.x/runtime/src/main/java/org/teiid/deployers/VDBRepository.java 2010-10-25
18:30:04 UTC (rev 2680)
@@ -106,7 +106,7 @@
return new VDBKey(vdb.getName(), vdb.getVersion());
}
- public VDBMetaData getVDB(String vdbName) throws VirtualDatabaseException {
+ public VDBMetaData getVDB(String vdbName) {
int latestVersion = 0;
for (VDBKey key:this.vdbRepo.tailMap(new VDBKey(vdbName, 0)).keySet()) {
if(!key.getName().equalsIgnoreCase(vdbName)) {
@@ -125,7 +125,7 @@
}
}
if(latestVersion == 0) {
- throw new
VirtualDatabaseException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2",
vdbName, "latest")); //$NON-NLS-1$ //$NON-NLS-2$
+ return null;
}
return getVDB(vdbName, latestVersion);
Modified: branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java
===================================================================
---
branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-10-25
16:56:38 UTC (rev 2679)
+++
branches/7.1.x/runtime/src/main/java/org/teiid/services/SessionServiceImpl.java 2010-10-25
18:30:04 UTC (rev 2680)
@@ -48,7 +48,6 @@
import org.teiid.client.security.SessionToken;
import org.teiid.core.util.ArgCheck;
import org.teiid.deployers.VDBRepository;
-import org.teiid.deployers.VirtualDatabaseException;
import org.teiid.dqp.internal.process.DQPCore;
import org.teiid.dqp.service.SessionService;
import org.teiid.dqp.service.SessionServiceException;
@@ -221,19 +220,20 @@
else {
vdb = this.vdbRepository.getVDB(vdbName, Integer.parseInt(vdbVersion));
}
- } catch (VirtualDatabaseException e) {
- throw new
SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2",
vdbName, vdbVersion)); //$NON-NLS-1$
} catch (NumberFormatException e) {
- throw new SessionServiceException(e,
RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2", vdbName,
vdbVersion)); //$NON-NLS-1$
+ throw new SessionServiceException(e,
RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._3", vdbVersion));
//$NON-NLS-1$
}
if (vdb == null) {
throw new
SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._1",
vdbName, vdbVersion)); //$NON-NLS-1$
}
- if (vdb.getStatus() != VDB.Status.ACTIVE || vdb.getConnectionType() ==
ConnectionType.NONE) {
+ if (vdb.getStatus() != VDB.Status.ACTIVE) {
throw new
SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._2",
vdbName, vdbVersion)); //$NON-NLS-1$
}
+ if (vdb.getConnectionType() == ConnectionType.NONE) {
+ throw new
SessionServiceException(RuntimePlugin.Util.getString("VDBService.VDB_does_not_exist._4",
vdbName, vdbVersion)); //$NON-NLS-1$
+ }
return vdb;
}
Modified: branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-10-25
16:56:38 UTC (rev 2679)
+++ branches/7.1.x/runtime/src/main/resources/org/teiid/runtime/i18n.properties 2010-10-25
18:30:04 UTC (rev 2680)
@@ -25,7 +25,9 @@
LocalBufferService.Failed_initializing_buffer_manager._8=Failed initializing buffer
manager.
VDBService.VDB_does_not_exist._1=VDB \"{0}\" version \"{1}\" does not
exist.
-VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not
in "active" status.
+VDBService.VDB_does_not_exist._2=VDB \"{0}\" version \"{1}\" is not
in the "active" status.
+VDBService.VDB_does_not_exist._4=VDB \"{0}\" version \"{1}\" is not
accepting connections.
+VDBService.VDB_does_not_exist._3=Invalid VDB version \"{0}\" - must be a
positive integer.
# session service
SessionServiceImpl.invalid_session=The specified session ID "{0}" is invalid.
It cannot be found in the userbase.