use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class GlobalTableStoreImpl method getState.
@Override
public void getState(OutputStream ostream) {
try {
ObjectOutputStream oos = new ObjectOutputStream(ostream);
for (Map.Entry<String, TempTable> entry : tableStore.getTempTables().entrySet()) {
sendTable(entry.getKey(), oos, true);
}
oos.writeObject(null);
oos.close();
} catch (IOException e) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30217, e);
} catch (TeiidComponentException e) {
throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30218, e);
}
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class TestBufferManagerImpl method testTupleBufferSessionMax.
@Test
public void testTupleBufferSessionMax() throws Exception {
BufferManagerImpl bufferManager = new BufferManagerImpl();
bufferManager.setCache(new MemoryStorageManager() {
@Override
public long getMaxStorageSpace() {
return 64000;
}
});
bufferManager.setMaxReserveKB(10);
bufferManager.setMaxActivePlans(10);
bufferManager.setOptions(new Options().maxSessionBufferSizeEstimate(100000));
bufferManager.initialize();
CommandContext context = new CommandContext();
context.setSession(new SessionMetadata());
CommandContext.pushThreadLocalContext(context);
try {
List<TupleBuffer> tupleBuffers = new ArrayList<TupleBuffer>();
for (int i = 0; i < 36; i++) {
TupleBuffer tb = bufferManager.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, String.class)), "x", TupleSourceType.PROCESSOR);
try {
for (int j = 0; j < 50; j++) {
tb.addTuple(Arrays.asList("a"));
}
tb.saveBatch();
if (i % 2 == 0) {
tb.remove();
}
} catch (TeiidComponentException e) {
assertEquals(34, i);
return;
}
tupleBuffers.add(tb);
}
} finally {
CommandContext.popThreadLocalContext();
}
fail();
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class ValidationVisitor method visit.
@Override
public void visit(AlterProcedure obj) {
GroupSymbol gs = obj.getTarget();
validateAlterTarget(obj);
try {
if (!gs.isProcedure() || !getMetadata().isVirtualModel(getMetadata().getModelID(gs.getMetadataID()))) {
// $NON-NLS-1$
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.not_a_procedure", gs), gs);
return;
}
Validator.validate(obj.getDefinition(), getMetadata(), this);
StoredProcedureInfo info = getMetadata().getStoredProcedureInfoForProcedure(gs.getName());
for (SPParameter param : info.getParameters()) {
if (param.getParameterType() == SPParameter.RESULT_SET) {
QueryResolver.validateProjectedSymbols(gs, param.getResultSetColumns(), obj.getDefinition().getProjectedSymbols());
break;
}
}
} catch (QueryValidatorException e) {
handleValidationError(e.getMessage(), obj.getDefinition().getBlock());
} catch (TeiidComponentException e) {
handleException(e);
}
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class BufferManagerFactory method initBufferManager.
public static BufferManagerImpl initBufferManager(BufferManagerImpl bufferManager) {
try {
bufferManager.initialize();
bufferManager.setUseWeakReferences(false);
MemoryStorageManager storageManager = new MemoryStorageManager();
SplittableStorageManager ssm = new SplittableStorageManager(storageManager);
ssm.setMaxFileSizeDirect(MemoryStorageManager.MAX_FILE_SIZE);
BufferFrontedFileStoreCache fsc = new BufferFrontedFileStoreCache();
fsc.setBufferManager(bufferManager);
// use conservative allocations
// allow the space to be GCed easily
fsc.setDirect(false);
fsc.setMaxStorageObjectSize(1 << 20);
fsc.setMemoryBufferSpace(1 << 21);
fsc.setStorageManager(ssm);
fsc.initialize();
bufferManager.setCache(fsc);
return bufferManager;
} catch (TeiidComponentException e) {
throw new RuntimeException(e);
}
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class CorrelatedReferenceCollectorVisitor method visit.
// ############### Visitor methods for language objects ##################
/**
* Visit a language object and collect symbols. This method should <b>NOT</b> be
* called directly.
* @param obj Language object
*/
public void visit(Reference obj) {
ElementSymbol e = obj.getExpression();
if (e == null || !e.isExternalReference()) {
return;
}
GroupSymbol g = e.getGroupSymbol();
for (int i = this.outerGroups.size() - (queryRoot ? 2 : 1); i >= 0; i--) {
GroupSymbol outer = this.outerGroups.get(i).get(g);
if (outer == null) {
continue;
}
try {
if (ResolverUtil.resolveElementsInGroup(outer, metadata).contains(e)) {
// add if correlated to the root groups
if (i == 0) {
this.references.add(obj);
}
return;
}
} catch (TeiidComponentException e1) {
throw new TeiidRuntimeException(e1);
}
}
}
Aggregations