2006-11-30 Atsushi Enomoto <atsushi@ximian.com>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 30 Nov 2006 07:06:59 +0000 (07:06 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 30 Nov 2006 07:06:59 +0000 (07:06 -0000)
* ServerType.cs : Now LogicalTypeInfo became this type to implement
  this class (and SoapTypeStubInfo to SoapServerType later).
* TypeStubManager.cs : so, split LogicalTypeInfo from here.
* XmlReturnReader.cs, XmlReturnWriter.cs, Methods.cs,
  HttpSimpleTypeStubInfo.cs, HttpGetTypeStubInfo.cs,
  HttpPostTypeStubInfo.cs : LogicalTypeInfo -> ServerType.

* HttpSimpleProtocolReflector.cs : LogicalTypeInfo -> ServerType.

svn path=/branches/atsushi/mcs/; revision=68734

mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
mcs/class/System.Web.Services/System.Web.Services.Description/HttpSimpleProtocolReflector.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpGetTypeStubInfo.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpPostTypeStubInfo.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleTypeStubInfo.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/ServerType.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnReader.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/XmlReturnWriter.cs

index a3e22317d0b17634057c0561bbde257ac07ac32f..275460c56f19e622fd59ced8e4199202042491a4 100644 (file)
@@ -1,3 +1,7 @@
+2006-11-30  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * HttpSimpleProtocolReflector.cs : LogicalTypeInfo -> ServerType.
+
 2006-11-30  Atsushi Enomoto  <atsushi@ximian.com>
 
        * SoapHeaderFaultBinding.cs, NamedItem.cs, SoapBinding.cs,
index 58c18913cf6945937d6d2dda23f140bdd23e3d54..6c7e201b4093f567853d2c970f596eda4a02d0e2 100644 (file)
@@ -68,7 +68,7 @@ namespace System.Web.Services.Description {
 
                protected override bool ReflectMethod ()
                {
-                       LogicalTypeInfo ti = TypeStubManager.GetLogicalTypeInfo (ServiceType);
+                       ServerType ti = TypeStubManager.GetLogicalTypeInfo (ServiceType);
                        HttpOperationBinding sob = new HttpOperationBinding();
                        sob.Location = "/" + MethodStubInfo.Name;
                        OperationBinding.Extensions.Add (sob);
index 5c6683b151daa2abbb6b3d4263379ba7b56d1d28..0b9c35e6b31667f043e14d0281e8c01755940318 100644 (file)
@@ -1,3 +1,12 @@
+2006-11-30  Atsushi Enomoto  <atsushi@ximian.com>
+
+       * ServerType.cs : Now LogicalTypeInfo became this type to implement
+         this class (and SoapTypeStubInfo to SoapServerType later).
+       * TypeStubManager.cs : so, split LogicalTypeInfo from here.
+       * XmlReturnReader.cs, XmlReturnWriter.cs, Methods.cs,
+         HttpSimpleTypeStubInfo.cs, HttpGetTypeStubInfo.cs,
+         HttpPostTypeStubInfo.cs : LogicalTypeInfo -> ServerType.
+
 2006-11-30  Atsushi Enomoto  <atsushi@ximian.com>
 
        * SoapHttpClientProtocol.cs : looks like (only) the last Text is used
index 8a411b44f71e65b120e66068657968cdd2da14a8..306c6285d065424eb60e149a63e0e17ba17caf4c 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Web.Services.Protocols
 
        internal class HttpGetTypeStubInfo : HttpSimpleTypeStubInfo
        {
-               public HttpGetTypeStubInfo (LogicalTypeInfo logicalTypeInfo): base (logicalTypeInfo)
+               public HttpGetTypeStubInfo (ServerType logicalTypeInfo): base (logicalTypeInfo)
                {
                }
 
index a66a12c99e525f5bfda7862a993b03e0d394ccb6..a1dc432716d224f9f3d89d5f59a2c2f91db9149a 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Web.Services.Protocols
        
        internal class HttpPostTypeStubInfo : HttpSimpleTypeStubInfo
        {
-               public HttpPostTypeStubInfo (LogicalTypeInfo logicalTypeInfo): base (logicalTypeInfo)
+               public HttpPostTypeStubInfo (ServerType logicalTypeInfo): base (logicalTypeInfo)
                {
                }
 
index 8dc1125601b2f8bca69ce96fece81c0418c8215c..f6434c6b14bad8db34e626a204d27e67cd415535 100644 (file)
@@ -97,7 +97,7 @@ namespace System.Web.Services.Protocols
 
        internal class HttpSimpleTypeStubInfo : TypeStubInfo
        {
-               public HttpSimpleTypeStubInfo (LogicalTypeInfo logicalTypeInfo): base (logicalTypeInfo)
+               public HttpSimpleTypeStubInfo (ServerType logicalTypeInfo): base (logicalTypeInfo)
                {
                }
 
index fe54812d5821a67cfe16a360e1ef77de66709837..905e8f81cb609191f4f85e6105d5830e3f8ce5cd 100644 (file)
@@ -504,7 +504,7 @@ namespace System.Web.Services.Protocols {
                internal XmlReflectionImporter  xmlImporter;
                internal SoapReflectionImporter soapImporter;
 
-               public SoapTypeStubInfo (LogicalTypeInfo logicalTypeInfo)
+               public SoapTypeStubInfo (ServerType logicalTypeInfo)
                : base (logicalTypeInfo)
                {
                        xmlImporter = new XmlReflectionImporter ();
index 9f33471960edd58a952aa915a719767715863f3b..152ae2f084cede53422934e0410cf8296f9ab574 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
-#if NET_2_0
+using System.Reflection;
+using System.Web.Services;
+using System.Web.Services.Description;
 
 namespace System.Web.Services.Protocols
 {
-       public class ServerType
+       //
+       // This class has information abou a web service. Through providess
+       // access to the TypeStubInfo instances for each protocol.
+       //
+#if NET_2_0
+       public
+#else
+       internal
+#endif
+       class ServerType // It was LogicalTypeInfo until Mono 1.2.
        {
-               public ServerType (Type type)
+               LogicalMethodInfo[] logicalMethods;
+
+               internal string WebServiceName;
+               internal string WebServiceNamespace;
+               internal string WebServiceAbstractNamespace;
+               internal string Description;
+               internal Type Type;
+               bool useEncoded;
+
+               TypeStubInfo soapProtocol;
+               TypeStubInfo httpGetProtocol;
+               TypeStubInfo httpPostProtocol;
+               
+               public ServerType (Type t)
+               {
+                       this.Type = t;
+
+                       object [] o = Type.GetCustomAttributes (typeof (WebServiceAttribute), false);
+                       if (o.Length == 1){
+                               WebServiceAttribute a = (WebServiceAttribute) o [0];
+                               WebServiceName = (a.Name != string.Empty) ? a.Name : Type.Name;
+                               WebServiceNamespace = (a.Namespace != string.Empty) ? a.Namespace : WebServiceAttribute.DefaultNamespace;
+                               Description = a.Description;
+                       } else {
+                               WebServiceName = Type.Name;
+                               WebServiceNamespace = WebServiceAttribute.DefaultNamespace;
+                       }
+                       
+                       // Determine the namespaces for literal and encoded schema types
+                       
+                       useEncoded = false;
+                       
+                       o = t.GetCustomAttributes (typeof(SoapDocumentServiceAttribute), true);
+                       if (o.Length > 0) {
+                               SoapDocumentServiceAttribute at = (SoapDocumentServiceAttribute) o[0];
+                               useEncoded = (at.Use == SoapBindingUse.Encoded);
+                       }
+                       else if (t.GetCustomAttributes (typeof(SoapRpcServiceAttribute), true).Length > 0)
+                               useEncoded = true;
+                       
+                       string sep = WebServiceNamespace.EndsWith ("/") ? "" : "/";
+
+                       WebServiceAbstractNamespace = WebServiceNamespace + sep + "AbstractTypes";
+
+                       MethodInfo [] type_methods = Type.GetMethods (BindingFlags.Instance | BindingFlags.Public);
+                       logicalMethods = LogicalMethodInfo.Create (type_methods, LogicalMethodTypes.Sync);
+               }
+               
+               internal LogicalMethodInfo[] LogicalMethods
+               {
+                       get { return logicalMethods; }
+               }
+               
+               internal TypeStubInfo GetTypeStub (string protocolName)
                {
+                       lock (this)
+                       {
+                               switch (protocolName)
+                               {
+                                       case "Soap": 
+                                               if (soapProtocol == null) soapProtocol = CreateTypeStubInfo (typeof(SoapTypeStubInfo));
+                                               return soapProtocol;
+                                       case "HttpGet":
+                                               if (httpGetProtocol == null) httpGetProtocol = CreateTypeStubInfo (typeof(HttpGetTypeStubInfo));
+                                               return httpGetProtocol;
+                                       case "HttpPost":
+                                               if (httpPostProtocol == null) httpPostProtocol = CreateTypeStubInfo (typeof(HttpPostTypeStubInfo));
+                                               return httpPostProtocol;
+                               }
+                       }
+                       throw new InvalidOperationException ("Protocol " + protocolName + " not supported");
                }
+               
+               TypeStubInfo CreateTypeStubInfo (Type type)
+               {
+                       TypeStubInfo tsi = (TypeStubInfo) Activator.CreateInstance (type, new object[] {this});
+                       tsi.Initialize ();
+                       return tsi;
+               }
+               
+               internal string GetWebServiceLiteralNamespace (string baseNamespace)
+               {
+                       if (useEncoded) {
+                               string sep = baseNamespace.EndsWith ("/") ? "" : "/";
+                               return baseNamespace + sep + "literalTypes";
+                       }
+                       else
+                               return baseNamespace;
+               }
+
+               internal string GetWebServiceEncodedNamespace (string baseNamespace)
+               {
+                       if (useEncoded)
+                               return baseNamespace;
+                       else {
+                               string sep = baseNamespace.EndsWith ("/") ? "" : "/";
+                               return baseNamespace + sep + "encodedTypes";
+                       }
+               }
+
+               internal string GetWebServiceNamespace (string baseNamespace, SoapBindingUse use)
+               {
+                       if (use == SoapBindingUse.Literal) return GetWebServiceLiteralNamespace (baseNamespace);
+                       else return GetWebServiceEncodedNamespace (baseNamespace);
+               }
+               
        }
 }
-
-#endif
index 6e5d36bd4f2df215d0b080fbc318277959db4b78..3683c26438eaf18f21176a180ae2eab436750b19 100644 (file)
@@ -85,12 +85,12 @@ namespace System.Web.Services.Protocols {
                Hashtable name_to_method = new Hashtable ();
                MethodStubInfo[] methods;
                ArrayList bindings = new ArrayList ();
-               LogicalTypeInfo logicalType;
+               ServerType logicalType;
                string defaultBinding;
                ArrayList mappings;
                XmlSerializer[] serializers;
 
-               public TypeStubInfo (LogicalTypeInfo logicalTypeInfo)
+               public TypeStubInfo (ServerType logicalTypeInfo)
                {
                        this.logicalType = logicalTypeInfo;
 
@@ -99,7 +99,7 @@ namespace System.Web.Services.Protocols {
                        Bindings.Add (binfo);
                }
                
-               public LogicalTypeInfo LogicalType
+               public ServerType LogicalType
                {
                        get { return logicalType; }
                }
@@ -238,132 +238,6 @@ namespace System.Web.Services.Protocols {
                public string Location;
        }
 
-
-       //
-       // This class has information abou a web service. Through providess
-       // access to the TypeStubInfo instances for each protocol.
-       //
-       internal class LogicalTypeInfo
-       {
-               LogicalMethodInfo[] logicalMethods;
-
-               internal string WebServiceName;
-               internal string WebServiceNamespace;
-               string WebServiceLiteralNamespace;
-               string WebServiceEncodedNamespace;
-               internal string WebServiceAbstractNamespace;
-               internal string Description;
-               internal Type Type;
-               bool useEncoded;
-
-               TypeStubInfo soapProtocol;
-               TypeStubInfo httpGetProtocol;
-               TypeStubInfo httpPostProtocol;
-               
-               public LogicalTypeInfo (Type t)
-               {
-                       this.Type = t;
-
-                       object [] o = Type.GetCustomAttributes (typeof (WebServiceAttribute), false);
-                       if (o.Length == 1){
-                               WebServiceAttribute a = (WebServiceAttribute) o [0];
-                               WebServiceName = (a.Name != string.Empty) ? a.Name : Type.Name;
-                               WebServiceNamespace = (a.Namespace != string.Empty) ? a.Namespace : WebServiceAttribute.DefaultNamespace;
-                               Description = a.Description;
-                       } else {
-                               WebServiceName = Type.Name;
-                               WebServiceNamespace = WebServiceAttribute.DefaultNamespace;
-                       }
-                       
-                       // Determine the namespaces for literal and encoded schema types
-                       
-                       useEncoded = false;
-                       
-                       o = t.GetCustomAttributes (typeof(SoapDocumentServiceAttribute), true);
-                       if (o.Length > 0) {
-                               SoapDocumentServiceAttribute at = (SoapDocumentServiceAttribute) o[0];
-                               useEncoded = (at.Use == SoapBindingUse.Encoded);
-                       }
-                       else if (t.GetCustomAttributes (typeof(SoapRpcServiceAttribute), true).Length > 0)
-                               useEncoded = true;
-                       
-                       string sep = WebServiceNamespace.EndsWith ("/") ? "" : "/";
-                       
-                       if (useEncoded) {
-                               WebServiceEncodedNamespace = WebServiceNamespace;
-                               WebServiceLiteralNamespace = WebServiceNamespace + sep + "literalTypes";
-                       }
-                       else {
-                               WebServiceEncodedNamespace = WebServiceNamespace + sep + "encodedTypes";
-                               WebServiceLiteralNamespace = WebServiceNamespace;
-                       }
-                       
-                       WebServiceAbstractNamespace = WebServiceNamespace + sep + "AbstractTypes";
-                       
-                       MethodInfo [] type_methods = Type.GetMethods (BindingFlags.Instance | BindingFlags.Public);
-                       logicalMethods = LogicalMethodInfo.Create (type_methods, LogicalMethodTypes.Sync);
-               }
-               
-               public LogicalMethodInfo[] LogicalMethods
-               {
-                       get { return logicalMethods; }
-               }
-               
-               public TypeStubInfo GetTypeStub (string protocolName)
-               {
-                       lock (this)
-                       {
-                               switch (protocolName)
-                               {
-                                       case "Soap": 
-                                               if (soapProtocol == null) soapProtocol = CreateTypeStubInfo (typeof(SoapTypeStubInfo));
-                                               return soapProtocol;
-                                       case "HttpGet":
-                                               if (httpGetProtocol == null) httpGetProtocol = CreateTypeStubInfo (typeof(HttpGetTypeStubInfo));
-                                               return httpGetProtocol;
-                                       case "HttpPost":
-                                               if (httpPostProtocol == null) httpPostProtocol = CreateTypeStubInfo (typeof(HttpPostTypeStubInfo));
-                                               return httpPostProtocol;
-                               }
-                       }
-                       throw new InvalidOperationException ("Protocol " + protocolName + " not supported");
-               }
-               
-               TypeStubInfo CreateTypeStubInfo (Type type)
-               {
-                       TypeStubInfo tsi = (TypeStubInfo) Activator.CreateInstance (type, new object[] {this});
-                       tsi.Initialize ();
-                       return tsi;
-               }
-               
-               public string GetWebServiceLiteralNamespace (string baseNamespace)
-               {
-                       if (useEncoded) {
-                               string sep = baseNamespace.EndsWith ("/") ? "" : "/";
-                               return baseNamespace + sep + "literalTypes";
-                       }
-                       else
-                               return baseNamespace;
-               }
-
-               public string GetWebServiceEncodedNamespace (string baseNamespace)
-               {
-                       if (useEncoded)
-                               return baseNamespace;
-                       else {
-                               string sep = baseNamespace.EndsWith ("/") ? "" : "/";
-                               return baseNamespace + sep + "encodedTypes";
-                       }
-               }
-
-               public string GetWebServiceNamespace (string baseNamespace, SoapBindingUse use)
-               {
-                       if (use == SoapBindingUse.Literal) return GetWebServiceLiteralNamespace (baseNamespace);
-                       else return GetWebServiceEncodedNamespace (baseNamespace);
-               }
-               
-       }
-
        //
        // Manages type stubs
        //
@@ -399,23 +273,23 @@ namespace System.Web.Services.Protocols {
 
                static internal TypeStubInfo GetTypeStub (Type t, string protocolName)
                {
-                       LogicalTypeInfo tm = GetLogicalTypeInfo (t);
+                       ServerType tm = GetLogicalTypeInfo (t);
                        return tm.GetTypeStub (protocolName);
                }
                
                //
                // This needs to be thread safe
                //
-               static internal LogicalTypeInfo GetLogicalTypeInfo (Type t)
+               static internal ServerType GetLogicalTypeInfo (Type t)
                {
                        lock (type_to_manager)
                        {
-                               LogicalTypeInfo tm = (LogicalTypeInfo) type_to_manager [t];
+                               ServerType tm = (ServerType) type_to_manager [t];
        
                                if (tm != null)
                                        return tm;
 
-                               tm = new LogicalTypeInfo (t);
+                               tm = new ServerType (t);
                                type_to_manager [t] = tm;
 
                                return tm;
index f0ab43ee2871965617190db1f0da945c2eb37d4c..b3fc312231fec0e0aad6d57bb9a82858f790a752 100644 (file)
@@ -50,7 +50,7 @@ namespace System.Web.Services.Protocols {
 
                public override object GetInitializer (LogicalMethodInfo methodInfo)
                {
-                       LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (methodInfo.DeclaringType);
+                       ServerType sti = TypeStubManager.GetLogicalTypeInfo (methodInfo.DeclaringType);
                        object[] ats = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes (typeof(XmlRootAttribute), true);
                        XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null; 
                        return new XmlSerializer (methodInfo.ReturnType, null, null, root, sti.GetWebServiceLiteralNamespace (sti.WebServiceNamespace));
@@ -67,7 +67,7 @@ namespace System.Web.Services.Protocols {
                                        sers[n] = null;
                                else
                                {
-                                       LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (metinfo.DeclaringType);
+                                       ServerType sti = TypeStubManager.GetLogicalTypeInfo (metinfo.DeclaringType);
                                        object[] ats = methodInfos[n].ReturnTypeCustomAttributeProvider.GetCustomAttributes (typeof(XmlRootAttribute), true);
                                        XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null; 
                                        sers[n] = importer.ImportTypeMapping (methodInfos[n].ReturnType, root, sti.GetWebServiceLiteralNamespace (sti.WebServiceNamespace));
index 6792ef1691eb86b33d82236af2df814e8ede8756..8b463a6ea17699a5eefaa9994308950e23165f3d 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Web.Services.Protocols {
 
                public override object GetInitializer (LogicalMethodInfo methodInfo)
                {
-                       LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (methodInfo.DeclaringType);
+                       ServerType sti = TypeStubManager.GetLogicalTypeInfo (methodInfo.DeclaringType);
                        object[] ats = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes (typeof(XmlRootAttribute), true);
                        XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null; 
                        
@@ -65,7 +65,7 @@ namespace System.Web.Services.Protocols {
                                else
                                {
                                        importer.IncludeTypes (metinfo.CustomAttributeProvider);
-                                       LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo (metinfo.DeclaringType);
+                                       ServerType sti = TypeStubManager.GetLogicalTypeInfo (metinfo.DeclaringType);
                                        object[] ats = methodInfos[n].ReturnTypeCustomAttributeProvider.GetCustomAttributes (typeof(XmlRootAttribute), true);
                                        XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null; 
                                        sers[n] = importer.ImportTypeMapping (methodInfos[n].ReturnType, root, sti.GetWebServiceLiteralNamespace (sti.WebServiceNamespace));