public InteropContext(string metadataDir, IRegistryProvider registryProvider)
        {
            RegistryProvider = registryProvider;
            var appRegistryProvider = new JsonFileAppRegistryProvider(Path.Combine(metadataDir, "apps.json"));

            _nativeAppLauncherClient = new NativeAppLauncherClient(metadataDir);

            var clientLazy = new Lazy <IClient>(() => _lifecycleManagerClient);
            var appLaunchedEventProvider = new AppLaunchedEventProvider();

            _appLifecycleManager        = new AppLifecycleManager(appRegistryProvider, appLaunchedEventProvider, clientLazy);
            _appLaunchedEventSubscriber = new AppLaunchedEventSubscriber(_appLifecycleManager, registryProvider, appLaunchedEventProvider, clientLazy);

            var appMetadataService = new AppMetadataServiceImpl(appRegistryProvider, registryProvider);

            _appLifecycleService   = new AppLifecycleServiceImpl(_appLifecycleManager);
            _contextLinkageService = new ContextLinkageServiceImpl(registryProvider, _appLifecycleManager, appLaunchedEventProvider);

            _lifecycleManagerClient = new AppLifecycleManagerClient(
                _appLifecycleService,
                appMetadataService,
                _contextLinkageService,
                s => s.WithBrokerWorkingDir(Directory.GetCurrentDirectory()));

            OnStop(_nativeAppLauncherClient.Stop);
            OnStop(_lifecycleManagerClient.Disconnect);
        }
示例#2
0
        public InteropContext(Plexus.UniqueId trustedLauncherId, string metadataDir, IRegistryProvider registryProvider)
        {
            RegistryProvider = registryProvider;
            var appRegistryProvider = new JsonFileAppRegistryProvider(Path.Combine(metadataDir, "apps.json"));

            _appLifecycleManagerClientClientRepository = new AppLifecycleManagerClientClientRepository();
            var appLaunchedEventProvider = new AppLaunchedEventProvider();

            _appLifecycleManager = new AppLifecycleManager(appRegistryProvider, appLaunchedEventProvider, _appLifecycleManagerClientClientRepository);
            _appLifecycleManager.RegisterAppInstance(trustedLauncherId);
            _appLaunchedEventSubscriber = new AppLaunchedEventSubscriber(_appLifecycleManager, registryProvider, appLaunchedEventProvider, _appLifecycleManagerClientClientRepository);

            var nativeLauncherInstanceId = Plexus.UniqueId.Generate();

            _appLifecycleManager.RegisterAppInstanceConnection(Generated.NativeAppLauncherClient.Id, nativeLauncherInstanceId);
            _nativeAppLauncherClient = new NativeAppLauncherClient(metadataDir, nativeLauncherInstanceId);

            _appMetadataService     = new AppMetadataServiceImpl(appRegistryProvider, registryProvider);
            _appLifecycleService    = new AppLifecycleServiceImpl(_appLifecycleManager);
            _contextLinkageService  = new ContextLinkageServiceImpl(registryProvider, _appLifecycleManager, appLaunchedEventProvider);
            _appRegistrationService = new AppRegistrationServiceImpl(_appLifecycleManager);

            OnStop(_nativeAppLauncherClient.Stop);
            OnStop(_appLifecycleManagerClientClientRepository.Stop);
        }