예제 #1
0
 public UserContextService(CremaService service, IUserContextEventCallback callback)
     : base(service, callback)
 {
     this.UserContext    = this.CremaHost.GetService(typeof(IUserContext)) as IUserContext;
     this.UserCollection = this.CremaHost.GetService(typeof(IUserCollection)) as IUserCollection;
     this.LogService.Debug($"{nameof(UserContextService)} Constructor");
 }
예제 #2
0
 public DomainContextService(CremaService service, IDomainContextEventCallback callback)
     : base(service, callback)
 {
     this.UserContext     = this.CremaHost.GetService(typeof(IUserContext)) as IUserContext;
     this.DomainContext   = this.CremaHost.GetService(typeof(IDomainContext)) as IDomainContext;
     this.DataBaseContext = this.CremaHost.GetService(typeof(IDataBaseContext)) as IDataBaseContext;
     this.LogService.Debug($"{nameof(DomainContextService)} Constructor");
 }
예제 #3
0
        protected override void OnStart(string[] args)
        {
            base.OnStart(args);

            var baseArgs = Environment.GetCommandLineArgs();
            var path     = baseArgs[1];
            var port     = int.Parse(baseArgs[2]);

            this.cremaService = new CremaService()
            {
                BasePath = path,
                Port     = port,
            };

            CremaLog.Debug("service base path : {0}", path);
            CremaLog.Debug("service port : {0}", port);

            try
            {
                CremaLog.Debug(args.Length);
                if (args.Any() == true)
                {
                    var settings = new Settings()
                    {
                        BasePath         = this.cremaService.BasePath,
                        Port             = this.cremaService.Port,
                        RepositoryModule = this.cremaService.RepositoryModule,
                        RepositoryName   = this.cremaService.RepositoryName,
                    };
                    var parser = new CommandLineParser("setting", settings);
                    parser.Parse(string.Join(" ", "setting", string.Join(" ", args)));

                    this.cremaService.BasePath         = settings.BasePath;
                    this.cremaService.Port             = settings.Port;
                    this.cremaService.RepositoryModule = settings.RepositoryModule;
                    this.cremaService.RepositoryName   = settings.RepositoryName;

                    CremaLog.Debug("=========================================================");
                    CremaLog.Debug("new settings");
                    CremaLog.Debug("service base path : {0}", settings.BasePath);
                    CremaLog.Debug("service port : {0}", settings.Port);
                    CremaLog.Debug("service repo name : {0}", settings.RepositoryName);
                    CremaLog.Debug("service repo module : {0}", settings.RepositoryModule);
                    CremaLog.Debug("=========================================================");
                }
            }
            catch (Exception e)
            {
                CremaLog.Error(e);
                throw e;
            }

            CremaLog.Debug("service open");
            this.cremaService.Open();
            this.cremaHost         = this.cremaService.CremaHost;
            this.cremaHost.Closed += CremaHost_Closed;
            CremaLog.Debug("service opened.");
        }
예제 #4
0
 public HttpCommandsService(ICremaHost cremaHost, CremaService cremaService)
     : base(cremaHost.GetService(typeof(ILogService)) as ILogService)
 {
     this.cremaHost    = cremaHost;
     this.cremaService = cremaService;
     this.logService   = cremaHost.GetService(typeof(ILogService)) as ILogService;
     this.userContext  = cremaHost.GetService(typeof(IUserContext)) as IUserContext;
     this.logService.Debug($"{nameof(HttpCommandsService)} Constructor");
 }
예제 #5
0
 public ConsoleCommandContext(ICremaHost cremaHost, CremaService service,
                              [ImportMany] IEnumerable <IConsoleDrive> rootItems,
                              [ImportMany] IEnumerable <IConsoleCommand> commands)
     : base(rootItems, commands)
 {
     this.cremaHost         = cremaHost;
     this.cremaHost.Opened += CremaHost_Opened;
     this.service           = service;
 }
