Package org.teiid
Interface CommandContext
-
- All Known Implementing Classes:
CommandContext
public interface CommandContext
Context 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 void
addListener(CommandListener listener)
Add a listener for command eventsvoid
addWarning(Exception ex)
Add an exception as a warning.Map<String,DataPolicy>
getAllowedDataPolicies()
Get the user's data policies, never nullSerializable
getCommandPayload()
Get the current command payloadTeiidConnection
getConnection()
Gets a connection to the current session.String
getConnectionId()
Get the connection idString
getConnectionID()
Deprecated.GeneratedKeys
getGeneratedKeys()
Returns the last set of generated keys for the current command or null if no keys have been generated.double
getNextRand()
Get the next random double valuedouble
getNextRand(long seed)
Sets the seed value and returns the next random double value.int
getProcessorBatchSize()
Get the processor batch size set on the BufferManagerString
getRequestId()
Get the current request idlong
getReuseCount()
Get the number of times this command has been reused.TimeZone
getServerTimeZone()
Get the serverTimeZone
Session
getSession()
Get the current sessionObject
getSessionVariable(String key)
Get the session variableSubject
getSubject()
Get the current subjectString
getUserName()
Get the current user name, which will just be the base user name and not include the security domain.VDB
getVdb()
Get the current vdbClassLoader
getVDBClassLoader()
Get class loader for VDB.String
getVdbName()
Get the current vdb nameString
getVdbVersion()
Get the current vdb versionboolean
isContinuous()
boolean
isReturnAutoGeneratedKeys()
Deprecated.void
removeListener(CommandListener listener)
Add a listener for command eventsGeneratedKeys
returnGeneratedKeys(String[] columnNames, Class<?>[] columnDataTypes)
Creates a holder for generated keys.Object
setSessionVariable(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 aTeiidSQLWarning
for 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
TeiidConnection getConnection() throws TeiidSQLException
Gets 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:
TeiidSQLException
-
-