URI hostname is case-insensitive but path is case-sensitive. Be careful when generati...
[beagle.git] / BeagleClient / RemoteControl.cs
blob71ee06726e50a9f72675e6061a0d50a968a00038
1 //
2 // RemoteControl.cs
3 //
4 // Copyright (C) 2004-2005 Novell, Inc.
5 //
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a
9 // copy of this software and associated documentation files (the "Software"),
10 // to deal in the Software without restriction, including without limitation
11 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 // and/or sell copies of the Software, and to permit persons to whom the
13 // Software is furnished to do so, subject to the following conditions:
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 // DEALINGS IN THE SOFTWARE.
27 using System.Collections;
28 using System.Text;
29 using System.Xml;
30 using System.Xml.Serialization;
32 using Beagle.Util;
34 namespace Beagle {
36 public class DaemonInformationRequest : RequestMessage {
37 /* User can request one or more of the four information. */
38 public bool GetVersion, GetSchedInfo, GetIndexStatus, GetIsIndexing;
40 // For backward compatibility
41 public DaemonInformationRequest () : this (true, true, true, true) { }
43 public DaemonInformationRequest (
44 bool get_version,
45 bool get_scheduler_info,
46 bool get_index_status,
47 bool get_is_indexing)
49 this.GetVersion = get_version;
50 this.GetSchedInfo = get_scheduler_info;
51 this.GetIndexStatus = get_index_status;
52 this.GetIsIndexing = get_is_indexing;
56 // These requests have no interesting client-side state
57 public class ShutdownRequest : RequestMessage { }
59 public class ReloadConfigRequest : RequestMessage { }
61 public class OptimizeIndexesRequest : RequestMessage { }
63 public class DaemonInformationResponse : ResponseMessage {
64 public string Version = null;
66 public SchedulerInformation SchedulerInformation = null;
68 [XmlArray]
69 [XmlArrayItem (ElementName = "QueryableStatus", Type = typeof (QueryableStatus))]
70 public ArrayList IndexStatus = null;
72 public bool IsIndexing = false;
74 // Methods and properties for backward compatibility and general utility
75 // The names of the properties dont match the corresponding method names,
76 // this is to not break clients out there.
78 [XmlIgnore]
79 public string HumanReadableStatus {
80 get {
81 if (SchedulerInformation == null)
82 return null;
84 return SchedulerInformation.ToHumanReadableString ();
88 [XmlIgnore]
89 public string IndexInformation {
90 get {
91 if (IndexStatus == null)
92 return null;
94 StringBuilder builder = new StringBuilder ('\n');
96 foreach (QueryableStatus status in IndexStatus) {
97 builder.Append ("Name: ").Append (status.Name).Append ('\n');
98 builder.Append ("Count: ").Append (status.ItemCount).Append ('\n');
99 builder.Append ("Indexing: ").Append (status.IsIndexing).Append ('\n');
100 builder.Append ('\n');
103 return builder.ToString ();