code: public MessageApp getMessageApplication(String strDBPrefix, String strSubSystem)
      {
          strSubSystem = Utility.getSystemSuffix(strSubSystem, this.getProperty(DBConstants.DEFAULT_SYSTEM_NAME));    // Normalize
          MessageApp messageApplication = null;
  		for (int i = 0; i < this.getApplicationCount(); i++)
  		{
  			App app = this.getApplication(i);
  			if (app instanceof MessageApp)
  			{
  			    Map<String, Object> messageAppProperties = app.getProperties();  // Only message app's properties (not env).
  				String strAppDBPrefix = (messageAppProperties == null) ? null : (String)messageAppProperties.get(DBConstants.DB_USER_PREFIX);
  				String strAppSubSystem = (messageAppProperties == null) ? null : (String)messageAppProperties.get(DBConstants.SYSTEM_NAME);
  				strAppSubSystem = Utility.getSystemSuffix(strAppSubSystem, this.getProperty(DBConstants.DEFAULT_SYSTEM_NAME));    // Normalize
  				boolean bDBMatch = false;
  				if ((strAppDBPrefix == null) && (strDBPrefix == null))
  					bDBMatch = true;
  				if (strAppDBPrefix != null)
  					if (strAppDBPrefix.equalsIgnoreCase(strDBPrefix))
  						bDBMatch = true;
  				boolean bSubSystemMatch = false;
  				if ((strAppSubSystem == null) && (strSubSystem == null))
  					bSubSystemMatch = true;
  				if (strAppSubSystem != null)
  					if (strAppSubSystem.equalsIgnoreCase(strSubSystem))
  						bSubSystemMatch = true;
  				if ((bDBMatch) && (bSubSystemMatch))
  					messageApplication = (MessageApp)app;
  			}
  		}
  		return messageApplication;
      }
docs: Find the message application.
  @param strDBPrefix The database prefix.
  @param strDomain The domain to get the message app for (or default/best guess if null)
  @return The message manager or null if no match.