[teiid-commits] teiid SVN: r2206 - in trunk/engine/src/main: resources/org/teiid/query/execution and 1 other directory.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Tue Jun 8 16:54:46 EDT 2010


Author: shawkins
Date: 2010-06-08 16:54:45 -0400 (Tue, 08 Jun 2010)
New Revision: 2206

Modified:
   trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
   trunk/engine/src/main/resources/org/teiid/query/execution/i18n.properties
Log:
TEIID-1102 adding tracking of file name if the file resource adapter is used

Modified: trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java	2010-06-08 20:00:16 UTC (rev 2205)
+++ trunk/engine/src/main/java/org/teiid/query/processor/relational/TextTableNode.java	2010-06-08 20:54:45 UTC (rev 2206)
@@ -38,16 +38,14 @@
 import org.teiid.common.buffer.TupleBatch;
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidProcessingException;
+import org.teiid.core.types.ClobImpl;
 import org.teiid.core.types.ClobType;
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.types.TransformationException;
 import org.teiid.query.execution.QueryExecPlugin;
 import org.teiid.query.processor.ProcessorDataManager;
-import org.teiid.query.sql.lang.TableFunctionReference;
 import org.teiid.query.sql.lang.TextTable;
 import org.teiid.query.sql.lang.TextTable.TextColumn;
