public class CallContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTRIBUTE_END_TIME
The attribute used for storing the execution end time.
|
static java.lang.String |
ATTRIBUTE_ERROR
The attribute used for storing the error message.
|
static java.lang.String |
ATTRIBUTE_LOG_BUFFER
The attribute used for storing the log string buffer.
|
static java.lang.String |
ATTRIBUTE_PROCEDURE
The attribute used for storing the execution root procedure.
|
static java.lang.String |
ATTRIBUTE_PROGRESS
The attribute used for storing the progress ratio.
|
static java.lang.String |
ATTRIBUTE_RESULT
The attribute used for storing the result data.
|
static java.lang.String |
ATTRIBUTE_SOURCE
The attribute used for storing call source information.
|
static java.lang.String |
ATTRIBUTE_START_TIME
The attribute used for storing the execution start time.
|
static java.lang.String |
ATTRIBUTE_TRACE
The attribute used for storing the trace flag.
|
static java.lang.String |
ATTRIBUTE_USER
The attribute used for storing the user information.
|
static int |
MAX_LOG_LENGTH
The maximum number of characters to store in the log buffer.
|
Constructor and Description |
---|
CallContext(Storage storage,
Environment env,
Library library)
Creates a new procedure call context.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
call(Procedure proc,
Bindings bindings)
Calls a procedure with the specified arguments.
|
java.lang.Object |
call(Procedure proc,
java.lang.Object[] args)
Calls a procedure with the specified arguments.
|
static void |
checkAccess(java.lang.String path,
java.lang.String permission)
Checks if the currently authenticated user has the specified
access permission to a storage path.
|
static void |
checkInternalAccess(java.lang.String path)
Checks if the currently authenticated user has internal access
to a storage path.
|
static void |
checkReadAccess(java.lang.String path)
Checks if the currently authenticated user has read access to
a storage path.
|
static void |
checkSearchAccess(java.lang.String path)
Checks if the currently authenticated user has search access to
a storage path.
|
static void |
checkWriteAccess(java.lang.String path)
Checks if the currently authenticated user has write access to
a storage path.
|
void |
connectionReleaseAll(boolean commit)
Releases all reserved adapter connections.
|
Channel |
connectionReserve(java.lang.String id)
Reserves a connection channel.
|
java.lang.Object |
execute(java.lang.String name,
java.lang.Object[] args)
Executes a procedure with the specified name and arguments.
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns a call attribute value.
|
CallStack |
getCallStack()
Returns the procedure call stack.
|
Environment |
getEnvironment()
Returns the connectivity environment used by this context.
|
Interceptor |
getInterceptor()
Returns the local procedure call interceptor.
|
Library |
getLibrary()
Returns the procedure library used by this context.
|
Storage |
getStorage()
Returns the data storage used by this context.
|
void |
interrupt()
Interrupts the current procedure call.
|
boolean |
isInterrupted()
Checks if the call has been interrupted.
|
boolean |
isTracing()
Checks if this call context has call trace logging enabled.
|
void |
log(java.lang.String message)
Logs the specified message to the log if tracing is enabled.
|
void |
logCall(java.lang.String name,
java.lang.Object[] args)
Logs the specified call to the log if tracing is enabled.
|
void |
logError(java.lang.Exception e)
Logs the specified call error to the log if tracing is
enabled.
|
void |
logResponse(java.lang.Object obj)
Logs the specified call response to the log if tracing is
enabled.
|
java.lang.String |
readPermission(int depth)
Returns the permission required to read a path at the current
call stack height.
|
void |
releaseAll(boolean commit)
Releases all currently reserved adapter connections.
|
void |
reserve(Procedure proc)
Reserves all adapter connections needed for executing the
specified procedure.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets a call attribute value.
|
void |
setInterceptor(Interceptor i)
Sets the local procedure call interceptor, overriding the
default library procedure call interceptor for calls in this
context.
|
public static final java.lang.String ATTRIBUTE_PROCEDURE
public static final java.lang.String ATTRIBUTE_START_TIME
public static final java.lang.String ATTRIBUTE_END_TIME
public static final java.lang.String ATTRIBUTE_PROGRESS
public static final java.lang.String ATTRIBUTE_USER
public static final java.lang.String ATTRIBUTE_SOURCE
public static final java.lang.String ATTRIBUTE_RESULT
public static final java.lang.String ATTRIBUTE_ERROR
public static final java.lang.String ATTRIBUTE_TRACE
public static final java.lang.String ATTRIBUTE_LOG_BUFFER
public static final int MAX_LOG_LENGTH
public CallContext(Storage storage, Environment env, Library library)
storage
- the data storage to useenv
- the environment to uselibrary
- the procedure library to usepublic Storage getStorage()
public Environment getEnvironment()
public Library getLibrary()
public Interceptor getInterceptor()
public void setInterceptor(Interceptor i)
i
- the interceptor to usepublic java.lang.Object getAttribute(java.lang.String name)
name
- the attribute namepublic void setAttribute(java.lang.String name, java.lang.Object value)
name
- the attribute namevalue
- the attribute valuepublic CallStack getCallStack()
public java.lang.String readPermission(int depth)
depth
- the max stack depth for read permissionRole.PERM_INTERNAL
,
Role.PERM_READ
public static void checkAccess(java.lang.String path, java.lang.String permission) throws ProcedureException
path
- the object storage pathpermission
- the requested permissionProcedureException
- if the current user didn't have
the requested access permissionpublic static void checkInternalAccess(java.lang.String path) throws ProcedureException
path
- the object storage pathProcedureException
- if the current user didn't have
internal accesspublic static void checkReadAccess(java.lang.String path) throws ProcedureException
path
- the object storage pathProcedureException
- if the current user didn't have
read accesspublic static void checkSearchAccess(java.lang.String path) throws ProcedureException
path
- the object storage pathProcedureException
- if the current user didn't have
search accesspublic static void checkWriteAccess(java.lang.String path) throws ProcedureException
path
- the object storage pathProcedureException
- if the current user didn't have
write accesspublic boolean isInterrupted()
interrupt()
public void interrupt()
isInterrupted()
public java.lang.Object execute(java.lang.String name, java.lang.Object[] args) throws ProcedureException
name
- the procedure nameargs
- the call argumentsProcedureException
- if the call execution caused an
errorpublic void reserve(Procedure proc) throws ProcedureException
proc
- the procedure definitionProcedureException
- if the connections couldn't be
reservedpublic void releaseAll(boolean commit)
commit
- the commit (or rollback) flagpublic java.lang.Object call(Procedure proc, java.lang.Object[] args) throws ProcedureException
proc
- the procedure definitionargs
- the call argumentsProcedureException
- if the argument binding failedpublic java.lang.Object call(Procedure proc, Bindings bindings) throws ProcedureException
proc
- the procedure definitionbindings
- the bindings to useProcedureException
- if the call execution caused an
errorexecute(String, Object[])
public Channel connectionReserve(java.lang.String id) throws ProcedureException
id
- the connection identifierProcedureException
- if the channel couldn't be
reservedconnectionReleaseAll(boolean)
public void connectionReleaseAll(boolean commit)
commit
- the commit (or rollback) flagconnectionReserve(String)
public boolean isTracing()
public void log(java.lang.String message)
message
- the message textpublic void logCall(java.lang.String name, java.lang.Object[] args)
name
- the procedure or object methodargs
- the arguments, or null for nonepublic void logResponse(java.lang.Object obj)
obj
- the call responsepublic void logError(java.lang.Exception e)
e
- the exception to log