public abstract class HandlerCallContext
extends java.lang.Object
HandlerCallContext
object can be used for the following purposes:
Note: Operations that cause handlers to execute can be initiated by an
application RPC or a background sweep job.
For application RPC's that submit a batch of changes, each top-level
change within the batch is treated as the root of a new operation chain, and so
causes a unique HandlerCallContext
to be created.
For inter-handler communications, the HandlerCallContext
object uses a
Map
object.
Key/value pairs are stored in a map for retrieval by other handlers (handlers executing
within the same operation chain).
The handlers which interact within an operation chain retrieve the shared map.
The values stored and passed in the map are defined by the participating handlers.
Key/value pairs can be set or retrieved using the standard Java Map
methods.
Note that a handler executed for an asynchronous subscription cannot access a map from a
previous synchronous or asynchronous handler execution.
HandlerCallContext
provides methods for
writing to a trace log at a specified level, provided logging is enabled with
TraceLoggingConfiguration
.
If the trace level specified is not enabled in TraceLoggingConfiguration
,
the server suppresses messages for that trace level.
HandlerCallContext
also provides methods for logging specified error or
warning messages. For these types of messages, you cannot specify the level of detail,
so log them sparingly to avoid cluttering the trace and error logs.
getAccessAllowedFor
method returns an
AccessRight
bit mask for a specified object and user.Examples
To get a HandlerCallContext
object:
HandlerCallContext hcc = HandlerCallContext.getInstance();
To set a property in the map:
hcc.getSharedMap().put("CascadeDelete", event.get_SourceObjectId());
To read from the map:
Id vsId = (Id)hcc.getSharedMap().get("CascadeDelete");
To log the Handlers subsystem:
if(hcc.isDetailTraceEnabled())
{
hcc.traceDetail("My trace info...");
}
To check the access that user Alice has for a document:
ObjectReference docRef = doc.getObjectReference(); // "doc" is the object to check
int access = hcc.getAccessAllowedFor(docRef, "Alice");
Modifier and Type | Method and Description |
---|---|
abstract int |
getAccessAllowedFor(ObjectReference obref,
java.lang.String user)
Return the access bits that a given user has to some object.
|
abstract ContentConversionServices |
getContentConversionServices()
Returns a utility interface for accessing content conversion services.
|
abstract java.lang.String |
getCurrentUserId()
Returns the identity of the user on whose behalf the handler has been called.
|
static HandlerCallContext |
getInstance()
Returns a
HandlerCallContext object. |
abstract Property |
getReadProtectedProperty(EngineObject src,
java.lang.String propertyName)
Returns the
Property object representing the normally inaccessible
value of a read-protected property. |
java.util.Map |
getSharedMap()
Returns a
Map object with key/value pairs. |
abstract java.lang.String |
getTemporaryFilesDirectory()
Returns the path to the directory into which the calling handler should
place any temporary files it requires.
|
abstract java.lang.Object |
getTransactionKey()
Returns an opaque object representing the transaction context in which the handler
is executing, if any.
|
abstract boolean |
isDetailTraceEnabled()
Indicates whether detailed-level tracing is enabled for the Handlers subsystem.
|
abstract boolean |
isModerateTraceEnabled()
Indicates whether moderate-level tracing is enabled for the Handlers subsystem.
|
abstract boolean |
isShuttingDown()
Indicates whether the server is in the process of shutting down.
|
abstract boolean |
isSummaryTraceEnabled()
Indicates whether summary-level tracing is enabled for the Handlers subsystem.
|
abstract void |
logError(java.lang.Object obj)
Writes the specified error to the server error log and trace log.
|
abstract void |
logWarning(java.lang.Object obj)
Writes the specified warning to the server trace log.
|
abstract void |
traceDetail(java.lang.Object obj)
Writes the detailed-level trace message to the server trace log.
|
abstract void |
traceModerate(java.lang.Object obj)
Writes the moderate-level trace message to the server trace log.
|
abstract void |
traceSummary(java.lang.Object obj)
Writes the summary-level trace message to the server trace log.
|
public static final HandlerCallContext getInstance()
HandlerCallContext
object.public final java.util.Map getSharedMap()
Map
object with key/value pairs.
The map is created by a handler for inter-handler
communications in an operation chain.public abstract void logError(java.lang.Object obj)
obj
- The object specifying the error.public abstract void logWarning(java.lang.Object obj)
obj
- The object specifying the warning.public abstract void traceDetail(java.lang.Object obj)
obj
- The object specifying the message.public abstract void traceModerate(java.lang.Object obj)
obj
- The object specifying the message.public abstract void traceSummary(java.lang.Object obj)
obj
- The object specifying the message.public abstract boolean isDetailTraceEnabled()
public abstract boolean isModerateTraceEnabled()
public abstract boolean isSummaryTraceEnabled()
public abstract int getAccessAllowedFor(ObjectReference obref, java.lang.String user)
obref
- the object to test. This must be a reference to an IndependentObject
, such as a
domain, object store, document, folder, custom object or class definition (to name just a few).user
- the user for whom the rights are determined. This string can be a short name, DN, SID or,
if on an Active Directory, a UPN. This cannot be a group name.AccessRight
bits that user
has to obref
.
If the object doesn't exist or if the user has no access to the object, then zero is returned.EngineRuntimeException
- E_OBJECT_NOT_FOUND if the user was not found in the configured LDAP setup.public abstract java.lang.Object getTransactionKey()
public abstract java.lang.String getCurrentUserId()
Factory.User.fetchCurrent
followed by get_Id()
on the returned User
object
but offers superior performance.public abstract boolean isShuttingDown()
It is recommended that a handler call this method before making an API call to the server. If the method returns true, the handler should clean up and return control to the server.
API calls to the server in a shutdown state will fail. As a result, a handler that is unaware of the server's shutdown state might write misleading error messages to the P8 log about the cause of the failures. The number of false error messages can be especially large for handlers processing batches of items in a loop. In such cases, a handler should call this method at the top of the processing loop.
true
if the server is shutting down.public abstract ContentConversionServices getContentConversionServices()
ContentConversionServices
public abstract Property getReadProtectedProperty(EngineObject src, java.lang.String propertyName)
Property
object representing the normally inaccessible
value of a read-protected property. A read-protected property is a binary-valued
property whose IsReadProtected metadata property is set to true
.
Note: this method cannot be used in an asynchronous event handler to retrieve read-protected properties from the SourceObject of the event.
By convention, a password or other sensitive string value is stored in a read-protected property as the bytes of the UTF-8 encoding of the string. This convention is applied by the Administration Console for Content Platform Engine to such properties that it manages. Applications can use read-protected properties for other purposes and with other encoding conventions.
Read-protected custom properties are encrypted when stored in the object store database in the same way as encrypted system properties. The encryption and decryption is handled transparently by the Content Platform Engine server.
src
- The EngineObject
having the read-protected property.propertyName
- The symbolic name of the read-protected property.Property
object containing the value.EngineRuntimeException
- API_PROPERTY_NOT_IN_CACHE
if the requested property is not in the property cache.
For more information, see Property Cache Concepts in the
Properties topic.public abstract java.lang.String getTemporaryFilesDirectory()
© Copyright IBM Corporation 2006, 2015. All rights reserved.