[teiid-commits] teiid SVN: r2165 - in trunk/runtime/src/main: resources/org/teiid/runtime and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Fri May 28 00:11:06 EDT 2010


Author: shawkins
Date: 2010-05-28 00:11:05 -0400 (Fri, 28 May 2010)
New Revision: 2165

Modified:
   trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
   trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
Log:
TEIID-1079 adding a check to see if the named translator can be found

Modified: trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2010-05-28 04:08:22 UTC (rev 2164)
+++ trunk/runtime/src/main/java/org/teiid/deployers/VDBDeployer.java	2010-05-28 04:11:05 UTC (rev 2165)
@@ -172,19 +172,25 @@
 				continue;
 			}			
 			for (String source:model.getSourceNames()) {
-				if (this.connectorManagerRepository.getConnectorManager(source) == null) {
+				if (this.connectorManagerRepository.getConnectorManager(source) != null) {
+					continue;
+				}
 
-					Translator translator = VDBDeployer.this.translatorRepository.getTranslatorMetaData(new VDBKey(deployment.getName(), deployment.getVersion()), model.getSourceTranslatorName(source));
-					ExecutionFactory ef = map.get(translator);
-					if ( ef == null) {
-						ef = TranslatorUtil.buildExecutionFactory(translator);
-						map.put(translator, ef);
-					}
+				String name = model.getSourceTranslatorName(source);
+				Translator translator = VDBDeployer.this.translatorRepository.getTranslatorMetaData(new VDBKey(deployment.getName(), deployment.getVersion()), name);
+				if (translator == null) {
+					throw new DeploymentException(RuntimePlugin.Util.getString("translator_not_found", name)); //$NON-NLS-1$
+				}
+			
+				ExecutionFactory ef = map.get(translator);
+				if ( ef == null) {
+					ef = TranslatorUtil.buildExecutionFactory(translator);
+					map.put(translator, ef);
+				}
 
-					ConnectorManager cm = new ConnectorManager(model.getSourceTranslatorName(source), model.getSourceConnectionJndiName(source));
-					cm.setExecutionFactory(ef);
-					this.connectorManagerRepository.addConnectorManager(source, cm);
-				}
+				ConnectorManager cm = new ConnectorManager(name, model.getSourceConnectionJndiName(source));
+				cm.setExecutionFactory(ef);
+				this.connectorManagerRepository.addConnectorManager(source, cm);
 			}
 		}
 	}
@@ -307,11 +313,11 @@
     			}
     			return store;
 			} catch (TranslatorException e) {
-				if (exception != null) {
+				if (exception == null) {
 					exception = e;
 				}
 			} catch (IOException e) {
-				if (exception != null) {
+				if (exception == null) {
 					exception = e;
 				}				
 			}

Modified: trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties
===================================================================
--- trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-05-28 04:08:22 UTC (rev 2164)
+++ trunk/runtime/src/main/resources/org/teiid/runtime/i18n.properties	2010-05-28 04:11:05 UTC (rev 2165)
@@ -306,3 +306,4 @@
 required_property_not_exists=Required property "{0}" has no value. Deployment is incomplete.
 name_not_found=Translator property "name" not defined for the deployment "{0}"
 translator_type_not_found=The parent translator defined not found in configuration "{0}"
+translator_not_found=Unknown translator "{0}"



More information about the teiid-commits mailing list