Package org.teiid
Interface CommandContext
-
public interface CommandContextContext information for the currently executing command. Can be used as an argument to UDFs.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidaddListener(CommandListener listener)Add a listener for command eventsvoidaddWarning(Exception ex)Add an exception as a warning.Map<String,DataPolicy>getAllowedDataPolicies()Get the user's data policies, never nullSerializablegetCommandPayload()Get the current command payloadorg.teiid.jdbc.TeiidConnectiongetConnection()Gets a connection to the current session.StringgetConnectionId()Get the connection idStringgetConnectionID()Deprecated.GeneratedKeysgetGeneratedKeys()Returns the last set of generated keys for the current command or null if no keys have been generated.doublegetNextRand()Get the next random double valuedoublegetNextRand(long seed)Sets the seed value and returns the next random double value.intgetProcessorBatchSize()Get the processor batch size set on the BufferManagerStringgetRequestId()Get the current request idlonggetReuseCount()Get the number of times this command has been reused.TimeZonegetServerTimeZone()Get the serverTimeZoneSessiongetSession()Get the current sessionObjectgetSessionVariable(String key)Get the session variableSubjectgetSubject()Get the current subjectStringgetUserName()Get the current user name, which will just be the base user name and not include the security domain.VDBgetVdb()Get the current vdbClassLoadergetVDBClassLoader()Get class loader for VDB.StringgetVdbName()Get the current vdb nameStringgetVdbVersion()Get the current vdb versionbooleanisContinuous()booleanisReturnAutoGeneratedKeys()Deprecated.voidremoveListener(CommandListener listener)Add a listener for command eventsGeneratedKeysreturnGeneratedKeys(String[] columnNames, Class<?>[] columnDataTypes)Creates a holder for generated keys.ObjectsetSessionVariable(String key, Object value)Set the session variable and return the old value if any
-
-
-
Method Detail
-
getUserName
String getUserName()
Get the current user name, which will just be the base user name and not include the security domain. See alsogetSession()-SessionBean.getSecurityDomain()- Returns:
-
getVdbName
String getVdbName()
Get the current vdb name- Returns:
-
getVdbVersion
String getVdbVersion()
Get the current vdb version- Returns:
-
getConnectionId
String getConnectionId()
Get the connection id- Returns:
-
getConnectionID
@Deprecated String getConnectionID()
Deprecated.Get the connection id- Returns:
-
getNextRand
double getNextRand()
Get the next random double value- Returns:
-
getNextRand
double getNextRand(long seed)
Sets the seed value and returns the next random double value. Additional calls togetNextRand()will be based upon the seed value.- Parameters:
seed-- Returns:
-
getProcessorBatchSize
int getProcessorBatchSize()
Get the processor batch size set on the BufferManager- Returns:
- - the nominal batch size target. actual batch sizes will vary based upon the column types
-
getSubject
Subject getSubject()
Get the current subject- Returns:
-
getSession
Session getSession()
Get the current session- Returns:
-
getCommandPayload
Serializable getCommandPayload()
Get the current command payload- Returns:
- may be null if the client did not set a payload
-
getRequestId
String getRequestId()
Get the current request id- Returns:
-
getAllowedDataPolicies
Map<String,DataPolicy> getAllowedDataPolicies()
Get the user's data policies, never null- Returns:
-
getVdb
VDB getVdb()
Get the current vdb- Returns:
-
addListener
void addListener(CommandListener listener)
Add a listener for command events- Parameters:
listener-
-
removeListener
void removeListener(CommandListener listener)
Add a listener for command events- Parameters:
listener-
-
getReuseCount
long getReuseCount()
Get the number of times this command has been reused. Useful in continuous executions.- Returns:
- See Also:
isContinuous()
-
getVDBClassLoader
ClassLoader getVDBClassLoader()
Get class loader for VDB.- Returns:
-
addWarning
void addWarning(Exception ex)
Add an exception as a warning. The exception will be wrapped by aTeiidSQLWarningfor the client. The warnings can be consumed through theStatement.getWarnings()method.- Parameters:
ex-
-
isContinuous
boolean isContinuous()
- Returns:
- true if this is a continuous query
-
isReturnAutoGeneratedKeys
@Deprecated boolean isReturnAutoGeneratedKeys()
Deprecated.Whether to return the keys generated by an insert.- Returns:
- true
-
returnGeneratedKeys
GeneratedKeys returnGeneratedKeys(String[] columnNames, Class<?>[] columnDataTypes)
Creates a holder for generated keys.- Parameters:
columnNames-columnDataTypes-- Returns:
-
getGeneratedKeys
GeneratedKeys getGeneratedKeys()
Returns the last set of generated keys for the current command or null if no keys have been generated.
-
setSessionVariable
Object setSessionVariable(String key, Object value)
Set the session variable and return the old value if any- Parameters:
key-value-- Returns:
-
getSessionVariable
Object getSessionVariable(String key)
Get the session variable- Parameters:
key-- Returns:
-
getConnection
org.teiid.jdbc.TeiidConnection getConnection() throws org.teiid.jdbc.TeiidSQLExceptionGets a connection to the current session.
WARNING be careful with blocking/recursive operations.
The returned connection is considered to be derived and is not allowed to alter the transaction state or close the session.
Each call to this method will return a new connection.
Client side execution/connection properties are specific to each connection instance- Returns:
- a Connection to the current session
- Throws:
org.teiid.jdbc.TeiidSQLException
-
-