use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class BufferManagerImpl method getState.
@Override
public void getState(String state_id, OutputStream ostream) {
TupleBuffer buffer = this.getTupleBuffer(state_id);
if (buffer != null) {
try {
ObjectOutputStream out = new ObjectOutputStream(ostream);
getTupleBufferState(out, buffer);
out.flush();
} catch (TeiidComponentException e) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30054, e);
} catch (IOException e) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30055, e);
}
}
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class FileStorageManager method initialize.
/**
* Initialize
*/
public void initialize() throws TeiidComponentException {
if (this.directory == null) {
throw new TeiidComponentException(QueryPlugin.Event.TEIID30040, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30040));
}
dirFile = new File(this.directory);
makeDir(dirFile);
for (int i = 0; i < subDirectories.length; i++) {
// $NON-NLS-1$
subDirectories[i] = new File(this.directory, "b" + i);
makeDir(subDirectories[i]);
}
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestResolver method helpCheckElements.
private void helpCheckElements(LanguageObject langObj, String[] elementNames, String[] elementIDs) {
List<ElementSymbol> elements = new ArrayList<ElementSymbol>();
ElementCollectorVisitor.getElements(langObj, elements);
// $NON-NLS-1$
assertEquals("Wrong number of elements: ", elementNames.length, elements.size());
for (int i = 0; i < elements.size(); i++) {
ElementSymbol symbol = elements.get(i);
// $NON-NLS-1$
assertEquals("Element name does not match: ", elementNames[i].toUpperCase(), symbol.getName().toUpperCase());
Object elementID = symbol.getMetadataID();
try {
String name = metadata.getFullName(elementID);
// $NON-NLS-1$ //$NON-NLS-2$
assertNotNull("ElementSymbol " + symbol + " was not resolved and has no metadataID", elementID);
// $NON-NLS-1$
assertEquals("ElementID name does not match: ", elementIDs[i].toUpperCase(), name.toUpperCase());
} catch (TeiidComponentException e) {
throw new RuntimeException(e);
}
}
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestJoinNode method helpCreateJoin.
protected void helpCreateJoin() {
// $NON-NLS-1$
ElementSymbol es1 = new ElementSymbol("e1");
es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
// $NON-NLS-1$
ElementSymbol es2 = new ElementSymbol("e2");
es2.setType(DataTypeManager.DefaultDataClasses.INTEGER);
List leftElements = new ArrayList();
leftElements.add(es1);
leftNode = new BlockingFakeRelationalNode(1, leftTuples);
leftNode.setElements(leftElements);
List rightElements = new ArrayList();
rightElements.add(es2);
rightNode = new BlockingFakeRelationalNode(2, rightTuples) {
@Override
public boolean hasBuffer() {
return false;
}
@Override
public TupleBuffer getBufferDirect(int maxRows) throws BlockedException, TeiidComponentException, TeiidProcessingException {
fail();
throw new AssertionError();
}
};
rightNode.setElements(rightElements);
List joinElements = new ArrayList();
joinElements.add(es1);
joinElements.add(es2);
join = new JoinNode(3);
joinStrategy = new NestedLoopJoinStrategy();
join.setJoinStrategy(joinStrategy);
join.setElements(joinElements);
join.setJoinType(joinType);
switch(criteriaType) {
case NO_CRITERIA:
break;
case EQUAL_CRITERIA:
join.setJoinExpressions(Arrays.asList(es1), Arrays.asList(es2));
joinStrategy = new MergeJoinStrategy(SortOption.SORT, SortOption.SORT, false);
join.setJoinStrategy(joinStrategy);
break;
case FUNCTION_CRITERIA:
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), es1 });
// $NON-NLS-1$
FunctionDescriptor desc = RealMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class });
func.setFunctionDescriptor(desc);
func.setType(DataTypeManager.DefaultDataClasses.INTEGER);
CompareCriteria joinCriteria = new CompareCriteria(es2, CompareCriteria.EQ, func);
join.setJoinCriteria(joinCriteria);
break;
}
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestSelectNode method testTimeslicing.
@Test
public void testTimeslicing() throws TeiidComponentException, TeiidProcessingException {
// $NON-NLS-1$
ElementSymbol es1 = new ElementSymbol("e1");
es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
List elements = new ArrayList();
elements.add(es1);
CompareCriteria crit = new CompareCriteria(es1, CompareCriteria.EQ, new Constant(new Integer(1)));
List[] data = new List[] { Arrays.asList(1), Arrays.asList(1), Arrays.asList(1) };
List childElements = new ArrayList();
childElements.add(es1);
helpTestSelect(elements, crit, childElements, null, data, new FakeRelationalNode(2, data), new SelectNode(3) {
int i = 0;
@Override
protected Evaluator getEvaluator(Map elementMap) {
return new Evaluator(elementMap, getDataManager(), getContext()) {
@Override
public Boolean evaluateTVL(Criteria criteria, List<?> tuple) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
if (i++ == 1) {
throw new QueryProcessor.ExpiredTimeSliceException();
}
return super.evaluateTVL(criteria, tuple);
}
};
}
});
}
Aggregations