Author: gert
Date: 2006-09-19 16:14:24 -0400 (Tue, 19 Sep 2006)
New Revision: 65684
Modified:
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ChangeLog
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceController.cs
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceProcessInstaller.cs
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/TimeoutException.cs
Log:
* ServiceProcessInstaller.cs: Added some missing attributes. Fixes
class status errors.
* ServiceBase.cs: Added missing attributes. Fixed signature of
OnCustomCommand and OnPowerEvent methods. Fixed code to match coding
guidelines and converted spaces to tabs.
* ServiceController.cs: Added missing attributes. Moved MonoTODO to
class level. Added descriptions for ServiceProcessDescription
attributes.
* TimeoutException.cs: Reduce accesibility of deserialization ctor to
protected to match MS. Fixed code to match coding guidelines and
converted spaces to tabs.
Modified: trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ChangeLog
===================================================================
--- trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ChangeLog
2006-09-19 20:14:01 UTC (rev 65683)
+++ trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ChangeLog
2006-09-19 20:14:24 UTC (rev 65684)
@@ -1,3 +1,17 @@
+2006-09-16 Gert Driesen <[EMAIL PROTECTED]>
+
+ * ServiceProcessInstaller.cs: Added some missing attributes. Fixes
+ class status errors.
+ * ServiceBase.cs: Added missing attributes. Fixed signature of
+ OnCustomCommand and OnPowerEvent methods. Fixed code to match coding
+ guidelines and converted spaces to tabs.
+ * ServiceController.cs: Added missing attributes. Moved MonoTODO to
+ class level. Added descriptions for ServiceProcessDescription
+ attributes.
+ * TimeoutException.cs: Reduce accesibility of deserialization ctor to
+ protected to match MS. Fixed code to match coding guidelines and
+ converted spaces to tabs.
+
2006-09-14 Gert Driesen <[EMAIL PROTECTED]>
* ServiceControllerPermissionEntryCollection.cs: Set eol-style to
Modified:
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs
===================================================================
--- trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs
2006-09-19 20:14:01 UTC (rev 65683)
+++ trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs
2006-09-19 20:14:24 UTC (rev 65684)
@@ -9,7 +9,6 @@
// (C) 2003, Ximian Inc and Cesar Octavio Lopez Nataren.
// (C) 2005, Voelcker Informatik AG
//
-
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -31,145 +30,163 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
using System;
+using System.ComponentModel;
using System.Globalization;
using System.Diagnostics;
namespace System.ServiceProcess
{
+#if ONLY_1_1
+ [Designer ("Microsoft.VisualStudio.Install.UserNTServiceDesigner, " +
Consts.AssemblyMicrosoft_VisualStudio,
"System.ComponentModel.Design.IRootDesigner")]
+#endif
+ [InstallerType (typeof (ServiceProcessInstaller))]
public class ServiceBase : System.ComponentModel.Component
{
internal delegate void RunServiceCallback (ServiceBase []
services);
-
+
// This member is used for interoperation with mono-service
internal static RunServiceCallback RunService = null;
-
- public ServiceBase() { }
- public const int MaxNameLength = 80;
+ public const int MaxNameLength = 80;
- bool hasStarted = false;
-
- bool auto_log = true;
- bool can_handle_power_event = false;
- bool can_pause_and_continue = false;
- bool can_shutdown = false;
- bool can_stop = true;
- EventLog event_log = null;
- string service_name;
+ bool hasStarted;
+ bool auto_log = true;
+ bool can_handle_power_event;
+ bool can_pause_and_continue;
+ bool can_shutdown;
+ bool can_stop = true;
+ EventLog event_log;
+ string service_name;
- public bool AutoLog {
+ public ServiceBase ()
+ {
+ }
- get { return auto_log; }
+ [DefaultValue (true)]
+ [ServiceProcessDescription ("")]
+ public bool AutoLog {
+ get { return auto_log; }
+ set { auto_log = value; }
+ }
- set { auto_log = value; }
- }
+ [DefaultValue (false)]
+ public bool CanHandlePowerEvent {
+ get { return can_handle_power_event; }
+ set {
+ if (hasStarted)
+ throw new InvalidOperationException (
+ Locale.GetText ("Cannot
modify this property " +
+
"after the service has started."));
- public bool CanHandlePowerEvent {
+ can_handle_power_event = value;
+ }
+ }
- get { return can_handle_power_event; }
+ [DefaultValue (false)]
+ public bool CanPauseAndContinue {
+ get { return can_pause_and_continue; }
+ set {
+ if (hasStarted)
+ throw new InvalidOperationException (
+ Locale.GetText ("Cannot
modify this property " +
+
"after the service has started."));
- set {
- if (hasStarted)
- throw new InvalidOperationException (
- Locale.GetText ("Cannot modify
this property " +
- "after the
service has started."));
+ can_pause_and_continue = value;
+ }
+ }
- can_handle_power_event = value;
- }
- }
+ [DefaultValue (false)]
+ public bool CanShutdown {
+ get { return can_shutdown; }
+ set {
+ if (hasStarted)
+ throw new InvalidOperationException (
+ Locale.GetText ("Cannot
modify this property " +
+
"after the service has started."));
- public bool CanPauseAndContinue {
+ can_shutdown = value;
+ }
+ }
- get { return can_pause_and_continue; }
+ [DefaultValue (true)]
+ public bool CanStop {
+ get { return can_stop; }
+ set {
+ if (hasStarted)
+ throw new InvalidOperationException (
+ Locale.GetText ("Cannot
modify this property " +
+
"after the service has started."));
- set {
- if (hasStarted)
- throw new InvalidOperationException (
- Locale.GetText ("Cannot modify
this property " +
- "after the
service has started."));
+ can_stop = value;
+ }
+ }
- can_pause_and_continue = value;
- }
- }
+ [Browsable (false)]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
+ public virtual EventLog EventLog {
+ get {
+ if (event_log == null)
+ event_log = new EventLog
("Application", ".", service_name);
+ return event_log;
+ }
+ }
- public bool CanShutdown {
+ [ServiceProcessDescription ("")]
+ [TypeConverter
("System.Diagnostics.Design.StringValueConverter, " +
Consts.AssemblySystem_Design)]
+ public string ServiceName {
+ get { return service_name; }
+ set {
+ if (hasStarted)
+ throw new InvalidOperationException (
+ Locale.GetText ("Cannot
modify this property " +
+
"after the service has started."));
- get { return can_shutdown; }
+ service_name = value;
+ }
+ }
- set {
- if (hasStarted)
- throw new InvalidOperationException (
- Locale.GetText ("Cannot modify
this property " +
- "after the
service has started."));
+ protected override void Dispose (bool disposing)
+ {
+ }
- can_shutdown = value;
- }
- }
+ protected virtual void OnStart (string [] args)
+ {
+ }
- public bool CanStop {
+ protected virtual void OnStop ()
+ {
+ }
- get { return can_stop; }
+ protected virtual void OnContinue ()
+ {
+ }
- set {
- if (hasStarted)
- throw new InvalidOperationException (
- Locale.GetText ("Cannot modify
this property " +
- "after the
service has started."));
+ protected virtual void OnCustomCommand (int command)
+ {
+ }
- can_stop = value;
- }
- }
-
- public virtual EventLog EventLog {
- get {
- if (event_log == null)
- event_log = new
EventLog ("Application", ".", service_name);
- return event_log;
- }
- }
+ protected virtual void OnPause ()
+ {
+ }
- public string ServiceName {
+ protected virtual void OnPowerEvent (PowerBroadcastStatus
powerStatus)
+ {
+ }
- get { return service_name; }
+ protected virtual void OnShutdown ()
+ {
+ }
- set {
- if (hasStarted)
- throw new InvalidOperationException (
- Locale.GetText ("Cannot modify
this property " +
- "after the
service has started."));
-
- service_name = value;
- }
- }
-
- protected override void Dispose (bool disposing) { }
-
- protected virtual void OnStart (string [] args) { }
-
- protected virtual void OnStop () { }
-
- protected virtual void OnContinue () { }
-
- protected virtual void OnCustomCommand () { }
-
- protected virtual void OnPause () { }
-
- protected virtual void OnPowerEvent () { }
-
- protected virtual void OnShutdown () { }
-
- public static void Run (ServiceBase service)
+ public static void Run (ServiceBase service)
{
- Run (new ServiceBase [] {service});
+ Run (new ServiceBase [] { service });
}
- public static void Run (ServiceBase [] servicesToRun)
+ public static void Run (ServiceBase [] servicesToRun)
{
if (RunService != null)
RunService (servicesToRun);
}
-
}
}
Modified:
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceController.cs
===================================================================
---
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceController.cs
2006-09-19 20:14:01 UTC (rev 65683)
+++
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceController.cs
2006-09-19 20:14:24 UTC (rev 65684)
@@ -41,6 +41,8 @@
namespace System.ServiceProcess
{
[Designer("System.ServiceProcess.Design.ServiceControllerDesigner, " +
Consts.AssemblySystem_Design)]
+ [MonoTODO ("No unix implementation")]
+ [ServiceProcessDescription ("")]
public class ServiceController : Component
{
private string _name;
@@ -51,7 +53,6 @@
private ServiceController [] _dependentServices;
private ServiceController [] _servicesDependedOn;
- [MonoTODO ("No unix implementation")]
public ServiceController ()
{
_machineName = ".";
@@ -59,12 +60,10 @@
_impl = CreateServiceControllerImpl (this);
}
- [MonoTODO ("No unix implementation")]
public ServiceController (string name) : this (name, ".")
{
}
- [MonoTODO ("No unix implementation")]
public ServiceController (string name, string machineName)
{
if (name == null || name.Length == 0)
@@ -78,9 +77,8 @@
_impl = CreateServiceControllerImpl (this);
}
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("Whether this service recognizes
the Pause and Continue commands.")]
public bool CanPauseAndContinue {
get {
#if NET_2_0
@@ -90,9 +88,8 @@
}
}
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("Whether this service can respond
to a system shutdown.")]
public bool CanShutdown {
get
{
@@ -103,9 +100,8 @@
}
}
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("Whether this service can be
stopped.")]
public bool CanStop {
get
{
@@ -116,9 +112,8 @@
}
}
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("The services that depend on this
service in order to run.")]
public ServiceController [] DependentServices {
get
{
@@ -131,10 +126,9 @@
}
}
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
[ReadOnly (true)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("The descriptive name of the
service.")]
public string DisplayName {
get {
if (_displayName.Length == 0 &&
(_serviceName.Length > 0 || _name.Length > 0))
@@ -165,11 +159,10 @@
}
}
- [MonoTODO ("No unix implementation")]
[Browsable (false)]
[DefaultValue (".")]
- [DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [RecommendedAsConfigurable (true)]
+ [ServiceProcessDescription ("The name of the machine on which
this service resides.")]
public string MachineName {
get {
return _machineName;
@@ -193,11 +186,10 @@
}
}
- [MonoTODO ("No unix implementation")]
[DefaultValue ("")]
[ReadOnly (true)]
[RecommendedAsConfigurable (true)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("The short name of the service.")]
public string ServiceName {
get {
if (_serviceName.Length == 0 &&
(_displayName.Length > 0 || _name.Length > 0))
@@ -232,9 +224,8 @@
}
}
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("Services that must be started in
order for this one to start.")]
public ServiceController [] ServicesDependedOn {
get
{
@@ -259,9 +250,8 @@
}
#endif
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("The type of this service.")]
public ServiceType ServiceType {
get
{
@@ -272,9 +262,8 @@
}
}
- [MonoTODO ("No unix implementation")]
[DesignerSerializationVisibility
(DesignerSerializationVisibility.Hidden)]
- [ServiceProcessDescription ("")]
+ [ServiceProcessDescription ("The status of the service, e.g.,
Running or Stopped.")]
public ServiceControllerStatus Status {
get
{
@@ -285,13 +274,11 @@
}
}
- [MonoTODO ("No unix implementation")]
public void Close ()
{
_impl.Close ();
}
- [MonoTODO ("No unix implementation")]
public void Continue ()
{
#if NET_2_0
@@ -300,14 +287,12 @@
_impl.Continue ();
}
- [MonoTODO ("No unix implementation")]
protected override void Dispose (bool disposing)
{
_impl.Dispose (disposing);
base.Dispose (disposing);
}
- [MonoTODO ("No unix implementation")]
public void ExecuteCommand (int command)
{
#if NET_2_0
@@ -316,13 +301,11 @@
_impl.ExecuteCommand (command);
}
- [MonoTODO ("No unix implementation")]
public static ServiceController[] GetDevices ()
{
return GetDevices (".");
}
- [MonoTODO ("No unix implementation")]
public static ServiceController[] GetDevices (string
machineName)
{
ValidateMachineName (machineName);
@@ -333,13 +316,11 @@
}
}
- [MonoTODO ("No unix implementation")]
public static ServiceController[] GetServices ()
{
return GetServices (".");
}
- [MonoTODO ("No unix implementation")]
public static ServiceController[] GetServices (string
machineName)
{
ValidateMachineName (machineName);
@@ -350,7 +331,6 @@
}
}
- [MonoTODO ("No unix implementation")]
public void Pause ()
{
#if NET_2_0
@@ -359,7 +339,6 @@
_impl.Pause ();
}
- [MonoTODO ("No unix implementation")]
public void Refresh ()
{
// MSDN: this method also sets the ServicesDependedOn
and
@@ -372,13 +351,11 @@
_impl.Refresh ();
}
- [MonoTODO ("No unix implementation")]
public void Start ()
{
Start (new string [0]);
}
- [MonoTODO ("No unix implementation")]
public void Start (string [] args)
{
#if NET_2_0
@@ -387,7 +364,6 @@
_impl.Start (args);
}
- [MonoTODO ("No unix implementation")]
public void Stop ()
{
#if NET_2_0
@@ -396,13 +372,11 @@
_impl.Stop ();
}
- [MonoTODO ("No unix implementation")]
public void WaitForStatus (ServiceControllerStatus
desiredStatus)
{
WaitForStatus (desiredStatus, TimeSpan.MaxValue);
}
- [MonoTODO ("No unix implementation")]
public void WaitForStatus (ServiceControllerStatus
desiredStatus, TimeSpan timeout)
{
#if NET_2_0
Modified:
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceProcessInstaller.cs
===================================================================
---
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceProcessInstaller.cs
2006-09-19 20:14:01 UTC (rev 65683)
+++
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceProcessInstaller.cs
2006-09-19 20:14:24 UTC (rev 65684)
@@ -44,6 +44,7 @@
private string password;
private string username;
+ [DefaultValue (ServiceAccount.User)]
public ServiceAccount Account {
get {
return account;
@@ -59,6 +60,7 @@
}
}
+ [Browsable (false)]
public string Password {
get {
return password;
@@ -68,6 +70,8 @@
}
}
+ [Browsable (false)]
+ [TypeConverter
("System.Diagnostics.Design.StringValueConverter, " +
Consts.AssemblySystem_Design)]
public string Username {
get {
return username;
Modified:
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/TimeoutException.cs
===================================================================
---
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/TimeoutException.cs
2006-09-19 20:14:01 UTC (rev 65683)
+++
trunk/mcs/class/System.ServiceProcess/System.ServiceProcess/TimeoutException.cs
2006-09-19 20:14:24 UTC (rev 65684)
@@ -6,7 +6,6 @@
//
// (C) 2003, Ximian Inc.
//
-
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -31,15 +30,21 @@
using System;
using System.Runtime.Serialization;
-namespace System.ServiceProcess {
+namespace System.ServiceProcess
+{
+ [Serializable]
+ public class TimeoutException : SystemException
+ {
+ public TimeoutException () : base ()
+ {
+ }
- [Serializable]
- public class TimeoutException : SystemException
- {
- public TimeoutException () : base () { }
+ public TimeoutException (string message) : base (message)
+ {
+ }
- public TimeoutException (string message) : base (message) { }
-
- public TimeoutException (SerializationInfo info,
StreamingContext context) : base (info, context) { }
- }
+ protected TimeoutException (SerializationInfo info,
StreamingContext context) : base (info, context)
+ {
+ }
+ }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches