Search in sources :

Example 6 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class TestSocketServiceRegistry method testXATransactionExceptionConversion.

public void testXATransactionExceptionConversion() throws Exception {
    Method m = DQP.class.getMethod("recover", new Class[] { Integer.TYPE });
    Throwable t = ExceptionUtil.convertException(m, new TeiidComponentException());
    assertTrue(t instanceof XATransactionException);
}
Also used : TeiidComponentException(org.teiid.core.TeiidComponentException) Method(java.lang.reflect.Method) XATransactionException(org.teiid.client.xa.XATransactionException)

Example 7 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class TestSocketServiceRegistry method testExceptionConversionNoException.

public void testExceptionConversionNoException() throws Exception {
    Method m = Foo.class.getMethod("somemethod", new Class[] {});
    Throwable t = ExceptionUtil.convertException(m, new TeiidComponentException());
    assertTrue(t instanceof TeiidRuntimeException);
}
Also used : TeiidComponentException(org.teiid.core.TeiidComponentException) Method(java.lang.reflect.Method) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException)

Example 8 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class TestOptimizer method getPlan.

public static ProcessorPlan getPlan(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, boolean shouldSucceed, CommandContext cc) {
    ProcessorPlan plan = null;
    if (analysisRecord == null) {
        analysisRecord = new AnalysisRecord(false, DEBUG);
    }
    Exception exception = null;
    try {
        // do planning
        plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, cc);
    } catch (QueryPlannerException e) {
        exception = e;
    } catch (TeiidComponentException e) {
        exception = e;
    } catch (Throwable e) {
        throw new TeiidRuntimeException(e);
    } finally {
        if (DEBUG) {
            System.out.println(analysisRecord.getDebugLog());
        }
    }
    if (!shouldSucceed) {
        // $NON-NLS-1$
        assertNotNull("Expected exception but did not get one.", exception);
        return null;
    }
    if (plan == null) {
        throw new TeiidRuntimeException(exception);
    }
    // $NON-NLS-1$
    assertNotNull("Output elements are null", plan.getOutputElements());
    // $NON-NLS-1$
    if (DEBUG)
        System.out.println("\n" + plan);
    return plan;
}
Also used : AnalysisRecord(org.teiid.query.analysis.AnalysisRecord) TeiidComponentException(org.teiid.core.TeiidComponentException) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) ProcessorPlan(org.teiid.query.processor.ProcessorPlan) QueryPlannerException(org.teiid.api.exception.query.QueryPlannerException) TeiidComponentException(org.teiid.core.TeiidComponentException) TeiidProcessingException(org.teiid.core.TeiidProcessingException) TeiidException(org.teiid.core.TeiidException) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) QueryPlannerException(org.teiid.api.exception.query.QueryPlannerException)

Example 9 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class TestBatchedUpdatePlanner method helpPlanCommand.

private BatchedUpdatePlan helpPlanCommand(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, boolean shouldSucceed) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
    // plan
    ProcessorPlan plan = null;
    AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
    if (shouldSucceed) {
        try {
            // do planning
            plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null);
        } finally {
            if (DEBUG) {
                System.out.println(analysisRecord.getDebugLog());
            }
        }
        return (BatchedUpdatePlan) plan;
    }
    Exception exception = null;
    try {
        // do planning
        QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null);
    } catch (QueryPlannerException e) {
        exception = e;
    } catch (TeiidComponentException e) {
        exception = e;
    } finally {
        if (DEBUG) {
            System.out.println(analysisRecord.getDebugLog());
        }
    }
    // $NON-NLS-1$
    assertNotNull("Expected exception but did not get one.", exception);
    return null;
}
Also used : AnalysisRecord(org.teiid.query.analysis.AnalysisRecord) TeiidComponentException(org.teiid.core.TeiidComponentException) ProcessorPlan(org.teiid.query.processor.ProcessorPlan) QueryPlannerException(org.teiid.api.exception.query.QueryPlannerException) TeiidComponentException(org.teiid.core.TeiidComponentException) QueryMetadataException(org.teiid.api.exception.query.QueryMetadataException) TeiidProcessingException(org.teiid.core.TeiidProcessingException) QueryPlannerException(org.teiid.api.exception.query.QueryPlannerException) BatchedUpdatePlan(org.teiid.query.processor.BatchedUpdatePlan)

Example 10 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class ComplexDocumentFilter method matches.

@Override
public boolean matches(Map<String, Object> parentProperties, Map<String, Object> childProperties) throws TranslatorException {
    try {
        List<Object> tuple = new ArrayList<>();
        int i = 0;
        for (Column column : parentTable.getMetadataObject().getColumns()) {
            tuple.add(i++, parentProperties.get(MarshallerBuilder.getDocumentAttributeName(column, false, metadata)));
        }
        for (Column column : childTable.getMetadataObject().getColumns()) {
            tuple.add(i++, childProperties.get(MarshallerBuilder.getDocumentAttributeName(column, true, metadata)));
        }
        org.teiid.query.util.CommandContext cc = new org.teiid.query.util.CommandContext();
        final Evaluator evaluator = new Evaluator(elementMap, null, cc);
        return evaluator.evaluate(criteria, tuple);
    } catch (ExpressionEvaluationException e) {
        throw new TranslatorException(e);
    } catch (BlockedException e) {
        throw new TranslatorException(e);
    } catch (TeiidComponentException e) {
        throw new TranslatorException(e);
    }
}
Also used : ExpressionEvaluationException(org.teiid.api.exception.query.ExpressionEvaluationException) ArrayList(java.util.ArrayList) Evaluator(org.teiid.query.eval.Evaluator) BlockedException(org.teiid.common.buffer.BlockedException) Column(org.teiid.metadata.Column) TranslatorException(org.teiid.translator.TranslatorException) TeiidComponentException(org.teiid.core.TeiidComponentException)

Aggregations

TeiidComponentException (org.teiid.core.TeiidComponentException)109 TeiidProcessingException (org.teiid.core.TeiidProcessingException)33 QueryMetadataException (org.teiid.api.exception.query.QueryMetadataException)23 TeiidRuntimeException (org.teiid.core.TeiidRuntimeException)23 ArrayList (java.util.ArrayList)18 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)17 BlockedException (org.teiid.common.buffer.BlockedException)16 IOException (java.io.IOException)15 List (java.util.List)14 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)13 Test (org.junit.Test)12 LanguageObject (org.teiid.query.sql.LanguageObject)12 QueryResolverException (org.teiid.api.exception.query.QueryResolverException)11 CommandContext (org.teiid.query.util.CommandContext)11 QueryValidatorException (org.teiid.api.exception.query.QueryValidatorException)10 ExpressionEvaluationException (org.teiid.api.exception.query.ExpressionEvaluationException)9 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)9 HashMap (java.util.HashMap)7 TeiidException (org.teiid.core.TeiidException)7 LogonException (org.teiid.client.security.LogonException)6