Exemple #1
0
        public IProject CreateProjectMsSql(string projectName, IApplicationServer appServer, IDatabaseServer dbServer,
                                           string databaseName, ISystemLocale language, CreatedProjectType type,
                                           UseVersioning useVersioning, IUser user)
        {
            const string CREATE_PROJECT =
                @"<ADMINISTRATION><PROJECT action=""addnew"" projectname=""{0}"" databaseserverguid=""{1}"" editorialserverguid=""{2}"" databasename=""{3}""
versioning=""{4}"" testproject=""{5}""><LANGUAGEVARIANTS><LANGUAGEVARIANT language=""{7}"" name=""{8}"" /></LANGUAGEVARIANTS><USERS><USER action=""assign"" guid=""{6}""/></USERS></PROJECT></ADMINISTRATION>";

            XmlDocument result = Session.ParseRQLResult(_session,
                                                        _session.ExecuteRQLRaw(
                                                            CREATE_PROJECT.RQLFormat(projectName, dbServer, appServer,
                                                                                     databaseName, (int)useVersioning,
                                                                                     (int)type, user,
                                                                                     language.LanguageAbbreviation,
                                                                                     language.Language),
                                                            RQL.IODataFormat.SessionKeyAndLogonGuid));

            string guidStr = result.InnerText;
            Guid   projectGuid;

            if (!Guid.TryParse(guidStr, out projectGuid))
            {
                throw new SmartAPIException(_session.ServerLogin,
                                            string.Format("Could not create project {0}", projectName));
            }

            InvalidateCache();
            return(new Project.Project(_session, projectGuid));
        }
Exemple #2
0
        public void SendMailFromSystemAccount(EMail mail)
        {
            IApplicationServer server      = ServerManager.ApplicationServers.First();
            string             fromAddress = server.From;

            SendEmail(fromAddress, mail);
        }
		public void Configure(object config, IApplicationServer server,
			Type listenerTransport, object listenerTransportConfig,
			Type appHostTransport, object appHostTransportConfig
		)
		{
			this.server = server;
			this.config = config as ListenerConfig;
		}
