Question & Answer
Question
How can an IBM Rational ClearQuest hook determine that it is being executed in the context of an OSLC session?
Answer
ClearQuest hooks have a way of determining that they are being executed in a ClearQuest web session.
For versions of ClearQuest older than 8.0.1.6, however, ClearQuest hooks cannot distinguish between a ClearQuest web session and an OSLC session.
Beginning with ClearQuest 8.0.1.6, a new session variable _CQ_OSLC_SESSION is set for sessions that are created and used by the ClearQuest OSLC API. This allows ClearQuest hooks know when they are being executed in the context of a ClearQuest OSLC call.
This sample perl hook shows how to determine the context in which the hook is being run.
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
---|
# In what context are we running this session?
# This code only works in ClearQuest 8.0.1.6 and later.
#
$sessionObj = $entity->GetSession();
# Test for existence of the new oslc session variable
if ($sessionObj->HasValue("_CQ_OSLC_SESSION")) {
# This is an OSLC session.
....
} elsif ($sessionObj->HasValue("_CQ_WEB_SESSION")) {
# This is a CQ Web session.
...
} else {
# This is a ClearQuest Windows client or ClearQuest Eclipse client.
...
}
Related Information
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21692212