int firstIndex = vdbName.indexOf('.');
int lastIndex = vdbName.lastIndexOf('.');
if (firstIndex != -1) {
if (firstIndex != lastIndex || vdbVersion != null) {
throw new SessionServiceException(RuntimePlugin.Util.getString("ambigious_name", vdbName, vdbVersion)); //$NON-NLS-1$
}
vdbVersion = vdbName.substring(firstIndex+1);
vdbName = vdbName.substring(0, firstIndex);
}
try {
if (vdbVersion == null) {
vdbVersion = "latest"; //$NON-NLS-1$
vdb = this.vdbRepository.getVDB(vdbName);
}
else {
vdb = this.vdbRepository.getVDB(vdbName, Integer.parseInt(vdbVersion));
}
} catch (NumberFormatException e) {
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) {
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;
}