com.ibm.tivoli.imi.controller

Class IMSessionHandler

  • java.lang.Object
    • com.ibm.tivoli.imi.controller.IMSessionHandler
    • Field Detail

      • MESSAGE_GROUP

        public static final java.lang.String MESSAGE_GROUP
        This is the Message Group used for all messages related to TSD IM integration. This value needs to be used with MessageKey enumeration
        See Also:
        Constant Field Values
      • IM_SERVER_HOST_MX_PROPERTY

        public static final java.lang.String IM_SERVER_HOST_MX_PROPERTY
        See Also:
        Constant Field Values
    • Method Detail

      • getIMSessionHandler

        public static IMSessionHandler getIMSessionHandler(javax.servlet.http.HttpSession httpSession)
        IMSessionHandler factory.
        Parameters:
        session -
        Returns:
        the existent IMSessionHandler for the HttpSession informed, or a new IMSessionHandler, if there is not one for the HttpSession, or null if it was not possible to create the IMSessionHandler due to the MXSession is no longer valid or any other reason
      • hasIMSessionHandler

        public static boolean hasIMSessionHandler(javax.servlet.http.HttpSession session)
        Returns true only if there is already a IMSessionHandler created for the current HttpSession
        Parameters:
        session -
        Returns:
        true only if there is already a IMSessionHandler created for the current HttpSession
      • validate

        public boolean validate()
                         throws java.rmi.RemoteException
        Returns true only if all required connection parameters have already been set
        Returns:
        true only if all required connection parameters have already been set
        Throws:
        java.rmi.RemoteException
      • refreshIMServerHostname

        public boolean refreshIMServerHostname()
                                        throws java.rmi.RemoteException
        Gets the value from Maximo System Property for IM server hostname and refresh it on IMSessionHandler if it is a new value (different from the current and non blank).
        Returns:
        true only if this IMSessionHandler is no longer valid because IM server hostname (on Maximo System Property) was changed to a non blank value
        Throws:
        java.rmi.RemoteException
      • refreshIMConnectionTimeout

        public boolean refreshIMConnectionTimeout()
                                           throws java.rmi.RemoteException
        Change the target session connect timeout
        Throws:
        java.rmi.RemoteException
      • openIMSession

        public boolean openIMSession()
                              throws IMException,
                                     java.rmi.RemoteException
        Open IM session related to this IMSessionHandler.
        Returns:
        true only if IM session was closed and has just been opened by method. False only if the IM session is already opened (in this case nothing else is done).
        Throws:
        IMException - if something wrong happens when opening IM session or if IM driver has not been set yet
        java.rmi.RemoteException
      • openIMSession

        public boolean openIMSession(IMUser.IMUserStatus imUserStatus)
                              throws IMException,
                                     java.rmi.RemoteException
        Open IM session related to this IMSessionHandler.
        Parameters:
        imUserStatus - IM user state to be set to IM session when opened
        Returns:
        true only if IM session was closed and has just been opened by method. False only if the IM session is already opened (in this case nothing else is done).
        Throws:
        IMException
        java.rmi.RemoteException
      • closeIMSession

        public boolean closeIMSession(boolean saveFlag,
                                      WebClientSession webClientSession)
                               throws IMException,
                                      TsdIMException
        Close IM session related to this IMSessionHandler. The handler is not closed after this method call, only its IM session is closed. So this handler can always open a new IM session in the future.
        Parameters:
        saveFlag - true means the chat history from the still opened chat windows will be saved before the still opened chat windows be aborted
        Returns:
        true only if IM session was opened and has just been closed by this method. False only if the IM session is not opened.
        Throws:
        IMException
        TsdIMException
      • getUserInfo

        public static UserInfo getUserInfo(javax.servlet.http.HttpSession httpSession)
        Get session specific information about the currently logged in maximo user include the cross references IM ID and IM password
        Returns:
        The UserInfo related to this HttpSession or null if the MXSession is not valid or does not exist
      • getImDriverName

        public java.lang.String getImDriverName()
      • getIMServerHostname

        public java.lang.String getIMServerHostname()
        Get IM server hostname
      • getIMConnectionTimeout

        public java.lang.String getIMConnectionTimeout()
        Get IM server connection timeout
      • getPartnerInfo

        public PartnerInfo getPartnerInfo(javax.servlet.http.HttpServletRequest httpRequest)
                                   throws java.rmi.RemoteException,
                                          java.security.NoSuchAlgorithmException,
                                          MXException,
                                          IMException
        Get specific information about the target person to chat with which includes the person's IM ID
        Throws:
        MXException
        java.security.NoSuchAlgorithmException
        java.rmi.RemoteException
        IMException
      • isIMSessionOpened

        public boolean isIMSessionOpened()
        Returns true only if the IMSession related to this IMSessionHandler is opened.
        Returns:
        true only if the IMSession related to this IMSessionHandler is opened
      • getUserStatus

        public IMUser.IMUserStatus getUserStatus(java.lang.String userIdOrEmail)
        Returns the user status based on his/her id or email
        Parameters:
        userIdOrEmail -
        Returns:
        the user status based on his/her id or email
      • isUserAvailable

        public boolean isUserAvailable(java.lang.String userId)
      • getChatHelper

        public ChatHelper getChatHelper(javax.servlet.http.HttpServletRequest httpRequest,
                                        java.lang.String sessionId,
                                        long chatIdentifier,
                                        java.lang.String partnerIMId)
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isPartnerChatting

        public boolean isPartnerChatting(java.lang.String partnerIMId)
      • chatClosed

        public void chatClosed(java.lang.String sessionId)
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • valueBound

        public void valueBound(javax.servlet.http.HttpSessionBindingEvent arg0)
        Specified by:
        valueBound in interface javax.servlet.http.HttpSessionBindingListener
      • valueUnbound

        public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent arg0)
        Specified by:
        valueUnbound in interface javax.servlet.http.HttpSessionBindingListener
      • wasChatHelperAborted

        public static boolean wasChatHelperAborted(java.lang.String sessionId)
      • wasChatTranscriptSavedBeforeAbortion

        public static boolean wasChatTranscriptSavedBeforeAbortion(java.lang.String sessionId)
        Returns true if the ChatHelper related to sessionId exist, was aborted and has saved the chat transcript before the abortion
        Parameters:
        sessionId -
        Returns:
        true only if the ChatHelper related to sessionId exist, was aborted and has saved the chat transcript before the abortion
        Throws:
        java.rmi.RemoteException
        java.security.NoSuchAlgorithmException
        MXException
      • resetActivityFlag

        public void resetActivityFlag()
      • logInfo

        public static void logInfo(java.lang.String logMessage)
      • logDebug

        public static void logDebug(java.lang.String logMessage)
      • logError

        public static void logError(java.lang.Throwable throwable)
      • logError

        public static void logError(java.lang.String logMessage,
                                    java.lang.Throwable throwable)