Exemple #4
0
 public void Configure(object config, IApplicationServer server,
                       Type listenerTransport, object listenerTransportConfig,
                       Type appHostTransport, object appHostTransportConfig
                       )
 {
     this.server = server;
     this.config = config as ListenerConfig;
 }
        public void Configure(object conf, IApplicationServer server,
                              Type listenerTransport, object listenerTransportConfig,
                              Type appHostTransport, object appHostTransportConfig)
        {
            this.server = server;
            this.config = conf as ListenerConfig;

            transport = (IListenerTransport)Activator.CreateInstance(listenerTransport);
            transport.Configure(this, listenerTransportConfig);

            appHostTransportType = appHostTransport;
        }
		public void Configure(object conf, IApplicationServer server, 
			Type listenerTransport, object listenerTransportConfig,
			Type appHostTransport, object appHostTransportConfig)
		{
			this.server = server;
			this.config = conf as ListenerConfig;

			transport = (IListenerTransport)Activator.CreateInstance (listenerTransport);
			transport.Configure (this, listenerTransportConfig);

			appHostTransportType = appHostTransport;
		}
 public BinarySerializationServerAdapter(TaskFactory Factory, IApplicationServer ApplicationServer)
 {
     this.Factory           = Factory;
     this.s                 = ApplicationServer;
     this.ssed              = new BinarySerializationServerEventDispatcher(ApplicationServer);
     this.ssed.ServerEvent += (CommandName, CommandHash, Parameters) =>
     {
         if (ServerEvent != null)
         {
             ServerEvent(CommandName, CommandHash, Parameters);
         }
     };
 }
 public void Setup()
 {
     _projection = new TestProjection();
     _receptor = new TestReceptor();
     _appServer = Configuration.InMemory(
         new List<Func<IEventStore, IEventPublisher, IApplicationService>>
             {
                 (es, ep) => new TestApplicationService(ep),
                 (es, ep) => new ProcessApplicationService(es)
             },
         () => new List<IProjection> { _projection},
         () => new List<IReceptor> { _receptor }
       );
 }
		public override void Configure (object appHostConfig, object webAppConfig, 
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			AspNetHostConfig config = appHostConfig as AspNetHostConfig;

			if (config != null) {
				LogLevel = config.Log.Level;
				LogToConsole = config.Log.WriteToConsole;
				AddTrailingSlash = config.AddTrailingSlash;
			}

			base.Configure (appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
		}
        public override void Configure(object appHostConfig, object webAppConfig,
                                       IApplicationServer server,
                                       IListenerTransport listenerTransport,
                                       Type appHostTransportType, object transportConfig)
        {
            AspNetHostConfig config = appHostConfig as AspNetHostConfig;

            if (config != null)
            {
                LogLevel         = config.Log.Level;
                LogToConsole     = config.Log.WriteToConsole;
                AddTrailingSlash = config.AddTrailingSlash;
            }

            base.Configure(appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
        }
Exemple #11
0
		public virtual void Configure (object appHostConfig, object webAppConfig, 
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			WebAppConfig appConfig = webAppConfig as WebAppConfig;
			if (appConfig != null) {
				vport = appConfig.VPort;
				vhost = appConfig.VHost;
				vpath = appConfig.VPath;
				path = appConfig.RealPath;
			}

			appServer = server;
			this.listenerTransport = listenerTransport;
			appHostTransport = (IApplicationHostTransport) Activator.CreateInstance (appHostTransportType);
			appHostTransport.Configure (this, transportConfig);
		}
		public virtual void Configure (object appHostConfig, object webAppConfig, 
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			WebAppConfig appConfig = webAppConfig as WebAppConfig;
			if (appConfig != null) {
				vport = appConfig.VPort;
				vhost = appConfig.VHost;
				vpath = appConfig.VPath;
				path = appConfig.RealPath;
			}

			appServer = server;
			physicalRoot = server.PhysicalRoot;
			this.listenerTransport = listenerTransport;
			appHostTransport = (IApplicationHostTransport) Activator.CreateInstance (appHostTransportType);
			appHostTransport.Configure (this, transportConfig);
			Logger.Write (LogLevel.Debug, "Configured host in domain {0}, id={1}", AppDomain.CurrentDomain.FriendlyName, AppDomain.CurrentDomain.Id);
		}
Exemple #13
0
        public virtual void Configure(object appHostConfig, object webAppConfig,
                                      IApplicationServer server,
                                      IListenerTransport listenerTransport,
                                      Type appHostTransportType, object transportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig != null)
            {
                vport = appConfig.VPort;
                vhost = appConfig.VHost;
                vpath = appConfig.VPath;
                path  = appConfig.RealPath;
            }

            appServer = server;
            this.listenerTransport = listenerTransport;
            appHostTransport       = (IApplicationHostTransport)Activator.CreateInstance(appHostTransportType);
            appHostTransport.Configure(this, transportConfig);
        }
Exemple #14
0
		public override void Configure (object appHostConfig, object webAppConfig,
			IApplicationServer server, 
			IListenerTransport listenerTransport, 
			Type appHostTransportType, object transportConfig)
		{
			RawHostConfig config = appHostConfig as RawHostConfig;

			if (config != null) {
				Logger.Level = config.Log.Level;
				Logger.WriteToConsole = config.Log.WriteToConsole;

				requestType = Type.GetType(config.RequestType);
				if (requestType == null) {
					Logger.Write(LogLevel.Error, "Couldn't find type '{0}'", config.RequestType);
					throw new ArgumentException ("appHostConfig.Type");
				}
				CreateRequestInstance = CreateDynamicMethod (requestType);
			}

			base.Configure (appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
		} 
Exemple #15
0
        public virtual void Configure(object appHostConfig, object webAppConfig,
                                      IApplicationServer server,
                                      IListenerTransport listenerTransport,
                                      Type appHostTransportType, object transportConfig)
        {
            WebAppConfig appConfig = webAppConfig as WebAppConfig;

            if (appConfig != null)
            {
                vport = appConfig.VPort;
                vhost = appConfig.VHost;
                vpath = appConfig.VPath;
                path  = appConfig.RealPath;
            }

            appServer              = server;
            physicalRoot           = server.PhysicalRoot;
            this.listenerTransport = listenerTransport;
            appHostTransport       = (IApplicationHostTransport)Activator.CreateInstance(appHostTransportType);
            appHostTransport.Configure(this, transportConfig);
            Logger.Write(LogLevel.Debug, "Configured host in domain {0}, id={1}", AppDomain.CurrentDomain.FriendlyName, AppDomain.CurrentDomain.Id);
        }
Exemple #16
0
        public override void Configure(object appHostConfig, object webAppConfig,
                                       IApplicationServer server,
                                       IListenerTransport listenerTransport,
                                       Type appHostTransportType, object transportConfig)
        {
            RawHostConfig config = appHostConfig as RawHostConfig;

            if (config != null)
            {
                Logger.Level          = config.Log.Level;
                Logger.WriteToConsole = config.Log.WriteToConsole;

                requestType = Type.GetType(config.RequestType);
                if (requestType == null)
                {
                    Logger.Write(LogLevel.Error, "Couldn't find type '{0}'", config.RequestType);
                    throw new ArgumentException("appHostConfig.Type");
                }
                CreateRequestInstance = CreateDynamicMethod(requestType);
            }

            base.Configure(appHostConfig, webAppConfig, server, listenerTransport, appHostTransportType, transportConfig);
        }
 public ApplicationController(IApplicationServer applicationServer, CommandBus bus)
 {
     _applicationServer = applicationServer;
     _commandBus        = bus;
 }
 public ApplicationCommandHandler(IApplicationServer applicationServer)
 {
     _applicationServer = applicationServer;
 }
Exemple #19
0
 public SimpleStepBaseTestProcess(IApplicationServer applicationServer)
 {
     _applicationServer = applicationServer;
     State          = new SimpleStepBaseTestProcessState();
     State.StepName = "Start procesu";
 }
Exemple #20
0
 public ProcessesController(IApplicationServer applicationServer)
 {
     this._applicationServer = applicationServer;
 }
Exemple #21
0
        public static int Main(string[] args)
        {
            // Load the configuration file stored in the
            // executable's resources.
            configmanager = new ConfigurationManager(
                typeof(MainClass).Assembly,
                "ConfigurationManager.xml");

            configmanager.LoadCommandLineArgs(args);

            // Show the help and exit.
            if ((bool)configmanager ["help"] || (bool)configmanager ["?"])
            {
                ShowHelp();
                return(0);
            }

            // Show the version and exit.
            if ((bool)configmanager ["version"])
            {
                ShowVersion();
                return(0);
            }

            string config = (string)configmanager ["config"];

            if (config == null)
            {
                Console.WriteLine("You must pass /config=<filename> option. See 'help' for more info");
                return(1);
            }


            try {
                string config_file = (string)configmanager ["configfile"];
                if (config_file != null)
                {
                    configmanager.LoadXmlConfig(config_file);
                }
            } catch (ApplicationException e) {
                Console.WriteLine(e.Message);
                return(1);
            } catch (System.Xml.XmlException e) {
                Console.WriteLine("Error reading XML configuration: {0}", e.Message);
                return(1);
            }

            try {
                string log_level = (string)configmanager ["loglevels"];

                if (log_level != null)
                {
                    Logger.Level = (LogLevel)Enum.Parse(typeof(LogLevel), log_level);
                }
            } catch {
                Console.WriteLine("Failed to parse log levels.");
                Console.WriteLine("Using default levels: {0}", Logger.Level);
            }

            // Enable console logging during Main ().
            Logger.WriteToConsole = true;

            try {
                string log_file = (string)configmanager ["logfile"];

                if (log_file != null)
                {
                    Logger.Open(log_file);
                }
            } catch (Exception e) {
                Logger.Write(LogLevel.Error, "Error opening log file: {0}", e.Message);
                Logger.Write(LogLevel.Error, "Events will not be logged.");
            }

            Logger.Write(LogLevel.Debug,
                         Assembly.GetExecutingAssembly().GetName().Name);

            bool auto_map = false;             //(bool) configmanager ["automappaths"];

            string applications = (string)configmanager ["applications"];
            string app_config_file;
            string app_config_dir;
            List <WebAppConfig> webapps = new List <WebAppConfig> ();

            try {
                app_config_file = (string)configmanager ["appconfigfile"];
                app_config_dir  = (string)configmanager ["appconfigdir"];
            } catch (ApplicationException e) {
                Logger.Write(LogLevel.Error, e.Message);
                return(1);
            }

            if (config != null)
            {
                webapps.AddRange(ConfigUtils.GetApplicationsFromConfigFile(config));
            }

            if (applications != null)
            {
                webapps.AddRange(ConfigUtils.GetApplicationsFromCommandLine(applications));
            }

            if (app_config_file != null)
            {
                webapps.AddRange(ConfigUtils.GetApplicationsFromConfigFile(app_config_file));
            }

            if (app_config_dir != null)
            {
                webapps.AddRange(ConfigUtils.GetApplicationsFromConfigDirectory(app_config_dir));
            }

            if (webapps.Count == 0 && !auto_map)
            {
                Logger.Write(LogLevel.Error,
                             "There are no applications defined, and path mapping is disabled.");
                Logger.Write(LogLevel.Error,
                             "Define an application using /applications, /appconfigfile, /appconfigdir");

                /*
                 * Logger.Write (LogLevel.Error,
                 *      "or by enabling application mapping with /automappaths=True.");
                 */
                return(1);
            }

//			server.MaxConnections = (ushort)
//			                        configmanager ["maxconns"];
//			server.MaxRequests = (ushort)
//			                     configmanager ["maxreqs"];
//			server.MultiplexConnections = (bool)
//			                              configmanager ["multiplex"];

//			Logger.Write (LogLevel.Debug, "Max connections: {0}",
//				server.MaxConnections);
//			Logger.Write (LogLevel.Debug, "Max requests: {0}",
//				server.MaxRequests);
//			Logger.Write (LogLevel.Debug, "Multiplex connections: {0}",
//				server.MultiplexConnections);

            bool stopable = (bool)configmanager ["stopable"];

            Logger.WriteToConsole = (bool)configmanager ["printlog"];

            List <ConfigInfo> serverConfigs = ConfigUtils.GetConfigsFromFile(config, "server", typeof(AppServerConfig));

            if (serverConfigs.Count != 1)
            {
                if (serverConfigs.Count == 0)
                {
                    Console.WriteLine("Could not find <server> node in file '{0}'", config);
                }
                else
                {
                    Console.WriteLine("Only one server is supported currently. Please remove redudant <server> node from file '{0}'", config);
                }
                return(1);
            }
            IApplicationServer srv = (IApplicationServer)Activator.CreateInstance(serverConfigs [0].Type);

            srv.Configure(serverConfigs [0].Config);

            List <ConfigInfo> listenerConfigs = ConfigUtils.GetConfigsFromFile(config, "listener", typeof(ListenerConfig));

            if (listenerConfigs.Count != 1)
            {
                if (listenerConfigs.Count == 0)
                {
                    Console.WriteLine("Could not find <listener> node in file '{0}'", config);
                }
                else
                {
                    Console.WriteLine("Only one listener is supported currently. Please remove redudant <listener> node from file '{0}'", config);
                }
                return(1);
            }
            List <ConfigInfo> hostConfigs = ConfigUtils.GetConfigsFromFile(config, "apphost", typeof(AppHostConfig));

            if (hostConfigs.Count == 0)
            {
                Console.WriteLine("Can't find <apphost> node in file '{0}'", config);
                return(1);
            }

            IWebListener listener = (IWebListener)Activator.CreateInstance(listenerConfigs[0].Type);

            listener.Configure(listenerConfigs[0].Config, srv,
                               listenerConfigs[0].ListenerTransport != null? listenerConfigs[0].ListenerTransport.Type: null,
                               listenerConfigs[0].ListenerTransport != null? listenerConfigs[0].ListenerTransport.Config: null,
                               listenerConfigs[0].AppHostTransport != null? listenerConfigs[0].AppHostTransport.Type: null,
                               listenerConfigs[0].AppHostTransport != null? listenerConfigs[0].AppHostTransport.Config: null
                               );

            foreach (WebAppConfig appConfig in webapps)
            {
                srv.CreateApplicationHost(
                    hostConfigs[0].Type, hostConfigs[0].Config,
                    appConfig,
                    listener.Transport, listener.AppHostTransportType,
                    listenerConfigs[0].AppHostTransport != null ? listenerConfigs[0].AppHostTransport.Config: null);
            }
            if (listener.Listen() != 0)
            {
                Logger.Write(LogLevel.Error, "Could not start server");
                return(1);
            }

            configmanager = null;

            if (stopable)
            {
                Console.WriteLine("Hit Return to stop the server.");
                Console.ReadLine();
            }
            else
            {
                UnixSignal[] signals = new UnixSignal[] {
                    new UnixSignal(Signum.SIGINT),
                    new UnixSignal(Signum.SIGTERM),
                };

                // Wait for a unix signal
                for (bool exit = false; !exit;)
                {
                    int id = UnixSignal.WaitAny(signals);

                    if (id >= 0 && id < signals.Length)
                    {
                        if (signals [id].IsSet)
                        {
                            exit = true;
                        }
                    }
                }
            }
            listener.Shutdown();

            return(0);
        }
Exemple #22
0
 public PreviewModel(IApplicationServer applicationServer, IJsonSerializer serializer)
 {
     this._applicationServer = applicationServer;
     this._serializer        = serializer;
 }
Exemple #23
0
 public IndexModel(IApplicationServer applicationServer)
 {
     this._applicationServer = applicationServer;
 }