[teiid-commits] teiid SVN: r2237 - in trunk: api/src/main/java/org/teiid/translator and 26 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Jun 16 15:02:50 EDT 2010


Author: shawkins
Date: 2010-06-16 15:02:47 -0400 (Wed, 16 Jun 2010)
New Revision: 2237

Modified:
   trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
   trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java
   trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
   trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
   trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
   trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java
   trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java
   trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java
   trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
   trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java
   trunk/common-core/src/main/java/org/teiid/core/util/Base64.java
   trunk/common-core/src/main/java/org/teiid/core/util/ReaderInputStream.java
   trunk/common-core/src/test/java/org/teiid/core/util/TestReaderInputStream.java
   trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java
   trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java
   trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSProcedureExecution.java
   trunk/connectors/translator-ws/src/main/resources/org/teiid/translator/ws/i18n.properties
   trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml
   trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
   trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
   trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
   trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
   trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java
   trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
   trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java
   trunk/engine/src/main/java/org/teiid/query/processor/xml/DocumentInProgress.java
   trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java
   trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java
   trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
   trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
   trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
   trunk/engine/src/main/resources/org/teiid/query/i18n.properties
   trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
   trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
   trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
   trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
   trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
   trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
   trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
   trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
Log:
TEIID-1021 adding support for clob<->blob conversions based upon charset encodings (this will also be used by xmlserialize, but that was not added yet).  Also started reorganizing the scalar functions reference.

