public static function registerApplicationPlugin(ApplicationPlugin $plugin, $priority = self::PRIORITY_NORMAL)
    {
        if ($priority != self::PRIORITY_HIGH 
                && $priority != self::PRIORITY_NORMAL 
                && $priority != self::PRIORITY_LOW) {
            throw new ArchException('Bad plugin priority');
        }
        $pluginClass = get_class($plugin);
        if (isset(self::$plugins[$pluginClass])) {
            throw new ArchException('Plugin ' . $pluginClass . ' already registered');
        }
        self::$plugins[$pluginClass] = $plugin;
        self::$pluginsOrder[$priority][] = $pluginClass;
    }