BBjAPI::killSession

Description

In BBj 4.00 and higher, this method kills a running BBj session.

Syntax

Return Value Method
void killSession(BBjSessionInfo SessionInfo, String username, String password)

Parameters

Parameter Description
SessionInfo A BBjSessionInfo object retrieved using BBjAPI::getSessionInfos() or BBjAPI::getCurrentSessionInfo().
username Name of user executing this operation.
password Password for user executing this operation.

Return Value

None.

Remarks

This call fails unless the user has permissions to terminate BBj Processes. To add permissions, go to the Users options under the Security folder of Enterprise Manager and check "BBj Processes (View, Terminate)", or use the BBjAdmin::setPermission method to set BBjAdmin.PROCESSES to true (1).

Example

rem BBjAPI::killSession Example

api! = BBjAPI()

sessions! = api!.getSessionInfos()
thisSession! = sessions!.size() - 1

print "The ID for this session is: ",sessions!.getItem(thisSession!).getSessionID()
print "The program name of this session is: ",sessions!.getItem(thisSession!).getProgramName()
print "-----"

login:
    print "Username:"
    input user$
    print "Password:"
    input pwd$

admin! = api!.getAdmin(user$, pwd$, err=authFailed)

if admin!.getPermission(user$, BBjAdmin.PROCESSES) = 1 then
    print "-----"
    print "This session will now terminate in 10 seconds, goodbye!"
    wait 10
    api!.killSession(sessions!.getItem(thisSession!), user$, pwd$)
else
    print "This user does not have permissions to terminate BBj Processes, please try again."
    goto login
endif

authFailed:
    print "Invalid username/password, please try again."
    goto login

See Also

BBjAPI::getSessionInfos

BBjSessionInfo

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.