Package org.teiid.translator

Examples of org.teiid.translator.TranslatorException


            Literal literal = (Literal) expr;
            if(literal.getType() == String.class) {
                String ticker = (String) literal.getValue();
                this.tickers.add(ticker.toUpperCase());               
            } else {
                this.exception = new TranslatorException(YahooPlugin.Util.getString("TickerCollectorVisitor.Unexpected_type", literal.getType().getName())); //$NON-NLS-1$
            }
        } else {
            this.exception = new TranslatorException(YahooPlugin.Util.getString("TickerCollectorVisitor.Unexpected_expression", expr)); //$NON-NLS-1$
        }
        
    }
View Full Code Here


        StringBuffer url = new StringBuffer();
        url.append(YahooPlugin.Util.getString("YahooExecution.URL_BEGIN")); //$NON-NLS-1$
       
        Set tickers = getTickers(query);
        if(tickers.size() == 0) {
            throw new TranslatorException(YahooPlugin.Util.getString("YahooExecution.No_tickers")); //$NON-NLS-1$
        }
        String urlAppendChar = YahooPlugin.Util.getString("YahooExecution.URL_APPEND_CHAR"); //$NON-NLS-1$
        Iterator tickerIter = tickers.iterator();
        url.append(tickerIter.next());       
        while(tickerIter.hasNext()) {
View Full Code Here

     * @return
     */
    static Set getTickers(Select query) throws TranslatorException {
        Condition crit = query.getWhere();
        if(crit == null) {
            throw new TranslatorException(YahooPlugin.Util.getString("YahooExecution.Must_have_criteria")); //$NON-NLS-1$
        }
        return TickerCollectorVisitor.getTickers(crit);
    }
View Full Code Here

            // clean up our opened connections
            buffReader.close();
            inSR.close();
                       
        } catch(MalformedURLException mue){
            throw new TranslatorException(mue, mue.getMessage());
        } catch(IOException e) {
            throw new TranslatorException(e, e.getMessage());
        } finally {
            buffReader = null;
            inSR = null;
        }
       
View Full Code Here

            Expression expr = symbol.getExpression();
            if(expr instanceof ColumnReference) {
                Column element = ((ColumnReference)expr).getMetadataObject();
                cols[i] = element.getPosition();
            } else {
                throw new TranslatorException(YahooPlugin.Util.getString("YahooExecution.Invalid_select_symbol", expr)); //$NON-NLS-1$
            }
        }
       
        return cols;
    }
View Full Code Here

      
      // Log our command
        LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Loopback executing command: " + command); //$NON-NLS-1$

        if(this.config.isThrowError()) {
            throw new TranslatorException("Failing because Error=true"); //$NON-NLS-1$
        }
             
        this.rowsNeeded = this.config.getRowCount();
       
        if (command instanceof QueryExpression) {
View Full Code Here

          } else {
            try {
              Binding type = Binding.valueOf(style.toUpperCase());
              style = type.getBindingId();
            } catch (IllegalArgumentException e) {
              throw new TranslatorException(WSExecutionFactory.UTIL.getString("invalid_invocation", Arrays.toString(Binding.values()))); //$NON-NLS-1$
            }
          }
         
          Dispatch<StreamSource> dispatch = conn.createDispatch(style, endpoint, StreamSource.class, executionFactory.getDefaultServiceMode());
 
      if (Binding.HTTP.getBindingId().equals(style)) {
        if (action == null) {
          action = "POST"; //$NON-NLS-1$
        }
        dispatch.getRequestContext().put(MessageContext.HTTP_REQUEST_METHOD, action);
        if (source != null && !"POST".equalsIgnoreCase(action)) { //$NON-NLS-1$
          if (this.executionFactory.getXMLParamName() == null) {
            throw new WebServiceException(WSExecutionFactory.UTIL.getString("http_usage_error")); //$NON-NLS-1$
          }
          try {
            Transformer t = TransformerFactory.newInstance().newTransformer();
            StringWriter writer = new StringWriter();
            //TODO: prevent this from being too large
                t.transform(source, new StreamResult(writer));
            String param = Util.httpURLEncode(this.executionFactory.getXMLParamName())+"="+Util.httpURLEncode(writer.toString()); //$NON-NLS-1$
            endpoint = WSConnection.Util.appendQueryString(endpoint, param);
          } catch (TransformerException e) {
            throw new WebServiceException(e);
          }
        }
      } else {
        if (action != null) {
          dispatch.getRequestContext().put(Dispatch.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
          dispatch.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, action);
        }
      }
     
      if (source == null) {
        // JBoss Native DispatchImpl throws exception when the source is null
        source = new StreamSource(new StringReader("<none/>")); //$NON-NLS-1$
      }
      this.returnValue = dispatch.invoke(source);
    } catch (SQLException e) {
      throw new TranslatorException(e);
    } catch (WebServiceException e) {
      throw new TranslatorException(e);
    } finally {
      Util.closeSource(source);
    }
    }
View Full Code Here

        ds = new InputStreamFactory.BlobInputStreamFactory((Blob)payload);
      }
     
      returnValue = dispatch.invoke(ds);
    } catch (SQLException e) {
      throw new TranslatorException(e);
    } catch (WebServiceException e) {
      throw new TranslatorException(e);
    }
    }
View Full Code Here

  public Column addColumn(String name, String type, ColumnSet<?> table) throws TranslatorException {
    if (autoCorrectColumnNames) {
      name.replace(AbstractMetadataRecord.NAME_DELIM_CHAR, '_');
    } else if (name.indexOf(AbstractMetadataRecord.NAME_DELIM_CHAR) != -1) {
      //TODO: for now this is not used
      throw new TranslatorException(DataPlugin.Util.getString("MetadataFactory.invalid_name", name)); //$NON-NLS-1$
    }
    Column column = new Column();
    column.setName(name);
    table.addColumn(column);
    column.setPosition(table.getColumns().size()); //1 based indexing
View Full Code Here

  private Datatype setColumnType(String type,
      BaseColumn column) throws TranslatorException {
    Datatype datatype = dataTypes.get(type);
    if (datatype == null) {
      throw new TranslatorException(DataPlugin.Util.getString("MetadataFactory.unknown_datatype", type)); //$NON-NLS-1$
    }
    column.setDatatype(datatype);
    column.setDatatypeUUID(datatype.getUUID());
    column.setLength(datatype.getLength());
    column.setPrecision(datatype.getPrecisionLength());
View Full Code Here

TOP

Related Classes of org.teiid.translator.TranslatorException

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.