Package org.teiid.core.types

Examples of org.teiid.core.types.SQLXMLImpl


    protected Object replaceObject(Object obj) throws IOException {
      if (obj instanceof BaseLob) {
        try {
          if (obj instanceof SQLXMLImpl) {
          streams.add(((SQLXMLImpl)obj).getBinaryStream());
            StreamFactoryReference sfr = new SQLXMLImpl();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof ClobImpl) {
            streams.add(new ReaderInputStream(((ClobImpl)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
            StreamFactoryReference sfr = new ClobImpl();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof BlobImpl) {
            streams.add(((Blob)obj).getBinaryStream());
            StreamFactoryReference sfr = new BlobImpl();
            references.add(sfr);
            return sfr;
          }
        } catch (SQLException e) {
          throw new IOException(e);
        }
      }
      else if (obj instanceof Serializable) {
        return obj;
      }
      else {
      try {
          if (obj instanceof Reader) {
            streams.add(new ReaderInputStream((Reader)obj, Charset.forName(Streamable.ENCODING)));
            StreamFactoryReference sfr = new SerializableReader();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof InputStream) {
            streams.add((InputStream)obj);
            StreamFactoryReference sfr = new SerializableInputStream();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof SQLXML) {
          streams.add(((SQLXML)obj).getBinaryStream());
            StreamFactoryReference sfr = new SQLXMLImpl();
            references.add(sfr);
            return sfr;
          } else if (obj instanceof Clob) {
            streams.add(new ReaderInputStream(((Clob)obj).getCharacterStream(), Charset.forName(Streamable.ENCODING)));
            StreamFactoryReference sfr = new ClobImpl();
View Full Code Here


              List<ArrayList<Object>> records = new ArrayList<ArrayList<Object>>(1);
              PlanNode plan = driverConnection.getCurrentPlanDescription();
              if (plan != null) {
                ArrayList<Object> row = new ArrayList<Object>(3);
                  row.add(DataTypeTransformer.getClob(plan.toString()));
                row.add(new SQLXMLImpl(plan.toXml()));
                row.add(DataTypeTransformer.getClob(driverConnection.getDebugLog()));
                records.add(row);
              }
              createResultSet(records, new String[] {"PLAN_TEXT", "PLAN_XML", "DEBUG_LOG"}, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                  new String[] {JDBCSQLTypeInfo.CLOB, JDBCSQLTypeInfo.XML, JDBCSQLTypeInfo.CLOB});
View Full Code Here

   */
  public Object transformDirect(Object value) throws TransformationException {
        String xml = (String)value;
        Reader reader = new StringReader(xml);
        Type type = isXml(reader);
        XMLType result = new XMLType(new SQLXMLImpl(xml));
        result.setType(type);
        return result;
  }
View Full Code Here

public class TestXMLValue extends TestCase {

    public void testXMLValue() throws Exception {
        String testString = "<foo>this is an xml value test</foo>"; //$NON-NLS-1$
        SQLXMLImpl xml = new SQLXMLImpl(testString);
       
        XMLType xv = new XMLType(xml);
        assertEquals(testString, xv.getString());
    }
View Full Code Here

    }

   
    public void testXMLValuePersistence() throws Exception {
        String testString = "<foo>this is an xml value test</foo>"; //$NON-NLS-1$
        SQLXMLImpl xml = new SQLXMLImpl(testString);
       
        XMLType xv = new XMLType(xml);
        String key = xv.getReferenceStreamId();
       
        // now force to serialize
View Full Code Here

      final Source xmlParam = xmlSource;
      TransformerFactory factory = TransformerFactory.newInstance();
            final Transformer transformer = factory.newTransformer(styleSource);
           
      //this creates a non-validated sqlxml - it may not be valid xml/root-less xml
      SQLXMLImpl result = XMLSystemFunctions.saveToBufferManager(context.getBufferManager(), new XMLTranslator() {
       
        @Override
        public void translate(Writer writer) throws TransformerException {
                  //transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); //$NON-NLS-1$
                  // Feed the resultant I/O stream into the XSLT processor
          transformer.transform(xmlParam, new StreamResult(writer));
        }
      });
      return new ClobType(new ClobImpl(result.getStreamFactory(), -1));
    } finally {
      Util.closeSource(styleSource);
      Util.closeSource(xmlSource);
    }
    }
View Full Code Here

    int start = 0;
    char[] chars = content.toCharArray();
    while (start < chars.length && chars[start] == ' ') {
      start++;
    }
    XMLType result = new XMLType(new SQLXMLImpl("<?" + name + " " + content.substring(start) + "?>")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    result.setType(Type.PI);
    return result;
  }
View Full Code Here

      break;
    }
  }
 
  public static XMLType xmlComment(String comment) {
    return new XMLType(new SQLXMLImpl("<!--" + comment + "-->")); //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

      try
        Writer writer = fsisf.getWriter();
          translator.translate(writer);
          writer.close();
          success = true;
          return new SQLXMLImpl(fsisf);
      } catch(IOException e) {
          throw new TeiidComponentException(e);
      } catch(TransformerException e) {
          throw new TeiidProcessingException(e);
      } finally {
View Full Code Here

        throw new TeiidProcessingException(e);
      } catch (IOException e) {
        fs.remove();
        throw new TeiidProcessingException(e);
      }
          XMLType result = new XMLType(new SQLXMLImpl(fsisf));
          result.setType(Type.CONTENT);
          return result;
    }
View Full Code Here

TOP

Related Classes of org.teiid.core.types.SQLXMLImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.