org.teiid.translator.ExecutionContext类的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中org.teiid.translator.ExecutionContext类的一些代码示例,展示了ExecutionContext类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExecutionContext类的具体详情如下:
包路径:org.teiid.translator.ExecutionContext
类名称:ExecutionContext

ExecutionContext介绍

[英]The security context provides information about the user context in which this query is being run. As of 4.2, the SecurityContext is a sub-interface of ExecutionContext such that both interfaces contain all of the methods from the prior independent interfaces. Thus, these interfaces can now be used interchangeably.
[中]安全上下文提供有关运行此查询的用户上下文的信息。从4.2开始,SecurityContext是ExecutionContext的子接口,因此两个接口都包含来自先前独立接口的所有方法。因此,这些接口现在可以互换使用。

代码示例

代码示例来源:origin: org.teiid.connectors/translator-jdbc

protected JDBCBaseExecution(Command command, Connection connection, ExecutionContext context, JDBCExecutionFactory jef) {
  this.connection = connection;
  this.context = context;
  this.executionFactory = jef;
  
  trimString = jef.isTrimStrings();
  fetchSize = context.getBatchSize();
  this.command = command;
}

代码示例来源:origin: org.teiid.connectors/translator-jdbc

public void addStatementWarnings() throws SQLException {
    SQLWarning warning = this.statement.getWarnings();
    if (warning != null) {
      context.addWarning(warning);
      if (LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) {
        while (warning != null) {
          LogManager.logDetail(LogConstants.CTX_CONNECTOR, context.getRequestId() + " Warning: ", warning); //$NON-NLS-1$
          warning = warning.getNextWarning();
        }
      }
    }
    this.statement.clearWarnings();
  }
}

代码示例来源:origin: teiid/teiid

public FakeExecutionContextImpl(ExecutionContext c) {
  super(c.getVdbName(), c.getVdbVersion(), c.getCommandPayload(), c
      .getConnectionId(), c.getConnectorIdentifier(), Long.valueOf(c
      .getRequestId()), c.getPartIdentifier(), c
      .getExecutionCountIdentifier());
}

代码示例来源:origin: org.teiid.connectors/translator-salesforce

public QueryExecutionImpl(QueryExpression command, SalesforceConnection connection, RuntimeMetadata metadata, ExecutionContext context, SalesForceExecutionFactory salesForceExecutionFactory) {
  this.connection = connection;
  this.metadata = metadata;
  this.context = context;
  this.query = command;
  this.executionFactory = salesForceExecutionFactory;
  connectionIdentifier = context.getConnectionId();
  connectorIdentifier = context.getConnectorIdentifier();
  requestIdentifier = context.getRequestId();
  partIdentifier = context.getPartIdentifier();
}

代码示例来源:origin: org.teiid.connectors/translator-jdbc

/**
 * Returns the source comment for the given command
 * @param context
 * @param command
 * @return the comment
 */
public String getSourceComment(ExecutionContext context, Command command) {
  if (addSourceComment() && context != null) {
    return comment.get().format(new Object[] {context.getConnectionId(), context.getRequestId(), context.getPartIdentifier(), 
        context.getExecutionCountIdentifier(), context.getSession().getUserName(), context.getVdbName(), context.getVdbVersion(), context.isTransactional() });
  }
  return ""; //$NON-NLS-1$ 
}

代码示例来源:origin: teiid/teiid

public boolean equals(Object obj) {
  if(obj == this) {
    return true;
  } 
  if(! (obj instanceof ExecutionContext)) {
    return false;
  } 
  ExecutionContext other = (ExecutionContext) obj;
  return EquivalenceUtil.areEqual(this.getRequestId(), other.getRequestId()) && 
  EquivalenceUtil.areEqual(this.getPartIdentifier(), other.getPartIdentifier());
}

代码示例来源:origin: org.teiid.connectors/translator-odata

@Override
public int[] getUpdateCounts() throws DataNotAvailableException, TranslatorException {
  if (this.visitor.getMethod().equals("DELETE")) { //$NON-NLS-1$
    //DELETE
    return (this.response != null)?new int[]{1}:new int[]{0};
  }
  else if(this.visitor.getMethod().equals("PUT")) { //$NON-NLS-1$
    // UPDATE; 
    // conflicting implementation found where some sent 200 with content; other with 204 no-content 
    return (this.response != null)?new int[]{1}:new int[]{0};
  }
  else if (this.visitor.getMethod().equals("POST")) { //$NON-NLS-1$
    //INSERT
    if (this.response != null && this.response.hasRow()) {
      if (this.executionContext.getCommandContext().isReturnAutoGeneratedKeys()) {
        addAutoGeneretedKeys();
      }                
      return new int[]{1};
    }
  }
  return new int[] {0};
}

