Package org.teiid.core

Examples of org.teiid.core.TeiidProcessingException


        textLine++;
        return '\n';
        }
        return (char)c;
    } catch (IOException e) {
      throw new TeiidProcessingException(e);
    }
  }
View Full Code Here


        reader = new BufferedReader(r);
      } else {
        reader = (BufferedReader)r;
      }
    } catch (SQLException e) {
      throw new TeiidProcessingException(e);
    }
   
    //process the skip field
    if (skip <= 0) {
      return;
View Full Code Here

      nameIndexes.put(string.toUpperCase(), nameIndexes.size());
    }
    for (TextColumn col : table.getColumns()) {
      Integer index = nameIndexes.get(col.getName().toUpperCase());
      if (index == null) {
        throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.header_missing", col.getName(), systemId)); //$NON-NLS-1$
      }
      nameIndexes.put(col.getName(), index);
    }
  }
View Full Code Here

          addValue(result, wasQualified, builder.toString());
          return result;
        }
        line = readLine(lineWidth, false);
        if (line == null) {
          throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.unclosed", systemId)); //$NON-NLS-1$
        }
      }
      char[] chars = line.toCharArray();
      for (int i = 0; i < chars.length; i++) {
        char chr = chars[i];
        if (chr == delimiter) {
          if (escaped || qualified) {
            builder.append(chr);
            escaped = false;
          } else {
            addValue(result, wasQualified, builder.toString());
            wasQualified = false;
            builder = new StringBuilder()//next entry
          }
        } else if (chr == quote) {
          if (noQuote) {   //it's the escape char
            if (escaped) {
              builder.append(quote);
            }
            escaped = !escaped;
          } else {
            if (qualified) {
              qualified = false;
            } else {
              if (wasQualified) {
                qualified = true;
                builder.append(chr);
              } else {
                if (builder.toString().trim().length() != 0) {
                  throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.character_not_allowed", textLine, systemId)); //$NON-NLS-1$
                }
                qualified = true;
                builder = new StringBuilder(); //start the entry over
                wasQualified = true;
              }
            }
          }
        } else {
          if (escaped) {
            //don't understand other escape sequences yet
            throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.unknown_escape", chr, textLine, systemId)); //$NON-NLS-1$
          }
          if (wasQualified && !qualified) {
            if (!Character.isWhitespace(chr)) {
              throw new TeiidProcessingException(QueryPlugin.Util.getString("TextTableNode.character_not_allowed", textLine, systemId)); //$NON-NLS-1$
            }
            //else just ignore
          } else {
            builder.append(chr);
          }
View Full Code Here

            this.currentRowNumber++;

            // check if we walked over the row limit
            if (this.currentRow != null && this.resultInfo.getUserRowLimit() > 0 && this.currentRowNumber > this.resultInfo.getUserRowLimit()) {
                if (this.resultInfo.exceptionOnRowlimit()) {
                    throw new TeiidProcessingException(QueryPlugin.Util.getString("row_limit_passed", new Object[] { new Integer(this.resultInfo.getUserRowLimit()), this.resultInfo.getResultSetName()})); //$NON-NLS-1$               
                }
                // well, we did not throw a exception, that means we need to limit it to current row
                this.currentRow = null;
            }
        }
View Full Code Here

        String sql = null;
        TriggerEvent event = obj.getEvent();
        if (obj.getEnabled() == null) {
          if (obj.isCreate()) {
              if (getPlanForEvent(t, event) != null) {
                throw new TeiidRuntimeException(new TeiidProcessingException(QueryPlugin.Util.getString("DdlPlan.event_already_exists", t.getName(), obj.getEvent()))); //$NON-NLS-1$
              }
          } else if (getPlanForEvent(t, event) == null) {
            throw new TeiidRuntimeException(new TeiidProcessingException(QueryPlugin.Util.getString("DdlPlan.event_not_exists", t.getName(), obj.getEvent()))); //$NON-NLS-1$
          }
          sql = obj.getDefinition().toString();
        } else if (getPlanForEvent(t, event) == null) {
        throw new TeiidRuntimeException(new TeiidProcessingException(QueryPlugin.Util.getString("DdlPlan.event_not_exists", t.getName(), obj.getEvent()))); //$NON-NLS-1$
        }
      if (pdm.getMetadataRepository() != null) {
        if (sql != null) {
          pdm.getMetadataRepository().setInsteadOfTriggerDefinition(workContext.getVdbName(), workContext.getVdbVersion(), t, obj.getEvent(), sql);
        } else {
View Full Code Here

     
      //TODO: see if there is pending work before preempting
     
          while(currentTime < context.getTimeSliceEnd() || context.isNonBlocking()) {
            if (requestCanceled) {
                  throw new TeiidProcessingException(QueryPlugin.Util.getString("QueryProcessor.request_cancelled", getProcessID())); //$NON-NLS-1$
              }
            if (currentTime > context.getTimeoutEnd()) {
              throw new TeiidProcessingException("Query timed out"); //$NON-NLS-1$
            }
              result = processPlan.nextBatch();
 
            if(result.getTerminationFlag()) {
              done = true;
View Full Code Here

      throws TeiidProcessingException, TeiidComponentException {
    try {
        // Defect 16059 - Rewrite the command to replace references, etc. with values.
      QueryRewriter.evaluateAndRewrite(atomicCommand, eval, context, metadata);
    } catch (QueryValidatorException e) {
        throw new TeiidProcessingException(e, QueryPlugin.Util.getString("AccessNode.rewrite_failed", atomicCommand)); //$NON-NLS-1$
    }
  }
View Full Code Here

      TeiidComponentException, TeiidProcessingException {
    if (item == null) {
      try {
        item = result.iter.next();
      } catch (XPathException e) {
        throw new TeiidProcessingException(e, QueryPlugin.Util.getString("XMLTableNode.error", e.getMessage())); //$NON-NLS-1$
      }
      rowCount++;
      if (item == null) {
        terminateBatches();
        return;
      }
    }
    List<Object> tuple = new ArrayList<Object>(projectedColumns.size());
    for (XMLColumn proColumn : projectedColumns) {
      if (proColumn.isOrdinal()) {
        tuple.add(rowCount);
      } else {
        try {
          XPathExpression path = proColumn.getPathExpression();
          XPathDynamicContext dynamicContext = path.createDynamicContext(item);
          SequenceIterator pathIter = path.iterate(dynamicContext);
          Item colItem = pathIter.next();
          if (colItem == null) {
            if (proColumn.getDefaultExpression() != null) {
              tuple.add(getEvaluator(Collections.emptyMap()).evaluate(proColumn.getDefaultExpression(), null));
            } else {
              tuple.add(null);
            }
            continue;
          }
          if (proColumn.getSymbol().getType() == DataTypeManager.DefaultDataClasses.XML) {
            XMLType value = table.getXQueryExpression().createXMLType(pathIter.getAnother(), this.getBufferManager(), false);
            tuple.add(value);
            continue;
          }
          if (pathIter.next() != null) {
            throw new TeiidProcessingException(QueryPlugin.Util.getString("XMLTableName.multi_value", proColumn.getName())); //$NON-NLS-1$
          }
          Object value = Value.convertToJava(colItem);
          if (value instanceof Item) {
            Item i = (Item)value;
            BuiltInAtomicType bat = typeMapping.get(proColumn.getSymbol().getType());
            if (bat != null) {
              ConversionResult cr = StringValue.convertStringToBuiltInType(i.getStringValueCS(), bat, null);
              value = cr.asAtomic();
              value = Value.convertToJava((AtomicValue)value);
              if (value instanceof Item) {
                value = ((Item)value).getStringValue();
              }
            } else {
              value = i.getStringValue();
            }
          }
          value = FunctionDescriptor.importValue(value, proColumn.getSymbol().getType());
          tuple.add(value);
        } catch (XPathException e) {
          throw new TeiidProcessingException(e, QueryPlugin.Util.getString("XMLTableNode.path_error", proColumn.getName())); //$NON-NLS-1$
        }
      }
    }
    item = null;
    addBatchRow(tuple);
View Full Code Here

    if (!array.getClass().isArray()) {
      if (array instanceof java.sql.Array) {
        try {
          array = ((java.sql.Array)array).getArray();
        } catch (SQLException e) {
          throw new TeiidProcessingException(e);
        }
      } else {
        throw new FunctionExecutionException(QueryPlugin.Util.getString("FunctionMethods.not_array_value", array.getClass())); //$NON-NLS-1$
      }
    }
   
    for (int output : projectionIndexes) {
      ProjectedColumn col = table.getColumns().get(output);
      try {
        Object val = Array.get(array, output);
        tuple.add(DataTypeManager.transformValue(val, table.getColumns().get(output).getSymbol().getType()));
      } catch (TransformationException e) {
        throw new TeiidProcessingException(e, QueryPlugin.Util.getString("ArrayTableNode.conversion_error", col.getName())); //$NON-NLS-1$
      } catch (ArrayIndexOutOfBoundsException e) {
        throw new FunctionExecutionException(QueryPlugin.Util.getString("FunctionMethods.array_index", output + 1)); //$NON-NLS-1$
      }
    }
    addBatchRow(tuple);
View Full Code Here

TOP

Related Classes of org.teiid.core.TeiidProcessingException

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.