-import org.teiid.query.sql.symbol.ElementSymbol;
-import org.teiid.query.sql.symbol.Expression;
 import org.teiid.query.util.CommandContext;
 
 /**
@@ -76,6 +74,7 @@
 	private BufferedReader reader;
 	private int textLine = 0;
 	private Map<String, Integer> nameIndexes;
+	private String systemId;
 	
 	public TextTableNode(int nodeID) {
 		super(nodeID);
@@ -180,13 +179,13 @@
 					index = nameIndexes.get(col.getName());
 				}
 				if (index >= vals.size()) {
-					throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.no_value", col.getName(), textLine)); //$NON-NLS-1$
+					throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.no_value", col.getName(), textLine, systemId)); //$NON-NLS-1$
 				}
 				val = vals.get(index);
 				try {
 					tuple.add(DataTypeManager.transformValue(val, table.getColumns().get(output).getSymbol().getType()));
 				} catch (TransformationException e) {
-					throw new TeiidProcessingException(e, QueryExecPlugin.Util.getString("TextTableNode.conversion_error", col.getName(), textLine)); //$NON-NLS-1$
+					throw new TeiidProcessingException(e, QueryExecPlugin.Util.getString("TextTableNode.conversion_error", col.getName(), textLine, systemId)); //$NON-NLS-1$
 				}
 			}
 			addBatchRow(tuple);
@@ -217,13 +216,19 @@
 		
 		setReferenceValues(this.table);
 		ClobType file = (ClobType)getEvaluator(Collections.emptyMap()).evaluate(table.getFile(), null);
-		
 		if (file == null) {
 			return;
 		}
 		
 		//get the reader
 		try {
+			this.systemId = "Unknown"; //$NON-NLS-1$
+			if (file.getReference() instanceof ClobImpl) {
+				this.systemId = ((ClobImpl)file.getReference()).getStreamFactory().getSystemId();
+				if (this.systemId == null) {
+					this.systemId = "Unknown"; //$NON-NLS-1$
+				}
+			} 
 			Reader r = file.getCharacterStream();
 			if (!(r instanceof BufferedReader)) {
 				reader = new BufferedReader(r);
@@ -262,7 +267,7 @@
 		for (TextColumn col : table.getColumns()) {
 			Integer index = nameIndexes.get(col.getName().toUpperCase());
 			if (index == null) {
-				throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.header_missing", col.getName())); //$NON-NLS-1$
+				throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.header_missing", col.getName(), systemId)); //$NON-NLS-1$
 			}
 			nameIndexes.put(col.getName(), index);
 		}
@@ -296,7 +301,7 @@
 				} 
 				line = readLine();
 				if (line == null) {
-					throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.unclosed")); //$NON-NLS-1$
+					throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.unclosed", systemId)); //$NON-NLS-1$
 				}
 			}
 			char[] chars = line.toCharArray();
@@ -326,7 +331,7 @@
 								builder.append(chr);
 							} else {
 								if (builder.toString().trim().length() != 0) {
-									throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.character_not_allowed", textLine)); //$NON-NLS-1$
+									throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.character_not_allowed", textLine, systemId)); //$NON-NLS-1$
 								}
 								qualified = true;
 								builder = new StringBuilder(); //start the entry over
@@ -337,11 +342,11 @@
 				} else {
 					if (escaped) {
 						//don't understand other escape sequences yet
-						throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.unknown_escape", chr, textLine)); //$NON-NLS-1$ 
+						throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.unknown_escape", chr, textLine, systemId)); //$NON-NLS-1$ 
 					}
 					if (wasQualified && !qualified) {
 						if (!Character.isWhitespace(chr)) {
-							throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.character_not_allowed", textLine)); //$NON-NLS-1$
+							throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.character_not_allowed", textLine, systemId)); //$NON-NLS-1$
 						}
 						//else just ignore
 					} else {
@@ -366,7 +371,7 @@
 	private List<String> parseFixedWidth(String line)
 			throws TeiidProcessingException {
 		if (line.length() < lineWidth) {
-			throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.invalid_width", line.length(), lineWidth, textLine)); //$NON-NLS-1$
+			throw new TeiidProcessingException(QueryExecPlugin.Util.getString("TextTableNode.invalid_width", line.length(), lineWidth, textLine, systemId)); //$NON-NLS-1$
 		}
 		ArrayList<String> result = new ArrayList<String>();
 		int beginIndex = 0;

Modified: trunk/engine/src/main/resources/org/teiid/query/execution/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/execution/i18n.properties	2010-06-08 20:00:16 UTC (rev 2205)
+++ trunk/engine/src/main/resources/org/teiid/query/execution/i18n.properties	2010-06-08 20:54:45 UTC (rev 2206)
@@ -209,13 +209,13 @@
 FileStorageManager.can_not_save_lobs=Can not save *Reference Lobs* into persistent disk storage.
 FileStorageManager.batch_error=Error while converting batched data to file storage.
 
-TextTableNode.no_value=No value found for column \"{0}\" in the row ending on text line {1}.
-TextTableNode.conversion_error=Could not convert value for column \"{0}\" in the row ending on text line {1}.
-TextTableNode.header_missing=HEADER entry missing for column name \"{0}\". 
-TextTableNode.unclosed=Text parse error: Unclosed qualifier at end of text.
-TextTableNode.character_not_allowed=Text parse error: Non-whitespace character found between the qualifier and the delimiter in text line {0}.
-TextTableNode.unknown_escape=Text parse error: Unknown escape sequence \\{0} in text line {1}.
-TextTableNode.invalid_width=Text parse error: Fixed width line width {0} is smaller than the expected {1} on text line {2}
+TextTableNode.no_value=No value found for column \"{0}\" in the row ending on text line {1} in {2}.
+TextTableNode.conversion_error=Could not convert value for column \"{0}\" in the row ending on text line {1} in {2}.
+TextTableNode.header_missing=HEADER entry missing for column name \"{0}\" in {1}. 
+TextTableNode.unclosed=Text parse error: Unclosed qualifier at end of text in {0}.
+TextTableNode.character_not_allowed=Text parse error: Non-whitespace character found between the qualifier and the delimiter in text line {0} in {1}.
+TextTableNode.unknown_escape=Text parse error: Unknown escape sequence \\{0} in text line {1} in {2}.
+TextTableNode.invalid_width=Text parse error: Fixed width line width {0} is smaller than the expected {1} on text line {2} in {3}.
 
 XMLTableNode.error=Error evaluating XQuery row context for XMLTable: {0}
 XMLTableNode.path_error=Error evaluating XMLTable column path expression for column: {0}



More information about the teiid-commits mailing list