代码示例来源:origin: org.teiid.connectors/translator-mongodb

AggregationOptions options = this.executionFactory.getOptions(this.executionContext.getBatchSize());		
    if (this.executionContext.getCommandContext().isReturnAutoGeneratedKeys()) {
      addAutoGeneretedKeys(executionResults.get(0));

代码示例来源:origin: org.teiid.connectors/translator-jdbc

Class<?>[] keyColumnDataTypes = null;
String[] keyColumnNames = null;
if (command instanceof Insert && context.getCommandContext().isReturnAutoGeneratedKeys() && executionFactory.supportsGeneratedKeys(context, command)) {
  Insert insert = (Insert)command;
  NamedTable nt = insert.getTable();
  try {
    ResultSet keys = statement.getGeneratedKeys();
    GeneratedKeys generatedKeys = context.getCommandContext().returnGeneratedKeys(keyColumnNames, keyColumnDataTypes);
    context.addWarning(e);
    LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Exception determining generated keys, no keys will be returned"); //$NON-NLS-1$

代码示例来源:origin: org.teiid.connectors/translator-salesforce

context.logCommand("Using retrieve: ", visitor.getRetrieveFieldList(), visitor.getTableName(), visitor.getIdInCriteria()); //$NON-NLS-1$
results = this.executionFactory.buildQueryResult(connection.retrieve(visitor.getRetrieveFieldList(),
    visitor.getTableName(), visitor.getIdInCriteria()));
context.logCommand(finalQuery);
    && (context.getSourceHints() != null && context.getSourceHints().contains("bulk"))) { //$NON-NLS-1$
  BulkValidator bulkValidator = new BulkValidator();
  query.acceptVisitor(bulkValidator);
results = connection.query(finalQuery, this.context.getBatchSize(), visitor.getQueryAll());

代码示例来源:origin: org.teiid.connectors/translator-jdbc

if (context != null) {
  Object payload = context.getCommandPayload();
  if (payload instanceof String) {
    String payloadString = (String)payload;
      } else {
        String msg = JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID11003, "Execution Payload", payloadString); //$NON-NLS-1$ 
        context.addWarning(new TranslatorException(msg));
        LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg);
  String hint = context.getSourceHint();
  if (context.getGeneralHint() != null) {
    if (hint != null) {
      hint += (" " + context.getGeneralHint()); //$NON-NLS-1$
    } else {
      hint = context.getGeneralHint();
    } else {
      String msg = JDBCPlugin.Util.gs(JDBCPlugin.Event.TEIID11003, "Source Hint", hint); //$NON-NLS-1$
      context.addWarning(new TranslatorException(msg));
      LogManager.logWarning(LogConstants.CTX_CONNECTOR, msg);

代码示例来源:origin: teiid/teiid

@Override
public void execute() throws TranslatorException {
  ec.addWarning(new Exception("Some warning")); //$NON-NLS-1$
}
@Override

代码示例来源:origin: teiid/teiid

public String toString() {
  if (!source) {
    if (event == Event.NEW) {
      return "\tSTART USER COMMAND:\tstartTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\ttxID=" + transactionID + "\tsessionID=" + sessionID + "\tapplicationName=" + applicationName + "\tprincipal=" + principal + "\tvdbName=" + vdbName + "\tvdbVersion=" + vdbVersion + "\tsql=" + sql;  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
    }
    return "\t"+ event +" USER COMMAND:\tendTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\ttxID=" + transactionID + "\tsessionID=" + sessionID + "\tprincipal=" + principal + "\tvdbName=" + vdbName + "\tvdbVersion=" + vdbVersion + "\tfinalRowCount=" + rowCount+ ((plan!=null)?"\tplan=" + plan.toYaml():"") + ((cpuTime!=null)?"\tcpuTime(ns)=" + cpuTime:"");  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$
  }
  if (event == Event.NEW) {
    return "\tSTART DATA SRC COMMAND:\tstartTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID + "\texecutionID="+ executionContext.getExecutionCountIdentifier() + "\ttxID=" + transactionID + "\tmodelName="+ modelName + "\ttranslatorName=" + translatorName + "\tsessionID=" + sessionID + "\tprincipal=" + principal + "\tsql=" + sql;  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
  }
  return "\t"+ event +" SRC COMMAND:\tendTime=" + new Timestamp(timestamp) + "\trequestID=" + requestID + "\tsourceCommandID="+ sourceCommandID + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
      "\texecutionID="+ executionContext.getExecutionCountIdentifier() + "\ttxID=" + transactionID + "\tmodelName="+ modelName + "\ttranslatorName=" + translatorName +  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
      "\tsessionID=" + sessionID + "\tprincipal=" + principal + ((sourceCommand != null)?"\tsourceCommand=" + StringUtil.toString(sourceCommand, " "):"") + ((rowCount != null)?"\tfinalRowCount=" + rowCount:"") + ((cpuTime!=null)?"\tcpuTime(ns)=" + cpuTime:"");  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$//$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
 }

代码示例来源:origin: org.teiid.connectors/translator-jdbc

protected void setSizeContraints(Statement statement) {
  try {
    executionFactory.setFetchSize(command, context, statement, fetchSize);
  } catch (SQLException e) {
    if (LogManager.isMessageToBeRecorded(LogConstants.CTX_CONNECTOR, MessageLevel.DETAIL)) {
      LogManager.logDetail(LogConstants.CTX_CONNECTOR, context.getRequestId(), " could not set fetch size: ", fetchSize); //$NON-NLS-1$
    }
  }
}

代码示例来源:origin: org.jboss.teiid/teiid-engine

public boolean equals(Object obj) {
  if(obj == this) {
    return true;
  } 
  if(! (obj instanceof ExecutionContext)) {
    return false;
  } 
  ExecutionContext other = (ExecutionContext) obj;
  return EquivalenceUtil.areEqual(this.getRequestId(), other.getRequestId()) && 
  EquivalenceUtil.areEqual(this.getPartIdentifier(), other.getPartIdentifier());
}

代码示例来源:origin: org.teiid.connectors/translator-odata4

@Override
public int[] getUpdateCounts() throws DataNotAvailableException, TranslatorException {
  if (this.visitor.getOperationType() == OperationType.DELETE) { 
    return new int[]{this.updateCount.get()};
  }
  else if(this.visitor.getOperationType() == OperationType.UPDATE) { 
    return new int[]{this.updateCount.get()};
  }
  else if (this.visitor.getOperationType() == OperationType.INSERT) { 
    if (this.createdEntity != null) {
      if (this.executionContext.getCommandContext().isReturnAutoGeneratedKeys()) {
        addAutoGeneretedKeys(this.visitor.getODataQuery().getRootDocument().getTable(), 
            this.createdEntity);
      }                                
    }
    return new int[]{1};
  }
  return new int[] {0};
}

代码示例来源:origin: org.teiid.connectors/translator-ldap

throw te;
this.executionContext.addWarning(te);
LogManager.logWarning(LogConstants.CTX_CONNECTOR, e, msg);

代码示例来源:origin: org.jboss.teiid.extensions/database-service

public CommandEnitity(CommandLogMessage msg) {
  this.time = new Timestamp(msg.getTimestamp());
  this.eventType = msg.getStatus().name();
  this.sessionId = msg.getSessionID();
  this.requestId = msg.getRequestID();
  this.vdbName = msg.getVdbName();
  this.vdbVersion = msg.getVdbVersion();
  this.applicationName = msg.getApplicationName();
  this.transactionId = msg.getTransactionID();
  this.principal = msg.getPrincipal();
  this.sourceCommandId = msg.getSourceCommandID();
  this.sourceCommand = msg.isSource();
  if (msg.getExecutionContext() != null) {
    this.executionId = msg.getExecutionContext().getExecutionCountIdentifier();
  }
  this.modelName = msg.getModelName();
  this.translatorName = msg.getTranslatorName();
  this.sql = msg.getSql();
  this.rowCount = msg.getRowCount();
  if ((msg.getPlan() != null && msg.getStatus() == Event.PLAN)) {
    try {
      this.queryplan = new SerialBlob(msg.getPlan().toString().getBytes());
    } catch (SerialException e) {
      //ignore
    } catch (SQLException e) {
      //ignore
    }
  }        
}

代码示例来源:origin: org.teiid.connectors/translator-salesforce

private void doSelect(String select) throws TranslatorException {
  this.results = this.connection.query(select, this.context.getBatchSize(), Boolean.FALSE);
}

代码示例来源:origin: org.teiid/teiid-engine

public boolean equals(Object obj) {
  if(obj == this) {
    return true;
  } 
  if(! (obj instanceof ExecutionContext)) {
    return false;
  } 
  ExecutionContext other = (ExecutionContext) obj;
  return EquivalenceUtil.areEqual(this.getRequestId(), other.getRequestId()) && 
  EquivalenceUtil.areEqual(this.getPartIdentifier(), other.getPartIdentifier());
}

相关文章