public AdminController(ServiceInfo serviceInfo, BusSettings busSettings, IAddinManager addinManager, IChannelManager channelManager) { _serviceInfo = serviceInfo ?? throw new ArgumentNullException(nameof(serviceInfo)); _busSettings = busSettings ?? throw new ArgumentNullException(nameof(busSettings)); _addinManager = addinManager ?? throw new ArgumentNullException(nameof(addinManager)); _channelManager = channelManager ?? throw new ArgumentNullException(nameof(channelManager)); }
public Admin() { this.asmLoader = ContainerManager.Container.Resolve<AssemblyManager>(); this.appEventHandler = ContainerManager.Container.Resolve<IAppEventHandler>(); this.frameworkAddinManager = ContainerManager.Container.Resolve<IAddinManager>(); this.Logger = ContainerManager.Container.Resolve<ILogger>(); UpdateAddinStatus(); }
public Admin() { this.asmLoader = ContainerManager.Container.Resolve <AssemblyManager>(); this.appEventHandler = ContainerManager.Container.Resolve <IAppEventHandler>(); this.frameworkAddinManager = ContainerManager.Container.Resolve <IAddinManager>(); this.Logger = ContainerManager.Container.Resolve <ILogger>(); UpdateAddinStatus(); }
public ChannelManager(IAddinManager addinManager, IChannelContextFactory contextFactory, BusSettings busSettings, IBusDataAdapter dataAdapter, ILogger logger) { _addinManager = addinManager ?? throw new ArgumentNullException(nameof(addinManager)); _contextFactory = contextFactory ?? throw new ArgumentNullException(nameof(contextFactory)); _busSettings = busSettings ?? throw new ArgumentNullException(nameof(addinManager)); _dataAdapter = dataAdapter ?? throw new ArgumentNullException(nameof(dataAdapter)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _groups = new ConcurrentDictionary <string, GroupInfo>(); _channels = new ConcurrentDictionary <string, IChannelContext>(); }
public Boot(LicenseManager licenseValidation, IAddinManager addinManager, IAddinLoader addinLoader, IEventDispatcher dispatcher, IFormEventHandler formEventHandler, I18NService i18nService, AddinAppEventHandler addinAppEventHandler) { this.licenseManager = licenseValidation; this.addinManager = addinManager; this.dispatcher = dispatcher; this.formEventHandler = formEventHandler; this.addinLoader = addinLoader; this.addinAppEventHandler = addinAppEventHandler; i18nService.ConfigureThreadI18n(System.Threading.Thread.CurrentThread); }
public MessageService(IServiceProvider serviceProvider) { _cancellationSource = new CancellationTokenSource(); _appConfig = serviceProvider.GetRequiredService <IAppSettingsConfig>(); _connConfig = serviceProvider.GetRequiredService <IConnectionStringsConfig>(); _busSettings = serviceProvider.GetRequiredService <BusSettings>(); _logger = serviceProvider.GetRequiredService <ILogger>(); _database = serviceProvider.GetRequiredService <IBusDatabase>(); _dataAdapter = serviceProvider.GetRequiredService <IBusDataAdapter>(); _authManager = serviceProvider.GetRequiredService <IAuthManager>(); _channelManager = serviceProvider.GetRequiredService <IChannelManager>(); _addinManager = serviceProvider.GetRequiredService <IAddinManager>(); _licManager = serviceProvider.GetRequiredService <ILicenseManager>(); _serviceInfo = serviceProvider.GetRequiredService <ServiceInfo>(); //_serviceInfoManager = serviceProvider.GetRequiredService<IServiceInfoManager>(); SetCurrentParamsTo(_serviceInfo); }
public static IWindsorContainer BuildContainer() { string assemblyName; Func <SAPbobsCOM.Company>[] companyFactory = (customCompanyFactory == null) ? new Func <SAPbobsCOM.Company>[] { SAPServiceFactory.CompanyFactory } : customCompanyFactory; Container = new WindsorContainer(); Container.Kernel.Resolver.AddSubResolver(new ArrayResolver(Container.Kernel)); // proxy for forms. Container.Register(Component.For <IInterceptor>().ImplementedBy <FormProxy>().Named("formProxy")); // proxy for Transactions Container.Register(Component.For <IInterceptor>().ImplementedBy <TransactionProxy>().Named("transactionProxy")); // forms are Transient. Container.Register(Classes.FromThisAssembly().IncludeNonPublicTypes().InNamespace("Dover.Framework.Form") .WithService.DefaultInterfaces().LifestyleTransient()); // SAP App Facttory. Container.Register(Component.For <SAPbouiCOM.Application>().UsingFactoryMethod(SAPServiceFactory.ApplicationFactory)); // company factory (use default, that initializes DI API from App if none was provided). for (int i = 0; i < companyFactory.Length; i++) { Container.Register(Component.For <SAPbobsCOM.Company>().UsingFactoryMethod(companyFactory[i]).Named("company" + i)); } for (int i = 0; i < companyFactory.Length; i++) { Container.Register(Component.For <BusinessOneDAO>().ImplementedBy <BusinessOneDAOSQLImpl>() .DependsOn(Dependency.OnComponent(typeof(SAPbobsCOM.Company), "company" + i)).Named("b1dao" + i)); } string runningFolder = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); // AddinManager registration. If I'm an AddIn, get addinManager from AppDomain, so // both (addin AppDomain and inception AppDomain) references the same implementation. IAddinManager addinManager = (IAddinManager)AppDomain.CurrentDomain.GetData("frameworkManager"); if (addinManager != null) { addinManagerSponsor = new Sponsor <IAddinManager>(addinManager); Container.Register(Component.For <IAddinManager>().Instance(addinManager).Named("IAddinManager")); } IAppEventHandler appEventHandler = (IAppEventHandler)AppDomain.CurrentDomain.GetData("appHandler"); if (appEventHandler != null) { appEventHandlerSponsor = new Sponsor <IAppEventHandler>(appEventHandler); Container.Register(Component.For <IAppEventHandler>().Instance(appEventHandler).Named("IAppEventHandler")); } // Register this Service as interface, not the underlying class. Container.Register(Component.For <ITempAssemblyLoader>().ImplementedBy <TempAssemblyLoader>()); // DAO registration. Abstract classes, they're singleton. Container.Register(Component.For <BusinessOneUIDAO>().ImplementedBy <BusinessOneUIDAOImpl>()); Container.Register(Component.For <AssemblyDAO>().ImplementedBy <AssemblyDAOImpl>()); Container.Register(Component.For <PermissionDAO>().ImplementedBy <PermissionDAOSQLImpl>()); Container.Register(Component.For <LicenseDAO>().ImplementedBy <LicenseDAOImpl>()); // Core and MicroCore Container.Register(Component.For <MicroCore>().LifestyleSingleton()); Container.Register(Component.For <MicroBoot>().LifestyleSingleton()); Container.Register(Component.For <Boot>().LifestyleSingleton()); assemblyName = Assembly.GetEntryAssembly() == null ? (string)AppDomain.CurrentDomain.GetData("assemblyName") : Assembly.GetEntryAssembly().GetName().Name; if (assemblyName == "Framework") { #if DEBUG CheckProxy(Assembly.Load(assemblyName)); // if passed on debug tests, we do not need this on production. #endif assemblyName = "Dover"; // Framework should be threated the same as Dover. } string logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, assemblyName + ".config"); if (!File.Exists(logPath)) { logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DoverTemp.config"); // Temp AppDomain logging. } Container.AddFacility <LoggingFacility>(f => f.UseLog4Net(logPath)); Container.Register(Component.For <TransactionProxy>().ImplementedBy <TransactionProxy>()); Container.Register(Component.For <EventProxy>().ImplementedBy <EventProxy>()); Container.Register(Component.For <AddinManager, IAddinManager>().Interceptors(typeof(TransactionProxy))); Container.Register(Component.For <FormEventHandler, IFormEventHandler>().Interceptors(typeof(EventProxy))); // Service registration, they are singleton. Container.Register(Classes.FromThisAssembly().IncludeNonPublicTypes().InNamespace("Dover.Framework.Service") .WithServiceAllInterfaces().LifestyleSingleton()); var logger = Container.Resolve <ILogger>(); logger.Debug(DebugString.Format(Messages.StartupFolder, runningFolder)); SAPServiceFactory.Logger = logger; var b1dao = Container.Resolve <BusinessOneDAO>(); SAPAppender.B1DAO = b1dao; return(Container); }
public AppShellImpl( IAppServices aFullPrivilegeAppServices, IConfigFileCollection aConfiguration, IAddinManager aAddinManager, IAppsDirectory aAppsDirectory, IStoreDirectory aStoreDirectory, Func<DvDevice, string, string, string, IDvProviderOpenhomeOrgApp1> aAppProviderConstructor, IZipReader aZipReader, IAppMetadataStore aMetadataStore, IZipVerifier aZipVerifier, ISystemAppsConfiguration aSystemAppsConfiguration, IXappServer aXappServer, bool aAutoStart) { iFullPrivilegeAppServices = aFullPrivilegeAppServices; iZipVerifier = aZipVerifier; iXappServer = aXappServer; //iZipReader = aZipReader; iMetadataStore = aMetadataStore; iConfiguration = aConfiguration; iAddinManager = aAddinManager; iAppsDirectory = aAppsDirectory; iStoreDirectory = aStoreDirectory; iAppProviderConstructor = aAppProviderConstructor; iNodeRebooter = iFullPrivilegeAppServices.NodeRebooter; //iApps = new Dictionary<string, PublishedApp>(); iHistory = new List<HistoryItem>(); // !!!! restore previous history from disk iKnownApps = new Dictionary<string, KnownApp>(); foreach (var app in iMetadataStore.LoadAppsFromStore()) { GetOrCreateKnownApp(app.AppName); } foreach (string dirname in iAppsDirectory.GetAppSubdirectories()) { GetOrCreateKnownApp(dirname); } MarkSystemApps(aSystemAppsConfiguration); if (aAutoStart) { Start(); } }
public TangraHostDelegate(string addinTypeName, IAddinManager addinManager) { m_AddinTypeName = addinTypeName; m_AddinManager = addinManager; }
internal AddInRunner(AssemblyInformation asm, IAddinManager frameworkAddinManager) { this.asm = asm; this.frameworkAddinManager = frameworkAddinManager; }
public ChannelContextFactory(IAddinManager addinManager, IChannelFactory factory, IBusDataAdapter dataAdapter) { _addinManager = addinManager ?? throw new ArgumentNullException(nameof(addinManager)); _factory = factory ?? throw new ArgumentNullException(nameof(factory)); _dataAdapter = dataAdapter ?? throw new ArgumentNullException(nameof(dataAdapter)); }
/// <summary> /// Create an app shell. Hosted apps are not automatically started. /// </summary> /// <param name="aFullPrivilegeAppServices"> /// Services that will be provided to apps granted permissions. /// (If we implement restricted permissions, such apps would /// receive only a subset of these services.) /// </param> /// <param name="aConfiguration"> /// Parsed config files. Some pre-installed apps need to read /// configuration information (such as location of serial devices) /// from these files. /// </param> /// <param name="aAddinManager"> /// Interface to the addin manager that handles actual loading of /// plugins. (Currently we use MEF.) /// </param> /// <param name="aAppsDirectory"> /// Interface to inspect and manipulate the apps directory, where /// we put app binaries and their static data. /// </param> /// <param name="aStoreDirectory"> /// Interface to inspect and manipulate the store directory, where /// apps store their dynamic, persistent data. /// </param> /// <param name="aAppProviderConstructor"> /// Constructor to create an AppProvider. The AppShell is responsible /// for creating a device for each app and publishing the app service /// on that device on behalf of the app, and it uses this to construct /// such a provider. (Unit tests need to be able to pass in a /// substitute here. /// </param> /// <param name="aZipReader"> /// Reads entries from a zip file. /// </param> /// <param name="aAppMetadataStore"> /// Stores persistent data about apps, such as deferred deletions or /// upgrades. /// </param> /// <param name="aZipVerifier"> /// Verifies that a zip file contains a valid OpenHome app. /// </param> /// <param name="aAutoStart"> /// If true, start the AppShell immediately. Otherwise, caller needs /// to call Start() when they want to start apps. /// </param> public AppShell( IAppServices aFullPrivilegeAppServices, IConfigFileCollection aConfiguration, IAddinManager aAddinManager, IAppsDirectory aAppsDirectory, IStoreDirectory aStoreDirectory, Func<DvDevice, string, string, string, IDvProviderOpenhomeOrgApp1> aAppProviderConstructor, IZipReader aZipReader, IAppMetadataStore aAppMetadataStore, IZipVerifier aZipVerifier, ISystemAppsConfiguration aSystemAppsConfiguration, IXappServer aXappServer, bool aAutoStart) { lock (iLock) { iImpl = new AppShellImpl( aFullPrivilegeAppServices, aConfiguration, aAddinManager, aAppsDirectory, aStoreDirectory, aAppProviderConstructor, aZipReader, aAppMetadataStore, aZipVerifier, aSystemAppsConfiguration, aXappServer, aAutoStart); iImpl.AppStatusChanged += OnAppStatusChanged; } }