public CustomServerSinkProvider(IDictionary properties, ICollection providerData) { string customSinkType = (string)properties["customSinkType"]; if (customSinkType == null) { throw new CustomSinkException("no customSinkType property in the <provider> element."); } this.customSinkType = Type.GetType(customSinkType); if (this.customSinkType == null) { throw new CustomSinkException( string.Format("Could not load type {0}", customSinkType)); } // make sure the custom sink type inherits BaseCustomSink if (!this.customSinkType.IsSubclassOf(typeof(BaseCustomSink))) { throw new CustomSinkException("Custom sink type does not inherit from BaseCustomSink"); } // see if there is a <customData> element in the provider data // and save it for passing it to the custom sink's constructor foreach (SinkProviderData data in providerData) { if (data.Name == "customData") { this.data = data; break; } } }
public ClientSinkData(SinkProviderData configurationData, IChannelSender channel, string url, object remoteChannelData) { this.Channel = channel; this.Url = url; this.RemoteChannelData = remoteChannelData; this.ConfigurationData = configurationData; }
ProviderData ReadProvider (string name, SmallXmlParser.IAttrList attrs, bool isTemplate) { ProviderData prov = (name == "provider") ? new ProviderData () : new FormatterData (); SinkProviderData data = new SinkProviderData ("root"); prov.CustomData = data.Children; currentProviderData = new Stack (); currentProviderData.Push (data); for (int i=0; i < attrs.Names.Length; ++i) { string at = attrs.Names[i]; string val = attrs.Values[i]; if (at == "id" && isTemplate) prov.Id = val; else if (at == "type") prov.Type = val; else if (at == "ref" && !isTemplate) prov.Ref = val; else prov.CustomProperties.Add (at, val); } if (prov.Id == null && isTemplate) throw new RemotingException ("id attribute is required"); return prov; }
void ReadCustomProviderData (string name, SmallXmlParser.IAttrList attrs) { SinkProviderData parent = (SinkProviderData) currentProviderData.Peek (); SinkProviderData data = new SinkProviderData (name); for (int i=0; i < attrs.Names.Length; ++i) data.Properties [attrs.Names[i]] = attrs.GetValue (i); parent.Children.Add (data); currentProviderData.Push (data); }
} // ProcessSinkProviderNode // providerData will already contain an object with the same name as the config node private static SinkProviderData ProcessSinkProviderData(ConfigNode node, RemotingXmlConfigFileData configData) { SinkProviderData providerData = new SinkProviderData(node.Name); foreach (ConfigNode childNode in node.Children) { SinkProviderData childData = ProcessSinkProviderData(childNode, configData); providerData.Children.Add(childData); } foreach (DictionaryEntry entry in node.Attributes) { providerData.Properties[entry.Key] = entry.Value; } return providerData; } // ProcessSinkProviderData
public ServerSinkData(SinkProviderData configurationData, IChannelReceiver channel) { this.Channel = channel; this.ConfigurationData = configurationData; }