diff options
author | Duncan Mak <duncan@mono-cvs.ximian.com> | 2003-07-31 05:00:14 +0400 |
---|---|---|
committer | Duncan Mak <duncan@mono-cvs.ximian.com> | 2003-07-31 05:00:14 +0400 |
commit | 4e48ab32cbe6d6b05a8a8bd921ef4b5ac729927d (patch) | |
tree | 969b76ddc037f711e0f68dcb7132456a31b23eab /mcs/class | |
parent | 354d8a46527b5a3634d720800de9c42c97e345c1 (diff) |
* TimeoutException.cs:
* ServiceProcessDescriptionAttribute.cs:
* ServiceControllerPermissionAttribute.cs:
* ServiceControllerPermissionEntryCollection.cs:
* ServiceControllerPermissionEntry.cs: Added.
* TODOAttribute.cs:
* Locale.cs: Added.
* ServiceBase.cs: Added missing APIs.
svn path=/trunk/mcs/; revision=16919
Diffstat (limited to 'mcs/class')
12 files changed, 469 insertions, 20 deletions
diff --git a/mcs/class/System.ServiceProcess/ChangeLog b/mcs/class/System.ServiceProcess/ChangeLog index b363f3fbb7c..58bc97f675c 100644 --- a/mcs/class/System.ServiceProcess/ChangeLog +++ b/mcs/class/System.ServiceProcess/ChangeLog @@ -1,7 +1,21 @@ -2003-02-23 Rafael Teixeira <rafaelteixeirabr@hotmail.com>
+2003-07-30 Duncan Mak <duncan@ximian.com> + + * TimeoutException.cs: + * ServiceProcessDescriptionAttribute.cs: + * ServiceControllerPermissionAttribute.cs: + * ServiceControllerPermissionEntryCollection.cs: + * ServiceControllerPermissionEntry.cs: Added. + + * TODOAttribute.cs: + * Locale.cs: Added. + + * ServiceBase.cs: Added missing APIs. + +2003-02-23 Rafael Teixeira <rafaelteixeirabr@hotmail.com> + * added makefile and other tidbits to be able to make in Linux -
-2002-12-10 Jeroen Janssen <japj@darius.demon.nl>
-
- * added System.ServiceProcess.build file
+ +2002-12-10 Jeroen Janssen <japj@darius.demon.nl> + + * added System.ServiceProcess.build file * added ChangeLog file
\ No newline at end of file diff --git a/mcs/class/System.ServiceProcess/Makefile b/mcs/class/System.ServiceProcess/Makefile index 2c72ccb2e08..5befd1ea05e 100644 --- a/mcs/class/System.ServiceProcess/Makefile +++ b/mcs/class/System.ServiceProcess/Makefile @@ -2,7 +2,7 @@ thisdir = class/System.ServiceProcess SUBDIRS = include ../../build/rules.make -LIBRARY = System.Serviceprocess.dll +LIBRARY = System.ServiceProcess.dll LIB_MCS_FLAGS = /r:System.dll NO_TEST = yes diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess.dll.sources b/mcs/class/System.ServiceProcess/System.ServiceProcess.dll.sources new file mode 100644 index 00000000000..918bc0f45b8 --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess.dll.sources @@ -0,0 +1,14 @@ +System.ServiceProcess/Locale.cs +System.ServiceProcess/TODOAttribute.cs +System.ServiceProcess/PowerBroadcastStatus.cs +System.ServiceProcess/ServiceAccount.cs +System.ServiceProcess/ServiceControllerPermissionAccess.cs +System.ServiceProcess/ServiceControllerStatus.cs +System.ServiceProcess/ServiceStartMode.cs +System.ServiceProcess/ServiceType.cs +System.ServiceProcess/ServiceBase.cs +System.ServiceProcess/TimeoutException.cs +System.ServiceProcess/ServiceProcessDescriptionAttribute.cs +System.ServiceProcess/ServiceControllerPermissionAttribute.cs +System.ServiceProcess/ServiceControllerPermissionEntry.cs +System.ServiceProcess/ServiceControllerPermissionEntryCollection.cs diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/Locale.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/Locale.cs new file mode 100644 index 00000000000..27e06881ff8 --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/Locale.cs @@ -0,0 +1,25 @@ +// +// Locale.cs +// +// Author: +// Miguel de Icaza (miguel@ximian.com) +// Andreas Nahr (ClassDevelopment@A-SoftTech.com) +// +// (C) 2001 - 2003 Ximian, Inc (http://www.ximian.com) +// + +internal sealed class Locale { + + private Locale () + { + } + + /// <summary> + /// Returns the translated message for the current locale + /// </summary> + public static string GetText (string msg) + { + return msg; + } +} + diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs index f23650363a3..1e58783227c 100644 --- a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceBase.cs @@ -1,20 +1,126 @@ +// +// System.ServiceProcess.ServiceBase.cs +// +// Authors: +// Cesar Octavio Lopez Nataren (cesar@ciencias.unam.mx) +// Duncan Mak (duncan@ximian.com) +// +// (C) 2003, Ximian Inc and Cesar Octavio Lopez Nataren. +// + + using System; +using System.Globalization; +using System.Diagnostics; namespace System.ServiceProcess { - public class ServiceBase + public class ServiceBase : System.ComponentModel.Component { public ServiceBase() { } - protected virtual void Dispose( bool disposing ) { }
+ public const int MaxNameLength = 80; + + bool hasStarted; + + bool auto_log; + bool can_handle_power_event; + bool can_pause_and_continue; + bool can_shutdown; + bool can_stop; + EventLog event_log; + string service_name; + + public bool AutoLog { + + get { return auto_log; } + + set { auto_log = value; } + } + + 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.")); + + can_handle_power_event = value; + } + } + + 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.")); + + can_pause_and_continue = value; + } + } + + public bool CanShutdown { + + get { return can_shutdown; } + + set { + if (hasStarted) + throw new InvalidOperationException ( + Locale.GetText ("Cannot modify this property " + + "after the service has started.")); + + can_shutdown = value; + } + } + + public bool CanStop { + + get { return can_stop; } + + set { + if (hasStarted) + throw new InvalidOperationException ( + Locale.GetText ("Cannot modify this property " + + "after the service has started.")); + + can_stop = value; + } + } + + public virtual EventLog EventLog { + get { return event_log; } + } + + public string ServiceName { + + get { return service_name; } + + 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 OnStart (string [] args) { } - protected virtual void OnStop() { } + protected virtual void OnStop () { } - protected string ServiceName; + public static void Run (ServiceBase service) { } - public static void Run(ServiceBase[] ServicesToRun) { } + public static void Run (ServiceBase [] ServicesToRun) { } } -}
\ No newline at end of file +} diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionAttribute.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionAttribute.cs new file mode 100644 index 00000000000..6ef4b30f1cf --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionAttribute.cs @@ -0,0 +1,68 @@ +// +// System.ServiceProcess.ServiceControllerPermissionAttribute.cs +// +// Author: +// Duncan Mak (duncan@ximian.com) +// +// (C) 2003, Ximian Inc. +// + +using System; +using System.Security; +using System.Security.Permissions; + +namespace System.ServiceProcess { + + [Serializable] + [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | + AttributeTargets.Struct | AttributeTargets.Constructor | + AttributeTargets.Method | AttributeTargets.Event)] + public class ServiceControllerPermissionAttribute : CodeAccessSecurityAttribute + { + string machine_name; + string service_name; + ServiceControllerPermissionAccess permission_access; + + public ServiceControllerPermissionAttribute (SecurityAction action) + : base (action) + { + machine_name = "."; + service_name = "*"; + permission_access = ServiceControllerPermissionAccess.Browse; + } + + public string MachineName { + + get { return machine_name; } + + + set { machine_name = value; } + } + + public ServiceControllerPermissionAccess PermissionAccess { + + get { return permission_access; } + + set { permission_access = value; } + } + + public string ServiceName { + + get { return service_name; } + + set { + if (value == null) + throw new ArgumentNullException ( + Locale.GetText ("Argument is null")); + + service_name = value; + } + } + + [MonoTODO] + public override IPermission CreatePermission () + { + throw new NotImplementedException (); + } + } +} diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionEntry.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionEntry.cs new file mode 100644 index 00000000000..bbc1b7d57f7 --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionEntry.cs @@ -0,0 +1,59 @@ +// +// System.ServiceProcess.ServiceControllerPermissionEntry.cs +// +// Author: +// Duncan Mak (duncan@ximian.com) +// +// (C) 2003, Ximian Inc. +// + +using System; +using System.ComponentModel; + +namespace System.ServiceProcess { + + [Serializable] + public class ServiceControllerPermissionEntry + { + string machine_name; + string service_name; + ServiceControllerPermissionAccess permission_access; + + + public ServiceControllerPermissionEntry () + { + machine_name = "."; + service_name = "*"; + permission_access = ServiceControllerPermissionAccess.Browse; + } + + public ServiceControllerPermissionEntry ( + ServiceControllerPermissionAccess permissionAccess, + string machineName, + string serviceName) + { + permission_access = permissionAccess; + machine_name = machineName; + service_name = serviceName; + } + + + public string MachineName { + + get { return machine_name; } + + } + + public string ServiceName { + + get { return service_name; } + + } + + public ServiceControllerPermissionAccess PermissionAccess { + + get { return permission_access; } + + } + } +} diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionEntryCollection.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionEntryCollection.cs new file mode 100644 index 00000000000..2f3543ac01d --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceControllerPermissionEntryCollection.cs @@ -0,0 +1,77 @@ +// +// System.ServiceProcess.ServiceControllerPermissionEntry.cs +// +// Author: +// Duncan Mak (duncan@ximian.com) +// +// (C) 2003, Ximian Inc. +// + +using System; +using System.Collections; + +namespace System.ServiceProcess { + + [Serializable] + public class ServiceControllerPermissionEntryCollection : CollectionBase + { + + public ServiceControllerPermissionEntry this [int index] { + + get { return base.List [index] as ServiceControllerPermissionEntry; } + + set { base.List [index] = value; } + + } + + public int Add (ServiceControllerPermissionEntry value) + { + return base.List.Add (value); + } + + public void AddRange (ServiceControllerPermissionEntry [] value) + { + foreach (ServiceControllerPermissionEntry entry in value) + base.List.Add (entry); + } + + public void AddRange (ServiceControllerPermissionEntryCollection value) + { + foreach (ServiceControllerPermissionEntry entry in value) + base.List.Add (entry); + } + + public bool Contains (ServiceControllerPermissionEntry value) + { + return base.List.Contains (value); + } + + public void CopyTo (ServiceControllerPermissionEntry [] array, int index) + { + base.List.CopyTo (array, index); + } + + public int IndexOf (ServiceControllerPermissionEntry value) + { + return base.List.IndexOf (value); + } + + public void Insert (int index, ServiceControllerPermissionEntry value) + { + base.List.Insert (index, value); + } + + public void Remove (ServiceControllerPermissionEntry value) + { + base.List.Remove (value); + } + + protected override void OnClear () {} + + protected override void OnInsert (int index, object value) {} + + protected override void OnRemove (int index, object value) {} + + protected override void OnSet (int index, object oldValue, object newValue) {} + } +} diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceProcessDescriptionAttribute.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceProcessDescriptionAttribute.cs new file mode 100644 index 00000000000..5407a778f15 --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/ServiceProcessDescriptionAttribute.cs @@ -0,0 +1,32 @@ +// +// System.ServiceProcess.ServiceProcessDescriptionAttribute.cs +// +// Author: +// Duncan Mak (duncan@ximian.com) +// +// (C) 2003, Ximian Inc. +// + +using System; +using System.ComponentModel; + +namespace System.ServiceProcess { + + [Serializable] + [AttributeUsage (AttributeTargets.All)] + public class ServiceProcessDescriptionAttribute : DescriptionAttribute + { + string description; + + public ServiceProcessDescriptionAttribute (string description) + { + this.description = description; + } + + public override string Description { + + get { return description; } + + } + } +} diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/TODOAttribute.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/TODOAttribute.cs new file mode 100644 index 00000000000..575d1f3b86b --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/TODOAttribute.cs @@ -0,0 +1,37 @@ +// +// TODOAttribute.cs +// +// Author: +// Ravi Pratap (ravi@ximian.com) +// +// (C) Ximian, Inc. http://www.ximian.com +// + +namespace System { + + /// <summary> + /// The TODO attribute is used to flag all incomplete bits in our class libraries + /// </summary> + /// + /// <remarks> + /// Use this to decorate any element which you think is not complete + /// </remarks> + [AttributeUsage (AttributeTargets.All, AllowMultiple=true)] + internal class MonoTODOAttribute : Attribute { + + private string comment; + + public MonoTODOAttribute () + {} + + public MonoTODOAttribute (string comment) + { + this.comment = comment; + } + + public string Comment + { + get { return comment; } + } + } +} diff --git a/mcs/class/System.ServiceProcess/System.ServiceProcess/TimeoutException.cs b/mcs/class/System.ServiceProcess/System.ServiceProcess/TimeoutException.cs new file mode 100644 index 00000000000..e4f67754c2f --- /dev/null +++ b/mcs/class/System.ServiceProcess/System.ServiceProcess/TimeoutException.cs @@ -0,0 +1,24 @@ +// +// System.ServiceProcess.TimeoutException.cs +// +// Author: +// Duncan Mak (duncan@ximian.com) +// +// (C) 2003, Ximian Inc. +// + +using System; +using System.Runtime.Serialization; + +namespace System.ServiceProcess { + + [Serializable] + public class TimeoutException : SystemException + { + public TimeoutException () : base () { } + + public TimeoutException (string message) : base (message) { } + + public TimeoutException (SerializationInfo info, StreamingContext context) : base (info, context) { } + } +} diff --git a/mcs/class/System.ServiceProcess/System.Serviceprocess.dll.sources b/mcs/class/System.ServiceProcess/System.Serviceprocess.dll.sources deleted file mode 100644 index a42791b56f3..00000000000 --- a/mcs/class/System.ServiceProcess/System.Serviceprocess.dll.sources +++ /dev/null @@ -1,7 +0,0 @@ -System.ServiceProcess/PowerBroadcastStatus.cs -System.ServiceProcess/ServiceAccount.cs -System.ServiceProcess/ServiceBase.cs -System.ServiceProcess/ServiceControllerPermissionAccess.cs -System.ServiceProcess/ServiceControllerStatus.cs -System.ServiceProcess/ServiceStartMode.cs -System.ServiceProcess/ServiceType.cs |