public void processRequest() throws TeiidComponentException, TeiidProcessingException { LogManager.logDetail(LogConstants.CTX_DQP, this.requestId, "executing", this.requestMsg.isPreparedStatement()?"prepared":"", this.requestMsg.getCommandString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ initMetadata(); generatePlan(false); postProcessXML(); createProcessor(); }
@Override public void processRequest() throws TeiidComponentException, TeiidProcessingException { super.processRequest(); if (this.requestMsg.getRequestOptions().isContinuous()) { this.processor.setContinuous(this.prepPlan, this.requestMsg.getCommandString()); } } }
public void processRequest() throws TeiidComponentException, TeiidProcessingException { LogManager.logDetail(LogConstants.CTX_DQP, this.requestId, "executing", this.requestMsg.isPreparedStatement()?"prepared":"", this.requestMsg.getCommandString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ initMetadata(); generatePlan(false); createProcessor(); }
request = new PreparedStatementRequest(prepPlanCache); } else { request = new Request(); state.session = workContext.getSession(); request.initialize(requestMsg, bufferManager, dataTierMgr, transactionService, state.sessionTables, workContext, this.prepPlanCache); request.setOptions(options); request.setExecutor(this.processWorkerPool); request.setResultSetCacheEnabled(this.rsCache != null); request.setAuthorizationValidator(this.authorizationValidator); final PreParser preparser = workContext.getVDB().getAttachment(PreParser.class); if (preparser != null) { if (this.config.getPreParser() != null) { request.setPreParser(new PreParser() { request.setPreParser(preparser); request.setPreParser(this.config.getPreParser()); request.setUserRequestConcurrency(this.getUserRequestSourceConcurrency()); ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>(); final RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
createCommandContext(); Command command = parseCommand(); getAnalysisRecord(); resolveCommand(command); checkReferences(references); validateAccess(requestMsg.getCommands(), command, CommandType.USER); validateQuery(command);
ParseInfo pi = Request.createParseInfo(requestMsg, this.dqpWorkContext.getSession()); cacheId = new CacheID(this.dqpWorkContext, pi, requestMsg.getCommandString()); cachable = cacheId.setParameters(requestMsg.getParameterValues()); TransactionContext tc = request.getTransactionContext(false); if (tc != null && tc.getTransactionType() != Scope.NONE) { initTransactionState(tc); request.initMetadata(); this.originalCommand = cr.getCommand(requestMsg.getCommandString(), request.metadata, pi); if (!request.validateAccess(requestMsg.getCommands(), this.originalCommand, CommandType.CACHED)) { LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Using result set cached results", cacheId); //$NON-NLS-1$ this.resultsBuffer = cr.getResults(); request.processRequest(); } finally { analysisRecord = request.analysisRecord; this.collector.setSaveLastRow(request.isReturingParams());
/** * Test Request.validateEntitlement(). * Make sure that this can be called both before and after metadata is initialized. * See defect 17209. * @throws Exception * @since 4.2 */ @Test public void testValidateEntitlement() throws Exception { QueryMetadataInterface metadata = RealMetadataFactory.example1Cached(); Request request = new Request(); Command command = QueryParser.getQueryParser().parseCommand(QUERY); QueryResolver.resolveCommand(command, metadata); RequestMessage message = new RequestMessage(); DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, RealMetadataFactory.example1VDB()); request.initialize(message, BufferManagerFactory.getStandaloneBufferManager(), null, new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null); request.initMetadata(); DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator(); DataRolePolicyDecider drpd = new DataRolePolicyDecider(); drpd.setAllowCreateTemporaryTablesByDefault(true); drpd.setAllowFunctionCallsByDefault(true); drav.setPolicyDecider(drpd); request.setAuthorizationValidator(drav); request.validateAccess(new String[] {QUERY}, command, CommandType.USER); }
private Request helpProcessMessage(RequestMessage message, SessionAwareCache<PreparedPlan> cache, DQPWorkContext workContext) throws TeiidComponentException, TeiidProcessingException { Request request = null; if (cache != null) { request = new PreparedStatementRequest(cache); } else { request = new Request(); } ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class); workContext.getVDB().addAttchment(ConnectorManagerRepository.class, repo); Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(new AutoGenDataService()); request.initialize(message, Mockito.mock(BufferManager.class), new FakeDataManager(), new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null); DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator(); request.setAuthorizationValidator(drav); request.processRequest(); return request; }
sqlQuery = this.preParser.preParse(sqlQuery, this.context); CacheID id = new CacheID(this.workContext, Request.createParseInfo(this.requestMsg, this.workContext.getSession()), sqlQuery); prepPlan = prepPlanCache.get(id); super.generatePlan(true); prepPlan.setCommand(this.userCommand);
throw new QueryValidatorException(QueryPlugin.Event.TEIID30490, QueryPlugin.Util.getString(this.requestMsg.getResultsMode()==ResultsMode.RESULTSET?"Request.no_result_set":"Request.result_set")); //$NON-NLS-1$ //$NON-NLS-2$ createCommandContext(); if (this.requestMsg.isReturnAutoGeneratedKeys() && command instanceof Insert) { Insert insert = (Insert)command;
private Command parseCommand() throws QueryParserException { if (requestMsg.getCommand() != null) { return (Command)requestMsg.getCommand(); } String[] commands = requestMsg.getCommands(); ParseInfo parseInfo = createParseInfo(this.requestMsg, this.workContext.getSession()); QueryParser queryParser = QueryParser.getQueryParser(); if (requestMsg.isPreparedStatement() || requestMsg.isCallableStatement() || !requestMsg.isBatchedUpdate()) { String commandStr = commands[0]; if (preParser != null) { commandStr = preParser.preParse(commandStr, this.context); } return queryParser.parseCommand(commandStr, parseInfo); } List<Command> parsedCommands = new ArrayList<Command>(commands.length); for (int i = 0; i < commands.length; i++) { String updateCommand = commands[i]; if (preParser != null) { updateCommand = preParser.preParse(updateCommand, this.context); } parsedCommands.add(queryParser.parseCommand(updateCommand, parseInfo)); } return new BatchedUpdateCommand(parsedCommands); }
request = new PreparedStatementRequest(prepPlanCache); } else { request = new Request(); state.session = workContext.getSession(); request.initialize(requestMsg, bufferManager, dataTierMgr, transactionService, state.sessionTables, workContext, this.prepPlanCache); request.setOptions(options); request.setExecutor(this.processWorkerPool); request.setResultSetCacheEnabled(this.rsCache != null); request.setAuthorizationValidator(this.authorizationValidator); final PreParser preparser = workContext.getVDB().getAttachment(PreParser.class); if (preparser != null) { if (this.config.getPreParser() != null) { request.setPreParser(new PreParser() { request.setPreParser(preparser); request.setPreParser(this.config.getPreParser()); request.setUserRequestConcurrency(this.getUserRequestSourceConcurrency()); ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>(); final RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
createCommandContext(); Command command = parseCommand(); getAnalysisRecord(); resolveCommand(command); checkReferences(references); validateAccess(requestMsg.getCommands(), command, CommandType.USER); validateQuery(command);
ParseInfo pi = Request.createParseInfo(requestMsg, this.dqpWorkContext.getSession()); cacheId = new CacheID(this.dqpWorkContext, pi, requestMsg.getCommandString()); cachable = cacheId.setParameters(requestMsg.getParameterValues()); TransactionContext tc = request.getTransactionContext(false); if (tc != null && tc.getTransactionType() != Scope.NONE) { initTransactionState(tc); request.initMetadata(); this.originalCommand = cr.getCommand(requestMsg.getCommandString(), request.metadata, pi); if (!request.validateAccess(requestMsg.getCommands(), this.originalCommand, CommandType.CACHED)) { LogManager.logDetail(LogConstants.CTX_DQP, requestID, "Using result set cached results", cacheId); //$NON-NLS-1$ this.resultsBuffer = cr.getResults(); request.processRequest(); } finally { analysisRecord = request.analysisRecord; this.collector.setSaveLastRow(request.isReturingParams());
public void processRequest() throws TeiidComponentException, TeiidProcessingException { LogManager.logDetail(LogConstants.CTX_DQP, this.requestId, "executing", this.requestMsg.isPreparedStatement()?"prepared":"", this.requestMsg.getCommandString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ initMetadata(); generatePlan(false); createProcessor(); }
sqlQuery = this.preParser.preParse(sqlQuery, this.context); CacheID id = new CacheID(this.workContext, Request.createParseInfo(this.requestMsg, this.workContext.getSession()), sqlQuery); prepPlan = prepPlanCache.get(id); super.generatePlan(true); prepPlan.setCommand(this.userCommand);
throw new QueryValidatorException(QueryPlugin.Event.TEIID30490, QueryPlugin.Util.getString(this.requestMsg.getResultsMode()==ResultsMode.RESULTSET?"Request.no_result_set":"Request.result_set")); //$NON-NLS-1$ //$NON-NLS-2$ createCommandContext(); if (this.requestMsg.isReturnAutoGeneratedKeys() && command instanceof Insert) { Insert insert = (Insert)command;
private Command parseCommand() throws QueryParserException { if (requestMsg.getCommand() != null) { return (Command)requestMsg.getCommand(); } String[] commands = requestMsg.getCommands(); ParseInfo parseInfo = createParseInfo(this.requestMsg, this.workContext.getSession()); QueryParser queryParser = QueryParser.getQueryParser(); if (requestMsg.isPreparedStatement() || requestMsg.isCallableStatement() || !requestMsg.isBatchedUpdate()) { String commandStr = commands[0]; if (preParser != null) { commandStr = preParser.preParse(commandStr, this.context); } return queryParser.parseCommand(commandStr, parseInfo); } List<Command> parsedCommands = new ArrayList<Command>(commands.length); for (int i = 0; i < commands.length; i++) { String updateCommand = commands[i]; if (preParser != null) { updateCommand = preParser.preParse(updateCommand, this.context); } parsedCommands.add(queryParser.parseCommand(updateCommand, parseInfo)); } return new BatchedUpdateCommand(parsedCommands); }
request = new PreparedStatementRequest(prepPlanCache); } else { request = new Request(); state.session = workContext.getSession(); request.initialize(requestMsg, bufferManager, dataTierMgr, transactionService, state.sessionTables, workContext, this.prepPlanCache); request.setOptions(options); request.setExecutor(this.processWorkerPool); request.setResultSetCacheEnabled(this.rsCache != null); request.setAuthorizationValidator(this.authorizationValidator); final PreParser preparser = workContext.getVDB().getAttachment(PreParser.class); if (preparser != null) { if (this.config.getPreParser() != null) { request.setPreParser(new PreParser() { request.setPreParser(preparser); request.setPreParser(this.config.getPreParser()); request.setUserRequestConcurrency(this.getUserRequestSourceConcurrency()); ResultsFuture<ResultsMessage> resultsFuture = new ResultsFuture<ResultsMessage>(); final RequestWorkItem workItem = new RequestWorkItem(this, requestMsg, request, resultsFuture.getResultsReceiver(), requestID, workContext);
createCommandContext(); Command command = parseCommand(); getAnalysisRecord(); resolveCommand(command); checkReferences(references); validateAccess(requestMsg.getCommands(), command, CommandType.USER); validateQuery(command);