* IInternalMessage.cs: Added. Provides some useful methods for method messages.
[mono.git] / mcs / class / corlib / System.Runtime.Remoting.Messaging / ConstructionCall.cs
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/ConstructionCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/ConstructionCall.cs
new file mode 100644 (file)
index 0000000..f9e19b3
--- /dev/null
@@ -0,0 +1,108 @@
+//
+// 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