Modified: trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java
===================================================================
--- trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/api/src/main/java/org/teiid/language/visitor/SQLStringVisitor.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -607,9 +607,7 @@
             if(Number.class.isAssignableFrom(type)) {
                 buffer.append(val);
             } else if(type.equals(DataTypeManager.DefaultDataClasses.BOOLEAN)) {
-                buffer.append("{b '") //$NON-NLS-1$
-                      .append(val)
-                      .append("'}"); //$NON-NLS-1$
+            	buffer.append(obj.getValue().equals(Boolean.TRUE) ? TRUE : FALSE);
             } else if(type.equals(DataTypeManager.DefaultDataClasses.TIMESTAMP)) {
                 buffer.append("{ts '") //$NON-NLS-1$
                       .append(val)

Modified: trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java
===================================================================
--- trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/api/src/main/java/org/teiid/translator/SourceSystemFunctions.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -40,6 +40,8 @@
 	public static final String ASCII = "ascii"; //$NON-NLS-1$
 	public static final String CHAR = "char"; //$NON-NLS-1$
 	public static final String CONCAT = "concat"; //$NON-NLS-1$
+	public static final String DECODE = "decode"; //$NON-NLS-1$
+	public static final String ENCODE = "encode"; //$NON-NLS-1$
 	//public static final String DIFFERENCE = "difference";
 	public static final String INITCAP = "initcap"; //$NON-NLS-1$
 	public static final String INSERT = "insert"; //$NON-NLS-1$

Modified: trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/client/src/main/java/org/teiid/jdbc/PreparedStatementImpl.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -678,7 +678,7 @@
 
 	public void setAsciiStream(int parameterIndex, final InputStream x)
 			throws SQLException {
-		this.setObject(parameterIndex, new ClobImpl(new InputStreamFactory("US-ASCII") { //$NON-NLS-1$
+		this.setObject(parameterIndex, new ClobImpl(new InputStreamFactory() { 
 			@Override
 			public InputStream getInputStream() throws IOException {
 				return x;
@@ -726,7 +726,7 @@
 	}
 
 	public void setClob(int parameterIndex, final Reader reader) throws SQLException {
-		this.setObject(parameterIndex, new ClobImpl(new InputStreamFactory(Streamable.ENCODING) {
+		this.setObject(parameterIndex, new ClobImpl(new InputStreamFactory() {
 			
 			@Override
 			public InputStream getInputStream() throws IOException {

Modified: trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/client/src/main/java/org/teiid/jdbc/ResultSetImpl.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -295,15 +295,16 @@
             	}
         	}
             if(currentValue instanceof ClobType){
-            	currentValue = new ClobImpl(createInputStreamFactory((ClobType)currentValue, null), ((ClobType)currentValue).getLength());
+            	currentValue = new ClobImpl(createInputStreamFactory((ClobType)currentValue), ((ClobType)currentValue).getLength());
             }
             else if (currentValue instanceof BlobType) {
-            	InputStreamFactory isf = createInputStreamFactory((BlobType)currentValue, null);
+            	InputStreamFactory isf = createInputStreamFactory((BlobType)currentValue);
             	isf.setLength(((BlobType)currentValue).getLength());
             	currentValue = new BlobImpl(isf);
             }
             else if (currentValue instanceof XMLType) {
-            	currentValue = new SQLXMLImpl(createInputStreamFactory((XMLType)currentValue, ((XMLType)currentValue).getEncoding()));
+            	currentValue = new SQLXMLImpl(createInputStreamFactory((XMLType)currentValue));
+            	((SQLXMLImpl)currentValue).setEncoding(((XMLType)currentValue).getEncoding());
             } 
         } 
         else if (currentValue instanceof java.util.Date) {
@@ -316,12 +317,9 @@
         return currentValue;
     }
     
-	private InputStreamFactory createInputStreamFactory(Streamable<?> type, String encoding) {
-		if (encoding == null) {
-			encoding = Streamable.ENCODING;
-		}
+	private InputStreamFactory createInputStreamFactory(Streamable<?> type) {
 		final StreamingLobChunckProducer.Factory factory = new StreamingLobChunckProducer.Factory(this.statement.getDQP(), this.requestID, type);
-		InputStreamFactory isf = new InputStreamFactory(encoding) {
+		InputStreamFactory isf = new InputStreamFactory() {
 			@Override
 			public InputStream getInputStream() throws IOException {
 				return new LobChunkInputStream(factory.getLobChunkProducer());

Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/CompactObjectOutputStream.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -25,6 +25,7 @@
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
@@ -196,7 +197,7 @@
 	    		references.add(sfr);
 	    		return sfr;
 	    	} else if (obj instanceof SQLXML) {
-				streams.add(new ReaderInputStream(((SQLXML)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
+				streams.add(((SQLXML)obj).getBinaryStream());
 	    		StreamFactoryReference sfr = new SQLXMLImpl();
 	    		references.add(sfr);
 	    		return sfr;
@@ -273,7 +274,7 @@
 		@Override
 		public int read(char[] cbuf, int off, int len) throws IOException {
 			if (r == null) {
-				r = isf.getCharacterStream();
+				r = new InputStreamReader(isf.getInputStream(), Streamable.ENCODING);
 			}
 			return r.read(cbuf, off, len);
 		}

Modified: trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java
===================================================================
--- trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/client/src/main/java/org/teiid/netty/handler/codec/serialization/ObjectDecoderInputStream.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -38,7 +38,6 @@
 import java.util.List;
 
 import org.teiid.core.types.InputStreamFactory;
-import org.teiid.core.types.Streamable;
 import org.teiid.core.types.InputStreamFactory.StreamFactoryReference;
 import org.teiid.core.util.ExternalizeUtil;
 
@@ -104,7 +103,7 @@
 	        if (stream == null) {
 	        	final File f = File.createTempFile("teiid", null); //$NON-NLS-1$
 		        StreamFactoryReference sfr = streams.get(streamIndex);
-		        sfr.setStreamFactory(new InputStreamFactory(Streamable.ENCODING) {
+		        sfr.setStreamFactory(new InputStreamFactory() {
 					
 					@Override
 					public InputStream getInputStream() throws IOException {

Modified: trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/common-core/src/main/java/org/teiid/core/types/BaseLob.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -3,9 +3,11 @@
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.io.Reader;
+import java.nio.charset.Charset;
 import java.sql.SQLException;
 
 import org.teiid.core.types.InputStreamFactory.StreamFactoryReference;
@@ -15,6 +17,7 @@
 	
 	private static final long serialVersionUID = -1586959324208959519L;
 	private InputStreamFactory streamFactory;
+	private String encoding;
 	
 	public BaseLob() {
 		
@@ -35,6 +38,14 @@
 		return streamFactory;
 	}
 	
+	public String getEncoding() {
+		return encoding;
+	}
+	
+	public void setEncoding(String encoding) {
+		this.encoding = encoding;
+	}
+	
 	public void free() throws SQLException {
 		if (this.streamFactory != null) {
 			try {
@@ -50,12 +61,20 @@
 	
     public Reader getCharacterStream() throws SQLException {
     	try {
-			return this.getStreamFactory().getCharacterStream();
+			Reader r = this.getStreamFactory().getCharacterStream();
+			if (r != null) {
+				return r;
+			}
 		} catch (IOException e) {
 			SQLException ex = new SQLException(e.getMessage());
 			ex.initCause(e);
 			throw ex;
 		}
+		String enc = getEncoding();
+		if (enc == null) {
+			enc = Streamable.ENCODING;
+		}
+		return new InputStreamReader(getBinaryStream(), Charset.forName(enc));
     }
 
     public InputStream getBinaryStream() throws SQLException {

Modified: trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/common-core/src/main/java/org/teiid/core/types/InputStreamFactory.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -27,7 +27,6 @@
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.Reader;
 import java.nio.charset.Charset;
 import java.sql.Blob;
@@ -47,31 +46,15 @@
 		
 	}
 	
-	private String encoding;
 	private String systemId;
 	private long length = -1;
 	
-	public InputStreamFactory() {
-	}
-	
-	public InputStreamFactory(String encoding) {
-		this.encoding = encoding;
-	}
-	
     /**
      * Get a new InputStream
      * @return
      */
     public abstract InputStream getInputStream() throws IOException;
     
-    public String getEncoding() {
-		return encoding;
-	}
-    
-    public void setEncoding(String encoding) {
-		this.encoding = encoding;
-	}
-    
     @Override
     public String getSystemId() {
     	return this.systemId;
@@ -95,11 +78,7 @@
 	}
     
     public Reader getCharacterStream() throws IOException {
-    	String enc = this.getEncoding();
-    	if (enc == null) {
-    		enc = Charset.defaultCharset().displayName();
-    	}
-		return new InputStreamReader(this.getInputStream(), enc);
+    	return null;
     }
     
     public static class FileInputStreamFactory extends InputStreamFactory {
@@ -107,11 +86,6 @@
     	private File f;
     	
     	public FileInputStreamFactory(File f) {
-    		this(f, null);
-    	}
-    	
-    	public FileInputStreamFactory(File f, String encoding) {
-    		super(encoding);
     		this.f = f;
     		this.setSystemId(f.toURI().toASCIIString());
 		}
@@ -131,16 +105,24 @@
     public static class ClobInputStreamFactory extends InputStreamFactory {
     	
     	private Clob clob;
+    	private Charset charset = Charset.forName(Streamable.ENCODING);
     	
     	public ClobInputStreamFactory(Clob clob) {
-    		super(Streamable.ENCODING);
     		this.clob = clob;
     	}
     	
+    	public Charset getCharset() {
+			return charset;
+		}
+    	
+    	public void setCharset(Charset charset) {
+			this.charset = charset;
+		}
+    	
     	@Override
     	public InputStream getInputStream() throws IOException {
     		try {
-				return new ReaderInputStream(clob.getCharacterStream(), Charset.forName(Streamable.ENCODING));
+				return new ReaderInputStream(clob.getCharacterStream(), charset);
 			} catch (SQLException e) {
 				throw new IOException(e);
 			}

Modified: trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/common-core/src/main/java/org/teiid/core/types/SQLXMLImpl.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -26,7 +26,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.Reader;
 import java.io.Writer;
 import java.nio.charset.Charset;
 import java.sql.SQLException;
@@ -57,9 +56,7 @@
  * read operations.
  */
 public class SQLXMLImpl extends BaseLob implements SQLXML {
-	
-	private boolean inMemory;
-    
+		
 	public SQLXMLImpl() {
 		
 	}
@@ -69,13 +66,13 @@
      * @param bytes
      */
     public SQLXMLImpl(final byte[] bytes) {
-    	super(new InputStreamFactory(Streamable.ENCODING) {
+    	super(new InputStreamFactory() {
 			@Override
 			public InputStream getInputStream() throws IOException {
 				return new ByteArrayInputStream(bytes);
 			}
 		});
-    	inMemory = true;
+    	setEncoding(Streamable.ENCODING);
 	}
     
     public SQLXMLImpl(final String str) {
@@ -87,22 +84,21 @@
     }
     
     @Override
-    public Reader getCharacterStream() throws SQLException {
-    	setEncoding();
-    	return super.getCharacterStream();
-    }
-
-	private void setEncoding() throws SQLException {
-		String encoding = XMLType.getEncoding(this);
-		if (encoding != null) {
-    		this.getStreamFactory().setEncoding(encoding);
+    public String getEncoding() {
+    	String enc = super.getEncoding();
+    	if (enc != null) {
+    		return enc;
+    	}
+    	try {
+			enc = XMLType.getEncoding(this.getBinaryStream());
+			if (enc != null) {
+				setEncoding(enc);
+			}
+		} catch (SQLException e) {
 		}
-	}
+    	return Streamable.ENCODING;
+    }
     
-    public boolean isInMemory() {
-		return inMemory;
-	}
-    
     @SuppressWarnings("unchecked")
 	public <T extends Source> T getSource(Class<T> sourceClass) throws SQLException {
 		if (sourceClass == null || sourceClass == StreamSource.class) {
@@ -160,4 +156,5 @@
 			throws SQLException {
 		throw SqlUtil.createFeatureNotSupportedException();
 	}
+	
 }

Modified: trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/common-core/src/main/java/org/teiid/core/types/XMLType.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -108,13 +108,6 @@
 		this.type = type;
 	}
 	
-	public Boolean isInMemory() {
-		if (this.reference instanceof SQLXMLImpl) {
-			return (((SQLXMLImpl) this.reference).isInMemory());
-		}
-		return null;
-	}
-	
 	public String getEncoding() {
 		return encoding;
 	}
@@ -145,32 +138,35 @@
 	 * @return
 	 */
 	public static String getEncoding(SQLXML xml) {
-		InputStream is = null;
 		try {
 			if (xml instanceof XMLType) {
 				XMLType type = (XMLType)xml;
+				if (type.encoding != null) {
+					return type.encoding;
+				}
 				xml = type.reference;
 			}
 			if (xml instanceof SQLXMLImpl) {
-				String encoding = ((SQLXMLImpl)xml).getStreamFactory().getEncoding();
-				if (encoding != null) {
-					return encoding;
-				}
+				return ((SQLXMLImpl)xml).getEncoding();
 			}
-			XMLInputFactory factory = XMLInputFactory.newInstance();
-			is = xml.getBinaryStream();
-			XMLStreamReader reader = factory.createXMLStreamReader(is);
-			return reader.getEncoding();
+			return getEncoding(xml.getBinaryStream());
 		} catch (SQLException e) {
 			return null;
+		}
+	}
+
+	public static String getEncoding(InputStream is) {
+		XMLInputFactory factory = XMLInputFactory.newInstance();
+		XMLStreamReader reader;
+		try {
+			reader = factory.createXMLStreamReader(is);
+			return reader.getEncoding();
 		} catch (XMLStreamException e) {
 			return null;
 		} finally {
-			if (is != null) {
-				try {
-					is.close();
-				} catch (IOException e) {
-				}
+			try {
+				is.close();
+			} catch (IOException e) {
 			}
 		}
 	}

Modified: trunk/common-core/src/main/java/org/teiid/core/util/Base64.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/util/Base64.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/common-core/src/main/java/org/teiid/core/util/Base64.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -413,23 +413,13 @@
      * @return the decoded data
      * @since 1.4
      */
-    public static byte[] decode( String s )
+    public static byte[] decode( CharSequence s )
 	{
-		byte[] source;
-        try
-        {
-        	source = s.getBytes( PREFERRED_ENCODING );
-        }   // end try
-        catch( java.io.UnsupportedEncodingException uee )
-        {
-        	source = s.getBytes();
-        }   // end catch
-		//</change>
-        if (source.length % 4 != 0) {
+        if (s.length() % 4 != 0) {
         	throw new IllegalArgumentException("Source bytes are not valid"); //$NON-NLS-1$
         }
         byte[] DECODABET = _STANDARD_DECODABET;
-    	int len = source.length;
+    	int len = s.length();
         byte[] outBuff = new byte[ len * 3 / 4 ]; // Upper limit on size of output
         int    outBuffPosn = 0;
         
@@ -440,7 +430,7 @@
         byte   sbiDecode = 0;
         for( i = 0; i < len; i++ )
         {
-            sbiCrop = (byte)(source[i] & 0x7f); // Only the low seven bits
+            sbiCrop = (byte)(s.charAt(i) & 0x7f); // Only the low seven bits
             sbiDecode = DECODABET[ sbiCrop ];
             
             if( sbiDecode >= WHITE_SPACE_ENC ) // White space, Equals sign or better

Modified: trunk/common-core/src/main/java/org/teiid/core/util/ReaderInputStream.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/util/ReaderInputStream.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/common-core/src/main/java/org/teiid/core/util/ReaderInputStream.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -27,25 +27,27 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStreamWriter;
 import java.io.Reader;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
+import java.io.Writer;
 import java.nio.charset.Charset;
 
 import org.teiid.core.types.DataTypeManager;
 
+/**
+ * Implements a buffered {@link InputStream} for a given {@link Reader} and {@link Charset}
+ */
 public class ReaderInputStream extends InputStream {
 	
+	//even though we're dealing with chars, we'll use the same default
 	private static final int DEFAULT_BUFFER_SIZE = DataTypeManager.MAX_LOB_MEMORY_BYTES;
 	
 	private final Reader reader;
-	private final Charset charSet;
+	private Writer writer;
 	private char[] charBuffer;
-	
+	private AccessibleByteArrayOutputStream out = new AccessibleByteArrayOutputStream();
 	private boolean hasMore = true;
-	private ByteBuffer currentBuffer;
-	private int prefixBytes;
-	private boolean needsPrefix = true;
+	private int pos = 0;
 	
 	public ReaderInputStream(Reader reader, Charset charSet) {
 		this(reader, charSet, DEFAULT_BUFFER_SIZE);
@@ -53,31 +55,27 @@
 
 	public ReaderInputStream(Reader reader, Charset charSet, int bufferSize) {
 		this.reader = reader;
-		this.charSet = charSet;
+		this.writer = new OutputStreamWriter(out, charSet);
 		this.charBuffer = new char[bufferSize];
-		if (charSet.displayName().equalsIgnoreCase("UTF-16")) { //$NON-NLS-1$
-			prefixBytes = 2;
-		}
 	}
 
 	@Override
 	public int read() throws IOException {
-		if (currentBuffer == null || !currentBuffer.hasRemaining()) {
-			if (!hasMore) {
-				return -1;
-			}
+		if (!hasMore) {
+			return -1;
+		}
+		while (pos >= out.getCount()) {
+			out.reset();
+			pos = 0;
 			int charsRead = reader.read(charBuffer);
 			if (charsRead == -1) {
 	            hasMore = false;
 				return -1;
 			}
-			currentBuffer = charSet.encode(CharBuffer.wrap(charBuffer, 0, charsRead));
-			if (!needsPrefix) {
-				currentBuffer.position(prefixBytes);
-			}
-			needsPrefix = false;
+			writer.write(charBuffer, 0, charsRead);
+			writer.flush();
 		}
-		return currentBuffer.get() & 0xff;
+		return out.getBuffer()[pos++] & 0xff;
 	}
 	
 	@Override

Modified: trunk/common-core/src/test/java/org/teiid/core/util/TestReaderInputStream.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/util/TestReaderInputStream.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/common-core/src/test/java/org/teiid/core/util/TestReaderInputStream.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -22,19 +22,18 @@
 
 package org.teiid.core.util;
 
+import static org.junit.Assert.*;
+
 import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.StringReader;
 import java.nio.charset.Charset;
 
-import org.teiid.core.util.ReaderInputStream;
+import org.junit.Test;
 
-import junit.framework.TestCase;
-
-
-public class TestReaderInputStream extends TestCase {
+public class TestReaderInputStream {
 	
-	public void testUTF8() throws Exception {
+	@Test public void testUTF8() throws Exception {
 		FileInputStream fis = new FileInputStream(UnitTestUtil.getTestDataFile("legal_notice.xml")); //$NON-NLS-1$
 		ReaderInputStream ris = new ReaderInputStream(new FileReader(UnitTestUtil.getTestDataFile("legal_notice.xml")), Charset.forName("UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$
 		
@@ -48,8 +47,7 @@
 		}
 	}
 	
-	//the encoding strategy is roughly equivalent to utf-16
-	public void testUTF16() throws Exception {
+	@Test public void testUTF16() throws Exception {
 		String actual = "!?abc"; //$NON-NLS-1$
 		ReaderInputStream ris = new ReaderInputStream(new StringReader(actual), Charset.forName("UTF-16"), 1); //$NON-NLS-1$
 		byte[] result = new byte[(actual.length()) * 2 + 2];
@@ -58,7 +56,7 @@
 		assertEquals(resultString, actual);
 	}
 	
-	public void testASCII() throws Exception  {
+	@Test public void testASCII() throws Exception  {
 		String actual = "!?abc"; //$NON-NLS-1$
 		ReaderInputStream ris = new ReaderInputStream(new StringReader(actual), Charset.forName("US-ASCII"), 1); //$NON-NLS-1$
 		byte[] result = new byte[actual.length()];

Modified: trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java
===================================================================
--- trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/connectors/translator-file/src/main/java/org/teiid/translator/file/FileExecutionFactory.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -104,11 +104,13 @@
 			}
 			ArrayList<Object> result = new ArrayList<Object>(2);
 			final File file = files[index++];
-			FileInputStreamFactory isf = new FileInputStreamFactory(file, encoding);
+			FileInputStreamFactory isf = new FileInputStreamFactory(file);
 			isf.setLength(file.length());
 			Object value = null;
 			if (isText) {
-				value = new ClobType(new ClobImpl(isf, -1));
+				ClobImpl clob = new ClobImpl(isf, -1);
+				clob.setEncoding(encoding);
+				value = new ClobType(clob);
 			} else {
 				value = new BlobType(new BlobImpl(isf));
 			}

Modified: trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java
===================================================================
--- trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSExecutionFactory.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -127,12 +127,12 @@
 		param.setNullType(NullType.Nullable);
 
 		param = metadataFactory.addProcedureParameter("action", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
-		param.setAnnotation("With a SOAP invocation, action sets the SOAPAction.  With HTTP it sets the HTTP Method (GET, POST, etc.).");
+		param.setAnnotation("With a SOAP invocation, action sets the SOAPAction.  With HTTP it sets the HTTP Method (GET, POST - default, etc.).");
 		param.setNullType(NullType.Nullable);
 
 		//can be one of string, xml, clob
-		param = metadataFactory.addProcedureParameter("request", TypeFacility.RUNTIME_NAMES.OBJECT, Type.In, p); //$NON-NLS-1$
-		param.setAnnotation("The String, XML, or CLOB value containing an XML document or fragment that represents the request (valid with SOAP or HTTP/POST invocations).  If the ExecutionFactory is configured in with a DefaultServiceMode or MESSAGE then SOAP request must contain the entire SOAP message.");
+		param = metadataFactory.addProcedureParameter("request", TypeFacility.RUNTIME_NAMES.XML, Type.In, p); //$NON-NLS-1$
+		param.setAnnotation("The XML document or root element that represents the request.  If the ExecutionFactory is configured in with a DefaultServiceMode or MESSAGE then SOAP request must contain the entire SOAP message.");
 		param.setNullType(NullType.Nullable);
 		
 		param = metadataFactory.addProcedureParameter("endpoint", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
@@ -141,9 +141,24 @@
 		
 		metadataFactory.addProcedureParameter("result", TypeFacility.RUNTIME_NAMES.XML, Type.ReturnValue, p); //$NON-NLS-1$
 		
-		//invokeHttp
+		/*p = metadataFactory.addProcedure("invokeHttp"); //$NON-NLS-1$ 
+		p.setAnnotation("Invokes a webservice that returns an binary result");
+
+		param = metadataFactory.addProcedureParameter("method", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
+		param.setAnnotation("Sets the HTTP Method (GET, POST - default, etc.).");
+		param.setNullType(NullType.Nullable);
+
+		//can be one of string, xml, clob
+		param = metadataFactory.addProcedureParameter("request", TypeFacility.RUNTIME_NAMES.OBJECT, Type.In, p); //$NON-NLS-1$
+		param.setAnnotation("The String, XML, BLOB, or CLOB value containing a payload request.");
+		param.setNullType(NullType.Nullable);
 		
+		param = metadataFactory.addProcedureParameter("endpoint", TypeFacility.RUNTIME_NAMES.STRING, Type.In, p); //$NON-NLS-1$
+		param.setAnnotation("The relative or abolute endpoint to use.  May be set or allowed to default to null to use the default endpoint address.");
+		param.setNullType(NullType.Nullable);
 		
+		metadataFactory.addProcedureParameter("result", TypeFacility.RUNTIME_NAMES.BLOB, Type.ReturnValue, p); //$NON-NLS-1$
+		metadataFactory.addProcedureParameter("contentType", TypeFacility.RUNTIME_NAMES.STRING, Type.Out, p); //$NON-NLS-1$*/	
 	}
 
 }

Modified: trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSProcedureExecution.java
===================================================================
--- trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSProcedureExecution.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/connectors/translator-ws/src/main/java/org/teiid/translator/ws/WSProcedureExecution.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -22,10 +22,8 @@
 
 package org.teiid.translator.ws;
 
-import java.io.IOException;
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.sql.Clob;
 import java.sql.SQLException;
 import java.sql.SQLXML;
 import java.util.Arrays;
@@ -41,7 +39,7 @@
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
 
-import org.teiid.core.types.ClobType;
+import org.teiid.core.types.XMLType;
 import org.teiid.language.Argument;
 import org.teiid.language.Call;
 import org.teiid.logging.LogConstants;
@@ -84,33 +82,10 @@
         
         String style = (String)arguments.get(0).getArgumentValue().getValue();
         String action = (String)arguments.get(1).getArgumentValue().getValue();
-        Object docObject = arguments.get(2).getArgumentValue().getValue();
+        XMLType docObject = (XMLType)arguments.get(2).getArgumentValue().getValue();
         Source source = null;
     	try {
-	        if (docObject instanceof SQLXML) {
-	        	SQLXML xml = (SQLXML)docObject;
-	        	source = xml.getSource(null);
-	            if (LogManager.isMessageToBeRecorded(LogConstants.CTX_WS, MessageLevel.DETAIL)) { 
-	    			LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Request " + xml.getString()); //$NON-NLS-1$
-	            }
-	        } else if (docObject instanceof Clob) {
-	        	Clob clob = (Clob)docObject;
-	        	source = new StreamSource(clob.getCharacterStream());
-	        	if (LogManager.isMessageToBeRecorded(LogConstants.CTX_WS, MessageLevel.DETAIL)) {
-	    			try {
-						LogManager.logDetail(LogConstants.CTX_CONNECTOR, "WebService Request: " + ClobType.getString(clob)); //$NON-NLS-1$
-					} catch (IOException e) {
-					} 
-	            }
-	        } else if (docObject instanceof String) {
-	        	String string = (String)docObject;
-	        	source = new StreamSource(new StringReader(string));
-	        	if (LogManager.isMessageToBeRecorded(LogConstants.CTX_WS, MessageLevel.DETAIL)) {
-	    			LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Request " + string); //$NON-NLS-1$
-	            }
-	        } else if (docObject != null) {
-	        	throw new TranslatorException(WSExecutionFactory.UTIL.getString("unknown_doc_type")); //$NON-NLS-1$
-	        }
+	        source = converToSource(docObject);
 	        String endpoint = (String)arguments.get(3).getArgumentValue().getValue();
 	        
 	        if (style == null) {
@@ -173,6 +148,16 @@
 			Util.closeSource(source);
 		}
     }
+
+	private StreamSource converToSource(SQLXML xml) throws SQLException {
+		if (xml == null) {
+			return null;
+		}
+		if (LogManager.isMessageToBeRecorded(LogConstants.CTX_WS, MessageLevel.DETAIL)) { 
+			LogManager.logDetail(LogConstants.CTX_CONNECTOR, "Request " + xml.getString()); //$NON-NLS-1$
+	    }
+		return xml.getSource(StreamSource.class);
+	}
     
     @Override
     public List<?> next() throws TranslatorException, DataNotAvailableException {

Modified: trunk/connectors/translator-ws/src/main/resources/org/teiid/translator/ws/i18n.properties
===================================================================
--- trunk/connectors/translator-ws/src/main/resources/org/teiid/translator/ws/i18n.properties	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/connectors/translator-ws/src/main/resources/org/teiid/translator/ws/i18n.properties	2010-06-16 19:02:47 UTC (rev 2237)
@@ -21,5 +21,4 @@
 #
 
 http_usage_error=In HTTP invocation mode, a non-POST method was specified with a request document.  Either the document should be added to the query string or POST should be used as the method.
-unknown_doc_type=Unknown document object type, should be one of XML, CLOB, String
 invalid_invocation=Invalid invocation style specified, should be one of {0} 
\ No newline at end of file

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/datatypes.xml	2010-06-16 19:02:47 UTC (rev 2237)
@@ -276,7 +276,7 @@
             <entry>clob</entry>
             <entry>char, boolean, byte, short, integer, long,
               biginteger, float, double, bigdecimal, xml<footnote>
-                  <para>See also <link linkend="xmlparse">XMLPARSE</link></para>
+                  <para>string to xml is equivlant to XMLPARSE(DOCUMENT exp) - See also <link linkend="xmlparse">XMLPARSE</link></para>
                 </footnote></entry>
           </row>
           <row>
@@ -350,7 +350,7 @@
             <entry>xml</entry>
             <entry></entry>
             <entry>string<footnote>
-                  <para>See also <link linkend="xmlserialize">XMLSERIALIZE</link></para>
+                  <para>xml to string is equivalent to XMLSERIALIZE(exp AS STRING) - see also <link linkend="xmlserialize">XMLSERIALIZE</link></para>
                 </footnote></entry>
           </row>
         </tbody>

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/scalar_functions.xml	2010-06-16 19:02:47 UTC (rev 2237)
@@ -920,6 +920,19 @@
           </row>
           <row>
             <entry>
+              <para>(7.0+) QUERYSTRING(path [, expr [AS name] ...])</para>
+            </entry>
+            <entry>
+              <para>Returns a properly encoded query string appended to the given path.  Null valued expressions are omitted, and a null path is treated as ''.</para>
+              <para>Names are optional for column reference expressions.</para>
+              <para>e.g. QUERYSTRING('path', 'value' as "&amp;x", ' &amp; ' as y, null as z) returns 'path?%26x=value&amp;y=%20%26%20'</para>
+            </entry>
+            <entry>
+              <para>path, expr in {string}.  name is an identifier</para>
+            </entry>
+          </row>
+          <row>
+            <entry>
               <para>REPEAT(str1,instances)</para>
             </entry>
             <entry>
@@ -1035,19 +1048,6 @@
               <para>x in {string}</para>
             </entry>
           </row>
-          <row>
-            <entry>
-              <para>QUERYSTRING(path [, expr [AS name] ...])</para>
-            </entry>
-            <entry>
-              <para>Returns a properly encoded query string appended to the given path.  Null valued expressions are omitted, and a null path is treated as ''.</para>
-              <para>Names are optional for column reference expressions.</para>
-              <para>e.g. QUERYSTRING('path', 'value' as "&amp;x", ' &amp; ' as y, null as z) returns 'path?%26x=value&amp;y=%20%26%20'</para>
-            </entry>
-            <entry>
-              <para>path, expr in {string}.  name is an identifier</para>
-            </entry>
-          </row>
         </tbody>
       </tgroup>
     </informaltable>
@@ -1191,6 +1191,18 @@
           </row>
           <row>
             <entry>
+              <para>FROM_UNIXTIME (unix_timestamp)</para>
+            </entry>
+            <entry>
+              <para>Return the Unix timestamp (in seconds) as a Timestamp value
+              </para>
+            </entry>
+            <entry>
+              <para>Unix timestamp (in seconds)</para>
+            </entry>
+          </row>
+          <row>
+            <entry>
               <para>HOUR(x)</para>
             </entry>
             <entry>
@@ -1213,32 +1225,44 @@
           </row>
           <row>
             <entry>
-              <para>MONTH(x)</para>
+              <para>MODIFYTIMEZONE (timestamp, startTimeZone,
+                endTimeZone)</para>
             </entry>
             <entry>
-              <para>Return month</para>
+              <para>Returns a timestamp based upon the incoming timestamp
+                adjusted for the differential between the start and end time
+                zones.  i.e. if the server is in GMT-6, then modifytimezone({ts
+                '2006-01-10 04:00:00.0'},'GMT-7', 'GMT-8') will return the
+                timestamp {ts '2006-01-10 05:00:00.0'} as read in GMT-6.  The
+                value has been adjusted 1 hour ahead to compensate for the
+                difference between GMT-7 and GMT-8.</para>
             </entry>
             <entry>
-              <para>x in {date, timestamp}, returns integer</para>
+              <para>startTimeZone and endTimeZone are strings,
+                returns a timestamp</para>
             </entry>
           </row>
           <row>
             <entry>
-              <para>MONTHNAME(x)</para>
+              <para>MODIFYTIMEZONE (timestamp, endTimeZone)</para>
             </entry>
             <entry>
-              <para>Return name of month</para>
+              <para>Return a timestamp in the same manner as
+                modifytimezone(timestamp, startTimeZone, endTimeZone), but will
+                assume that the startTimeZone is the same as the server process.
+              </para>
             </entry>
             <entry>
-              <para>x in {date, timestamp}, returns string</para>
+              <para>Timestamp is a timestamp; endTimeZone is a string,
+                returns a timestamp</para>
             </entry>
           </row>
           <row>
             <entry>
-              <para>QUARTER(x)</para>
+              <para>MONTH(x)</para>
             </entry>
             <entry>
-              <para>Return quarter</para>
+              <para>Return month</para>
             </entry>
             <entry>
               <para>x in {date, timestamp}, returns integer</para>
@@ -1246,6 +1270,17 @@
           </row>
           <row>
             <entry>
+              <para>MONTHNAME(x)</para>
+            </entry>
+            <entry>
+              <para>Return name of month</para>
+            </entry>
+            <entry>
+              <para>x in {date, timestamp}, returns string</para>
+            </entry>
+          </row>
+          <row>
+            <entry>
               <para>PARSEDATE(x, y)</para>
             </entry>
             <entry>
@@ -1279,6 +1314,17 @@
           </row>
           <row>
             <entry>
+              <para>QUARTER(x)</para>
+            </entry>
+            <entry>
+              <para>Return quarter</para>
+            </entry>
+            <entry>
+              <para>x in {date, timestamp}, returns integer</para>
+            </entry>
+          </row>
+          <row>
+            <entry>
               <para>SECOND(x)</para>
             </entry>
             <entry>
@@ -1385,52 +1431,6 @@
               <para>x in {date, timestamp}, returns integer</para>
             </entry>
           </row>
-          <row>
-            <entry>
-              <para>MODIFYTIMEZONE (timestamp, startTimeZone,
-                endTimeZone)</para>
-            </entry>
-            <entry>
-              <para>Returns a timestamp based upon the incoming timestamp
-                adjusted for the differential between the start and end time
-                zones.  i.e. if the server is in GMT-6, then modifytimezone({ts
-                '2006-01-10 04:00:00.0'},'GMT-7', 'GMT-8') will return the
-                timestamp {ts '2006-01-10 05:00:00.0'} as read in GMT-6.  The
-                value has been adjusted 1 hour ahead to compensate for the
-                difference between GMT-7 and GMT-8.</para>
-            </entry>
-            <entry>
-              <para>startTimeZone and endTimeZone are strings,
-                returns a timestamp</para>
-            </entry>
-          </row>
-          <row>
-            <entry>
-              <para>MODIFYTIMEZONE (timestamp, endTimeZone)</para>
-            </entry>
-            <entry>
-              <para>Return a timestamp in the same manner as
-                modifytimezone(timestamp, startTimeZone, endTimeZone), but will
-                assume that the startTimeZone is the same as the server process.
-              </para>
-            </entry>
-            <entry>
-              <para>Timestamp is a timestamp; endTimeZone is a string,
-                returns a timestamp</para>
-            </entry>
-          </row>
-          <row>
-            <entry>
-              <para>FROM_UNIXTIME (unix_timestamp)</para>
-            </entry>
-            <entry>
-              <para>Return the Unix timestamp (in seconds) as a Timestamp value
-              </para>
-            </entry>
-            <entry>
-              <para>Unix timestamp (in seconds)</para>
-            </entry>
-          </row>
         </tbody>
       </tgroup>
     </informaltable>
@@ -1578,6 +1578,17 @@
           </row>
           <row>
             <entry>
+              <para>COALESCE(x,y+)</para>
+            </entry>
+            <entry>
+              <para>Returns the first non-null parameter</para>
+            </entry>
+            <entry>
+              <para>x and all y's can be any compatible types</para>
+            </entry>
+          </row>
+          <row>
+            <entry>
               <para>IFNULL(x,y)</para>
             </entry>
             <entry>
@@ -1611,17 +1622,6 @@
               <para>param1 and param2 must be compatable comparable types</para>
             </entry>
           </row>
-          <row>
-            <entry>
-              <para>COALESCE(x,y+)</para>
-            </entry>
-            <entry>
-              <para>Returns the first non-null parameter</para>
-            </entry>
-            <entry>
-              <para>x and all y's can be any compatible types</para>
-            </entry>
-          </row>
         </tbody>
       </tgroup>
     </informaltable>
@@ -1870,24 +1870,26 @@
         <tbody>
           <row>
             <entry>
-              <para><code>USER()</code></para>
+              <para><code>COMMANDPAYLOAD()</code></para>
             </entry>
             <entry>
-              <para>Retrieve the name of the user executing the
-                query</para>
+              <para>Retrieve the string form of the command payload
+                or null if no command payload was specified. The command
+                payload is set by a method on the Teiid JDBC API
+                extensions on a per-query basis.</para>
             </entry>
             <entry>
-              <para>return is string</para>
+              <para>Returns a string</para>
             </entry>
           </row>
           <row>
             <entry>
-              <para><code>ENV(key)</code></para>
+              <para><code>COMMANDPAYLOAD(key)</code></para>
             </entry>
             <entry>
-              <para>Retrieve an environment property. The only key
-                currently allowed is ‘sessionid’, although this will expand
-                in the future.</para>
+              <para>Cast the command payload object to a
+                java.util.Properties object and look up the specified key in
+                the object</para>
             </entry>
             <entry>
               <para>key in {string}, return is string</para>
@@ -1895,29 +1897,27 @@
           </row>
           <row>
             <entry>
-              <para><code>COMMANDPAYLOAD()</code></para>
+              <para><code>ENV(key)</code></para>
             </entry>
             <entry>
-              <para>Retrieve the string form of the command payload
-                or null if no command payload was specified. The command
-                payload is set by a method on the Teiid JDBC API
-                extensions on a per-query basis.</para>
+              <para>Retrieve an environment property. The only key
+                currently allowed is ‘sessionid’, although this will expand
+                in the future.</para>
             </entry>
             <entry>
-              <para>Returns a string</para>
+              <para>key in {string}, return is string</para>
             </entry>
           </row>
           <row>
             <entry>
-              <para><code>COMMANDPAYLOAD(key)</code></para>
+              <para><code>USER()</code></para>
             </entry>
             <entry>
-              <para>Cast the command payload object to a
-                java.util.Properties object and look up the specified key in
-                the object</para>
+              <para>Retrieve the name of the user executing the
+                query</para>
             </entry>
             <entry>
-              <para>key in {string}, return is string</para>
+              <para>return is string</para>
             </entry>
           </row>
         </tbody>
@@ -1959,7 +1959,7 @@
           </row>
           <row>
             <entry>
-              <para><code>XSLTRANSFORM(doc, xsl)</code></para>
+              <para><code>(7.0+) XSLTRANSFORM(doc, xsl)</code></para>
             </entry>
             <entry>
               <para>Applies an xsl stylesheet to the given document.  If either argument is null, the result is null.</para>
@@ -1971,7 +1971,7 @@
           </row>
           <row id="xmlquery">
             <entry>
-              <para><code>XMLQUERY([&lt;NSP&gt;] xquery [&lt;PASSING&gt;] [(NULL|EMPTY) ON EMPTY]]</code></para>
+              <para><code>(7.0+) XMLQUERY([&lt;NSP&gt;] xquery [&lt;PASSING&gt;] [(NULL|EMPTY) ON EMPTY]]</code></para>
               <para>PASSING:=<code>PASSING exp [AS name] [, exp [AS name]]*</code></para>
             </entry>
             <entry>
@@ -2067,11 +2067,11 @@
           </row>
           <row>
             <entry id="xmlserialize">
-              <para><code>XMLSERIALIZE((DOCUMENT|CONTENT) exp [AS datatype])</code></para>
+              <para><code>XMLSERIALIZE([(DOCUMENT|CONTENT)] exp [AS datatype])</code></para>
             </entry>
             <entry>
               <para>Returns a character type representation of the exp expression. 
-              Only a character type (string, clob) may be specified as the datatype.  
+              Only a character type (string, varchar, clob) may be specified as the datatype.  CONTENT is the default.  
               If DOCUMENT is specified and the xml is not a valid document or fragment, then an exception is raised. 
               </para>
             </entry>

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/sql_support.xml	2010-06-16 19:02:47 UTC (rev 2237)
@@ -724,7 +724,7 @@
       </note>
       <sect3 id="nested_table">
 		<title>Nested Table Reference</title>
-		<para>Nested tables may appear in the FROM clause with the TABLE
+		<para>(7.0+) Nested tables may appear in the FROM clause with the TABLE
 			keyword. They are an alternative to using a view with normal join
 			semantics.  The columns projected from the command contained in the nested table
 			 may be used just as any of the other FROM clause projected columns in join criteria, the where clause, etc.
@@ -748,7 +748,7 @@
 	  </sect3>
 	  <sect3 id="texttable">
 		<title>TEXTTABLE</title>
-		<para>The TEXTTABLE funciton processes character input to produce tabular ouptut.  It supports both fixed and delimited file format parsing.  
+		<para>(7.0+) The TEXTTABLE funciton processes character input to produce tabular ouptut.  It supports both fixed and delimited file format parsing.  
 			The function itself defines what columns it projects.  
 		    The TEXTTABLE function is implicitly a nested table and may be correlated to preceeding FROM clause entries.
       	</para>
@@ -826,8 +826,8 @@
 	  </sect3>
 	  <sect3 id="xmltable">
 		<title>XMLTABLE</title>
-		<para>The XMLTABLE funciton uses XQuery to produce tabular ouptut.  
-		    The XMLTABLE function is implicitly a nested table and may be correlated to preceeding FROM clause entries.
+		<para>(7.0+) The XMLTABLE funciton uses XQuery to produce tabular ouptut.  
+		    The XMLTABLE function is implicitly a nested table and may be correlated to preceeding FROM clause entries.  XMLTABLE is part of the SQL/XML 2006 specification. 
       	</para>
       	<para>
         Usage:

Modified: trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml
===================================================================
--- trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/documentation/reference/src/main/docbook/en-US/content/translators.xml	2010-06-16 19:02:47 UTC (rev 2237)
@@ -97,6 +97,7 @@
 </tbody>
 </tgroup>
 </table>
+<para>There are file importer settings, but it does provide metadata for dynamic vdbs.</para>
 <sect3><title>Usage</title>
 <para>Retrieve all files as BLOBs with the given extension at the given path. <programlisting>call getFiles('path/*.ext')</programlisting>
 If the extension pattern is not specified and the path is a directory, then all files in the directory will be returned.  If the path or filename doesn't exist, then no results will be returned.
@@ -360,7 +361,7 @@
 </tbody>
 </tgroup>
 </table>
-<para>There are no import settings for the Loopback translator.</para>
+<para>There are no import settings for the Loopback translator; it also does not provide metadata - it should be used as a testing stub.</para>
 </sect2>
 <sect2>
 <title>Salesforce Translator</title>
@@ -687,14 +688,15 @@
 </tbody>
 </tgroup>
 </table>
+<para>There are ws importer settings, but it does provide metadata for dynamic vdbs.</para>
 <sect3><title>Usage</title>
 <para>The main procedure, invoke, allows for multiple binding, or protocol modes, including HTTP, SOAP11, and SOAP12. 
-<programlisting>Procedure invoke(binding in STRING, action in STRING, request in OBJECT, endpoint in STRING) returns XML</programlisting>
+<programlisting>Procedure invoke(binding in STRING, action in STRING, request in XML, endpoint in STRING) returns XML</programlisting>
 </para>
 <para>The binding may be one of null (to use the default) HTTP, SOAP11, or SOAP12.  Action with a SOAP binding indicates the SOAPAction value.  Action with a HTTP binding indicates the HTTP method (GET, POST, etc.), which defaults to POST.</para>
 <para>A null value for the binding or endpoint will use the default value.  The default endpoint is specified in the WS resource adapter configuration.  The endpoint URL may be absolute or relative.  If it's relative then it will be combined with the default endpoint.</para>
 <para>Since multiple parameters are not required to have values, it is often more clear to call the invoke procedure with named parameter syntax. e.g. <programlisting>call invoke(binding='HTTP', action='GET')</programlisting></para>
-<para>The request can be an XML, STRING, or CLOB value and should be a valid XML document.</para>
+<para>The request XML should be a valid XML document or root element.</para>
 <para>See the ws-weather example in the kit and database metadata for a full description of invoke.</para>
 </sect3>
 </sect2>

Modified: trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/eval/Evaluator.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -23,13 +23,12 @@
 package org.teiid.query.eval;
 
 import java.io.IOException;
-import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringReader;
-import java.nio.charset.Charset;
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.SQLException;
+import java.sql.SQLXML;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -53,6 +52,7 @@
 import org.teiid.core.TeiidComponentException;
 import org.teiid.core.TeiidProcessingException;
 import org.teiid.core.types.BaseLob;
+import org.teiid.core.types.BlobType;
 import org.teiid.core.types.ClobImpl;
 import org.teiid.core.types.ClobType;
 import org.teiid.core.types.DataTypeManager;
@@ -114,7 +114,6 @@
 import org.teiid.query.xquery.saxon.SaxonXQueryExpression;
 import org.teiid.translator.WSConnection.Util;
 
-
 public class Evaluator {
 
     private final class SequenceReader extends Reader {
@@ -671,11 +670,12 @@
 			return null;
 		}
 		XMLType.Type type = Type.DOCUMENT;
-		XMLType result = null;
+		SQLXMLImpl result = null;
 		try {
 			if (value instanceof String) {
 				String string = (String)value;
-				result = new XMLType(new SQLXMLImpl(string));
+				result = new SQLXMLImpl(string);
+				result.setEncoding(Streamable.ENCODING);
 				if (!xp.isWellFormed()) {
 					Reader r = new StringReader(string);
 					type = validate(xp, r);
@@ -683,49 +683,36 @@
 			} else {
 				InputStreamFactory isf = null;
 				Streamable<?> s = (Streamable<?>)value;
-				if (s.getReference() instanceof BaseLob) {
-					BaseLob baseLob = (BaseLob)s.getReference();
-					isf = baseLob.getStreamFactory();
-				} else {
-					if (s instanceof Clob) {
-						isf = new InputStreamFactory.ClobInputStreamFactory((Clob)s.getReference());
-					} else {
-						isf = new InputStreamFactory.BlobInputStreamFactory((Blob)s.getReference());
-					}
-				}
-				result = new XMLType(new SQLXMLImpl(isf));
+				isf = getInputStreamFactory(s);
+				result = new SQLXMLImpl(isf);
 				if (!xp.isWellFormed()) {
-					String encoding = null;
-					Reader r = null;
-					if (s instanceof Clob) {
-						r = isf.getCharacterStream();
-					} else {
-						encoding = XMLType.getEncoding(result); //look for the xml declaration
-						if (encoding == null) {
-							encoding = "UTF-8"; //$NON-NLS-1$
-						}
-						r = new InputStreamReader(isf.getInputStream(), encoding);
-					}
+					Reader r = result.getCharacterStream();
 					type = validate(xp, r);
-					if (encoding != null) {
-						isf.setEncoding(encoding);
-					}
 				}
 			}
 		} catch (TransformationException e) {
 			throw new ExpressionEvaluationException(e, e.getMessage());
-		} catch (IOException e) {
-			throw new ExpressionEvaluationException(e, e.getMessage());
 		} catch (SQLException e) {
 			throw new ExpressionEvaluationException(e, e.getMessage());
 		}
 		if (!xp.isDocument()) {
 			type = Type.CONTENT;
 		}
-		result.setType(type);
-		return result;
+		XMLType xml = new XMLType(result);
+		xml.setType(type);
+		return xml;
 	}
 
+	//TODO: determine when wrapping is not needed
+	public static InputStreamFactory getInputStreamFactory(Streamable<?> s) {
+		if (s instanceof ClobType) {
+			return new InputStreamFactory.ClobInputStreamFactory((Clob)s.getReference());
+		} else if (s instanceof BlobType){
+			return new InputStreamFactory.BlobInputStreamFactory((Blob)s.getReference());
+		}
+		return new InputStreamFactory.SQLXMLInputStreamFactory((SQLXML)s.getReference());
+	}
+
 	private Type validate(final XMLParse xp, Reader r)
 			throws TransformationException {
 		if (!xp.isDocument()) {
@@ -792,7 +779,7 @@
 			return null;
 		}
 		try {
-			if (!xs.isDocument()) {
+			if (xs.isDocument() == null || !xs.isDocument()) {
 				return serialize(xs, value);
 			}
 			if (value.getType() == Type.UNKNOWN) {
@@ -810,18 +797,11 @@
 		throw new FunctionExecutionException(QueryPlugin.Util.getString("Evaluator.xmlserialize")); //$NON-NLS-1$
 	}
 
-	private Object serialize(XMLSerialize xs, XMLType value)
-			throws SQLException, TransformationException {
+	private Object serialize(XMLSerialize xs, XMLType value) throws TransformationException {
 		if (xs.getType() == DataTypeManager.DefaultDataClasses.STRING) {
 			return DataTypeManager.transformValue(value, xs.getType());
 		}
-		InputStreamFactory isf = null;
-		if (value.getReference() instanceof BaseLob) {
-			BaseLob baseLob = (BaseLob)value.getReference();
-			isf = baseLob.getStreamFactory();
-		} else {
-			isf = new InputStreamFactory.SQLXMLInputStreamFactory(value.getReference());
-		}
+		InputStreamFactory isf = getInputStreamFactory(value);
 		return new ClobType(new ClobImpl(isf, -1));
 	}
 

Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionLibrary.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -87,11 +87,6 @@
     public static final String COALESCE = "coalesce"; //$NON-NLS-1$
 
     public static final String SPACE = "space"; //$NON-NLS-1$
-    
-    public static final String XMLFOREST = "XMLFOREST"; //$NON-NLS-1$
-    public static final String XMLATTRIBUTES = "XMLATTRIBUTES"; //$NON-NLS-1$
-    public static final String XMLNAMESPACES = "XMLNAMESPACES"; //$NON-NLS-1$
-    public static final String XMLELEMENT = "XMLELEMENT"; //$NON-NLS-1$
 	
     // Function tree for system functions (never reloaded)
     private FunctionTree systemFunctions;

Modified: trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/function/FunctionMethods.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -25,6 +25,13 @@
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CoderResult;
+import java.sql.Blob;
+import java.sql.Clob;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.text.DateFormat;
@@ -38,8 +45,15 @@
 
 import org.teiid.api.exception.query.ExpressionEvaluationException;
 import org.teiid.api.exception.query.FunctionExecutionException;
+import org.teiid.core.types.BlobImpl;
+import org.teiid.core.types.BlobType;
+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.core.types.InputStreamFactory.BlobInputStreamFactory;
+import org.teiid.core.types.InputStreamFactory.ClobInputStreamFactory;
+import org.teiid.core.util.Base64;
 import org.teiid.core.util.TimestampWithTimezone;
 import org.teiid.language.SQLConstants.NonReserved;
 import org.teiid.query.QueryPlugin;
@@ -1246,4 +1260,102 @@
         return TimestampWithTimezone.createTimestamp(value, context.getServerTimeZone(), cal);
     } 
     
+    public static Blob decode(ClobType value, String encoding) {
+    	/*if ("HEX".equalsIgnoreCase(encoding)) {
+    		
+    	} 
+    	if ("BASE64".equalsIgnoreCase(encoding)) {
+    		
+    	}*/
+    	ClobInputStreamFactory cisf = new ClobInputStreamFactory(value.getReference());
+    	cisf.setCharset(Charset.forName(encoding));
+    	return new BlobType(new BlobImpl(cisf));
+    }
+    
+    public static Clob encode(BlobType value, String encoding) {
+    	/*if ("HEX".equalsIgnoreCase(encoding)) {
+    		
+    	} 
+    	if ("BASE64".equalsIgnoreCase(encoding)) {
+    		
+    	}*/
+    	BlobInputStreamFactory bisf = new BlobInputStreamFactory(value.getReference());
+    	ClobImpl clob = new ClobImpl(bisf, -1);
+    	clob.setEncoding(encoding);
+    	return new ClobType(clob);
+    }
+    
+    public static class Base64Encoder extends CharsetEncoder {
+
+    	private CharBuffer cb = CharBuffer.wrap(new char[4]);
+    	
+    	protected Base64Encoder() {
+			super(Charset.forName("US-ASCII"), .75f, 1); //$NON-NLS-1$
+		}
+
+		@Override
+    	protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
+		    while (in.hasRemaining()) {
+	    		cb.put(in.get());
+	    		if (!cb.hasRemaining()) {
+					if (!out.hasRemaining()) {
+					    return CoderResult.OVERFLOW;
+					}
+					cb.position(0);
+					out.put(Base64.decode(cb));
+					cb.clear();
+	    		}
+		    }
+		    return CoderResult.UNDERFLOW;
+    	}
+		
+		@Override
+		protected CoderResult implFlush(ByteBuffer out) {
+			if (cb.position() != 0) {
+				return CoderResult.unmappableForLength(cb.position());
+			}
+			return super.implFlush(out);
+		}
+    }
+    
+/*  This does not seem to work, since the flush is never called  
+ 	public static class Base64Decoder extends CharsetDecoder {
+
+    	private ByteBuffer bb = ByteBuffer.wrap(new byte[3]);
+    	
+		protected Base64Decoder() {
+			super(Charset.forName("US-ASCII"), 1.25f, 3); //$NON-NLS-1$
+		}
+
+		@Override
+		protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out) {
+		    while (in.hasRemaining()) {
+	    		bb.put(in.get());
+	    		if (!bb.hasRemaining()) {
+					if (!out.hasRemaining()) {
+					    return CoderResult.OVERFLOW;
+					}
+					bb.position(0);
+					out.put(Base64.encodeBytes(bb.array()));
+					bb.clear();
+	    		}
+		    }
+		    return CoderResult.UNDERFLOW;
+		}
+		
+		@Override
+		protected CoderResult implFlush(CharBuffer out) {
+			if (bb.position() != 0) {
+				if (!out.hasRemaining()) {
+				    return CoderResult.OVERFLOW;
+				}
+				byte[] bytes = Arrays.copyOf(bb.array(), bb.position());
+				out.put(Base64.encodeBytes(bytes));
+				bb.clear();
+			}
+			return super.implFlush(out);
+		}
+    }
+*/    
+    
 }

Modified: trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/function/source/SystemSource.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -144,6 +144,9 @@
         addClobFunction("lower", QueryPlugin.Util.getString("SystemSource.LowerClob_result"), "lowerCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         addClobFunction("upper", QueryPlugin.Util.getString("SystemSource.UpperClob_result"), "upperCase", DataTypeManager.DefaultDataTypes.CLOB); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
         
+        addEncodeFunction();
+        addDecodeFunction();
+        
         // conversion
         addConversionFunctions();   
         
@@ -576,7 +579,25 @@
 					new FunctionParameter("str2", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Insert_arg4")) }, //$NON-NLS-1$ //$NON-NLS-2$
 				new FunctionParameter("result", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.Insert_result")) ) );                 //$NON-NLS-1$ //$NON-NLS-2$
 	}
-		
+	
+	private void addEncodeFunction() {
+		functions.add(
+			new FunctionMethod("encode", QueryPlugin.Util.getString("SystemSource.encode_desc"), CONVERSION, FUNCTION_CLASS, "encode", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$  
+				new FunctionParameter[] {
+					new FunctionParameter("value", DataTypeManager.DefaultDataTypes.BLOB, QueryPlugin.Util.getString("SystemSource.encode_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
+					new FunctionParameter("encoding", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.encode_arg2"))}, //$NON-NLS-1$ //$NON-NLS-2$
+				new FunctionParameter("result", DataTypeManager.DefaultDataTypes.CLOB, QueryPlugin.Util.getString("SystemSource.encode_result")) ) );                 //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
+	private void addDecodeFunction() {
+		functions.add(
+			new FunctionMethod("decode", QueryPlugin.Util.getString("SystemSource.decode_desc"), CONVERSION, FUNCTION_CLASS, "decode", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$  
+				new FunctionParameter[] {
+					new FunctionParameter("value", DataTypeManager.DefaultDataTypes.CLOB, QueryPlugin.Util.getString("SystemSource.decode_arg1")), //$NON-NLS-1$ //$NON-NLS-2$
+					new FunctionParameter("encoding", DataTypeManager.DefaultDataTypes.STRING, QueryPlugin.Util.getString("SystemSource.decode_arg2"))}, //$NON-NLS-1$ //$NON-NLS-2$
+				new FunctionParameter("result", DataTypeManager.DefaultDataTypes.BLOB, QueryPlugin.Util.getString("SystemSource.decode_result")) ) );                 //$NON-NLS-1$ //$NON-NLS-2$
+	}
+	
     private void addAsciiFunction() {
         functions.add(
             new FunctionMethod(SourceSystemFunctions.ASCII, QueryPlugin.Util.getString("SystemSource.Ascii_desc"), STRING, FUNCTION_CLASS, "ascii", //$NON-NLS-1$ //$NON-NLS-2$ 

Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/DocumentInProgress.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/DocumentInProgress.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/DocumentInProgress.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -52,22 +52,23 @@
     private Element currentParent;
     private Element currentObject;
     private boolean finished;
-    private String documentEncoding = MappingNodeConstants.Defaults.DEFAULT_DOCUMENT_ENCODING;
     private boolean isFormatted = MappingNodeConstants.Defaults.DEFAULT_FORMATTED_DOCUMENT.booleanValue();
     private SQLXMLImpl xml;
     
     public DocumentInProgress(FileStore store, String encoding) throws TeiidComponentException{
     	final FileStoreInputStreamFactory fsisf = new FileStoreInputStreamFactory(store, encoding);
         this.xml = new SQLXMLImpl(fsisf);
+        this.xml.setEncoding(encoding);
         SAXTransformerFactory factory = new TransformerFactoryImpl();
         try {
 			//SAX2.0 ContentHandler
 			handler = factory.newTransformerHandler();
-			handler.setResult(new StreamResult(fsisf.getOuptStream()));
+			handler.setResult(new StreamResult(fsisf.getOuputStream()));
 		} catch (Exception e) {
 			throw new TeiidComponentException(e);
 		}
         transformer = handler.getTransformer();
+        transformer.setOutputProperty(OutputKeys.ENCODING, encoding);
     }
     
     public SQLXMLImpl getSQLXML() {
@@ -75,13 +76,6 @@
     }
     
 	/**
-	 * @see org.teiid.query.processor.xml.DocumentInProgress#setDocumentEncoding(java.lang.String)
-	 */
-	public void setDocumentEncoding(String documentEncoding) {
-		this.documentEncoding = documentEncoding;
-	}
-
-	/**
 	 * @see org.teiid.query.processor.xml.DocumentInProgress#setDocumentFormat(boolean)
 	 */
 	public void setDocumentFormat(boolean isFormatted) {
@@ -287,7 +281,6 @@
 	
 	private void startDocument() throws SAXException{
         showState( "startDocument - TOP" );  //$NON-NLS-1$
-		transformer.setOutputProperty(OutputKeys.ENCODING, documentEncoding);
 		if(isFormatted){
 			transformer.setOutputProperty(OutputKeys.INDENT, "yes");//$NON-NLS-1$
 		}

Modified: trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/processor/xml/XMLUtil.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -28,8 +28,8 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.nio.charset.Charset;
 
 import javax.xml.transform.TransformerException;
 
@@ -52,9 +52,10 @@
 	public static final class FileStoreInputStreamFactory extends InputStreamFactory {
 		private final FileStore lobBuffer;
 		private final FileStoreOutputStream fsos;
+		private String encoding;
 
 		public FileStoreInputStreamFactory(FileStore lobBuffer, String encoding) {
-			super(encoding);
+			this.encoding = encoding;
 			this.lobBuffer = lobBuffer;
 			fsos = lobBuffer.createOutputStream(DataTypeManager.MAX_LOB_MEMORY_BYTES);
 			this.lobBuffer.setCleanupReference(this);
@@ -75,14 +76,10 @@
 		}
 
 		public Writer getWriter() {
-			try {
-				return new OutputStreamWriter(fsos, Streamable.ENCODING);
-			} catch (UnsupportedEncodingException e) {
-				throw new RuntimeException(e);
-			}
+			return new OutputStreamWriter(fsos, Charset.forName(encoding));
 		}
 		
-		public OutputStream getOuptStream() {
+		public OutputStream getOuputStream() {
 			return fsos;
 		}
 

Modified: trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/sql/symbol/XMLSerialize.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -30,7 +30,7 @@
 
 	private static final long serialVersionUID = -6574662238317329252L;
 	
-	private boolean document;
+	private Boolean document;
 	private Expression expression;
 	private String typeString;
 	private Class<?> type;
@@ -51,11 +51,11 @@
 		return expression;
 	}
 	
-	public boolean isDocument() {
+	public Boolean isDocument() {
 		return document;
 	}
 	
-	public void setDocument(boolean document) {
+	public void setDocument(Boolean document) {
 		this.document = document;
 	}
 	

Modified: trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/sql/visitor/SQLStringVisitor.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -24,7 +24,6 @@
 
 import static org.teiid.language.SQLConstants.Reserved.*;
 
-import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -33,7 +32,6 @@
 import java.util.List;
 
 import org.teiid.core.types.DataTypeManager;
-import org.teiid.core.types.XMLType;
 import org.teiid.core.util.StringUtil;
 import org.teiid.language.SQLConstants;
 import org.teiid.language.SQLConstants.NonReserved;
@@ -1156,15 +1154,6 @@
                 constantParts = new Object[] { "{t'", obj.getValue().toString(), "'}" }; //$NON-NLS-1$ //$NON-NLS-2$
             } else if(type.equals(DataTypeManager.DefaultDataClasses.DATE)) {
                 constantParts = new Object[] { "{d'", obj.getValue().toString(), "'}" }; //$NON-NLS-1$ //$NON-NLS-2$
-            } else if(type.equals(DataTypeManager.DefaultDataClasses.XML)){
-            	XMLType value = (XMLType)obj.getValue();
-            	if (Boolean.TRUE.equals(value.isInMemory())) {
-                	try {
-						constantParts = new Object[] { "{x '", escapeStringValue(value.getString(), "'"), "'}" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-					} catch (SQLException e) {
-						
-					} 
-            	}
             } 
             if (constantParts == null) {
             	String strValue = obj.getValue().toString();
@@ -1571,7 +1560,7 @@
     
     @Override
     public void visit(XMLAttributes obj) {
-    	parts.add(FunctionLibrary.XMLATTRIBUTES);
+    	parts.add(XMLATTRIBUTES);
     	parts.add("("); //$NON-NLS-1$
     	registerNodes(obj.getArgs(), 0);
     	parts.add(")"); //$NON-NLS-1$
@@ -1579,7 +1568,7 @@
     
     @Override
     public void visit(XMLElement obj) {
-    	parts.add(FunctionLibrary.XMLELEMENT);
+    	parts.add(XMLELEMENT);
     	parts.add("(NAME "); //$NON-NLS-1$
     	outputDisplayName(obj.getName());
     	if (obj.getNamespaces() != null) {
@@ -1599,7 +1588,7 @@
     
     @Override
     public void visit(XMLForest obj) {
-    	parts.add(FunctionLibrary.XMLFOREST);
+    	parts.add(XMLFOREST);
     	parts.add("("); //$NON-NLS-1$
     	if (obj.getNamespaces() != null) {
     		parts.add(registerNode(obj.getNamespaces()));
@@ -1611,7 +1600,7 @@
     
     @Override
     public void visit(XMLNamespaces obj) {
-    	parts.add(FunctionLibrary.XMLNAMESPACES);
+    	parts.add(XMLNAMESPACES);
     	parts.add("("); //$NON-NLS-1$
     	for (Iterator<NamespaceItem> items = obj.getNamespaceItems().iterator(); items.hasNext();) {
     		NamespaceItem item = items.next();
@@ -1804,12 +1793,14 @@
     public void visit(XMLSerialize obj) {
     	parts.add(XMLSERIALIZE);
     	parts.add(Tokens.LPAREN);
-    	if (obj.isDocument()) {
-    		parts.add(NonReserved.DOCUMENT);
-    	} else {
-    		parts.add(NonReserved.CONTENT);
+    	if (obj.isDocument() != null) {
+	    	if (obj.isDocument()) {
+	    		parts.add(NonReserved.DOCUMENT);
+	    	} else {
+	    		parts.add(NonReserved.CONTENT);
+	    	}
+	    	parts.add(SPACE);
     	}
-    	parts.add(SPACE);
     	parts.add(registerNode(obj.getExpression()));
     	if (obj.getTypeString() != null) {
     		parts.add(SPACE);
@@ -1882,5 +1873,5 @@
     	}
    		return SQLConstants.isReservedWord(string);
     }
-
+    
 }

Modified: trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/java/org/teiid/query/validator/ValidationVisitor.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -22,6 +22,7 @@
 
 package org.teiid.query.validator;
 
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
@@ -347,7 +348,13 @@
                 	handleValidationError(QueryPlugin.Util.getString("QueryResolver.invalid_xpath", e.getMessage()), obj); //$NON-NLS-1$
                 }
 	        }
-	    }
+        } else if(obj.getFunctionDescriptor().getName().equalsIgnoreCase(SourceSystemFunctions.ENCODE) || obj.getFunctionDescriptor().getName().equalsIgnoreCase(SourceSystemFunctions.DECODE)) {
+        	try {
+        		Charset.forName((String)((Constant)obj.getArg(1)).getValue());
+        	} catch (IllegalArgumentException e) {
+        		handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.invalid_encoding", obj.getArg(1)), obj); //$NON-NLS-1$
+        	}
+        }
     }
 
     // ############### Visitor methods for stored procedure lang objects ##################

Modified: trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj
===================================================================
--- trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/javacc/org/teiid/query/parser/SQLParser.jj	2010-06-16 19:02:47 UTC (rev 2237)
@@ -368,7 +368,6 @@
 | 	< TIMETYPE: "{" "t" >
 | 	< TIMESTAMPTYPE: "{" "ts" >
 | 	< BOOLEANTYPE: "{" "b" >
-| 	< XMLTYPE: "{" "x" >
 
 |	< INTEGERVAL: (<MINUS>)?(<DIGIT>)+ >
 |   < FLOATVAL: (<MINUS>)? (<DIGIT>)* <PERIOD> (<DIGIT>)+ 
@@ -1919,7 +1918,7 @@
 }
 {
 	<XMLSERIALIZE> <LPAREN>
-	doc = nonReserved("DOCUMENT", "CONTENT")
+	[LOOKAHEAD(<ID>, {matchesAny(getToken(1).image, "document", "content") != null}) doc = nonReserved("DOCUMENT", "CONTENT")]
 	expr = expression(info)
 	[
 		<AS> (t = <STRING> | t = <VARCHAR> | t = <CLOB>)
@@ -1928,7 +1927,9 @@
 	{
 		XMLSerialize result = new XMLSerialize();
 		result.setExpression(expr);
-		result.setDocument("document".equalsIgnoreCase(doc));
+		if (doc != null) {
+			result.setDocument("document".equalsIgnoreCase(doc));
+		}
 		if (t != null) {
 			result.setTypeString(t.image);
 		}
@@ -3228,6 +3229,23 @@
 		<RPAREN>				
 	)
 	|
+	LOOKAHEAD(<ID>, {matchesAny(getToken(1).image, "encode", "decode") != null}) (	
+		funcName = nonReserved("ENCODE", "DECODE")
+		<LPAREN>
+		expression = expression(info) 
+		{		
+			args.add(expression);
+			expression = null;
+		}
+		<COMMA>
+		expression = stringConstant()
+		{
+			args.add(expression);
+			expression = null;
+		} 
+		<RPAREN>				
+	)
+	|
 	LOOKAHEAD(<ID>, {matchesAny(getToken(1).image, "timestampadd", "timestampdiff") != null}) (	
 		funcName = nonReserved("TIMESTAMPADD", "TIMESTAMPDIFF")
 		<LPAREN>
@@ -3389,6 +3407,17 @@
 	}
 }
 
+Constant stringConstant() :
+{
+	String val = null;
+}
+{
+	val = stringVal()
+	{
+		return new Constant(val);
+	}
+}
+
 XMLParse xmlParse(ParseInfo info) :
 {
 	Expression expr = null;
@@ -3699,8 +3728,7 @@
         ( (<BOOLEANTYPE>   { escapeType=DataTypeManager.DefaultDataClasses.BOOLEAN; } |
           <TIMESTAMPTYPE> { escapeType=DataTypeManager.DefaultDataClasses.TIMESTAMP; } | 
           <DATETYPE>      { escapeType=DataTypeManager.DefaultDataClasses.DATE; } |
-          <TIMETYPE>      { escapeType=DataTypeManager.DefaultDataClasses.TIME; } |
-          <XMLTYPE>      { escapeType=DataTypeManager.DefaultDataClasses.XML; }) strVal=stringVal() { 
+          <TIMETYPE>      { escapeType=DataTypeManager.DefaultDataClasses.TIME; }) strVal=stringVal() { 
 	        	try {
 	        		constant = new Constant(DataTypeManager.transformValue(strVal, escapeType), escapeType);
 	        	} catch (TransformationException e) {

Modified: trunk/engine/src/main/resources/org/teiid/query/i18n.properties
===================================================================
--- trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/main/resources/org/teiid/query/i18n.properties	2010-06-16 19:02:47 UTC (rev 2237)
@@ -811,6 +811,14 @@
 SystemSource.coalesce_description=Returns the first non-null parameter
 SystemSource.coalesce_param1=parameter
 SystemSource.coalesce_result=The first non-null parameter
+SystemSource.encode_desc=Encodes the given Blob to a Clob
+SystemSource.encode_arg1=Blob
+SystemSource.encode_arg2=The encoding
+SystemSource.encode_result=The Clob
+SystemSource.decode_desc=Decodes a Clob to a Blob
+SystemSource.decode_arg1=Clob
+SystemSource.decode_arg2=The encoding
+SystemSource.decode_result=The Blob
 TempMetadataAdapter.Element_____{0}_____not_found._1=Element ''{0}'' not found.
 TempMetadataAdapter.Group_____{0}_____not_found._1=Group ''{0}'' not found.
 ExpressionEvaluator.Must_push=Function {0} is marked in the function metadata as a function that must be evaluated at the source.
@@ -905,6 +913,7 @@
 ValidationVisitor.invalid_default=XMLTABLE DEFAULT expression is invalid: "{0}"
 ValidationVisitor.context_required=The XQuery requires a context item, but none exists in the PASSING clause.
 ValidationVisitor.xmlserialize_type=XMLSERIALIZE expects a STRING, CLOB, or BLOB value.
+ValidationVisitor.invalid_encoding=Encoding {0} is not valid.
 UpdateProcedureResolver.only_variables=Element symbol "{0}" cannot be assigned a value.  Only declared VARIABLES can be assigned values.
 wrong_result_type=No results found; or non-XML result object has been produced as a result of the execution of XQuery expression. Please note that only XML type results are supported.
 MappingLoader.unknown_node_type=Unknown Node Type "{0}" being loaded by the XML mapping document.

Modified: trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/test/java/org/teiid/query/function/TestFunctionLibrary.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -26,6 +26,8 @@
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.sql.Blob;
+import java.sql.Clob;
 import java.sql.Date;
 import java.sql.Time;
 import java.sql.Timestamp;
@@ -36,15 +38,20 @@
 import java.util.Properties;
 import java.util.TimeZone;
 
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialClob;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.teiid.api.exception.query.FunctionExecutionException;
 import org.teiid.common.buffer.BufferManagerFactory;
+import org.teiid.core.types.BlobType;
 import org.teiid.core.types.ClobType;
 import org.teiid.core.types.DataTypeManager;
 import org.teiid.core.types.NullType;
 import org.teiid.core.types.XMLType;
+import org.teiid.core.types.DataTypeManager.DefaultDataClasses;
 import org.teiid.core.util.ObjectConverterUtil;
 import org.teiid.core.util.TimestampWithTimezone;
 import org.teiid.language.SQLConstants.NonReserved;
@@ -1361,4 +1368,15 @@
         assertEquals("<!--comment-->", xml);
     }
 	
+	@Test public void testEncode() throws Exception {
+		Clob result = (Clob)helpInvokeMethod("encode", new Class[] {DefaultDataClasses.BLOB, DefaultDataClasses.STRING}, new Object[] { new BlobType(new SerialBlob("hello world".getBytes("ASCII"))), "ASCII" }, null); //$NON-NLS-1$
+		String string = result.getSubString(1, (int)result.length());
+		assertEquals("hello world", string);
+	}
+	
+	@Test public void testDecode() throws Exception {
+		Blob result = (Blob)helpInvokeMethod("decode", new Class[] {DefaultDataClasses.CLOB, DefaultDataClasses.STRING}, new Object[] { new ClobType(new SerialClob("hello world".toCharArray())), "UTF32" }, null); //$NON-NLS-1$
+		assertEquals(44, result.length()); //4 bytes / char
+	}
+	
 }

Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/relational/rules/TestRuleAccessPatternValidation.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -24,9 +24,6 @@
 
 import static org.junit.Assert.*;
 
-import java.util.ArrayList;
-import java.util.Collection;
-
 import org.junit.Test;
 import org.teiid.api.exception.query.QueryMetadataException;
 import org.teiid.api.exception.query.QueryPlannerException;
@@ -44,7 +41,6 @@
 import org.teiid.query.parser.QueryParser;
 import org.teiid.query.resolver.QueryResolver;
 import org.teiid.query.sql.lang.Command;
-import org.teiid.query.sql.visitor.GroupCollectorVisitor;
 import org.teiid.query.unittest.FakeMetadataFacade;
 import org.teiid.query.unittest.FakeMetadataFactory;
 import org.teiid.query.util.CommandContext;
@@ -67,8 +63,7 @@
 	 * be below the access node after the rule is run
 	 */
 	private void helpTestAccessPatternValidation(String command) throws Exception {
-		Collection groups = new ArrayList();
-		PlanNode node = this.helpPlan(command, groups);
+		PlanNode node = this.helpPlan(command);
 
         if(DEBUG) {
             System.out.println("\nfinal plan node:\n"+node); //$NON-NLS-1$
@@ -85,13 +80,10 @@
 	 * @param groups Collection to add parsed and resolved GroupSymbols to
 	 * @return the root PlanNode of the query plan
 	 */
-	private PlanNode helpPlan(String command, Collection groups) throws Exception {
+	private PlanNode helpPlan(String command) throws Exception {
 		Command query = QueryParser.getQueryParser().parseCommand(command);
 		QueryResolver.resolveCommand(query, METADATA);
 		
-		//save groups for later
-		GroupCollectorVisitor.getGroups(query, groups);
-		
 		//Generate canonical plan
     	RelationalPlanner p = new RelationalPlanner();
     	p.initialize(query, null, METADATA, FINDER, null, null);

Modified: trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/test/java/org/teiid/query/parser/TestParser.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -6833,5 +6833,12 @@
     	f.setWellFormed(true);
     	helpTestExpression("xmlparse(document x wellformed)", "XMLPARSE(DOCUMENT x WELLFORMED)", f);
     }
+    
+    @Test public void testXmlSerialize1() throws Exception {
+    	XMLSerialize f = new XMLSerialize();
+    	f.setExpression(new ElementSymbol("x"));
+    	f.setTypeString("CLOB");
+    	helpTestExpression("xmlserialize(x as CLOB)", "XMLSERIALIZE(x AS CLOB)", f);
+    }
 
 }

Modified: trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/test/java/org/teiid/query/processor/TestSQLXMLProcessing.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -256,7 +256,7 @@
     }
     
     @Test public void testXmlQueryEmptyNull() throws Exception {
-    	String sql = "select xmlquery('/a' passing {x '<x/>'} null on empty)"; //$NON-NLS-1$
+    	String sql = "select xmlquery('/a' passing xmlparse(document '<x/>') null on empty)"; //$NON-NLS-1$
         
         List<?>[] expected = new List<?>[] {
         		Arrays.asList((String)null)

Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestResolver.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -2947,7 +2947,7 @@
     }
     
     @Test public void testQueryString() throws Exception {
-    	helpResolveException("select querystring({x '<a/>'})");
+    	helpResolveException("select querystring(xmlparse(document '<a/>'))");
     }
     
 }
\ No newline at end of file

Modified: trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/engine/src/test/java/org/teiid/query/validator/TestValidator.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -1999,7 +1999,7 @@
     }
     
     @Test public void testXMLTablePassingMultipleContext() {
-    	helpValidate("select * from pm1.g1, xmltable('/' passing {x '<a/>'}, {x '<b/>'}) as x", new String[] {"XMLTABLE('/' PASSING {x '<a/>'}, {x '<b/>'}) AS x"}, FakeMetadataFactory.example1Cached());
+    	helpValidate("select * from pm1.g1, xmltable('/' passing xmlparse(DOCUMENT '<a/>'), xmlparse(DOCUMENT '<b/>')) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>'), XMLPARSE(DOCUMENT '<b/>')) AS x"}, FakeMetadataFactory.example1Cached());
     }
 
     @Ignore("this is actually handled by saxon and will show up during resolving")
@@ -2012,7 +2012,7 @@
     }
 
     @Test public void testXMLTableMultipleOrdinals() {
-    	helpValidate("select * from pm1.g1, xmltable('/' passing {x '<a/>'} columns x for ordinality, y for ordinality) as x", new String[] {"XMLTABLE('/' PASSING {x '<a/>'} COLUMNS x FOR ORDINALITY, y FOR ORDINALITY) AS x"}, FakeMetadataFactory.example1Cached());
+    	helpValidate("select * from pm1.g1, xmltable('/' passing XMLPARSE(DOCUMENT '<a/>') columns x for ordinality, y for ordinality) as x", new String[] {"XMLTABLE('/' PASSING XMLPARSE(DOCUMENT '<a/>') COLUMNS x FOR ORDINALITY, y FOR ORDINALITY) AS x"}, FakeMetadataFactory.example1Cached());
     }
     
     @Test public void testXMLTableContextRequired() {
@@ -2034,4 +2034,9 @@
     @Test public void testXmlParse() throws Exception {
     	helpValidate("select xmlparse(content e2) from pm1.g1", new String[] {"XMLPARSE(CONTENT e2)"}, FakeMetadataFactory.example1Cached());
     }
+    
+    @Test public void testDecode() throws Exception {
+    	helpValidate("select decode(e1, '?') from pm1.g1", new String[] {"decode(e1, '?')"}, FakeMetadataFactory.example1Cached());
+    }
+
 }

Modified: trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/runtime/src/main/java/org/teiid/transport/ObjectDecoder.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -42,7 +42,6 @@
 import org.teiid.common.buffer.FileStore;
 import org.teiid.common.buffer.StorageManager;
 import org.teiid.core.types.InputStreamFactory;
-import org.teiid.core.types.Streamable;
 import org.teiid.core.types.InputStreamFactory.StreamFactoryReference;
 import org.teiid.core.util.ExternalizeUtil;
 import org.teiid.netty.handler.codec.serialization.CompactObjectInputStream;
@@ -146,7 +145,7 @@
 	        	store = storageManager.createFileStore("temp-stream"); //$NON-NLS-1$
 		        StreamFactoryReference sfr = streams.get(streamIndex);
 		        store.setCleanupReference(sfr);
-		        sfr.setStreamFactory(new InputStreamFactory(Streamable.ENCODING) {
+		        sfr.setStreamFactory(new InputStreamFactory() {
 					FileStore fs = store;
 					@Override
 					public InputStream getInputStream() throws IOException {

Modified: trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
===================================================================
--- trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java	2010-06-16 15:26:50 UTC (rev 2236)
+++ trunk/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java	2010-06-16 19:02:47 UTC (rev 2237)
@@ -252,7 +252,7 @@
         assertEquals(expected, getString(TestLiteralImpl.example("string'Literal"))); //$NON-NLS-1$
         expected = "1000"; //$NON-NLS-1$
         assertEquals(expected, getString(TestLiteralImpl.example(new Integer(1000))));
-        expected = "{b 'true'}"; //$NON-NLS-1$
+        expected = "TRUE"; //$NON-NLS-1$
         assertEquals(expected, getString(TestLiteralImpl.example(Boolean.TRUE)));
         long now = System.currentTimeMillis();
         Date date = new Date(now);



More information about the teiid-commits mailing list