예제 #6
0
 public ShellViewModel(CremaService service, CremaSettings settings, IAppConfiguration configs, AppSettings appSettings)
 {
     this.service     = service;
     this.settings    = settings;
     this.configs     = configs;
     this.DisplayName = "Crema Server";
     this.Dispatcher.InvokeAsync(() =>
     {
         this.configs.Update(this);
         this.Initialize(appSettings);
     });
 }
예제 #7
0
        public override IEnumerable <Tuple <System.Type, object> > GetParts()
        {
            var service = new CremaService(this);

            foreach (var item in base.GetParts())
            {
                yield return(item);
            }
            yield return(new Tuple <Type, object>(typeof(CremaApplication), this));

            yield return(new Tuple <Type, object>(typeof(CremaService), service));

            yield return(new Tuple <Type, object>(typeof(ICremaService), service));
        }
예제 #8
0
        public UserServiceHost(ICremaHost cremaHost, int port, CremaService cremaService)
            : base(cremaHost, typeof(UserService), address, port)
        {
            this.cremaService = cremaService;
            this.AddServiceEndpoint(typeof(IUserService), CreateNetTcpBinding(), string.Empty);
            this.Description.Behaviors.Add(new InstanceProviderBehavior());

#if DEBUG
            if (Environment.OSVersion.Platform != PlatformID.Unix)
            {
                this.Description.Behaviors.Add(new ServiceMetadataBehavior());
                this.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
            }
#endif
        }
예제 #9
0
        public HttpCommandsServiceHost(ICremaHost cremaHost, int port, CremaService cremaService)
            : base(cremaHost, typeof(HttpCommandsService), address, port)
        {
            this.cremaService = cremaService;
            var endpoint = this.AddServiceEndpoint(typeof(IHttpCommandsService), CreateWebHttpBinding(), string.Empty);

            endpoint.Behaviors.Add(new WebHttpBehavior());
            endpoint.Behaviors.Add(new ErrorHandlerBehavior());
            this.Description.Behaviors.Add(new InstanceProviderBehavior());

#if DEBUG
            if (Environment.OSVersion.Platform != PlatformID.Unix)
            {
                this.Description.Behaviors.Add(new ServiceMetadataBehavior());
                this.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
            }
#endif
        }
예제 #10
0
        private void InitCremaService()
        {
            var repoPath = DirectoryUtility.Prepare(CremaDbPath, "_repo");

            using (var bootstrap = new CremaBootstrapper())
            {
                bootstrap.CreateRepository(repoPath, "crema", false);
            }

            Service                = new CremaService();
            Service.BasePath       = repoPath;
            Service.MultiThreading = true;
            Service.Port           = 4004;
            Service.HttpPort       = AddressUtility.GetDefaultHttpPort(Service.Port);

            Service.Open();

            CremaHost = Service.GetService <ICremaHost>();
        }
예제 #11
0
 public DataBaseContextServiceHostProvider(CremaService service)
 {
     this.service = service;
 }
예제 #12
0
 public ShellViewModel(CremaService service, [ImportMany] IEnumerable <IRepositoryProvider> repoProviders)
 {
     this.service          = service;
     this.repoProviders    = repoProviders.ToArray();
     this.repositoryModule = CremaBootstrapper.DefaultRepositoryModule;
 }
예제 #13
0
 public HttpCommandServiceHost(ICremaHost cremaHost, CremaService cremaService)
 {
     this.cremaHost    = cremaHost;
     this.cremaService = cremaService;
 }
