of errors to the base class.
* ContractSearchPattern.cs, DiscoveryDocumentLinksPattern.cs,
DiscoveryDocumentSearchPattern.cs, XmlSchemaSearchPattern.cs: Implemented.
* DiscoveryClientProtocol.cs: Do not throw exceptions in ResolveAll method,
rather add them to the errors list.
* DiscoveryReference.cs: Generate DiscoveryException where needed, so
DiscoveryClientProtocol can get the url for which an exception was thrown.
* DiscoveryExceptionDictionary.cs: Implemented.
svn path=/trunk/mcs/; revision=23892
+2004-03-10 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * ContractReference.cs, DiscoveryDocumentReference.cs: Delegate handling
+ of errors to the base class.
+ * ContractSearchPattern.cs, DiscoveryDocumentLinksPattern.cs,
+ DiscoveryDocumentSearchPattern.cs, XmlSchemaSearchPattern.cs: Implemented.
+ * DiscoveryClientProtocol.cs: Do not throw exceptions in ResolveAll method,
+ rather add them to the errors list.
+ * DiscoveryReference.cs: Generate DiscoveryException where needed, so
+ DiscoveryClientProtocol can get the url for which an exception was thrown.
+ * DiscoveryExceptionDictionary.cs: Implemented.
+
2004-03-10 Lluis Sanchez Gual <lluis@ximian.com>
* DiscoveryClientProtocol.cs: Read additional information (such as soap
{\r
if (prot.Documents.Contains (import.Location)) // Already resolved\r
continue;\r
- \r
- string url = import.Location;\r
- string contentType = null;\r
- Stream stream = prot.Download (ref url, ref contentType);\r
- XmlTextReader reader = new XmlTextReader (stream);\r
- reader.MoveToContent ();\r
\r
- DiscoveryReference refe;\r
- if (ServiceDescription.CanRead (reader))\r
+ string url = import.Location;\r
+ try\r
{\r
- ServiceDescription refWsdl = ServiceDescription.Read (reader);\r
- refe = new ContractReference ();\r
- refe.ClientProtocol = prot;\r
- refe.Url = url;\r
- ((ContractReference)refe).ResolveInternal (prot, refWsdl);\r
- prot.Documents.Add (url, refWsdl);\r
+ string contentType = null;\r
+ Stream stream = prot.Download (ref url, ref contentType);\r
+ XmlTextReader reader = new XmlTextReader (stream);\r
+ reader.MoveToContent ();\r
+ \r
+ DiscoveryReference refe;\r
+ if (ServiceDescription.CanRead (reader))\r
+ {\r
+ ServiceDescription refWsdl = ServiceDescription.Read (reader);\r
+ refe = new ContractReference ();\r
+ refe.ClientProtocol = prot;\r
+ refe.Url = url;\r
+ ((ContractReference)refe).ResolveInternal (prot, refWsdl);\r
+ prot.Documents.Add (url, refWsdl);\r
+ }\r
+ else\r
+ {\r
+ XmlSchema schema = XmlSchema.Read (reader, null);\r
+ refe = new SchemaReference ();\r
+ refe.ClientProtocol = prot;\r
+ refe.Url = url;\r
+ prot.Documents.Add (url, schema);\r
+ }\r
+ \r
+ if (!prot.References.Contains (url))\r
+ prot.References.Add (refe);\r
+ \r
+ reader.Close ();\r
}\r
- else\r
+ catch (Exception ex)\r
{\r
- XmlSchema schema = XmlSchema.Read (reader, null);\r
- refe = new SchemaReference ();\r
- refe.ClientProtocol = prot;\r
- refe.Url = url;\r
- prot.Documents.Add (url, schema);\r
+ ReportError (url, ex);\r
}\r
- \r
- if (!prot.References.Contains (url))\r
- prot.References.Add (refe);\r
- \r
- reader.Close ();\r
}\r
}\r
\r
//\r
// Author:\r
// Dave Bettin (javabettin@yahoo.com)\r
+// Lluis Sanchez Gual (lluis@ximian.com)\r
//\r
// Copyright (C) Dave Bettin, 2002\r
//\r
\r
#region Constructors\r
\r
- [MonoTODO]\r
public ContractSearchPattern () \r
{\r
- throw new NotImplementedException ();\r
}\r
\r
#endregion // Constructors\r
\r
#region Methods\r
\r
- [MonoTODO]\r
public override DiscoveryReference GetDiscoveryReference (string filename)\r
{\r
- throw new NotImplementedException ();\r
+ ContractReference refe = new ContractReference ();\r
+ refe.Url = filename;\r
+ refe.Ref = filename;\r
+ refe.DocRef = filename;\r
+ return refe;\r
}\r
\r
#endregion // Methods\r
references.Add (re.Url, re);\r
}\r
\r
- foreach (object info in doc.AdditionalInfo)\r
- additionalInformation.Add (info);\r
+ if (doc.AdditionalInfo != null) {\r
+ foreach (object info in doc.AdditionalInfo)\r
+ additionalInformation.Add (info);\r
+ }\r
}\r
\r
public Stream Download (ref string url)\r
ArrayList list = new ArrayList (References.Values);\r
foreach (DiscoveryReference re in list)\r
{\r
- if (re is DiscoveryDocumentReference)\r
- ((DiscoveryDocumentReference)re).ResolveAll ();\r
- else\r
- re.Resolve ();\r
+ try\r
+ {\r
+ if (re is DiscoveryDocumentReference)\r
+ ((DiscoveryDocumentReference)re).ResolveAll ();\r
+ else\r
+ re.Resolve ();\r
+ }\r
+ catch (DiscoveryException ex)\r
+ {\r
+ Errors [ex.Url] = ex.Exception; \r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ Errors [re.Url] = ex; \r
+ }\r
}\r
}\r
\r
\r
#endregion // Properties\r
}\r
+ \r
#endregion // Classes\r
}\r
+ \r
+ internal class DiscoveryException : Exception\r
+ {\r
+ public string Url;\r
+ public Exception Exception;\r
+ \r
+ public DiscoveryException (string url, Exception origin)\r
+ {\r
+ Url = url;\r
+ Exception = origin;\r
+ }\r
+ }\r
}
//\r
// Author:\r
// Dave Bettin (javabettin@yahoo.com)\r
+// Lluis Sanchez Gual (lluis@ximian.com)\r
//\r
// Copyright (C) Dave Bettin, 2002\r
//\r
\r
#region Constructors\r
\r
- [MonoTODO]\r
public DiscoveryDocumentLinksPattern () \r
{\r
- throw new NotImplementedException ();\r
}\r
\r
#endregion // Constructors\r
\r
#region Methods\r
\r
- [MonoTODO]\r
public override DiscoveryReference GetDiscoveryReference (string filename)\r
{\r
- throw new NotImplementedException ();\r
+ DiscoveryDocumentReference refe = new DiscoveryDocumentReference ();\r
+ refe.Url = filename;\r
+ refe.Ref = filename;\r
+ return refe;\r
}\r
\r
#endregion // Methods\r
DiscoveryDocument doc = document;\r
foreach (DiscoveryReference re in doc.References)\r
{\r
- if (re is DiscoveryDocumentReference)\r
- ((DiscoveryDocumentReference)re).ResolveAll ();\r
- else\r
- re.Resolve ();\r
+ try\r
+ {\r
+ if (re is DiscoveryDocumentReference)\r
+ ((DiscoveryDocumentReference)re).ResolveAll ();\r
+ else\r
+ re.Resolve ();\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ReportError (re.Url, ex);\r
+ }\r
}\r
}\r
\r
//\r
// Author:\r
// Dave Bettin (javabettin@yahoo.com)\r
+// Lluis Sanchez Gual (lluis@ximian.com)\r
//\r
// Copyright (C) Dave Bettin, 2002\r
//\r
\r
#region Constructors\r
\r
- [MonoTODO]\r
public DiscoveryDocumentSearchPattern () \r
{\r
- throw new NotImplementedException ();\r
}\r
\r
#endregion // Constructors\r
\r
#region Methods\r
\r
- [MonoTODO]\r
public override DiscoveryReference GetDiscoveryReference (string filename)\r
{\r
- throw new NotImplementedException ();\r
+ DiscoveryDocumentReference refe = new DiscoveryDocumentReference ();\r
+ refe.Url = filename;\r
+ refe.Ref = filename;\r
+ return refe;\r
}\r
\r
#endregion // Methods\r
//\r
// Author:\r
// Dave Bettin (javabettin@yahoo.com)\r
+// Lluis Sanchez Gual (lluis@ximian.com)\r
//\r
// Copyright (C) Dave Bettin, 2002\r
//\r
\r
using System.Collections;\r
\r
-namespace System.Web.Services.Discovery {\r
- public sealed class DiscoveryExceptionDictionary : DictionaryBase {\r
-\r
+namespace System.Web.Services.Discovery \r
+{\r
+ public sealed class DiscoveryExceptionDictionary : DictionaryBase \r
+ {\r
#region Constructors\r
\r
- [MonoTODO]\r
public DiscoveryExceptionDictionary () \r
{\r
}\r
#region Properties\r
\r
public Exception this[string url] {\r
- [MonoTODO]\r
- get { throw new NotImplementedException (); }\r
- \r
- [MonoTODO]\r
- set { throw new NotImplementedException (); }\r
+ get { return (Exception) InnerHashtable [url]; }\r
+ set { \r
+ if (url == null)\r
+ throw new ArgumentNullException ();\r
+ InnerHashtable [url] = value; \r
+ }\r
}\r
\r
public ICollection Keys {\r
- [MonoTODO]\r
- get { throw new NotImplementedException (); }\r
+ get { return InnerHashtable.Keys; }\r
}\r
\r
public ICollection Values {\r
- [MonoTODO]\r
- get { throw new NotImplementedException (); }\r
+ get { return InnerHashtable.Values; }\r
}\r
\r
#endregion // Properties\r
\r
#region Methods\r
\r
- [MonoTODO]\r
public void Add (string url, Exception value)\r
{\r
- throw new NotImplementedException ();\r
+ InnerHashtable.Add (url, value);\r
}\r
\r
- [MonoTODO]\r
public bool Contains (string url)\r
{\r
- throw new NotImplementedException ();\r
+ return InnerHashtable.Contains (url);\r
}\r
\r
- [MonoTODO]\r
public void Remove (string url)\r
{\r
- throw new NotImplementedException ();\r
+ InnerHashtable.Remove (url);\r
}\r
\r
#endregion // Methods\r
public void Resolve () \r
{\r
if (clientProtocol == null) \r
- throw new InvalidOperationException ("The ClientProtocol property is a null reference");\r
+ throw new InvalidOperationException ("The ClientProtocol property is a null reference.");\r
\r
if (clientProtocol.Documents.Contains (Url)) // Already resolved\r
return;\r
\r
- string contentType = null;\r
- string url = Url;\r
- Stream stream = clientProtocol.Download (ref url, ref contentType);\r
- Resolve (contentType, stream);\r
+ try\r
+ {\r
+ string contentType = null;\r
+ string url = Url;\r
+ Stream stream = clientProtocol.Download (ref url, ref contentType);\r
+ Resolve (contentType, stream);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ReportError (Url, ex);\r
+ }\r
}\r
\r
protected internal abstract void Resolve (string contentType, Stream stream);\r
\r
- public abstract void WriteDocument (object document, Stream stream); \r
+ public abstract void WriteDocument (object document, Stream stream);\r
\r
+ internal void ReportError (string url, Exception ex)\r
+ {\r
+ if (ex is DiscoveryException) throw ex;\r
+ else throw new DiscoveryException (url, ex);\r
+ }\r
+ \r
#endregion // Methods\r
}\r
}
//\r
// Author:\r
// Dave Bettin (javabettin@yahoo.com)\r
+// Lluis Sanchez Gual (lluis@ximian.com)\r
//\r
// Copyright (C) Dave Bettin, 2002\r
//\r
\r
#region Constructors\r
\r
- [MonoTODO]\r
public XmlSchemaSearchPattern () \r
{\r
- throw new NotImplementedException ();\r
}\r
\r
#endregion // Constructors\r
\r
#region Methods\r
\r
- [MonoTODO]\r
public override DiscoveryReference GetDiscoveryReference (string filename)\r
{\r
- throw new NotImplementedException ();\r
+ SchemaReference refe = new SchemaReference ();\r
+ refe.Url = filename;\r
+ refe.Ref = filename;\r
+ return refe;\r
}\r
\r
#endregion // Methods\r