Example #1
0
 /// <summary>
 /// Attaches a Monitor to the server
 /// </summary>
 /// <param name="monitor">Monitor</param>
 public void AttachMonitor(ServerMonitor monitor)
 {
     if (this._process != null)
     {
         this.DetachMonitor();
         if (this._activeLogger == null)
         {
             this._activeLogger = new ConsoleCapture(this._process, monitor);
         }
     }
 }
        /// <summary>
        /// Creates a new Console Capture
        /// </summary>
        /// <param name="p">Process</param>
        /// <param name="monitor">Server Monitor which wishes to receive the capture</param>
        public ConsoleCapture(Process p, ServerMonitor monitor)
        {
            this._process = p;
            this._monitor = monitor;

            this._errorHandler  = new DataReceivedEventHandler(this.HandleError);
            this._outputHandler = new DataReceivedEventHandler(this.HandleOutput);

            if (!this._process.StartInfo.UseShellExecute && this._process.StartInfo.RedirectStandardError && this._process.StartInfo.RedirectStandardOutput)
            {
                this._process.BeginErrorReadLine();
                this._process.BeginOutputReadLine();
                this._process.ErrorDataReceived  += this._errorHandler;
                this._process.OutputDataReceived += this._outputHandler;
            }
            else
            {
                monitor.WriteLine("Cannot monitor a process that was not started in the current rdfServerGUI session but you may still stop this server");
            }
        }
Example #3
0
        /// <summary>
        /// Attaches a Monitor to the Server
        /// </summary>
        /// <param name="monitor">Monitor</param>
        public void AttachMonitor(ServerMonitor monitor)
        {
            this.DetachMonitor();

            //Set up logger
            this._activeLogger = new MonitorLogger(monitor, this._logFormat);
            this._server.AddLogger(this._activeLogger);

            //Set up console
            this._activeConsole = new MonitorConsole(monitor);
            if (this._server.Console is MulticastConsole)
            {
                ((MulticastConsole)this._server.Console).AddConsole(this._activeConsole);
            }
            else
            {
                IServerConsole current   = this._server.Console;
                IServerConsole multicast = new MulticastConsole(new IServerConsole[] { current, this._activeConsole });
                this._server.Console = multicast;
            }
        }
Example #4
0
 public MonitorConsole(ServerMonitor monitor)
 {
     this._monitor = monitor;
 }
Example #5
0
 /// <summary>
 /// Creates a new logger
 /// </summary>
 /// <param name="monitor">Monitor</param>
 public MonitorLogger(ServerMonitor monitor)
     : this(monitor, ApacheStyleLogger.LogCommon)
 {
 }
Example #6
0
 /// <summary>
 /// Creates a new logger
 /// </summary>
 /// <param name="monitor">Monitor</param>
 /// <param name="logFormat">Log Format</param>
 public MonitorLogger(ServerMonitor monitor, String logFormat)
     : base(logFormat)
 {
     this._monitor = monitor;
 }