예제 #14
0
        protected override void OnStart(string[] args)
        {
            base.OnStart(args);

            try
            {
                var environmentCommandLineArgs = Environment.GetCommandLineArgs();
                var baseArgs = IsMonoRuntime
                    ? environmentCommandLineArgs.Skip(environmentCommandLineArgs.Length - MonoRuntimeCommandLineArgsCount - 1).Take(MonoRuntimeCommandLineArgsCount + 1).ToArray()
                    : environmentCommandLineArgs;
                var path     = baseArgs[1];
                var port     = int.Parse(baseArgs[2]);
                var httpPort = int.Parse(baseArgs[3]);

                this.cremaService = new CremaService()
                {
                    BasePath = path,
                    Port     = port,
                    HttpPort = httpPort
                };

                CremaLog.Debug(args.Length);
                if (!IsMonoRuntime && args.Any())
                {
                    var settings = new Settings()
                    {
                        BasePath         = this.cremaService.BasePath,
                        Port             = this.cremaService.Port,
                        HttpPort         = this.cremaService.HttpPort.Value,
                        RepositoryModule = this.cremaService.RepositoryModule,
                        RepositoryName   = this.cremaService.RepositoryName,
                    };
                    var parser = new CommandLineParser("setting", settings);
                    parser.Parse(string.Join(" ", "setting", string.Join(" ", args)));

                    this.cremaService.BasePath         = settings.BasePath;
                    this.cremaService.Port             = settings.Port;
                    this.cremaService.RepositoryModule = settings.RepositoryModule;
                    this.cremaService.RepositoryName   = settings.RepositoryName;

                    CremaLog.Debug("=========================================================");
                    CremaLog.Debug("new settings");
                    CremaLog.Debug("service base path : {0}", settings.BasePath);
                    CremaLog.Debug("service port : {0}", settings.Port);
                    CremaLog.Debug("service http port : {0}", settings.HttpPort);
                    CremaLog.Debug("service repo name : {0}", settings.RepositoryName);
                    CremaLog.Debug("service repo module : {0}", settings.RepositoryModule);
                    CremaLog.Debug("=========================================================");
                }
                else if (args.Any())
                {
                    CremaLog.Debug("service base path : {0}", this.cremaService.BasePath);
                    CremaLog.Debug("service port : {0}", this.cremaService.Port);
                    CremaLog.Debug("service http port : {0}", this.cremaService.HttpPort ?? -1);
                    CremaLog.Debug("service repo name : {0}", this.cremaService.RepositoryName);
                    CremaLog.Debug("service repo module: {0}", this.cremaService.RepositoryModule);
                }
            }
            catch (Exception e)
            {
                CremaLog.Error(e);
                throw e;
            }

            CremaLog.Debug("service open");
            this.cremaService.Open();
            this.cremaHost         = this.cremaService.CremaHost;
            this.cremaHost.Closed += CremaHost_Closed;
            CremaLog.Debug("service opened.");
        }
예제 #15
0
 public HttpCommandsServiceHostProvider(ICremaHost cremaHost, CremaService cremaService)
 {
     this.cremaHost    = cremaHost;
     this.cremaService = cremaService;
 }
예제 #16
0
 public UserContextServiceHostProvider(CremaService cremaService)
 {
     this.cremaService = cremaService;
 }
 public DomainContextServiceHost(CremaService service)
 {
     this.service = service;
 }
 public AppBootstrapperDescriptor()
 {
     this.service = new CremaService(this);
 }
예제 #19
0
 public UserServiceHostProvider(ICremaHost cremaHost, CremaService cremaService)
 {
     this.cremaHost    = cremaHost;
     this.cremaService = cremaService;
 }
예제 #20
0
 public HttpDescriptorService(CremaService service, ICremaHost cremaHost)
 {
     this.service   = service;
     this.cremaHost = cremaHost;
 }
예제 #21
0
 public DataBaseServiceHost(CremaService service)
 {
     this.service = service;
 }
예제 #22
0
 public HttpDescriptorServiceHostProvider(ICremaHost cremaHost, CremaService cremaService)
 {
     this.cremaHost    = cremaHost;
     this.cremaService = cremaService;
 }
예제 #23
0
 public UserContextServiceHost(CremaService service)
 {
     this.service = service;
 }
예제 #24
0
 public CremaApplication()
 {
     this.service = this.GetService(typeof(CremaService)) as CremaService;
 }