/// <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);
        }
Beispiel #2
0
 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);
         }
     }
 }
Beispiel #3
0
        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>
 /// Determines whether the collection contains a specific DestinationSettings value.
 /// </summary>
 /// <param name="value">The DestinationSettings to locate in the collection.</param>
 /// <returns>true if the DestinationSettings is found in the collection; otherwise, false.</returns>
 public bool Contains(DestinationSettings value)
 {
     return(List.Contains(value));
 }
 /// <summary>
 /// Removes the first occurrence of a specific DestinationSettings from the collection.
 /// </summary>
 /// <param name="value">The DestinationSettings to remove from the collection.</param>
 public void Remove(DestinationSettings value)
 {
     _destinationDictionary.Remove(value.Id);
     List.Remove(value);
 }
 /// <summary>
 /// Inserts a DestinationSettings 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 DestinationSettings to insert into the collection.</param>
 public void Insert(int index, DestinationSettings value)
 {
     _destinationDictionary[value.Id] = value;
     List.Insert(index, value);
 }
 /// <summary>
 /// Determines the index of a specific item in the collection.
 /// </summary>
 /// <param name="value">The DestinationSettings to locate in the collection.</param>
 /// <returns>The index of value if found in the collection; otherwise, -1.</returns>
 public int IndexOf(DestinationSettings value)
 {
     return(List.IndexOf(value));
 }
 /// <summary>
 /// Adds a DestinationSettings to the collection.
 /// </summary>
 /// <param name="value">The DestinationSettings to add to the collection.</param>
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(DestinationSettings value)
 {
     _destinationDictionary[value.Id] = value;
     return(List.Add(value));
 }