Package org.teiid.dqp.message

Examples of org.teiid.dqp.message.AtomicRequestMessage


   
    DQPWorkContext workContext = FakeMetadataFactory.buildWorkContext(EXAMPLE_BQT, FakeMetadataFactory.exampleBQTVDB());
    workContext.getSession().setSessionId(String.valueOf(1));
    workContext.getSession().setUserName("foo"); //$NON-NLS-1$
   
    AtomicRequestMessage request = new AtomicRequestMessage(rm, workContext, nodeid);
    request.setCommand(helpGetCommand("SELECT BQT1.SmallA.INTKEY FROM BQT1.SmallA", EXAMPLE_BQT)); //$NON-NLS-1$
    request.setRequestID(new RequestID(requestid));
    request.setConnectorName("testing"); //$NON-NLS-1$
    request.setFetchSize(5);
    return request;
  }
View Full Code Here


  }

  private AtomicResultsMessage helpExecuteUpdate() throws Exception,
      Throwable {
    Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
    AtomicRequestMessage arm = createNewAtomicRequestMessage(1, 1);
    arm.setCommand(command);
    ConnectorWorkItem synchConnectorWorkItem = new ConnectorWorkItem(arm, TestConnectorManager.getConnectorManager());
    return synchConnectorWorkItem.execute();
  }
View Full Code Here

    ((FakeConnector)cm.getExecutionFactory()).setImmutable(true);
   

    // command must not be a SELECT
    Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
    AtomicRequestMessage requestMsg = createNewAtomicRequestMessage(1, 1);
    requestMsg.setCommand(command);
   
    // To make the AtomicRequestMessage transactional, construct your own
    requestMsg.setTransactionContext( new TransactionContext(){
      @Override
      public Xid getXid() {
        return Mockito.mock(Xid.class);
      }} );
   
View Full Code Here

    ((FakeConnector)cm.getExecutionFactory()).setImmutable(false);
   
       
    // command must not be a SELECT
    Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT); //$NON-NLS-1$
    AtomicRequestMessage requestMsg = createNewAtomicRequestMessage(1, 1);
    requestMsg.setCommand(command);
   
    // To make the AtomicRequestMessage transactional, construct your own
    requestMsg.setTransactionContext( new TransactionContext(){
      @Override
      public Xid getXid() {
        return Mockito.mock(Xid.class);
      }} );
   
View Full Code Here

        DQPCore rm = new DQPCore();
        rm.setTransactionService(new FakeTransactionService());
        RequestMessage r0 = new RequestMessage("foo"); //$NON-NLS-1$
        RequestID requestID = new RequestID(SESSION_STRING, 1);
        RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null);
        AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.getDqpWorkContext(), 1);

        DataTierTupleSource info = Mockito.mock(DataTierTupleSource.class);
        workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info);
       
        DataTierTupleSource arInfo = workItem.getConnectorRequest(atomicReq.getAtomicRequestID());
        assertTrue(arInfo == info);
    }
View Full Code Here

        DQPCore rm = new DQPCore();
        rm.setTransactionService(new FakeTransactionService());
        RequestMessage r0 = new RequestMessage("foo"); //$NON-NLS-1$
        RequestID requestID = new RequestID(SESSION_STRING, 1);
        RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null);
        AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.getDqpWorkContext(), 1);

        DataTierTupleSource info = Mockito.mock(DataTierTupleSource.class);
        workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info);
       
        workItem.closeAtomicRequest(atomicReq.getAtomicRequestID());
       
        DataTierTupleSource arInfo = workItem.getConnectorRequest(atomicReq.getAtomicRequestID());
        assertNull(arInfo);
    }
View Full Code Here

        context.setVdbName("test"); //$NON-NLS-1$
        context.setVdbVersion(1);
        context.setQueryProcessorFactory(new QueryProcessorFactoryImpl(bs.getBufferManager(), dtm, new DefaultCapabilitiesFinder(), null, metadata));
        workItem = TestDQPCoreRequestHandling.addRequest(rm, original, requestID, null, workContext);
       
        request = new AtomicRequestMessage(original, workContext, nodeId);
        request.setCommand(command);
        request.setConnectorName("FakeConnectorID"); //$NON-NLS-1$
        info = new DataTierTupleSource(request, workItem, connectorManager.registerRequest(request), dtm, limit);
    }
