[teiid-commits] teiid SVN: r4037 - in branches/8.0.x: admin/src/test/java/org/teiid/adminapi/impl and 3 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Thu Apr 26 15:09:47 EDT 2012


Author: shawkins
Date: 2012-04-26 15:09:46 -0400 (Thu, 26 Apr 2012)
New Revision: 4037

Modified:
   branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
   branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
   branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
   branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
   branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java
   branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties
Log:
TEIID-2017 fixing invalid model type handling and removing an unnecessary catch.

Modified: branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java
===================================================================
--- branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java	2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/ModelMetaData.java	2012-04-26 19:09:46 UTC (rev 4037)
@@ -28,7 +28,12 @@
 import java.util.LinkedList;
 import java.util.List;
 
-import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
 
 import org.teiid.adminapi.Model;
 import org.teiid.adminapi.impl.ModelMetaData.ValidationError.Severity;
@@ -108,7 +113,7 @@
 	@Override
 	public Type getModelType() {
 		try {
-			return Type.valueOf(modelType.toUpperCase());
+			return Type.valueOf(modelType);
 		} catch(IllegalArgumentException e) {
 			return Type.OTHER;
 		}
@@ -143,7 +148,11 @@
     }
     
     public void setModelType(String modelType) {
-        this.modelType = modelType;
+    	if (modelType != null) {
+    		this.modelType = modelType.toUpperCase();
+    	} else {
+    		this.modelType = null;
+    	}
     }    
     
     public String toString() {

Modified: branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java
===================================================================
--- branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java	2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/admin/src/main/java/org/teiid/adminapi/impl/VDBMetadataParser.java	2012-04-26 19:09:46 UTC (rev 4037)
@@ -39,7 +39,6 @@
 
 import org.teiid.adminapi.AdminPlugin;
 import org.teiid.adminapi.DataPolicy;
-import org.teiid.adminapi.Model;
 import org.teiid.adminapi.Translator;
 import org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData;
 import org.teiid.adminapi.impl.ModelMetaData.ValidationError;
@@ -219,7 +218,7 @@
 	private static void parseModel(XMLStreamReader reader, ModelMetaData model) throws XMLStreamException {
 		Properties props = getAttributes(reader);
 		model.setName(props.getProperty(Element.NAME.getLocalName()));
-		model.setModelType(Model.Type.valueOf(props.getProperty(Element.TYPE.getLocalName(), "PHYSICAL")));
+		model.setModelType(props.getProperty(Element.TYPE.getLocalName(), "PHYSICAL"));
 		model.setVisible(Boolean.parseBoolean(props.getProperty(Element.VISIBLE.getLocalName(), "true")));
 		model.setPath(props.getProperty(Element.PATH.getLocalName()));
 		

Modified: branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java
===================================================================
--- branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java	2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/admin/src/test/java/org/teiid/adminapi/impl/TestModelMetaData.java	2012-04-26 19:09:46 UTC (rev 4037)
@@ -34,7 +34,7 @@
 	public void testModelType() {
 		
 		ModelMetaData model = new ModelMetaData();
-		model.modelType = "physical";
+		model.setModelType("physical");
 		
 		assertTrue(model.getModelType() == Model.Type.PHYSICAL);
 		assertTrue(model.isSource());

Modified: branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/engine/src/main/java/org/teiid/dqp/internal/process/Request.java	2012-04-26 19:09:46 UTC (rev 4037)
@@ -30,9 +30,7 @@
 import java.util.concurrent.Executor;
 
 import org.teiid.adminapi.impl.VDBMetaData;
-import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryParserException;
-import org.teiid.api.exception.query.QueryPlannerException;
 import org.teiid.api.exception.query.QueryResolverException;
 import org.teiid.api.exception.query.QueryValidatorException;
 import org.teiid.client.RequestMessage;
@@ -413,36 +411,32 @@
             }
         }
         
+    	// If using multi-source models, insert a proxy to simplify the supported capabilities.  This is 
+        // done OUTSIDE the cache (wrapped around the cache) intentionally to avoid caching the simplified
+        // capabilities which may be different for the same model in a different VDB used by this same DQP.
+    	CapabilitiesFinder finder = this.capabilitiesFinder;
+        if(this.multiSourceModels != null) {
+            finder = new MultiSourceCapabilitiesFinder(finder, this.multiSourceModels);
+        }
+        
+        boolean debug = analysisRecord.recordDebug();
+		if(debug) {
+			analysisRecord.println("\n============================================================================"); //$NON-NLS-1$
+            analysisRecord.println("USER COMMAND:\n" + command);		 //$NON-NLS-1$
+        }
+        // Run the optimizer
         try {
-        	// If using multi-source models, insert a proxy to simplify the supported capabilities.  This is 
-            // done OUTSIDE the cache (wrapped around the cache) intentionally to avoid caching the simplified
-            // capabilities which may be different for the same model in a different VDB used by this same DQP.
-        	CapabilitiesFinder finder = this.capabilitiesFinder;
-            if(this.multiSourceModels != null) {
-                finder = new MultiSourceCapabilitiesFinder(finder, this.multiSourceModels);
+            processPlan = QueryOptimizer.optimizePlan(command, metadata, idGenerator, finder, analysisRecord, context);
+        } finally {
+            String debugLog = analysisRecord.getDebugLog();
+            if(debugLog != null && debugLog.length() > 0) {
+                LogManager.log(requestMsg.getShowPlan()==ShowPlan.DEBUG?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);               
             }
-            
-            boolean debug = analysisRecord.recordDebug();
-    		if(debug) {
-    			analysisRecord.println("\n============================================================================"); //$NON-NLS-1$
-                analysisRecord.println("USER COMMAND:\n" + command);		 //$NON-NLS-1$
+            if (analysisRecord.recordAnnotations() && analysisRecord.getAnnotations() != null && !analysisRecord.getAnnotations().isEmpty()) {
+            	LogManager.logDetail(LogConstants.CTX_QUERY_PLANNER, analysisRecord.getAnnotations());
             }
-            // Run the optimizer
-            try {
-                processPlan = QueryOptimizer.optimizePlan(command, metadata, idGenerator, finder, analysisRecord, context);
-            } finally {
-                String debugLog = analysisRecord.getDebugLog();
-                if(debugLog != null && debugLog.length() > 0) {
-                    LogManager.log(requestMsg.getShowPlan()==ShowPlan.DEBUG?MessageLevel.INFO:MessageLevel.TRACE, LogConstants.CTX_QUERY_PLANNER, debugLog);               
-                }
-                if (analysisRecord.recordAnnotations() && analysisRecord.getAnnotations() != null && !analysisRecord.getAnnotations().isEmpty()) {
-                	LogManager.logDetail(LogConstants.CTX_QUERY_PLANNER, analysisRecord.getAnnotations());
-                }
-            }
-            LogManager.logDetail(LogConstants.CTX_DQP, new Object[] { QueryPlugin.Util.getString("BasicInterceptor.ProcessTree_for__4"), requestId, processPlan }); //$NON-NLS-1$
-        } catch (QueryMetadataException e) {
-             throw new QueryPlannerException(QueryPlugin.Event.TEIID30494, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30494, requestId));
         }
+        LogManager.logDetail(LogConstants.CTX_DQP, new Object[] { QueryPlugin.Util.getString("BasicInterceptor.ProcessTree_for__4"), requestId, processPlan }); //$NON-NLS-1$
     }
 
     public void processRequest() 

Modified: branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java
===================================================================
--- branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java	2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/engine/src/main/java/org/teiid/query/QueryPlugin.java	2012-04-26 19:09:46 UTC (rev 4037)
@@ -535,7 +535,6 @@
 		TEIID30491,
 		TEIID30492,
 		TEIID30493,
-		TEIID30494,
 		TEIID30495,
 		TEIID30496,
 		TEIID30497,

Modified: branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties	2012-04-25 23:47:29 UTC (rev 4036)
+++ branches/8.0.x/engine/src/main/resources/org/teiid/query/i18n.properties	2012-04-26 19:09:46 UTC (rev 4037)
@@ -860,7 +860,6 @@
 TEIID30548=Property value length exceeds max of {0}.
 TEIID30549=Could not find a metadata record with uuid {0}.
 TEIID30489=Unable to load metadata for VDB name
-TEIID30494=Unknown query metadata exception while registering query: {0}.
 DQPCore.Clearing_prepared_plan_cache=Clearing prepared plan cache
 DQPCore.Clearing_prepared_plan_cache_for_vdb=Clearing prepared plan cache for vdb {0}.{1} 
 DQPCore.clearing_resultset_cache=Clearing the resultset cache for vdb {0}.{1}



More information about the teiid-commits mailing list