* ServerContextTerminatorSink.cs: Added support for construction messages.
* MethodCall.cs: Implemented serialization support. Added support for IInternalMessage.
* MethodDictionary.cs: Added support for IInternalMessage.
* MethodResponse.cs: Added serialization support. Added support for IInternalMessage.
* MonoMethodMessage.cs: Added support for IInternalMessage.
* ReturnMessage.cs: Added support for IInternalMessage.
* ClientContextTerminatorSink.cs: Added.
* ConstructionCall.cs: Added.
* ConstructionCallDictionary.cs: Added.
* ConstructionResponse.cs: Added.
* EnvoyTerminatorSink.cs: Added.
svn path=/trunk/mcs/; revision=11726
+2003-02-18 Lluis Sanchez Gual <lluis@ideary.com>
+
+ * IInternalMessage.cs: Added. Provides some useful methods for method messages.
+ * ServerContextTerminatorSink.cs: Added support for construction messages.
+ * MethodCall.cs: Implemented serialization support. Added support for IInternalMessage.
+ * MethodDictionary.cs: Added support for IInternalMessage.
+ * MethodResponse.cs: Added serialization support. Added support for IInternalMessage.
+ * MonoMethodMessage.cs: Added support for IInternalMessage.
+ * ReturnMessage.cs: Added support for IInternalMessage.
+ * ClientContextTerminatorSink.cs: Added.
+ * ConstructionCall.cs: Added.
+ * ConstructionCallDictionary.cs: Added.
+ * ConstructionResponse.cs: Added.
+ * EnvoyTerminatorSink.cs: Added.
+
2003-02-07 Patrik Torstensson
* CADMessages.cs: Disable smuggeling of objects cross domain, still issues casing remoting
--- /dev/null
+//
+// System.Runtime.Remoting.Messaging.ClientContextTerminatorSink.cs
+//
+// Author: Lluis Sanchez Gual (lluis@ideary.com)
+//
+// (C) 2003, Lluis Sanchez Gual
+//\r
+\r
+using System;\r
+using System.Runtime.Remoting;\r
+\r
+namespace System.Runtime.Remoting.Messaging\r
+{\r
+ public class ClientContextTerminatorSink: IMessageSink\r
+ {\r
+ public ClientContextTerminatorSink()\r
+ {\r
+ }\r
+\r
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+ Identity identity = RemotingServices.GetMessageTargetIdentity (msg);
+ return identity.ChannelSink.SyncProcessMessage (msg);
+ }
+
+ public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
+ {
+ Identity identity = RemotingServices.GetMessageTargetIdentity (msg);
+ return identity.ChannelSink.AsyncProcessMessage (msg, replySink);
+ }
+
+ public IMessageSink NextSink
+ {
+ get { return null; }
+ } \r
+ }\r
+}\r
--- /dev/null
+//
+// System.Runtime.Remoting.Messaging.ConstructionCall.cs
+//
+// Author: Lluis Sanchez Gual (lluis@ideary.com)
+//
+// (C) 2003, Lluis Sanchez Gual
+//\r
+\r
+using System;\r
+using System.Threading;\r
+using System.Collections;\r
+using System.Runtime.Remoting.Activation;\r
+using System.Runtime.Serialization;\r
+using System.Runtime.Remoting.Contexts;\r
+\r
+namespace System.Runtime.Remoting.Messaging\r
+{\r
+ [Serializable] [CLSCompliant (false)]
+ public class ConstructionCall: MethodCall, IConstructionCallMessage\r
+ {\r
+ IActivator _activator;\r
+ object[] _activationAttributes;\r
+ IList _contextProperties;\r
+ Type _activationType;\r
+ string _activationTypeName;\r
+\r
+ public ConstructionCall(IMessage msg): base (msg)\r
+ {\r
+ _activationTypeName = TypeName;\r
+\r
+/* object[] attribs = ActivationType.GetCustomAttributes (typeof (IContextProperty), true);\r
+\r
+ if (attribs.Length > 0)\r
+ _contextProperties = new ArrayList (attribs);\r
+*/\r
+ _activationAttributes = null; // FIXME: put something here\r
+ }\r
+\r
+ public ConstructionCall (Header[] headers): base (headers)\r
+ {\r
+ }\r
+\r
+ internal ConstructionCall (SerializationInfo info, StreamingContext context): base (info, context)
+ {
+ }
+\r
+ internal override void InitDictionary()\r
+ {\r
+ ConstructionCallDictionary props = new ConstructionCallDictionary (this);\r
+ ExternalProperties = props;
+ InternalProperties = props.GetInternalProperties();\r
+ }\r
+\r
+ public Type ActivationType \r
+ {
+ get
+ {
+ if (_activationType == null) _activationType = Type.GetType (_activationTypeName);
+ return _activationType;
+ }
+ }
+
+ public string ActivationTypeName \r
+ {
+ get { return _activationTypeName; }
+ }
+
+ public IActivator Activator \r
+ {
+ get { return _activator; }
+ set { _activator = value; }
+ }
+
+ public object [] CallSiteActivationAttributes \r
+ {
+ get { return _activationAttributes; }
+ }
+
+ public IList ContextProperties \r
+ {
+ get { return _contextProperties; }
+ }\r
+\r
+ internal override void InitMethodProperty(string key, object value)
+ {
+ switch (key)
+ {
+ case "__Activator" : _activator = (IActivator) value; return;
+ case "__CallSiteActivationAttributes" : _activationAttributes = (object[]) value; return;
+ case "__ActivationType" : _activationType = (Type) value; return;
+ case "__ContextProperties" : _contextProperties = (IList) value; return;
+ case "__ActivationTypeName" : _activationTypeName = (string) value; return;
+ default: base.InitMethodProperty (key, value); return;
+ }
+ }
+
+ public override void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData (info, context);
+
+ info.AddValue ("__Activator", _activator);
+ info.AddValue ("__CallSiteActivationAttributes", _activationAttributes);
+ info.AddValue ("__ActivationType", null);
+ info.AddValue ("__ContextProperties", _contextProperties);
+ info.AddValue ("__ActivationTypeName", _activationTypeName);
+ } \r
+ }\r
+}\r
--- /dev/null
+//
+// System.Runtime.Remoting.Messaging.ConstructionCallDictionary.cs
+//
+// Author: Lluis Sanchez Gual (lluis@ideary.com)
+//
+// (C) 2003, Lluis Sanchez Gual
+//\r
+\r
+using System;\r
+using System.Runtime.Remoting.Activation;\r
+\r
+namespace System.Runtime.Remoting.Messaging\r
+{\r
+ class ConstructionCallDictionary : MethodDictionary\r
+ {\r
+ public static string[] InternalKeys = new string[] {"__Uri", "__MethodName", "__TypeName", "__MethodSignature", "__Args", "__CallContext", "__CallSiteActivationAttributes", "__ActivationType", "__ContextProperties", "__Activator", "__ActivationTypeName"};\r
+\r
+ public ConstructionCallDictionary(IConstructionCallMessage message) : base (message) \r
+ { \r
+ MethodKeys = InternalKeys;\r
+ }\r
+
+ protected override object GetMethodProperty (string key)
+ {
+ switch (key)
+ {
+ case "__Activator" : return ((IConstructionCallMessage)_message).Activator;
+ case "__CallSiteActivationAttributes" : return ((IConstructionCallMessage)_message).CallSiteActivationAttributes;
+ case "__ActivationType" : return ((IConstructionCallMessage)_message).ActivationType;
+ case "__ContextProperties" : return ((IConstructionCallMessage)_message).ContextProperties;
+ case "__ActivationTypeName" : return ((IConstructionCallMessage)_message).ActivationTypeName;
+ default : return base.GetMethodProperty (key);
+ }
+ }
+
+ protected override void SetMethodProperty (string key, object value)
+ {
+ switch (key)
+ {
+ case "__Activator": ((IConstructionCallMessage)_message).Activator = (IActivator) value; break;
+
+ case "__CallSiteActivationAttributes":
+ case "__ActivationType":
+ case "__ContextProperties":
+ case "__ActivationTypeName": throw new ArgumentException ("key was invalid");
+
+ default: base.SetMethodProperty (key, value); break;
+ }
+ }
+ }\r
+}\r
--- /dev/null
+//
+// System.Runtime.Remoting.Messaging.ConstructionResponse.cs
+//
+// Author: Lluis Sanchez Gual (lluis@ideary.com)
+//
+// (C) 2003, Lluis Sanchez Gual
+//\r
+\r
+using System;\r
+using System.Runtime.Remoting.Activation;\r
+using System.Runtime.Serialization;
+\r
+namespace System.Runtime.Remoting.Messaging\r
+{\r
+ [Serializable] [CLSCompliant (false)]
+ public class ConstructionResponse: MethodResponse, IConstructionReturnMessage\r
+ {\r
+ public ConstructionResponse(object resultObject, LogicalCallContext callCtx, IMethodCallMessage msg)\r
+ : base (resultObject, null, callCtx, msg)\r
+ {\r
+ }\r
+\r
+ internal ConstructionResponse (SerializationInfo info, StreamingContext context): base (info, context)
+ {
+ }
+ }\r
+}\r
--- /dev/null
+//
+// System.Runtime.Remoting.Messaging.EnvoyTerminatorSink.cs
+//
+// Author: Lluis Sanchez Gual (lluis@ideary.com)
+//
+// (C) 2003, Lluis Sanchez Gual
+//\r
+\r
+using System;\r
+using System.Threading;\r
+\r
+namespace System.Runtime.Remoting.Messaging\r
+{\r
+ internal class EnvoyTerminatorSink: IMessageSink\r
+ {\r
+ public static EnvoyTerminatorSink Instance = new EnvoyTerminatorSink();\r
+\r
+ public IMessage SyncProcessMessage (IMessage msg)
+ {
+// FIXME: restore when Thread.CurrentContext workds
+// return Thread.CurrentContext.GetClientContextSinkChain ().SyncProcessMessage (msg);
+ return System.Runtime.Remoting.Contexts.Context.DefaultContext.GetClientContextSinkChain ().SyncProcessMessage (msg);
+ }
+
+ public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
+ {
+ return Thread.CurrentContext.GetClientContextSinkChain ().AsyncProcessMessage (msg, replySink);
+ }
+
+ public IMessageSink NextSink
+ {
+ get { return null; }
+ }\r
+ }\r
+}\r
--- /dev/null
+using System;\r
+using System.Runtime.Remoting;\r
+\r
+namespace System.Runtime.Remoting.Messaging\r
+{\r
+ internal interface IInternalMessage\r
+ {\r
+ Identity TargetIdentity { get; set; }\r
+ string Uri { get; set; }\r
+ }\r
+}\r
namespace System.Runtime.Remoting.Messaging {
[Serializable] [CLSCompliant (false)]
- public class MethodCall : IMethodCallMessage, IMethodMessage, IMessage, ISerializable
+ public class MethodCall : IMethodCallMessage, IMethodMessage, IMessage, ISerializable, IInternalMessage
{
string _uri;
string _typeName;
MethodBase _methodBase;
LogicalCallContext _callContext;
ArgInfo _inArgInfo;
- InternalDictionary _properties;
+ Identity _targetIdentity;
+
+ protected IDictionary ExternalProperties;
+ protected IDictionary InternalProperties;
public MethodCall (Header [] headers)
{
if (headers == null || headers.Length == 0) return;
foreach (Header header in headers)
- {
- switch (header.Name)
- {
- case "__TypeName" : _typeName = (string)header.Value; break;
- case "__MethodName" : _methodName = (string)header.Value; break;
- case "__MethodSignature" : _methodSignature = (Type[])header.Value; break;
- case "__Args" : _args = (object[])header.Value; break;
- case "__CallContext" : _callContext = (LogicalCallContext)header.Value; break;
- default: _properties [header.Name] = header.Value; break;
- }
- }
+ InitMethodProperty (header.Name, header.Value);
ResolveMethod ();
+ }
+
+ internal MethodCall (SerializationInfo info, StreamingContext context)
+ {
Init();
+
+ foreach (SerializationEntry entry in info)
+ InitMethodProperty ((string)entry.Name, entry.Value);
+
+ ResolveMethod ();
}
- internal MethodCall (CADMethodCallMessage msg) {
+ internal MethodCall (CADMethodCallMessage msg)
+ {
_typeName = msg.TypeName;
_uri = msg.Uri;
_methodName = msg.MethodName;
CADMessageBase.UnmarshalProperties (Properties, msg.PropertiesCount, args);
}
- [MonoTODO]
public MethodCall (IMessage msg)
{
+ IMethodMessage call = (IMethodMessage) msg;
+ _uri = call.Uri;
+ _typeName = call.TypeName;
+ _methodName = call.MethodName;
+ _args = call.Args;
+ _methodSignature = (Type[]) call.MethodSignature;
+ _methodBase = call.MethodBase;
+ _callContext = call.LogicalCallContext;
+
Init();
- throw new NotImplementedException ();
+
}
- protected IDictionary ExternalProperties;
- protected IDictionary InternalProperties;
+ public MethodCall (string uri, string typeName, string methodName, object[] args)
+ {
+ _uri = uri;
+ _typeName = typeName;
+ _methodName = methodName;
+ _args = args;
+
+ Init();
+ ResolveMethod();
+ }
+
+ internal virtual void InitMethodProperty(string key, object value)
+ {
+ switch (key)
+ {
+ case "__TypeName" : _typeName = (string) value; return;
+ case "__MethodName" : _methodName = (string) value; return;
+ case "__MethodSignature" : _methodSignature = (Type[]) value; return;
+ case "__Args" : _args = (object[]) value; return;
+ case "__CallContext" : _callContext = (LogicalCallContext) value; return;
+ case "__Uri" : _uri = (string) value; return;
+ default: Properties[key] = value; return;
+ }
+ }
+
+ public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue ("__TypeName", _typeName);
+ info.AddValue ("__MethodName", _methodName);
+ info.AddValue ("__MethodSignature", _methodSignature);
+ info.AddValue ("__Args", _args);
+ info.AddValue ("__CallContext", _callContext);
+ info.AddValue ("__Uri", _uri);
+
+ if (InternalProperties != null) {
+ foreach (DictionaryEntry entry in InternalProperties)
+ info.AddValue ((string) entry.Key, entry.Value);
+ }
+ }
public int ArgCount {
get { return _args.Length; }
}
public virtual IDictionary Properties {
- get { return _properties; }
+ get
+ {
+ if (ExternalProperties == null) InitDictionary ();
+ return ExternalProperties;
+ }
+ }
+
+ internal virtual void InitDictionary()
+ {
+ MethodCallDictionary props = new MethodCallDictionary (this);
+ ExternalProperties = props;
+ InternalProperties = props.GetInternalProperties();
}
- public string TypeName {
+ public string TypeName
+ {
get { return _typeName; }
}
return _inArgInfo.GetInOutArgName(index);
}
- [MonoTODO]
- public void GetObjectData (SerializationInfo info, StreamingContext context)
- {
- throw new NotImplementedException ();
- }
-
[MonoTODO]
public virtual object HeaderHandler (Header[] h)
{
public virtual void Init ()
{
- _properties = new InternalDictionary (this);
- ExternalProperties = _properties;
- InternalProperties = _properties.GetInternalProperties();
}
public void ResolveMethod ()
throw new NotImplementedException ();
}
- class InternalDictionary : MethodCallDictionary\r
- {\r
- public InternalDictionary(MethodCall message) : base (message) { }\r
-
- protected override void SetMethodProperty (string key, object value)
- {
- if (key == "__Uri") ((MethodCall)_message).Uri = (string)value;
- else base.SetMethodProperty (key, value);
- }
+ Identity IInternalMessage.TargetIdentity
+ {
+ get { return _targetIdentity; }
+ set { _targetIdentity = value; }
}
}
}
//
// 2003 (C) Lluis Sanchez Gual
//
-\r
-using System;\r
-using System.Collections;\r
-\r
-namespace System.Runtime.Remoting.Messaging\r
-{\r
- [Serializable]\r
- internal class MethodDictionary : IDictionary\r
- {\r
- IDictionary _internalProperties = null;\r
- protected IMethodMessage _message;\r
- string[] _methodKeys;\r
- bool _ownProperties = false;\r
-\r
- public MethodDictionary (IMethodMessage message)\r
- {\r
- _message = message;\r
- }\r
-\r
- internal bool HasInternalProperties \r
- {\r
- get \r
- {\r
- if (null != _internalProperties)\r
- {\r
- // MethodCallMessageWrapper uses a nested MethodDictionary\r
- if (_internalProperties is MethodDictionary)\r
- return ((MethodDictionary)_internalProperties).HasInternalProperties;\r
- else \r
- return _internalProperties.Count > 0;\r
- }\r
- return false;\r
- }\r
- }\r
-\r
- internal IDictionary InternalProperties\r
- {\r
- get \r
- {\r
- if (null != _internalProperties)\r
- {\r
- if (_internalProperties is MethodDictionary)\r
- return ((MethodDictionary)_internalProperties).InternalProperties;\r
- }\r
- return _internalProperties;\r
- }\r
- }\r
-\r
- public string[] MethodKeys\r
- {\r
- get { return _methodKeys; }\r
- set { _methodKeys = value; }\r
- }\r
-\r
- protected virtual IDictionary AllocInternalProperties()\r
- {\r
- _ownProperties = true;\r
- return new Hashtable();\r
- }\r
-\r
- public IDictionary GetInternalProperties()\r
- {\r
- if (_internalProperties == null) _internalProperties = AllocInternalProperties();\r
- return _internalProperties;\r
- }\r
-\r
- private bool IsOverridenKey (string key)\r
- {\r
- // Small optimization. If the internal properties have been\r
- // created by this dictionary, then it can be assured that it does\r
- // not contain values for overriden keys.\r
- if (_ownProperties) return false;\r
-\r
- foreach (string mkey in _methodKeys)\r
- if (key == mkey) return true;\r
- return false;\r
- }\r
-\r
- public MethodDictionary(string[] keys)\r
- {\r
- _methodKeys = keys;\r
- }\r
-\r
+
+using System;
+using System.Collections;
+
+namespace System.Runtime.Remoting.Messaging
+{
+ [Serializable]
+ internal class MethodDictionary : IDictionary
+ {
+ IDictionary _internalProperties = null;
+ protected IMethodMessage _message;
+ string[] _methodKeys;
+ bool _ownProperties = false;
+
+ public MethodDictionary (IMethodMessage message)
+ {
+ _message = message;
+ }
+
+ internal bool HasInternalProperties
+ {
+ get
+ {
+ if (null != _internalProperties)
+ {
+ // MethodCallMessageWrapper uses a nested MethodDictionary
+ if (_internalProperties is MethodDictionary)
+ return ((MethodDictionary)_internalProperties).HasInternalProperties;
+ else
+ return _internalProperties.Count > 0;
+ }
+ return false;
+ }
+ }
+
+ internal IDictionary InternalProperties
+ {
+ get
+ {
+ if (null != _internalProperties)
+ {
+ if (_internalProperties is MethodDictionary)
+ return ((MethodDictionary)_internalProperties).InternalProperties;
+ }
+ return _internalProperties;
+ }
+ }
+
+ public string[] MethodKeys
+ {
+ get { return _methodKeys; }
+ set { _methodKeys = value; }
+ }
+
+ protected virtual IDictionary AllocInternalProperties()
+ {
+ _ownProperties = true;
+ return new Hashtable();
+ }
+
+ public IDictionary GetInternalProperties()
+ {
+ if (_internalProperties == null) _internalProperties = AllocInternalProperties();
+ return _internalProperties;
+ }
+
+ private bool IsOverridenKey (string key)
+ {
+ // Small optimization. If the internal properties have been
+ // created by this dictionary, then it can be assured that it does
+ // not contain values for overriden keys.
+ if (_ownProperties) return false;
+
+ foreach (string mkey in _methodKeys)
+ if (key == mkey) return true;
+ return false;
+ }
+
+ public MethodDictionary(string[] keys)
+ {
+ _methodKeys = keys;
+ }
+
public bool IsFixedSize
{
get { return false; }
{
case "__CallContext": // Ignore?
case "__OutArgs":
- case "__Return": break;
+ case "__Return": return;
case "__MethodName" :
case "__TypeName" :
case "__MethodSignature" :
case "__Args" : throw new ArgumentException ("key was invalid");
+ case "__Uri": ((IInternalMessage)_message).Uri = (string) value; return;
}
}
else return false;
}
- public void Remove (object key)\r
- {\r
+ public void Remove (object key)
+ {
string keyStr = (string)key;
for (int n=0; n<_methodKeys.Length; n++)
if (_methodKeys[n] == keyStr) throw new ArgumentException ("key was invalid");
-\r
+
if (_internalProperties != null) _internalProperties.Remove (key);
- }\r
-\r
+ }
+
public int Count
{
get
{
Values.CopyTo (array, index);
}
-\r
+
IEnumerator IEnumerable.GetEnumerator()
{
return new DictionaryEnumerator (this);
}
-\r
+
public IDictionaryEnumerator GetEnumerator ()
{
return new DictionaryEnumerator (this);
}
-
// Dictionary enumerator
class DictionaryEnumerator : IDictionaryEnumerator
return false;
}
- public void Reset()\r
+ public void Reset()
{
_posMethod = -1;
_hashtableEnum.Reset();
}
}
- }\r
-}\r
+ }
+}
namespace System.Runtime.Remoting.Messaging {
[Serializable] [CLSCompliant (false)]
- public class MethodResponse : IMethodReturnMessage, ISerializable
+ public class MethodResponse : IMethodReturnMessage, ISerializable, IInternalMessage
{
string _methodName;
string _uri;
Exception _exception;
Type [] _methodSignature;
ArgInfo _inArgInfo;
- InternalDictionary _properties;
-\r
- object [] _outArgs;\r
+ object [] _outArgs;
IMethodCallMessage _callMsg;
-
LogicalCallContext _callContext;
+ Identity _targetIdentity;
+
+ protected IDictionary ExternalProperties;
+ protected IDictionary InternalProperties;
public MethodResponse (Header[] headers, IMethodCallMessage mcm)
{
+ if (mcm != null)
+ {
+ _methodName = mcm.MethodName;
+ _uri = mcm.Uri;
+ _typeName = mcm.TypeName;
+ _methodBase = mcm.MethodBase;
+ _methodSignature = (Type[]) mcm.MethodSignature;
+ }
+
+ if (headers != null)
+ {
+ foreach (Header header in headers)
+ InitMethodProperty (header.Name, header.Value);
+ }
}
internal MethodResponse (Exception e, IMethodCallMessage msg) {
CADMessageBase.UnmarshalProperties (Properties, retmsg.PropertiesCount, args);
}
- protected IDictionary ExternalProperties;
- protected IDictionary InternalProperties;
+ internal MethodResponse (SerializationInfo info, StreamingContext context)
+ {
+ foreach (SerializationEntry entry in info)
+ InitMethodProperty (entry.Name, entry.Value);
+ }
+
+ internal void InitMethodProperty (string key, object value)
+ {
+ switch (key)
+ {
+ case "__TypeName": _typeName = (string) value; break;
+ case "__MethodName": _methodName = (string) value; break;
+ case "__MethodSignature": _methodSignature = (Type[]) value; break;
+ case "__Uri": _uri = (string) value; break;
+ case "__Return": _returnValue = value; break;
+ case "__OutArgs": _outArgs = (object[]) value; break;
+ case "__fault": _exception = (Exception) value; break;
+ case "__CallContext": _callContext = (LogicalCallContext) value; break;
+ default: Properties [key] = value; break;
+ }
+ }
public int ArgCount {
get {
public virtual IDictionary Properties {
get {
- if (null == _properties) {
- _properties = new InternalDictionary (this);
-
- ExternalProperties = _properties;
- InternalProperties = _properties.GetInternalProperties();
+ if (null == ExternalProperties) {
+ MethodReturnDictionary properties = new MethodReturnDictionary (this);
+ ExternalProperties = properties;
+ InternalProperties = properties.GetInternalProperties();
}
return ExternalProperties;
throw new NotSupportedException ();
}
- [MonoTODO]
public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
{
- throw new NotImplementedException ();
+ if (_exception == null)
+ {
+ info.AddValue ("__TypeName", _typeName);
+ info.AddValue ("__MethodName", _methodName);
+ info.AddValue ("__MethodSignature", _methodSignature);
+ info.AddValue ("__Uri", _uri);
+ info.AddValue ("__Return", _returnValue);
+ info.AddValue ("__OutArgs", _outArgs);
+ }
+ else
+ info.AddValue ("__fault", _exception);
+
+ info.AddValue ("__CallContext", _callContext);
+
+ if (InternalProperties != null) {
+ foreach (DictionaryEntry entry in InternalProperties)
+ info.AddValue ((string) entry.Key, entry.Value);
+ }
}
public object GetOutArg (int argNum)
{
throw new NotImplementedException ();
}
-\r
- class InternalDictionary : MethodReturnDictionary {\r
- public InternalDictionary(MethodResponse message) : base (message) { }\r
- protected override void SetMethodProperty (string key, object value) {
- if (key == "__Uri") ((MethodResponse) _message).Uri = (string)value;
- else base.SetMethodProperty (key, value);
- }
+ Identity IInternalMessage.TargetIdentity
+ {
+ get { return _targetIdentity; }
+ set { _targetIdentity = value; }
}
}
}
namespace System.Runtime.Remoting.Messaging {
[Serializable]
- public class MonoMethodMessage : IMethodCallMessage, IMethodReturnMessage {
+ public class MonoMethodMessage : IMethodCallMessage, IMethodReturnMessage, IInternalMessage {
MonoMethod method;
string uri;
- InternalDictionary properties;
+ MethodCallDictionary properties;
Type[] methodSignature;
+ Identity identity;
+
+
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern void InitMessage (MonoMethod method, object [] out_args);
public IDictionary Properties {
get {
- if (properties == null) properties = new InternalDictionary (this);
+ if (properties == null) properties = new MethodCallDictionary (this);
return properties;
}
}
return null;
}
- [Serializable]
- class InternalDictionary : MethodCallDictionary\r
- {\r
- public InternalDictionary(MonoMethodMessage message) : base (message) \r
- { \r
- }\r
-
- protected override void SetMethodProperty (string key, object value)
- {
- if (key == "__Uri") ((MonoMethodMessage)_message).Uri = (string)value;
- else base.SetMethodProperty (key, value);
- }
+ Identity IInternalMessage.TargetIdentity
+ {
+ get { return identity; }
+ set { identity = value; }
}
-
}
}
namespace System.Runtime.Remoting.Messaging {
[Serializable]
- public class ReturnMessage : IMethodReturnMessage, IMethodMessage \r
+ public class ReturnMessage : IMethodReturnMessage, IMethodMessage, IInternalMessage \r
{
object[] _outArgs;
LogicalCallContext _callCtx;
string _methodName;
object _methodSignature;
string _typeName;
- InternalDictionary _properties;
+ MethodReturnDictionary _properties;
+ Identity _targetIdentity;
public ReturnMessage (object returnValue, object [] outArgs,
int outArgCount, LogicalCallContext callCtx,
public virtual IDictionary Properties {
get {
- if (_properties == null) _properties = new InternalDictionary (this);
+ if (_properties == null) _properties = new MethodReturnDictionary (this);
return _properties;
}
}
return _methodBase.GetParameters()[arg_num].Name;
}
-
- class InternalDictionary : MethodReturnDictionary\r
- {\r
- public InternalDictionary(ReturnMessage message) : base (message) { }\r
-
- protected override void SetMethodProperty (string key, object value)
- {
- if (key == "__Uri") ((ReturnMessage)_message).Uri = (string)value;
- else base.SetMethodProperty (key, value);
- }
- }\r
+ Identity IInternalMessage.TargetIdentity
+ {
+ get { return _targetIdentity; }
+ set { _targetIdentity = value; }
+ }
}
}
using System;
using System.Runtime.Remoting;
+using System.Runtime.Remoting.Activation;
namespace System.Runtime.Remoting.Messaging
{
{
public IMessage SyncProcessMessage (IMessage msg)
{
- ServerIdentity identity = RemotingServices.GetMessageTargetIdentity (msg);
- return identity.SyncObjectProcessMessage (msg);
+ if (msg is IConstructionCallMessage)
+ return ActivationServices.CreateInstanceFromMessage ((IConstructionCallMessage) msg);
+ else
+ {
+ ServerIdentity identity = (ServerIdentity) RemotingServices.GetMessageTargetIdentity (msg);
+ return identity.SyncObjectProcessMessage (msg);
+ }
}
public IMessageCtrl AsyncProcessMessage (IMessage msg, IMessageSink replySink)
{
- ServerIdentity identity = RemotingServices.GetMessageTargetIdentity (msg);
+ ServerIdentity identity = (ServerIdentity) RemotingServices.GetMessageTargetIdentity (msg);
return identity.AsyncObjectProcessMessage (msg, replySink);
}