View Full Code Here

   
    if(CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName)) {
      return processSystemQuery(context, command, workItem.getDqpWorkContext());
    }
   
    AtomicRequestMessage aqr = createRequest(context.getProcessorID(), command, modelName, connectorBindingId, nodeID);
    if (limit > 0) {
      aqr.setFetchSize(Math.min(limit, aqr.getFetchSize()));
    }
    if (context.getDataObjects() != null) {
      for (GroupSymbol gs : GroupCollectorVisitor.getGroupsIgnoreInlineViews(command, false)) {
        context.accessedDataObject(gs.getMetadataID());
      }
    }
    ConnectorManagerRepository cmr = workItem.getDqpWorkContext().getVDB().getAttachment(ConnectorManagerRepository.class);
    ConnectorWork work = cmr.getConnectorManager(aqr.getConnectorName()).registerRequest(aqr);
        return new DataTierTupleSource(aqr, workItem, work, this, limit);
  }
View Full Code Here

      throws TeiidProcessingException, TeiidComponentException {
    RequestWorkItem workItem = requestMgr.getRequestWorkItem((RequestID)processorId);
   
      RequestMessage request = workItem.requestMsg;
    // build the atomic request based on original request + context info
        AtomicRequestMessage aqr = new AtomicRequestMessage(request, workItem.getDqpWorkContext(), nodeID);
        aqr.setCommand(command);
        aqr.setModelName(modelName);
        aqr.setMaxResultRows(requestMgr.getMaxSourceRows());
        aqr.setExceptionOnMaxRows(requestMgr.isExceptionOnMaxSourceRows());
        aqr.setPartialResults(request.supportsPartialResults());
        aqr.setSerial(requestMgr.getUserRequestSourceConcurrency() == 1);
        if (nodeID >= 0) {
          aqr.setTransactionContext(workItem.getTransactionContext());
        }
        aqr.setFetchSize(this.bufferService.getBufferManager().getConnectorBatchSize());
        if (connectorBindingId == null) {
          VDBMetaData vdb = workItem.getDqpWorkContext().getVDB();
          ModelMetaData model = vdb.getModel(modelName);
          List<String> bindings = model.getSourceNames();
          if (bindings == null || bindings.size() != 1) {
              // this should not happen, but it did occur when setting up the SystemAdmin models
              throw new TeiidComponentException(QueryPlugin.Util.getString("DataTierManager.could_not_obtain_connector_binding", new Object[]{modelName, workItem.getDqpWorkContext().getVdbName(), workItem.getDqpWorkContext().getVdbVersion() })); //$NON-NLS-1$
          }
          connectorBindingId = bindings.get(0);
          Assertion.isNotNull(connectorBindingId, "could not obtain connector id"); //$NON-NLS-1$
        }
        aqr.setConnectorName(connectorBindingId);
    return aqr;
  }
View Full Code Here

                    if (connectorName == null) {
                      continue;
                    }
                    // If the request has not yet completed processing, then
                    // add all the subrequest messages
                  AtomicRequestMessage arm = conInfo.getAtomicRequestMessage();
                  RequestMetadata info = new RequestMetadata();
                  if (conInfo.isQueued()) {
                    info.setThreadState(ThreadState.QUEUED);
                  } else if (conInfo.isRunning()) {
                    info.setThreadState(ThreadState.RUNNING);
                  } else {
                    info.setThreadState(ThreadState.IDLE);
                  }
                  info.setExecutionId(arm.getRequestID().getExecutionID());
                  info.setSessionId(holder.requestID.getConnectionID());
                  info.setCommand(arm.getCommand().toString());
                  info.setStartTime(arm.getProcessingTimestamp());
                  info.setSourceRequest(true);
                  info.setNodeId(arm.getAtomicRequestID().getNodeID());
                  info.setState(conInfo.isCanceled()?ProcessingState.CANCELED:conInfo.isDone()?ProcessingState.DONE:ProcessingState.PROCESSING);
              results.add(info);
                }
               
                // check if only need long running queries.
View Full Code Here

TOP

Related Classes of org.teiid.dqp.message.AtomicRequestMessage

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.