@SuppressWarnings("unchecked")
    public int handleOtherMessage(BaseMessage message)
    {
        // Special case - This class can also be used to start an application
        if (m_properties != null)
            if (m_properties.get(DBParams.PROCESS) == null)
                if (m_properties.get("standalone") == null)
        {
            if ((message.getMessageHeader().get(REMOVE_LISTENER) != null)
                || (message.get(REMOVE_LISTENER) != null))
            {   // Special message to get rid of this listener (typically send by server app when it is created)
                this.free();
                message.consume();
            }
            else if (m_properties.get(DBParams.APPLICATION) != null)
            {
                String strApplicationClass = (String)m_properties.get(DBParams.APPLICATION);
                Application app  = (Application)ClassServiceUtility.getClassService().makeObjectFromClassName(strApplicationClass);
                if (app != null)
                {
                    Environment env = ((BaseApplication)m_application).getEnvironment();
                    MessageApp messageApp = env.getMessageApplication(false, null);
                    if (messageApp != null)
                    {   // Move the correct application properties (such as database table type)
                        Map<String, Object> properties = messageApp.getProperties();
                        m_properties = Utility.copyAppProperties(m_properties, properties);
                    }
                    if (m_properties.get(MessageConstants.QUEUE_NAME) == null)
                        m_properties.put(MessageConstants.QUEUE_NAME, message.getMessageHeader().getQueueName());
                    if (m_properties.get(MessageConstants.QUEUE_TYPE) == null)
                        m_properties.put(MessageConstants.QUEUE_TYPE, message.getMessageHeader().getQueueType());
                    m_properties.remove(DBParams.APPLICATION);
                    m_properties.remove(MessageApplication.AUTOSTART);
                    app.init(env, m_properties, null);
                    
                    // Don't listen any more (Since application will be listening)!
                    this.free();
                    boolean bMessageSent = false;
                    for (int i = 1; ; i++)
                    {
                        String strProcessClass = (String)((MapMessage)message).get(DBParams.PROCESS + Integer.toString(i));
                        if (strProcessClass == null)
                            break;  // End of initial processes
                        bMessageSent = true;
                        Map<String,Object> properties = new HashMap<String,Object>();
                        if (message instanceof MapMessage)  // Always
                        {
                            Map<String,Object> propMessage = (Map<String,Object>)message.getData();
                            if (propMessage != null)
                                properties.putAll(propMessage);
                        }
                        properties.remove(DBParams.APPLICATION);
                        properties.remove(MessageApplication.AUTOSTART);
                        properties.put(DBParams.PROCESS, strProcessClass);
                        BaseMessage messageInitial = new MapMessage(new BaseMessageHeader(message.getMessageHeader().getQueueName(), message.getMessageHeader().getQueueType(), this, null), properties);
                        env.getMessageManager(m_application, true).sendMessage(messageInitial);   // Resend it! (Don't consume it!)
                    }
                    if (!bMessageSent)
                        env.getMessageManager(m_application, true).sendMessage(message);   // Resend it! (Don't consume it!)
                }
            }
        }
        return DBConstants.NORMAL_RETURN;
    }
@ SuppressWarnings ( "unchecked" ) public int handleOtherMessage ( BaseMessage message ) { if ( m_properties != null ) if ( m_properties . get ( DBParams . PROCESS ) == null ) if ( m_properties . get ( "standalone" ) == null ) { if ( ( message . getMessageHeader ( ) . get ( REMOVE_LISTENER ) != null ) || ( message . get ( REMOVE_LISTENER ) != null ) ) { this . free ( ) ; message . consume ( ) ; } else if ( m_properties . get ( DBParams . APPLICATION ) != null ) { String strApplicationClass = ( String ) m_properties . get ( DBParams . APPLICATION ) ; Application app = ( Application ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( strApplicationClass ) ; if ( app != null ) { Environment env = ( ( BaseApplication ) m_application ) . getEnvironment ( ) ; MessageApp messageApp = env . getMessageApplication ( false , null ) ; if ( messageApp != null ) { Map < String , Object > properties = messageApp . getProperties ( ) ; m_properties = Utility . copyAppProperties ( m_properties , properties ) ; } if ( m_properties . get ( MessageConstants . QUEUE_NAME ) == null ) m_properties . put ( MessageConstants . QUEUE_NAME , message . getMessageHeader ( ) . getQueueName ( ) ) ; if ( m_properties . get ( MessageConstants . QUEUE_TYPE ) == null ) m_properties . put ( MessageConstants . QUEUE_TYPE , message . getMessageHeader ( ) . getQueueType ( ) ) ; m_properties . remove ( DBParams . APPLICATION ) ; m_properties . remove ( MessageApplication . AUTOSTART ) ; app . init ( env , m_properties , null ) ; this . free ( ) ; boolean bMessageSent = false ; for ( int i = 1 ; ; i ++ ) { String strProcessClass = ( String ) ( ( MapMessage ) message ) . get ( DBParams . PROCESS + Integer . toString ( i ) ) ; if ( strProcessClass == null ) break ; bMessageSent = true ; Map < String , Object > properties = new HashMap < String , Object > ( ) ; if ( message instanceof MapMessage ) { Map < String , Object > propMessage = ( Map < String , Object > ) message . getData ( ) ; if ( propMessage != null ) properties . putAll ( propMessage ) ; } properties . remove ( DBParams . APPLICATION ) ; properties . remove ( MessageApplication . AUTOSTART ) ; properties . put ( DBParams . PROCESS , strProcessClass ) ; BaseMessage messageInitial = new MapMessage ( new BaseMessageHeader ( message . getMessageHeader ( ) . getQueueName ( ) , message . getMessageHeader ( ) . getQueueType ( ) , this , null ) , properties ) ; env . getMessageManager ( m_application , true ) . sendMessage ( messageInitial ) ; } if ( ! bMessageSent ) env . getMessageManager ( m_application , true ) . sendMessage ( message ) ; } } } return DBConstants . NORMAL_RETURN ; }
Handle non-process message (such as messages that start an application).
@param message
@return