/// <summary> /// Loads a services-config.xml file. /// </summary> /// <param name="configPath">Path to the file.</param> /// <param name="configFileName">Service configuration file name.</param> /// <returns>A ServiceConfigSettings instance loaded from the specified file.</returns> public static ServiceConfigSettings Load() { ServiceConfigSettings serviceConfigSettings = new ServiceConfigSettings(); //Create a default amf channel ChannelSettings channelSettings = new ChannelSettings("my-amf", "flex.messaging.endpoints.AMFEndpoint", @"http://{server.name}:{server.port}/{context.root}/gateway"); serviceConfigSettings.ChannelsSettings.Add(channelSettings); ServiceSettings serviceSettings = new ServiceSettings(serviceConfigSettings, SolidSoft.AMFCore.Messaging.Services.RemotingService.RemotingServiceId, typeof(SolidSoft.AMFCore.Messaging.Services.RemotingService).FullName); string messageType = "flex.messaging.messages.RemotingMessage"; string typeName = AMFConfiguration.Instance.ClassMappings.GetType(messageType); serviceSettings.SupportedMessageTypes[messageType] = typeName; serviceConfigSettings.ServiceSettings.Add(serviceSettings); AdapterSettings adapterSettings = new AdapterSettings("dotnet", typeof(SolidSoft.AMFCore.Remoting.RemotingAdapter).FullName, true); serviceSettings.DefaultAdapter = adapterSettings; DestinationSettings destinationSettings = new DestinationSettings(serviceSettings, DestinationSettings.AMFDestination, adapterSettings, "*"); serviceSettings.DestinationSettings.Add(destinationSettings); serviceConfigSettings._flexClientSettings = new FlexClientSettings(); return(serviceConfigSettings); }
internal DestinationSettings(ServiceSettings serviceSettings, string id, AdapterSettings adapter, string source) { _serviceSettings = serviceSettings; _properties = new Hashtable(); _channels = new ChannelSettingsCollection(); _id = id; _adapter = adapter; _properties["source"] = source; }
internal DestinationSettings CreateDestinationSettings(string id, string source) { lock (_objLock) { if (!this.DestinationSettings.ContainsKey(id)) { AdapterSettings adapterSettings = new AdapterSettings("dotnet", typeof(SolidSoft.AMFCore.Remoting.RemotingAdapter).FullName, false); DestinationSettings destinationSettings = new DestinationSettings(this, id, adapterSettings, source); this.DestinationSettings.Add(destinationSettings); return(destinationSettings); } else { return(this.DestinationSettings[id] as DestinationSettings); } } }
internal void Init(XmlNode serviceElement) { _id = serviceElement.Attributes["id"].Value; _class = serviceElement.Attributes["class"].Value; string messageTypes = serviceElement.Attributes["messageTypes"].Value; string[] messageTypesList = messageTypes.Split(new char[] { ',' }); foreach (string messageType in messageTypesList) { string type = AMFConfiguration.Instance.ClassMappings.GetType(messageType); _supportedMessageTypes[messageType] = type; } //Read adapters XmlNode adaptersNode = serviceElement.SelectSingleNode("adapters"); if (adaptersNode != null) { foreach (XmlNode adapterNode in adaptersNode.SelectNodes("*")) { AdapterSettings adapterSettings = new AdapterSettings(adapterNode); _adapterSettings.Add(adapterSettings); if (adapterSettings.Default) { _defaultAdapterSettings = adapterSettings; } } } else { AdapterSettings adapterSettings = new AdapterSettings("dotnet", typeof(SolidSoft.AMFCore.Remoting.RemotingAdapter).FullName, true); _defaultAdapterSettings = adapterSettings; _adapterSettings.Add(adapterSettings); } //Read destinations XmlNodeList destinationNodeList = serviceElement.SelectNodes("destination"); foreach (XmlNode destinationNode in destinationNodeList) { DestinationSettings destinationSettings = new DestinationSettings(this, destinationNode); this.DestinationSettings.Add(destinationSettings); } }
/// <summary> /// Inserts a AdapterSettings item to the collection at the specified index. /// </summary> /// <param name="index">The zero-based index at which value should be inserted.</param> /// <param name="value">The AdapterSettings to insert into the collection.</param> public void Insert(int index, AdapterSettings value) { _adapterDictionary[value.Id] = value; List.Insert(index, value); }
/// <summary> /// Determines the index of a specific item in the collection. /// </summary> /// <param name="value">The AdapterSettings to locate in the collection.</param> /// <returns>The index of value if found in the collection; otherwise, -1.</returns> public int IndexOf(AdapterSettings value) { return(List.IndexOf(value)); }
/// <summary> /// Adds a AdapterSettings to the collection. /// </summary> /// <param name="value">The AdapterSettings to add to the collection.</param> /// <returns>The position into which the new element was inserted.</returns> public int Add(AdapterSettings value) { _adapterDictionary[value.Id] = value; return(List.Add(value)); }
/// <summary> /// Determines whether the collection contains a specific AdapterSettings value. /// </summary> /// <param name="value">The AdapterSettings to locate in the collection.</param> /// <returns>true if the AdapterSettings is found in the collection; otherwise, false.</returns> public bool Contains(AdapterSettings value) { return(List.Contains(value)); }
/// <summary> /// Removes the first occurrence of a specific AdapterSettings from the collection. /// </summary> /// <param name="value">The AdapterSettings to remove from the collection.</param> public void Remove(AdapterSettings value) { _adapterDictionary.Remove(value.Id); List.Remove(value); }
internal DestinationSettings(ServiceSettings serviceSettings, XmlNode destinationNode) { _serviceSettings = serviceSettings; _properties = new Hashtable(); _channels = new ChannelSettingsCollection(); _id = destinationNode.Attributes["id"].Value; XmlNode adapterNode = destinationNode.SelectSingleNode("adapter"); if (adapterNode != null) { string adapterRef = adapterNode.Attributes["ref"].Value; AdapterSettings adapterSettings = serviceSettings.AdapterSettings[adapterRef] as AdapterSettings; _adapter = adapterSettings; } _propertiesNode = destinationNode.SelectSingleNode("properties"); if (_propertiesNode != null) { XmlNode sourceNode = _propertiesNode.SelectSingleNode("source"); if (sourceNode != null) { _properties["source"] = sourceNode.InnerXml; } XmlNode factoryNode = _propertiesNode.SelectSingleNode("factory"); if (factoryNode != null) { _properties["factory"] = factoryNode.InnerXml; } XmlNode attributeIdNode = _propertiesNode.SelectSingleNode("attribute-id"); if (attributeIdNode != null) { //If you specify an attribute-id element in the destination, you can control which attribute the component is stored in //This lets more than one destination share the same instance. _properties["attribute-id"] = attributeIdNode.InnerXml; } else { //Stored using the destination name as the attribute _properties["attribute-id"] = _id; } XmlNode scopeNode = _propertiesNode.SelectSingleNode("scope"); if (scopeNode != null) { _properties["scope"] = scopeNode.InnerXml; } XmlNode networkNode = _propertiesNode.SelectSingleNode("network"); if (networkNode != null) { NetworkSettings networkSettings = new NetworkSettings(networkNode); _network = networkSettings; } XmlNode metadataNode = _propertiesNode.SelectSingleNode("metadata"); if (metadataNode != null) { MetadataSettings metadataSettings = new MetadataSettings(metadataNode); _metadata = metadataSettings; } XmlNode serverNode = _propertiesNode.SelectSingleNode("server"); if (serverNode != null) { ServerSettings serverSettings = new ServerSettings(serverNode); _server = serverSettings; } XmlNode msmqNode = _propertiesNode.SelectSingleNode("msmq"); if (msmqNode != null) { MsmqSettings msmqSettings = new MsmqSettings(msmqNode); _msmqSettings = msmqSettings; } } XmlNode channelsNode = destinationNode.SelectSingleNode("channels"); if (channelsNode != null) { XmlNodeList channelNodeList = channelsNode.SelectNodes("channel"); foreach (XmlNode channelNode in channelNodeList) { string channelRef = channelNode.Attributes["ref"].Value; if (channelRef != null) { ChannelSettings channelSettings = _serviceSettings.ServiceConfigSettings.ChannelsSettings[channelRef] as ChannelSettings; _channels.Add(channelSettings); } else { ChannelSettings channelSettings = new ChannelSettings(channelNode); _channels.Add(channelSettings); } } } }