Package org.teiid.core

Examples of org.teiid.core.TeiidComponentException


        if (bytes == null) {
          return null;
        }
      return ObjectConverterUtil.convertToString(new ByteArrayInputStream(bytes));
    } catch (IOException e) {
      throw new TeiidComponentException(e);
    }
    }
View Full Code Here


                    if (getContext().validateXML()){
                      Reader reader;
                  try {
                    reader = xml.getCharacterStream();
                  } catch (SQLException e) {
                    throw new TeiidComponentException(e);
                  }
                      try {
                        validateDoc(reader);
                      } finally {
                        try {
View Full Code Here

    // get the schema
    if (xmlSchemas == null || xmlSchemas.isEmpty()){
        // if there is no schema no need to validate
        // return a warning saying there is no schema
            TeiidException noSchema = new TeiidComponentException("ERR.015.006.0042", QueryPlugin.Util.getString("ERR.015.006.0042")); //$NON-NLS-1$ //$NON-NLS-2$
      addWarning(noSchema);
      return;
    }
   
    // perform the validation
    HashMap nameSpaceMap = null;
    try{
        // also find the target name space URIs for the document(s).
        nameSpaceMap = getTargetNameSpaces(xmlSchemas);
    } catch(TeiidException me){
      addWarning(me);
      nameSpaceMap = new HashMap();
    }
   
    // Create a SAXParser
    SAXParserFactory spf = SAXParserFactory.newInstance();
        spf.setNamespaceAware(true);
        spf.setValidating(true);
        XMLReader reader = null;

    // set the features on the parser
    try{
          SAXParser parser = spf.newSAXParser();
          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema"); //$NON-NLS-1$ //$NON-NLS-2$
          parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", nameSpaceMap.keySet().toArray())//$NON-NLS-1$
          reader = parser.getXMLReader();
    } catch (SAXException err) {
            throw new TeiidComponentException(err);
        } catch (ParserConfigurationException err) {
            throw new TeiidComponentException(err);
        }
   
    // place the schema into the customized entity resolver so that we can
    // resolve the schema elements
    EntityResolver xmlEntityResolver = new MultiEntityResolver(nameSpaceMap);
    reader.setEntityResolver(xmlEntityResolver);

    // Create the specialized error handler so that we can get any warnings,
    // errors, or fatal errors back from validation
    MMErrorHandler errorHandler = new MMErrorHandler();   
    reader.setErrorHandler(errorHandler);
   
    // create the input stream for the xml document to be parsed
    InputSource source = new InputSource(xmlStream);
   
    try{
        reader.parse(source);
    } catch(SAXException se){
      throw new TeiidComponentException(se);
    } catch(IOException io){
      throw new TeiidComponentException(io);
    }

    // determine if we have any warnings, errors, or fatal errors and report as necessary
    if (errorHandler.hasExceptions()) {
        List exceptionList = errorHandler.getExceptionList();
View Full Code Here

       for (SQLXML schema : schemas) {
         InputStream is;
      try {
        is = schema.getBinaryStream();
      } catch (SQLException e) {
        throw new TeiidComponentException(e);
      }
      InputSource source = new InputSource(is);
             pch.targetNameSpace = null;
         try {
                parser.parse(source, pch);
            } catch (SAXException err) {
                throw new TeiidException(err);
            } catch (IOException err) {
                throw new TeiidComponentException(err);
            } finally {
              try {
          is.close();
        } catch (IOException e) {
         
View Full Code Here

    }

  private CursorState getCursorState(String rsKey) throws TeiidComponentException {
    CursorState state = this.cursorStates.get(rsKey);
    if (state == null) {
      throw new TeiidComponentException(QueryPlugin.Util.getString("ERR.015.006.0037", rsKey)); //$NON-NLS-1$
    }
    return state;
  }
View Full Code Here

    public boolean hasExceptions() {
        return exceptionList != null && !exceptionList.isEmpty();
    }
   
    public void error(SAXParseException ex){
        addException(new TeiidComponentException("ERR.015.006.0049", QueryPlugin.Util.getString("ERR.015.006.0048", ex.getMessage()))); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

   
    public void error(SAXParseException ex){
        addException(new TeiidComponentException("ERR.015.006.0049", QueryPlugin.Util.getString("ERR.015.006.0048", ex.getMessage()))); //$NON-NLS-1$ //$NON-NLS-2$
    }
    public void fatalError(SAXParseException ex){     
        addException(new TeiidComponentException("ERR.015.006.0048", QueryPlugin.Util.getString("ERR.015.006.0048", ex.getMessage())));       //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

    }
    public void fatalError(SAXParseException ex){     
        addException(new TeiidComponentException("ERR.015.006.0048", QueryPlugin.Util.getString("ERR.015.006.0048", ex.getMessage())));       //$NON-NLS-1$ //$NON-NLS-2$
    }
    public void warning(SAXParseException ex){
        addException(new TeiidComponentException("ERR.015.006.0049", QueryPlugin.Util.getString("ERR.015.006.0048", ex.getMessage()))); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

        PlanExecutor executor = (PlanExecutor)this.resultsMap.get(aliasResultName);
        if (executor == null) {
            if (this.parentContext != null) {
                return this.parentContext.getCurrentRow(aliasResultName);
            }
            throw new TeiidComponentException(QueryPlugin.Util.getString("results_not_found", aliasResultName)); //$NON-NLS-1$
        }
        return executor.currentRow();
    }
View Full Code Here

        PlanExecutor executor = (PlanExecutor)this.resultsMap.get(aliasResultName);
        if (executor == null) {
            if (this.parentContext != null) {
                return this.parentContext.getNextRow(aliasResultName);
            }
            throw new TeiidComponentException(QueryPlugin.Util.getString("results_not_found", aliasResultName)); //$NON-NLS-1$
        }
        return executor.nextRow();
    }
View Full Code Here

TOP

Related Classes of org.teiid.core.TeiidComponentException

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.