using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services; namespace Repository.WebServices { /// ///

Query Web Service. Invoked by PageBoxes.

///

Copyright (c) 2002 Alexis Grandemange
/// Mail: alexis.grandemange@pagebox.net

///
This program is free software; you can redistribute it and/or
	/// modify it under the terms of the GNU Lesser General Public
	/// License as published by the Free Software Foundation; version
	/// 2.1 of the License.
	/// This library is distributed in the hope that it will be useful,
	/// but WITHOUT ANY WARRANTY; without even the implied warranty of
	/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	/// GNU Lesser General Public License for more details.
	/// A copy of the GNU Lesser General Public License lesser.txt should be
	/// included in the distribution.
///
[WebService(Namespace="Repository")] public class RepoQuery : System.Web.Services.WebService { public RepoQuery() { //CODEGEN: This call is required by the ASP.NET Web Services Designer InitializeComponent(); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { } #endregion /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { } /// /// Enumerates the subscribers and archive subscribers to archive but DeployURL. /// /// archive name /// URL of the querying PageBox Deploy.asmx [WebMethod] public string[] GetSubscribers(string archive, string DeployURL) { ArrayList al = new ArrayList(); populate(Global.subRep.subscribers, archive, DeployURL, al); populate(Global.subRep.asubscribers, archive, DeployURL, al); if (al.Count == 0) { Log.write(DeployURL, Context.Request.ServerVariables["REMOTE_HOST"], "RepoQuery.GetSubscribers(" + archive + ") found no subscribers"); return null; } Log.write(DeployURL, Context.Request.ServerVariables["REMOTE_HOST"], "RepoQuery.GetSubscribers(" + archive + ") returned " + al[0]); return (string[])al.ToArray(Type.GetType("System.String")); } /// /// Populate an ArrayList with subscribers to archive defined in h but DeployURL. /// /// subscribers or archive subscribers /// archive name /// URL of the querying PageBox Deploy.asmx /// updated ArrayList (returned) /// updated ArrayList private ArrayList populate(Hashtable h, string archive, string DeployURL, ArrayList al) { IDictionaryEnumerator ide = h.GetEnumerator(); while(ide.MoveNext()) { string key = (string)ide.Key; if (key.Equals(DeployURL)) continue; Subscriber sub = (Subscriber)ide.Value; if (sub.archs.Contains(archive)) al.Add(key); } return al; } } }